Skip to content

Remove deprecated api registerForRemoteNotifications #41

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

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Batch Cordova Plugin
- Added `setPhoneNumber` API to the `BatchProfileAttributeEditor` class. This requires to have a user identifier registered or to call the `identify` method beforehand.
- Added `setSMSMarketingSubscription` API to the `BatchProfileAttributeEditor` class.

**Push**
- Removed deprecated API `registerForRemoteNotifications`. Please use `requestNotificationAuthorization` to request permission when needed, and `requestToken` at each app launch.

## 6.0.0

This is a major release, please see our [migration guide](https://doc.batch.com/cordova/migrations/5x-migration/) for more info on how to update your current Batch implementation.
Expand Down
1 change: 0 additions & 1 deletion dist/src/android/interop/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public enum Action
MESSAGING_SET_DO_NOT_DISTURB_ENABLED("messaging.setDoNotDisturbEnabled"),
MESSAGING_SHOW_PENDING_MESSAGE("messaging.showPendingMessage"),
PUSH_GET_LAST_KNOWN_TOKEN("push.getLastKnownPushToken"),
PUSH_REGISTER("push.register"),
PUSH_SET_GCM_SENDER_ID("push.setGCMSenderID"),
PUSH_CLEAR_BADGE("push.clearBadge"),
PUSH_DISMISS_NOTIFICATIONS("push.dismissNotifications"),
Expand Down
3 changes: 0 additions & 3 deletions dist/src/android/interop/Bridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ private static SimplePromise<String> doAction(String actionName, Map<String, Obj
case PUSH_DISMISS_NOTIFICATIONS:
dismissNotifications();
break;
case PUSH_REGISTER:
// iOS only, do nothing
return null;
case PUSH_CLEAR_BADGE:
// iOS only, do nothing
return null;
Expand Down
10 changes: 0 additions & 10 deletions dist/src/ios/interop/BatchBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,6 @@ + (NSString *)boolToBridgeString:(BOOL)value
{
// Do nothing
}
else if ([action caseInsensitiveCompare:REGISTER_NOTIFS] == NSOrderedSame)
{
[BatchBridge registerForRemoteNotifications];
}
else if ([action caseInsensitiveCompare:DISMISS_NOTIFS] == NSOrderedSame)
{
[BatchBridge dismissNotifications];
Expand Down Expand Up @@ -483,12 +479,6 @@ + (void)setNotificationTypes:(BatchNotificationType)type
[BatchPush setRemoteNotificationTypes:type];
}

+ (void)registerForRemoteNotifications
{
[BatchPush requestNotificationAuthorization];
[BatchPush refreshToken];
}

+ (void)clearBadge
{
[BatchPush clearBadge];
Expand Down
1 change: 0 additions & 1 deletion dist/src/ios/interop/BatchBridgeShared.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ if (error == NULL) {\
#define PUSH_REQUEST_AUTHORIZATION @"push.requestAuthorization"
#define PUSH_REQUEST_PROVISIONAL_AUTH @"push.iOS.requestProvisionalAuthorization"

#define REGISTER_NOTIFS @"push.register"
#define DISMISS_NOTIFS @"push.dismissNotifications"
#define CLEAR_BADGE @"push.clearBadge"

Expand Down
1 change: 0 additions & 1 deletion src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export enum Push {
SetIOSShowForegroundNotifications = "push.setIOSShowForegroundNotifications",
SetIOSNotifTypes = "push.setIOSNotifTypes",
SetAndroidNotifTypes = "push.setAndroidNotifTypes",
Register = "push.register",
DismissNotifications = "push.dismissNotifications",
ClearBadge = "push.clearBadge",
RefreshToken = "push.iOS.refreshToken",
Expand Down
1 change: 0 additions & 1 deletion src/batchStub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class PushStub implements BatchSDK.PushModule {
this.iOSNotificationTypes = iOSNotificationTypes;
}

public registerForRemoteNotifications() {}
public refreshToken() {}
public requestNotificationAuthorization() {}
public requestProvisionalNotificationAuthorization() {}
Expand Down
4 changes: 0 additions & 4 deletions src/modules/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ export class PushModule implements BatchSDK.PushModule {
this.iOSNotificationTypes = iOSNotificationTypes;
}

public registerForRemoteNotifications(): void {
sendToBridge(null, PushActions.Register, null);
}

public refreshToken(): void {
sendToBridge(null, PushActions.RefreshToken, null);
}
Expand Down
7 changes: 0 additions & 7 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,6 @@ export declare namespace BatchSDK {
AndroidNotificationTypes: typeof AndroidNotificationTypes;
iOSNotificationTypes: typeof iOSNotificationTypes;

/**
* Ask iOS users if they want to accept push notifications. Required to be able to push users.
* No effect on Android.
* @deprecated Use requestNotificationAuthorization/requestProvisionalNotificationAuthorization and refreshToken
*/
registerForRemoteNotifications(): void;

/**
* Ask iOS to refresh the push token. If the app didn't prompt the user for consent yet, this will not be done.
* You should call this at the start of your app, to make sure Batch always gets a valid token after app updates.
Expand Down
Loading