Skip to content

Commit

Permalink
Merge pull request #1040 from punksta/patch-1
Browse files Browse the repository at this point in the history
Safe FirebaseMessaging usage
  • Loading branch information
Libin Lu authored Sep 7, 2018
2 parents 7557b00 + 40c3f7e commit 5cec691
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,24 @@ public void removeAllDeliveredNotifications(){

@ReactMethod
public void subscribeToTopic(String topic){
FirebaseMessaging.getInstance().subscribeToTopic(topic);
try {
FirebaseMessaging.getInstance().subscribeToTopic(topic);
promise.resolve(null);
} catch (IOException e) {
e.printStackTrace();
promise.reject(null,e.getMessage());
}
}

@ReactMethod
public void unsubscribeFromTopic(String topic){
FirebaseMessaging.getInstance().unsubscribeFromTopic(topic);
try {
FirebaseMessaging.getInstance().unsubscribeFromTopic(topic);
promise.resolve(null);
} catch (IOException e) {
e.printStackTrace();
promise.reject(null,e.getMessage());
}
}

@ReactMethod
Expand Down

0 comments on commit 5cec691

Please sign in to comment.