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 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Apps/APN/components/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ const Dashboard = ({ navigation }) => {
const registerDeviceToken = () => {
if (deviceToken !== null) {
CustomerIO.registerDeviceToken(deviceToken);
alert('Device token registered successfully');
//alert('Device token registered successfully');

CustomerIO.deleteDeviceToken();
alert('Registered, and then deleted token');
levibostian marked this conversation as resolved.
Show resolved Hide resolved
return;
}
alert('Could not register device. Device token unavailable.');
Expand Down
Original file line number Diff line number Diff line change
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
5 changes: 5 additions & 0 deletions ios/CustomerioReactnative.swift
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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