[notifications] Fix some android issues with local notifications

This commit is contained in:
Chris Bianca
2018-03-07 18:29:53 +00:00
parent aa367e7be8
commit 57ffa9bd3e
7 changed files with 119 additions and 57 deletions

View File

@@ -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

View File

@@ -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;
});
}
/**