Commit 40c3f7ee authored by Stanislav Shakirov's avatar Stanislav Shakirov Committed by GitHub

Safe FirebaseMessaging usage

parent b884852e
...@@ -212,12 +212,24 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li ...@@ -212,12 +212,24 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li
@ReactMethod @ReactMethod
public void subscribeToTopic(String topic){ 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 @ReactMethod
public void unsubscribeFromTopic(String topic){ 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 @ReactMethod
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment