[notifications] Add enableLights and enableVibration to AndroidChannel
This commit is contained in:
parent
1cf17f1d89
commit
f5fa7436a9
@ -617,6 +617,9 @@ public class RNFirebaseNotificationManager {
|
||||
String lightColor = channelMap.getString("lightColor");
|
||||
channel.setLightColor(Color.parseColor(lightColor));
|
||||
}
|
||||
if (channelMap.hasKey("lightsEnabled")) {
|
||||
channel.enableLights(channelMap.getBoolean("lightsEnabled"));
|
||||
}
|
||||
if (channelMap.hasKey("lockScreenVisibility")) {
|
||||
channel.setLockscreenVisibility(channelMap.getInt("lockScreenVisibility"));
|
||||
}
|
||||
@ -627,6 +630,9 @@ public class RNFirebaseNotificationManager {
|
||||
Uri sound = getSound(channelMap.getString("sound"));
|
||||
channel.setSound(sound, null);
|
||||
}
|
||||
if (channelMap.hasKey("vibrationEnabled")) {
|
||||
channel.enableVibration(channelMap.getBoolean("vibrationEnabled"));
|
||||
}
|
||||
if (channelMap.hasKey("vibrationPattern")) {
|
||||
ReadableArray vibrationArray = channelMap.getArray("vibrationPattern");
|
||||
long[] vibration = new long[]{};
|
||||
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user