@@ -93,7 +93,19 @@ Make sure you enabled the folowing in `Xcode` -> `Signing & Capabilities`:
9393
9494- (BOOL)application:(UIApplication * )application didFinishLaunchingWithOptions:(NSDictionary * )launchOptions
9595{
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 ] ;
97109}
98110
99111...
@@ -171,7 +183,34 @@ On RN60+, auto linking with pod file should work.
171183 - In ` Header Search Paths ` , add ` $(SRCROOT)/../node_modules/react-native-voip-push-notification/ios/RNVoipPushNotification ` with ` recursive `
172184</details>
173185
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
175214
176215``` javascript
177216
0 commit comments