@@ -128,8 +128,6 @@ Make sure you enabled the folowing in `Xcode` -> `Signing & Capabilities`:
128
128
// --- Handle incoming pushes (for ios >= 11)
129
129
- (void)pushRegistry:(PKPushRegistry * )registry didReceiveIncomingPushWithPayload:(PKPushPayload * )payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {
130
130
131
- // --- Process the received push
132
- [ RNVoipPushNotificationManager didReceiveIncomingPushWithPayload: payload forType:(NSString * )type] ;
133
131
134
132
// --- NOTE: apple forced us to invoke callkit ASAP when we receive voip push
135
133
// --- see: react-native-callkeep
@@ -139,9 +137,16 @@ Make sure you enabled the folowing in `Xcode` -> `Signing & Capabilities`:
139
137
NSString * callerName = [ NSString stringWithFormat:@"%@ (Connecting...)", payload.dictionaryPayload[ @"callerName"]] ;
140
138
NSString * handle = payload.dictionaryPayload[ @"handle"] ;
141
139
140
+ // --- this is optional, only required if you want to call ` completion() ` on the js side
141
+ [ RNVoipPushNotificationManager addCompletionHandler: uuid completionHandler: completion ] ;
142
+
143
+ // --- Process the received push
144
+ [ RNVoipPushNotificationManager didReceiveIncomingPushWithPayload: payload forType:(NSString * )type] ;
145
+
142
146
// --- You should make sure to report to callkit BEFORE execute ` completion() `
143
147
[ RNCallKeep reportNewIncomingCall: uuid handle: handle handleType:@"generic" hasVideo: false localizedCallerName: callerName fromPushKit: YES payload: nil ] ;
144
-
148
+
149
+ // --- You don't need to call it if you stored ` completion() ` and will call it on the js side.
145
150
completion();
146
151
}
147
152
...
@@ -220,6 +225,11 @@ class MyComponent extends React.Component {
220
225
VoipPushNotification .wakeupByPush = false ;
221
226
}
222
227
228
+
229
+ // --- optionally, if you `addCompletionHandler` from the native side, once you have done the js jobs to initiate a call, call `completion()`
230
+ VoipPushNotification .onVoipNotificationCompleted (notification .getData ().uuid );
231
+
232
+
223
233
/**
224
234
* Local Notification Payload
225
235
*
@@ -235,7 +245,6 @@ class MyComponent extends React.Component {
235
245
});
236
246
}
237
247
...
238
-
239
248
}
240
249
241
250
```
0 commit comments