Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: delete device token from profile #158

Merged
merged 3 commits into from Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -117,6 +117,11 @@ class CustomerIOReactNativeModule(
customerIO()?.registerDeviceToken(token)
}

@ReactMethod
fun deleteDeviceToken() {
customerIO()?.deleteDeviceToken()
}

@ReactMethod
fun getPushPermissionStatus(promise: Promise) {
pushMessagingModule.getPushPermissionStatus(promise)
Expand Down
2 changes: 2 additions & 0 deletions ios/CustomerioReactnative.m
Expand Up @@ -23,6 +23,8 @@ @interface RCT_EXTERN_MODULE(CustomerioReactnative, NSObject)

RCT_EXTERN_METHOD(registerDeviceToken : (nonnull NSString *) token)

RCT_EXTERN_METHOD(deleteDeviceToken)

RCT_EXTERN_METHOD(showPromptForPushNotifications: (NSDictionary *) options
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
Expand Down
5 changes: 5 additions & 0 deletions ios/CustomerioReactnative.swift
Expand Up @@ -137,6 +137,11 @@ class CustomerioReactnative: NSObject {
CustomerIO.shared.registerDeviceToken(token)
}

@objc(deleteDeviceToken)
func deleteDeviceToken() {
CustomerIO.shared.deleteDeviceToken()
}

/**
To show push notification prompt if current authorization status is not determined
*/
Expand Down
4 changes: 4 additions & 0 deletions src/CustomerioTracking.tsx
Expand Up @@ -154,6 +154,10 @@ class CustomerIO {
CustomerioReactnative.registerDeviceToken(token);
}

static deleteDeviceToken() {
CustomerioReactnative.deleteDeviceToken();
}

/**
* Request to show prompt for push notification permissions.
* Prompt will only be shown if the current status is - not determined.
Expand Down