[notifications] Add enableLights and enableVibration to AndroidChannel

This commit is contained in:
Chris Bianca
2018-03-31 15:42:14 +01:00
parent 1cf17f1d89
commit f5fa7436a9
2 changed files with 40 additions and 0 deletions

View File

@@ -12,10 +12,12 @@ type NativeAndroidChannel = {|
group?: string,
importance: ImportanceType,
lightColor?: string,
lightsEnabled?: boolean,
lockScreenVisibility?: VisibilityType,
name: string,
showBadge?: boolean,
sound?: string,
vibrationEnabled?: boolean,
vibrationPattern?: number[],
|};
@@ -26,10 +28,12 @@ export default class AndroidChannel {
_group: string | void;
_importance: ImportanceType;
_lightColor: string | void;
_lightsEnabled: boolean | void;
_lockScreenVisibility: VisibilityType;
_name: string;
_showBadge: boolean | void;
_sound: string | void;
_vibrationEnabled: boolean | void;
_vibrationPattern: number[] | void;
constructor(channelId: string, name: string, importance: ImportanceType) {
@@ -65,6 +69,10 @@ export default class AndroidChannel {
return this._lightColor;
}
get lightsEnabled(): ?boolean {
return this._lightsEnabled;
}
get lockScreenVisibility(): ?VisibilityType {
return this._lockScreenVisibility;
}
@@ -81,10 +89,34 @@ export default class AndroidChannel {
return this._sound;
}
get vibrationEnabled(): ?boolean {
return this._vibrationEnabled;
}
get vibrationPattern(): ?(number[]) {
return this._vibrationPattern;
}
/**
*
* @param lightsEnabled
* @returns {AndroidChannel}
*/
enableLights(lightsEnabled: boolean): AndroidChannel {
this._lightsEnabled = lightsEnabled;
return this;
}
/**
*
* @param vibrationEnabled
* @returns {AndroidChannel}
*/
enableVibration(vibrationEnabled: boolean): AndroidChannel {
this._vibrationEnabled = vibrationEnabled;
return this;
}
/**
*
* @param bypassDnd
@@ -188,10 +220,12 @@ export default class AndroidChannel {
group: this._group,
importance: this._importance,
lightColor: this._lightColor,
lightsEnabled: this._lightsEnabled,
lockScreenVisibility: this._lockScreenVisibility,
name: this._name,
showBadge: this._showBadge,
sound: this._sound,
vibrationEnabled: this._vibrationEnabled,
vibrationPattern: this._vibrationPattern,
};
}