Skip to content

Commit fe1f6c7

Browse files
r0b0t3dzxcpoiu
authored andcommitted
separate requestPermissions and registerVoipToken (#40)
1 parent d129f9c commit fe1f6c7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ export default class RNVoipPushNotification {
125125
RNVoipPushNotificationManager.requestPermissions(requestedPermissions);
126126
}
127127

128+
/**
129+
* Register for voip token
130+
*
131+
* @static
132+
* @memberof RNVoipPushNotification
133+
*/
134+
static registerVoipToken() {
135+
RNVoipPushNotificationManager.registerVoipToken();
136+
}
137+
128138
/**
129139
* You will never need to instantiate `RNVoipPushNotification` yourself.
130140
* Listening to the `notification` event and invoking

ios/RNVoipPushNotification/RNVoipPushNotificationManager.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,19 @@ - (void)handleRemoteNotificationReceived:(NSNotification *)notification
197197
}
198198
dispatch_async(dispatch_get_main_queue(), ^{
199199
[self registerUserNotification:permissions];
200-
[self voipRegistration];
201200
});
202201
}
203202

203+
RCT_EXPORT_METHOD(registerVoipToken)
204+
{
205+
if (RCTRunningInAppExtension()) {
206+
return;
207+
}
208+
dispatch_async(dispatch_get_main_queue(), ^{
209+
[self voipRegistration];
210+
});
211+
}
212+
204213
RCT_EXPORT_METHOD(checkPermissions:(RCTResponseSenderBlock)callback)
205214
{
206215
if (RCTRunningInAppExtension()) {

0 commit comments

Comments
 (0)