mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-05-07 00:42:37 +08:00
[notifications] JS tidy up
This commit is contained in:
@@ -20,41 +20,41 @@ import type {
|
||||
export default class AndroidNotification {
|
||||
// TODO optional fields
|
||||
// TODO actions: Action[]; // icon, title, ??pendingIntent??, allowGeneratedReplies, extender, extras, remoteinput (ugh)
|
||||
_autoCancel: boolean;
|
||||
_badgeIconType: BadgeIconTypeType;
|
||||
_category: CategoryType;
|
||||
_autoCancel: boolean | void;
|
||||
_badgeIconType: BadgeIconTypeType | void;
|
||||
_category: CategoryType | void;
|
||||
_channelId: string;
|
||||
_clickAction: string | void;
|
||||
_color: string;
|
||||
_colorized: boolean;
|
||||
_contentInfo: string;
|
||||
_defaults: DefaultsType[];
|
||||
_group: string;
|
||||
_groupAlertBehaviour: GroupAlertType;
|
||||
_groupSummary: boolean;
|
||||
_largeIcon: string;
|
||||
_lights: Lights;
|
||||
_localOnly: boolean;
|
||||
_color: string | void;
|
||||
_colorized: boolean | void;
|
||||
_contentInfo: string | void;
|
||||
_defaults: DefaultsType[] | void;
|
||||
_group: string | void;
|
||||
_groupAlertBehaviour: GroupAlertType | void;
|
||||
_groupSummary: boolean | void;
|
||||
_largeIcon: string | void;
|
||||
_lights: Lights | void;
|
||||
_localOnly: boolean | void;
|
||||
_notification: Notification;
|
||||
_number: number;
|
||||
_ongoing: boolean;
|
||||
_onlyAlertOnce: boolean;
|
||||
_number: number | void;
|
||||
_ongoing: boolean | void;
|
||||
_onlyAlertOnce: boolean | void;
|
||||
_people: string[];
|
||||
_priority: PriorityType;
|
||||
_progress: Progress;
|
||||
_priority: PriorityType | void;
|
||||
_progress: Progress | void;
|
||||
// _publicVersion: Notification;
|
||||
_remoteInputHistory: string[];
|
||||
_shortcutId: string;
|
||||
_showWhen: boolean;
|
||||
_remoteInputHistory: string[] | void;
|
||||
_shortcutId: string | void;
|
||||
_showWhen: boolean | void;
|
||||
_smallIcon: SmallIcon;
|
||||
_sortKey: string;
|
||||
_sortKey: string | void;
|
||||
// TODO: style: Style; // Need to figure out if this can work
|
||||
_ticker: string;
|
||||
_timeoutAfter: number;
|
||||
_usesChronometer: boolean;
|
||||
_vibrate: number[];
|
||||
_visibility: VisibilityType;
|
||||
_when: number;
|
||||
_ticker: string | void;
|
||||
_timeoutAfter: number | void;
|
||||
_usesChronometer: boolean | void;
|
||||
_vibrate: number[] | void;
|
||||
_visibility: VisibilityType | void;
|
||||
_when: number | void;
|
||||
|
||||
// android unsupported
|
||||
// content: RemoteViews
|
||||
@@ -112,6 +112,134 @@ export default class AndroidNotification {
|
||||
};
|
||||
}
|
||||
|
||||
get autoCancel(): ?boolean {
|
||||
return this._autoCancel;
|
||||
}
|
||||
|
||||
get badgeIconType(): ?BadgeIconTypeType {
|
||||
return this._badgeIconType;
|
||||
}
|
||||
|
||||
get category(): ?CategoryType {
|
||||
return this._category;
|
||||
}
|
||||
|
||||
get channelId(): string {
|
||||
return this._channelId;
|
||||
}
|
||||
|
||||
get clickAction(): ?string {
|
||||
return this._clickAction;
|
||||
}
|
||||
|
||||
get color(): ?string {
|
||||
return this._color;
|
||||
}
|
||||
|
||||
get colorized(): ?boolean {
|
||||
return this._colorized;
|
||||
}
|
||||
|
||||
get contentInfo(): ?string {
|
||||
return this._contentInfo;
|
||||
}
|
||||
|
||||
get defaults(): ?(DefaultsType[]) {
|
||||
return this._defaults;
|
||||
}
|
||||
|
||||
get group(): ?string {
|
||||
return this._group;
|
||||
}
|
||||
|
||||
get groupAlertBehaviour(): ?GroupAlertType {
|
||||
return this._groupAlertBehaviour;
|
||||
}
|
||||
|
||||
get groupSummary(): ?boolean {
|
||||
return this._groupSummary;
|
||||
}
|
||||
|
||||
get largeIcon(): ?string {
|
||||
return this._largeIcon;
|
||||
}
|
||||
|
||||
get lights(): ?Lights {
|
||||
return this._lights;
|
||||
}
|
||||
|
||||
get localOnly(): ?boolean {
|
||||
return this._localOnly;
|
||||
}
|
||||
|
||||
get number(): ?number {
|
||||
return this._number;
|
||||
}
|
||||
|
||||
get ongoing(): ?boolean {
|
||||
return this._ongoing;
|
||||
}
|
||||
|
||||
get onlyAlertOnce(): ?boolean {
|
||||
return this._onlyAlertOnce;
|
||||
}
|
||||
|
||||
get people(): string[] {
|
||||
return this._people;
|
||||
}
|
||||
|
||||
get priority(): ?PriorityType {
|
||||
return this._priority;
|
||||
}
|
||||
|
||||
get progress(): ?Progress {
|
||||
return this._progress;
|
||||
}
|
||||
|
||||
get remoteInputHistory(): ?(string[]) {
|
||||
return this._remoteInputHistory;
|
||||
}
|
||||
|
||||
get shortcutId(): ?string {
|
||||
return this._shortcutId;
|
||||
}
|
||||
|
||||
get showWhen(): ?boolean {
|
||||
return this._showWhen;
|
||||
}
|
||||
|
||||
get smallIcon(): SmallIcon {
|
||||
return this._smallIcon;
|
||||
}
|
||||
|
||||
get sortKey(): ?string {
|
||||
return this._sortKey;
|
||||
}
|
||||
|
||||
get ticker(): ?string {
|
||||
return this._ticker;
|
||||
}
|
||||
|
||||
get timeoutAfter(): ?number {
|
||||
return this._timeoutAfter;
|
||||
}
|
||||
|
||||
get usesChronometer(): ?boolean {
|
||||
return this._usesChronometer;
|
||||
}
|
||||
|
||||
get vibrate(): ?(number[]) {
|
||||
return this._vibrate;
|
||||
}
|
||||
|
||||
get visibility(): ?VisibilityType {
|
||||
return this._visibility;
|
||||
}
|
||||
|
||||
get when(): ?number {
|
||||
return this._when;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param person
|
||||
@@ -451,6 +579,10 @@ export default class AndroidNotification {
|
||||
throw new Error(
|
||||
'AndroidNotification: Missing required `channelId` property'
|
||||
);
|
||||
} else if (!this._smallIcon) {
|
||||
throw new Error(
|
||||
'AndroidNotification: Missing required `smallIcon` property'
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user