[notifications] Continue android implementation

This commit is contained in:
Chris Bianca
2018-02-15 14:59:21 +00:00
parent 99b4b6550b
commit cd0ef4e3b7
15 changed files with 413 additions and 276 deletions

View File

@@ -17,17 +17,18 @@ type Progress = {
};
type SmallIcon = {
icon: number,
icon: string,
level?: number,
};
export type NativeAndroidNotification = {
export type NativeAndroidNotification = {|
// TODO actions: Action[],
autoCancel: boolean,
badgeIconType: BadgeIconTypeType,
category: CategoryType,
channelId: string,
color: number,
clickAction?: string,
color: string,
colorized: boolean,
contentInfo: string,
defaults: DefaultsType[],
@@ -43,7 +44,7 @@ export type NativeAndroidNotification = {
people: string[],
priority: PriorityType,
progress: Progress,
publicVersion: Notification,
// publicVersion: Notification,
remoteInputHistory: string[],
shortcutId: string,
showWhen: boolean,
@@ -56,7 +57,7 @@ export type NativeAndroidNotification = {
vibrate: number[],
visibility: VisibilityType,
when: number,
};
|};
export const BadgeIconType = {
Large: 2,
@@ -122,7 +123,8 @@ export default class AndroidNotification {
_badgeIconType: BadgeIconTypeType;
_category: CategoryType;
_channelId: string;
_color: number;
_clickAction: string;
_color: string;
_colorized: boolean;
_contentInfo: string;
_defaults: DefaultsType[];
@@ -139,11 +141,13 @@ export default class AndroidNotification {
_people: string[];
_priority: PriorityType;
_progress: Progress;
_publicVersion: Notification;
// _publicVersion: Notification;
_remoteInputHistory: string[];
_shortcutId: string;
_showWhen: boolean;
_smallIcon: SmallIcon;
_smallIcon: SmallIcon = {
icon: 'ic_launcher',
};
_sortKey: string;
// TODO: style: Style; // Need to figure out if this can work
_ticker: string;
@@ -170,9 +174,7 @@ export default class AndroidNotification {
/**
*
* @param identifier
* @param identifier
* @param identifier
* @param person
* @returns {Notification}
*/
addPerson(person: string): Notification {
@@ -228,7 +230,7 @@ export default class AndroidNotification {
* @param color
* @returns {Notification}
*/
setColor(color: number): Notification {
setColor(color: string): Notification {
this._color = color;
return this._notification;
}
@@ -394,10 +396,10 @@ export default class AndroidNotification {
* @param publicVersion
* @returns {Notification}
*/
setPublicVersion(publicVersion: Notification): Notification {
/* setPublicVersion(publicVersion: Notification): Notification {
this._publicVersion = publicVersion;
return this._notification;
}
} */
/**
*
@@ -435,7 +437,7 @@ export default class AndroidNotification {
* @param level
* @returns {Notification}
*/
setSmallIcon(icon: number, level?: number): Notification {
setSmallIcon(icon: string, level?: number): Notification {
this._smallIcon = {
icon,
level,
@@ -517,6 +519,7 @@ export default class AndroidNotification {
badgeIconType: this._badgeIconType,
category: this._category,
channelId: this._channelId,
clickAction: this._clickAction,
color: this._color,
colorized: this._colorized,
contentInfo: this._contentInfo,
@@ -533,7 +536,7 @@ export default class AndroidNotification {
people: this._people,
priority: this._priority,
progress: this._progress,
publicVersion: this._publicVersion,
// publicVersion: this._publicVersion,
remoteInputHistory: this._remoteInputHistory,
shortcutId: this._shortcutId,
showWhen: this._showWhen,