mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-24 04:24:52 +08:00
[notifications] Fix some android issues with local notifications
This commit is contained in:
@@ -293,6 +293,16 @@ export default class AndroidNotification {
|
||||
return this._notification;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param clickAction
|
||||
* @returns {Notification}
|
||||
*/
|
||||
setClickAction(clickAction: string): Notification {
|
||||
this._clickAction = clickAction;
|
||||
return this._notification;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param color
|
||||
|
||||
@@ -38,7 +38,7 @@ type OnNotificationObserver = {
|
||||
type OnNotificationOpened = NotificationOpen => any;
|
||||
|
||||
type OnNotificationOpenedObserver = {
|
||||
next: OnNotificationOpen,
|
||||
next: NotificationOpen,
|
||||
};
|
||||
|
||||
const NATIVE_EVENTS = [
|
||||
@@ -158,12 +158,18 @@ export default class Notifications extends ModuleBase {
|
||||
return getNativeModule(this).getBadge();
|
||||
}
|
||||
|
||||
getInitialNotification(): Promise<Object> {
|
||||
getInitialNotification(): Promise<NotificationOpen> {
|
||||
return getNativeModule(this)
|
||||
.getInitialNotification()
|
||||
.then(
|
||||
notification => (notification ? new Notification(notification) : null)
|
||||
);
|
||||
.then((notificationOpen: NativeNotificationOpen) => {
|
||||
if (notificationOpen) {
|
||||
return {
|
||||
action: notificationOpen.action,
|
||||
notification: new Notification(notificationOpen.notification),
|
||||
};
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user