Skip to content

Commit 6ea7e90

Browse files
v1.1.1
1 parent 50270bf commit 6ea7e90

File tree

12 files changed

+96
-81
lines changed

12 files changed

+96
-81
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.1.1
2+
- README.md improvements (thank you [VictorUvarov](https://github.com/voximplant/flutter_callkit/pull/5))
3+
- `FCXStartCallAction.contactIdentifier` and `FCXStartCallAction.video` parameters no longer ignored in native iOS code
4+
15
## 1.1.0+3
26
- LICENSE warning fix
37
- Code formatted according to dartfmt
@@ -13,7 +17,7 @@
1317
- Handling push notifications example on Swift added
1418

1519
## 1.1.0
16-
'FlutterCallkitPlugin.hasCallWithUUID:' API added in iOS code
20+
`FlutterCallkitPlugin.hasCallWithUUID:` API added in iOS code
1721

1822
## 1.0.0
1923
Release

README.md

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ Flutter SDK for CallKit integration to Flutter applications on iOS
55
Supported on iOS >= 10
66

77
## Install
8+
89
1. Add `flutter_callkit_voximplant` as a dependency in your pubspec.yaml file.
910

1011
2. Add the following entry to your `Info.plist` file, located in `<project root>/ios/Runner/Info.plist`:
11-
```
12+
13+
```PLIST
1214
<key>UIBackgroundModes</key>
1315
<array>
14-
<string>voip</string>
16+
<string>voip</string>
1517
</array>
1618
```
19+
1720
This entry required for CallKit to work
1821

1922
## Usage
@@ -31,7 +34,8 @@ A few differences explained:
3134
- Use FCXPlugin.processPushCompletion (dart) to execute completion block received from push (iOS 11+ only)
3235
- FCXCallController and FCXProvider are only allowed in single instance (use it as a singletone)
3336

34-
#### Initialization
37+
### Initialization
38+
3539
```dart
3640
import 'package:flutter_callkit_voximplant/flutter_callkit_voximplant.dart';
3741
@@ -50,9 +54,11 @@ try {
5054
}
5155
```
5256

53-
#### Making outgoing calls
57+
### Making outgoing calls
58+
5459
To make an outgoing call, an app requests a FCXStartCallAction object from its FCXCallController object.
5560
The action consists of a UUID to uniquely identify the call and a FCXHandle object to specify the recipient.
61+
5662
```dart
5763
Future<void> makeCall(String contactName, String uuid) async {
5864
FCXHandle handle = FCXHandle(FCXHandleType.Generic, contactName);
@@ -61,18 +67,17 @@ Future<void> makeCall(String contactName, String uuid) async {
6167
}
6268
```
6369

64-
After the recipient answers the call, the system calls the provider's performAnswerCallAction method.
65-
In your implementation of that method, configure an AVAudioSession and call the fulfill() method
66-
on the action object when finished.
70+
After the call is connected, the system calls the provider's performStartCallAction method. In your implementation,
71+
this method is responsible for configuring an AVAudioSession and calling fulfill() on the action when finished.
6772

6873
```dart
69-
_provider.performAnswerCallAction = (answerCallAction) async {
74+
_provider.performStartCallAction = (startCallAction) async {
7075
// configure audio session
71-
await answerCallAction.fulfill();
76+
await startCallAction.fulfill();
7277
};
7378
```
7479

75-
#### Receiving an Incoming Call
80+
### Receiving an Incoming Call
7681

7782
Using the information provided by the external notification,
7883
the app creates a UUID and a CXCallUpdate object to uniquely identify the call and the caller,
@@ -85,18 +90,18 @@ Future<void> handleIncomingCall(String contactName, String uuid) async {
8590
}
8691
```
8792

88-
After the call is connected, the system calls the performStartCallAction method of the provider.
89-
In your implementation, this method responsible for configuring an AVAudioSession
90-
and calling fulfill() on the action when finished.
93+
After the recipient answers the call, the system calls the performAnswerCallAction method of the provider.
94+
In your implementation of that method, configure an AVAudioSession and call the fulfill() method
95+
on the action object when finished.
9196

9297
```dart
93-
_provider.performStartCallAction = (startCallAction) async {
98+
_provider.performAnswerCallAction = (answerCallAction) async {
9499
// configure audio session
95-
await startCallAction.fulfill();
100+
await answerCallAction.fulfill();
96101
};
97102
```
98103

99-
#### Handling push notifications
104+
### Handling push notifications
100105

101106
Note: This SDK is not related to PushKit
102107

@@ -105,6 +110,7 @@ Push handling must be done through native iOS code due to [iOS 13 PushKit VoIP r
105110
Flutter CallKit SDK has built-in reportNewIncomingCallWithUUID:callUpdate:providerConfiguration:pushProcessingCompletion:) method (iOS) to correctly work with it
106111

107112
#### Swift
113+
108114
```swift
109115
import Flutter
110116
import flutter_callkit_voximplant
@@ -119,15 +125,15 @@ class AppDelegate: FlutterAppDelegate, PKPushRegistryDelegate {
119125
) {
120126
processPush(with: payload.dictionaryPayload, and: nil)
121127
}
122-
128+
123129
func pushRegistry(_ registry: PKPushRegistry,
124130
didReceiveIncomingPushWith payload: PKPushPayload,
125131
for type: PKPushType,
126132
completion: @escaping () -> Void
127133
) {
128134
processPush(with: payload.dictionaryPayload, and: completion)
129135
}
130-
136+
131137
// 2. process push
132138
private func processPush(with payload: Dictionary<AnyHashable, Any>,
133139
and completion: (() -> Void)?
@@ -156,6 +162,7 @@ class AppDelegate: FlutterAppDelegate, PKPushRegistryDelegate {
156162
```
157163

158164
#### Objective-C
165+
159166
```objective-c
160167
#import <Flutter/Flutter.h>
161168
#import <FlutterCallkitPlugin.h>
@@ -169,23 +176,23 @@ class AppDelegate: FlutterAppDelegate, PKPushRegistryDelegate {
169176
@implementation AppDelegate
170177

171178
// 1. override PKPushRegistryDelegate methods
172-
- (void) pushRegistry:(PKPushRegistry *)registry
173-
didReceiveIncomingPushWithPayload:(PKPushPayload *)payload
179+
- (void) pushRegistry:(PKPushRegistry *)registry
180+
didReceiveIncomingPushWithPayload:(PKPushPayload *)payload
174181
forType:(PKPushType)type {
175182
[self processPushWithPayload:payload.dictionaryPayload
176183
andCompletionHandler:nil];
177184
}
178185

179-
- (void) pushRegistry:(PKPushRegistry *)registry
186+
- (void) pushRegistry:(PKPushRegistry *)registry
180187
didReceiveIncomingPushWithPayload:(PKPushPayload *)payload
181-
forType:(PKPushType)type
188+
forType:(PKPushType)type
182189
withCompletionHandler:(void (^)(void))completion {
183190
[self processPushWithPayload:payload.dictionaryPayload
184191
andCompletionHandler:completion];
185192
}
186193

187194
// 2. process push
188-
-(void)processPushWithPayload:(NSDictionary *)payload
195+
-(void)processPushWithPayload:(NSDictionary *)payload
189196
andCompletionHandler:(dispatch_block_t)completion {
190197
// 3. get uuid and other needed information from payload
191198
NSUUID *UUID = [[NSUUID alloc] initWithUUIDString:payload[@"UUID"]];
@@ -194,8 +201,8 @@ didReceiveIncomingPushWithPayload:(PKPushPayload *)payload
194201
CXCallUpdate *callUpdate = [CXCallUpdate new];
195202
callUpdate.localizedCallerName = localizedName;
196203
// 5. prepare provider configuration
197-
CXProviderConfiguration *configuration =
198-
[[CXProviderConfiguration alloc]
204+
CXProviderConfiguration *configuration =
205+
[[CXProviderConfiguration alloc]
199206
initWithLocalizedName:@"ExampleLocalizedName"];
200207
// 6. send it to plugin
201208
[FlutterCallkitPlugin reportNewIncomingCallWithUUID:UUID

example/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PODS:
22
- Flutter (1.0.0)
3-
- "flutter_callkit_voximplant (1.1.0+3)":
3+
- flutter_callkit_voximplant (1.1.1):
44
- Flutter
55

66
DEPENDENCIES:
@@ -15,8 +15,8 @@ EXTERNAL SOURCES:
1515

1616
SPEC CHECKSUMS:
1717
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
18-
flutter_callkit_voximplant: c37fe6b128546d215843c5442757c3e6051e9680
18+
flutter_callkit_voximplant: b01193937c96e634258721bb38d520c201f69bfc
1919

2020
PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d
2121

22-
COCOAPODS: 1.9.3
22+
COCOAPODS: 1.10.0

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
3737
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
3838
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
39-
7E090D30253F69A800C5BA19 /* Profile.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Profile.xcconfig; path = Flutter/Profile.xcconfig; sourceTree = "<group>"; };
39+
7E090D29253F679F00C5BA19 /* Profile.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Profile.xcconfig; path = Flutter/Profile.xcconfig; sourceTree = "<group>"; };
4040
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
4141
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
4242
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -68,11 +68,11 @@
6868
9740EEB11CF90186004384FC /* Flutter */ = {
6969
isa = PBXGroup;
7070
children = (
71-
7E090D30253F69A800C5BA19 /* Profile.xcconfig */,
7271
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
7372
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7473
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
7574
9740EEB31CF90195004384FC /* Generated.xcconfig */,
75+
7E090D29253F679F00C5BA19 /* Profile.xcconfig */,
7676
);
7777
name = Flutter;
7878
sourceTree = "<group>";
@@ -148,7 +148,7 @@
148148
97C146E61CF9000F007C117D /* Project object */ = {
149149
isa = PBXProject;
150150
attributes = {
151-
LastUpgradeCheck = 1200;
151+
LastUpgradeCheck = 1020;
152152
ORGANIZATIONNAME = "The Chromium Authors";
153153
TargetAttributes = {
154154
97C146ED1CF9000F007C117D = {
@@ -276,7 +276,6 @@
276276
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
277277
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
278278
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
279-
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
280279
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
281280
CLANG_WARN_STRICT_PROTOTYPES = YES;
282281
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -306,7 +305,7 @@
306305
};
307306
249021D4217E4FDB00AE95B9 /* Profile */ = {
308307
isa = XCBuildConfiguration;
309-
baseConfigurationReference = 7E090D30253F69A800C5BA19 /* Profile.xcconfig */;
308+
baseConfigurationReference = 7E090D29253F679F00C5BA19 /* Profile.xcconfig */;
310309
buildSettings = {
311310
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
312311
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@@ -352,7 +351,6 @@
352351
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
353352
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
354353
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
355-
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
356354
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
357355
CLANG_WARN_STRICT_PROTOTYPES = YES;
358356
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -408,7 +406,6 @@
408406
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
409407
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
410408
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
411-
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
412409
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
413410
CLANG_WARN_STRICT_PROTOTYPES = YES;
414411
CLANG_WARN_SUSPICIOUS_MOVE = YES;

example/lib/call_service.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ class CallService {
2323
CallChanged callChangedEvent;
2424
bool _configured = false;
2525

26-
String getCallerName() {
27-
return _managedCall?.callerName;
28-
}
26+
String get callerName => _managedCall?.callerName;
2927

3028
Future<void> emulateIncomingCall(String contactName) async {
3129
await _configure();
@@ -52,6 +50,8 @@ class CallService {
5250
FCXHandle handle = FCXHandle(FCXHandleType.Generic, contactName);
5351

5452
FCXStartCallAction action = FCXStartCallAction(_managedCall.uuid, handle);
53+
action.contactIdentifier = 'Example contact ID';
54+
action.video = false;
5555

5656
await _callController.requestTransactionWithAction(action);
5757
}
@@ -66,11 +66,12 @@ class CallService {
6666
await _callController.configure();
6767

6868
FCXProviderConfiguration configuration = FCXProviderConfiguration(
69-
'FlutterCallKit',
70-
includesCallsInRecents: true,
71-
supportsVideo: false,
72-
maximumCallsPerCallGroup: 1,
73-
supportedHandleTypes: {FCXHandleType.Generic});
69+
'FlutterCallKit',
70+
includesCallsInRecents: true,
71+
supportsVideo: false,
72+
maximumCallsPerCallGroup: 1,
73+
supportedHandleTypes: {FCXHandleType.Generic},
74+
);
7475

7576
await _provider.configure(configuration);
7677

example/lib/main.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import 'package:flutter_callkit_example/screens/main_screen.dart';
33

44
void main() {
55
WidgetsFlutterBinding.ensureInitialized();
6-
runApp(MaterialApp(
7-
title: 'FlutterCallKit',
8-
home: MainScreen(),
9-
));
6+
runApp(
7+
MaterialApp(
8+
title: 'FlutterCallKit',
9+
home: MainScreen(),
10+
),
11+
);
1012
}

example/lib/screens/call_screen.dart

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,21 @@ class _CallScreenState extends State<CallScreen> {
4141
),
4242
body: Center(
4343
child: Column(
44-
mainAxisAlignment: MainAxisAlignment.center,
45-
children: <Widget>[
46-
SizedBox(
47-
child: Text(
48-
'${_callService.getCallerName() ?? ''}',
49-
style: TextStyle(fontSize: 30),
50-
),
51-
height: 100,
44+
mainAxisAlignment: MainAxisAlignment.center,
45+
children: <Widget>[
46+
SizedBox(
47+
child: Text(
48+
'${_callService.callerName ?? ''}',
49+
style: TextStyle(fontSize: 30),
5250
),
53-
ExampleButton('${_muted ? 'Unmute' : 'Mute'}', _muteOnTouch),
54-
ExampleButton('${_onHold ? 'Resume' : 'Hold'}', _holdOnTouch),
55-
ExampleButton('Send DTMF', _dtmfOnTouch),
56-
ExampleButton('Hangup', _onHangupTouch)
57-
]),
51+
height: 100,
52+
),
53+
ExampleButton('${_muted ? 'Unmute' : 'Mute'}', _muteOnTouch),
54+
ExampleButton('${_onHold ? 'Resume' : 'Hold'}', _holdOnTouch),
55+
ExampleButton('Send DTMF', _dtmfOnTouch),
56+
ExampleButton('Hangup', _onHangupTouch)
57+
],
58+
),
5859
),
5960
);
6061
}

0 commit comments

Comments
 (0)