Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit fc6a7cf

Browse files
authored
Merge pull request #917 from experionarjun/feature/unsubscribeFromTopic
Added functionality to Unsubscribe from Topic
2 parents d7705f8 + 72ca630 commit fc6a7cf

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ public void onComplete(@NonNull Task<InstanceIdResult> task) {
143143
public void subscribeToTopic(String topic) {
144144
FirebaseMessaging.getInstance().subscribeToTopic(topic);
145145
}
146+
147+
@ReactMethod
148+
public void unsubscribeFromTopic(String topic) {
149+
FirebaseMessaging.getInstance().unsubscribeFromTopic(topic);
150+
}
146151

147152
@ReactMethod
148153
public void presentLocalNotification(ReadableMap details) {

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@ Notifications.subscribeToTopic = function() {
277277
return this.callNative('subscribeToTopic', arguments);
278278
};
279279

280+
Notifications.unsubscribeFromTopic = function () {
281+
return this.callNative('unsubscribeFromTopic', arguments);
282+
};
283+
280284
Notifications.presentLocalNotification = function() {
281285
return this.callNative('presentLocalNotification', arguments);
282286
};

0 commit comments

Comments
 (0)