File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed
android/src/main/java/com/geektime/rnonesignalandroid Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -389,6 +389,16 @@ public void userProvidedPrivacyConsent(Promise promise) {
389389 promise .resolve (OneSignal .userProvidedPrivacyConsent ());
390390 }
391391
392+ @ ReactMethod
393+ public void setExternalUserId (String externalId ) {
394+ OneSignal .setExternalUserId (externalId );
395+ }
396+
397+ @ ReactMethod
398+ public void removeExternalUserId () {
399+ OneSignal .removeExternalUserId ();
400+ }
401+
392402 private void registerNotificationsReceivedNotification () {
393403 IntentFilter intentFilter = new IntentFilter (NOTIFICATION_RECEIVED_INTENT_FILTER );
394404 mReactContext .registerReceiver (new BroadcastReceiver () {
Original file line number Diff line number Diff line change @@ -357,4 +357,15 @@ export default class OneSignal {
357357 return RNOneSignal . userProvidedPrivacyConsent ( ) ;
358358 }
359359
360+ static setExternalUserId ( externalId ) {
361+ if ( ! checkIfInitialized ( ) ) return ;
362+
363+ RNOneSignal . setExternalUserId ( externalId ) ;
364+ }
365+
366+ static removeExternalUserId ( ) {
367+ if ( ! checkIfInitialized ( ) ) return ;
368+
369+ RNOneSignal . removeExternalUserId ( ) ;
370+ }
360371}
Original file line number Diff line number Diff line change @@ -343,5 +343,12 @@ + (void)sendEventWithName:(NSString *)name withBody:(NSDictionary *)body {
343343 [OneSignal setLogLevel: logLevel visualLevel: visualLogLevel];
344344}
345345
346+ RCT_EXPORT_METHOD (setExternalUserId:(NSString *)externalId) {
347+ [OneSignal setExternalUserId: externalId];
348+ }
349+
350+ RCT_EXPORT_METHOD (removeExternalUserId) {
351+ [OneSignal removeExternalUserId ];
352+ }
346353
347354@end
You can’t perform that action at this time.
0 commit comments