[fcm] Fix getInitialMessage; Handle a few more android fields

This commit is contained in:
Chris Bianca 2018-02-09 10:17:16 +00:00
parent 7cac981468
commit 1ddc76616d
2 changed files with 7 additions and 2 deletions

View File

@ -69,7 +69,6 @@ public class RNFirebaseMessaging extends ReactContextBaseJavaModule implements A
@ReactMethod @ReactMethod
public void requestPermission(Promise promise) { public void requestPermission(Promise promise) {
// TODO: Object structure?
promise.resolve(null); promise.resolve(null);
} }
@ -190,6 +189,10 @@ public class RNFirebaseMessaging extends ReactContextBaseJavaModule implements A
messageMap.putString("messageId", extras.getString("google.message_id")); messageMap.putString("messageId", extras.getString("google.message_id"));
} else if (key.equals("google.sent_time")) { } else if (key.equals("google.sent_time")) {
messageMap.putDouble("sentTime", extras.getLong("google.sent_time")); messageMap.putDouble("sentTime", extras.getLong("google.sent_time"));
} else if (key.equals("google.ttl")) {
messageMap.putDouble("ttl", extras.getDouble("google.ttl"));
} else if (key.equals("_fbSourceApplicationHasBeenSet")) {
// ignore known unneeded fields
} else { } else {
dataMap.putString(key, extras.getString(key)); dataMap.putString(key, extras.getString(key));
} }

View File

@ -139,7 +139,9 @@ export default class Messaging extends ModuleBase {
} }
getInitialMessage(): Promise<?Message> { getInitialMessage(): Promise<?Message> {
return getNativeModule(this).getInitialMessage(); return getNativeModule(this)
.getInitialMessage()
.then(message => new Message(this, message));
} }
hasPermission(): Promise<boolean> { hasPermission(): Promise<boolean> {