Skip to content

Commit

Permalink
Merge pull request #1008 from moulie415/master
Browse files Browse the repository at this point in the history
delete notification channel method
  • Loading branch information
Libin Lu authored Aug 3, 2018
2 parents 4bcc5d1 + 1cac5d2 commit 40ada99
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ public void createNotificationChannel(ReadableMap details, Promise promise){
promise.resolve(null);
}

@ReactMethod
public void deleteNotificationChannel(String id, Promise promise) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationManager mngr = (NotificationManager) getReactApplicationContext().getSystemService(NOTIFICATION_SERVICE);
mngr.deleteNotificationChannel(id);
}
promise.resolve(null);
}

@ReactMethod
public void getFCMToken(Promise promise) {
try {
Expand Down
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ FCM.createNotificationChannel = (channel) => {
}
}

FCM.deleteNotificationChannel = (channel) => {
if (Platform.OS === 'android') {
return RNFIRMessaging.deleteNotificationChannel(channel);
}
}

FCM.presentLocalNotification = (details) => {
details.id = details.id || new Date().getTime().toString();
details.local_notification = true;
Expand Down

0 comments on commit 40ada99

Please sign in to comment.