@@ -93,7 +93,19 @@ Make sure you enabled the folowing in `Xcode` -> `Signing & Capabilities`:
93
93
94
94
- (BOOL)application:(UIApplication * )application didFinishLaunchingWithOptions:(NSDictionary * )launchOptions
95
95
{
96
- ...
96
+ RCTBridge * bridge = [[ RCTBridge alloc] initWithDelegate: self launchOptions: launchOptions ] ;
97
+
98
+
99
+
100
+ // ===== (THIS IS OPTIONAL) =====
101
+ // --- register VoipPushNotification here ASAP rather than in JS. Doing this from the JS side may be too slow for some use cases
102
+ // --- see: https://github.com/react-native-webrtc/react-native-voip-push-notification/issues/59#issuecomment-691685841
103
+ [ RNVoipPushNotificationManager voipRegistration] ;
104
+ // ===== (THIS IS OPTIONAL) =====
105
+
106
+
107
+
108
+ RCTRootView * rootView = [[ RCTRootView alloc] initWithBridge: bridge moduleName:@"AppName" initialProperties: nil ] ;
97
109
}
98
110
99
111
...
@@ -171,7 +183,34 @@ On RN60+, auto linking with pod file should work.
171
183
- In ` Header Search Paths ` , add ` $(SRCROOT)/../node_modules/react-native-voip-push-notification/ios/RNVoipPushNotification ` with ` recursive `
172
184
</details>
173
185
174
- ## Usage:
186
+ ## API and Usage:
187
+
188
+ #### Native API:
189
+
190
+ Voip Push is time sensitive, these native API mainly used in AppDelegate.m, especially before JS bridge is up.
191
+ This usually
192
+
193
+ * ` (void)voipRegistration ` ---
194
+ register delegate for PushKit if you like to register in AppDelegate.m ASAP instead JS side ( too late for some use cases )
195
+ * ` (void)didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type ` ---
196
+ call this api to fire 'register' event to JS
197
+ * ` (void)didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type ` ---
198
+ call this api to fire 'notification' event to JS
199
+ * ` (void)addCompletionHandler:(NSString *)uuid completionHandler:(RNVoipPushNotificationCompletion)completionHandler ` ---
200
+ add completionHandler to RNVoipPush module
201
+ * ` (void)removeCompletionHandler:(NSString *)uuid ` ---
202
+ remove completionHandler to RNVoipPush module
203
+
204
+ #### JS API:
205
+
206
+ * ` registerVoipToken() ` --- JS method to register PushKit delegate
207
+ * ` onVoipNotificationCompleted(notification.uuid) ` --- JS mehtod to tell PushKit we have handled received voip push
208
+
209
+ #### Events:
210
+
211
+ * ` 'register' ` --- fired when PushKit give us the latest token
212
+ * ` 'notification' ` --- fired when received voip push notification
213
+ * ` 'didLoadWithEvents' ` --- fired when there are not-fired events been cached before js bridge is up
175
214
176
215
``` javascript
177
216
0 commit comments