Skip to content

Commit

Permalink
Version 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hiennguyen92 committed Jan 5, 2024
1 parent 077cd16 commit c319c8e
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 15 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 2.0.1

* Fixed some bugs.
* `Android` using Telecom Framework
* Add `silenceEvents`
* Add `normalHandle` props https://github.com/hiennguyen92/flutter_callkit_incoming/pull/403
* Android add `textColor` props https://github.com/hiennguyen92/flutter_callkit_incoming/pull/398
* Android invisible avatar for default https://github.com/hiennguyen92/flutter_callkit_incoming/pull/393
* Add Method for call API when accept/decline/end/timeout

## 2.0.0+2

* Fixed some bugs.
Expand Down
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,75 @@ A Flutter plugin to show incoming call in your Flutter app(Custom for Android/Ca
//Kotlin/Java Android
FlutterCallkitIncomingPlugin.getInstance().sendEventCustom(body: Map<String, Any>)
```
* 3.1 Call API when accept/decline/end/timeout
```swift
//Appdelegate
...
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate, PKPushRegistryDelegate, CallkitIncomingAppDelegate {
...

// Func Call api for Accept
func onAccept(_ call: Call) {
let json = ["action": "ACCEPT", "data": call.data.toJSON()] as [String: Any]
print("LOG: onAccept")
self.performRequest(parameters: json) { result in
switch result {
case .success(let data):
print("Received data: \(data)")

case .failure(let error):
print("Error: \(error.localizedDescription)")
}
}
}
// Func Call API for Decline
func onDecline(_ call: Call) {
let json = ["action": "DECLINE", "data": call.data.toJSON()] as [String: Any]
print("LOG: onDecline")
self.performRequest(parameters: json) { result in
switch result {
case .success(let data):
print("Received data: \(data)")

case .failure(let error):
print("Error: \(error.localizedDescription)")
}
}
}
func onEnd(_ call: Call) {
let json = ["action": "END", "data": call.data.toJSON()] as [String: Any]
print("LOG: onEnd")
self.performRequest(parameters: json) { result in
switch result {
case .success(let data):
print("Received data: \(data)")

case .failure(let error):
print("Error: \(error.localizedDescription)")
}
}
}
func onTimeOut(_ call: Call) {
let json = ["action": "TIMEOUT", "data": call.data.toJSON()] as [String: Any]
print("LOG: onTimeOut")
self.performRequest(parameters: json) { result in
switch result {
case .success(let data):
print("Received data: \(data)")

case .failure(let error):
print("Error: \(error.localizedDescription)")
}
}
}
...

```
<a href='https://github.com/hiennguyen92/flutter_callkit_incoming/blob/master/example/ios/Runner/AppDelegate.swift'>Please check full: Example</a>

4. Properties

Expand Down
16 changes: 8 additions & 8 deletions example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ import flutter_callkit_incoming

// Func Call api for Accept
func onAccept(_ call: Call) {
let json = ["action": "ACCEPT", "uuid": "XXX-XXX-XXX-XXX-ACCEPT"]
print("CCCC: onAccept")
let json = ["action": "ACCEPT", "data": call.data.toJSON()] as [String: Any]
print("LOG: onAccept")
self.performRequest(parameters: json) { result in
switch result {
case .success(let data):
Expand All @@ -98,8 +98,8 @@ import flutter_callkit_incoming

// Func Call API for Decline
func onDecline(_ call: Call) {
let json = ["action": "DECLINE", "uuid": "XXX-XXX-XXX-XXX-DECLINE"]
print("CCCC: onDecline")
let json = ["action": "DECLINE", "data": call.data.toJSON()] as [String: Any]
print("LOG: onDecline")
self.performRequest(parameters: json) { result in
switch result {
case .success(let data):
Expand All @@ -112,8 +112,8 @@ import flutter_callkit_incoming
}

func onEnd(_ call: Call) {
let json = ["action": "END", "uuid": "XXX-XXX-XXX-XXX-END"]
print("CCCC: onEnd")
let json = ["action": "END", "data": call.data.toJSON()] as [String: Any]
print("LOG: onEnd")
self.performRequest(parameters: json) { result in
switch result {
case .success(let data):
Expand All @@ -126,8 +126,8 @@ import flutter_callkit_incoming
}

func onTimeOut(_ call: Call) {
let json = ["action": "TIMEOUT", "uuid": "XXX-XXX-XXX-XXX-TIMEOUT"]
print("CCCC: onTimeOut")
let json = ["action": "TIMEOUT", "data": call.data.toJSON()] as [String: Any]
print("LOG: onTimeOut")
self.performRequest(parameters: json) { result in
switch result {
case .success(let data):
Expand Down
10 changes: 5 additions & 5 deletions ios/Classes/Call.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import AVFoundation

public class Call: NSObject {

let uuid: UUID
let data: Data
let isOutGoing: Bool
public var uuid: UUID
public var data: Data
public var isOutGoing: Bool

var handle: String?
public var handle: String?

var stateDidChange: (() -> Void)?
var hasStartedConnectDidChange: (() -> Void)?
Expand Down Expand Up @@ -240,7 +240,7 @@ public class Call: NSObject {
}
}

public func toJSON() -> [String: Any] {
open func toJSON() -> [String: Any] {
let ios: [String : Any] = [
"iconName": iconName,
"handleType": handleType,
Expand Down
3 changes: 2 additions & 1 deletion ios/Classes/SwiftFlutterCallkitIncomingPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ public class SwiftFlutterCallkitIncomingPlugin: NSObject, FlutterPlugin, CXProvi
action.fail()
return
}
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1000)) {
self.configurAudioSession()
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1200)) {
self.configurAudioSession()
}
call.hasConnectDidChange = { [weak self] in
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_callkit_incoming
description: Flutter Callkit Incoming to show callkit screen in your Flutter app.
version: 2.0.0+2
version: 2.0.1
homepage: https://github.com/hiennguyen92/flutter_callkit_incoming
repository: https://github.com/hiennguyen92/flutter_callkit_incoming
issue_tracker: https://github.com/hiennguyen92/flutter_callkit_incoming/issues
Expand Down

0 comments on commit c319c8e

Please sign in to comment.