UNPKG

react-native-firebase-compiled

Version:

A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Sto

243 lines (187 loc) 4.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _types = require("./types"); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } class AndroidChannel { constructor(channelId, name, importance) { _defineProperty(this, "_bypassDnd", void 0); _defineProperty(this, "_channelId", void 0); _defineProperty(this, "_description", void 0); _defineProperty(this, "_group", void 0); _defineProperty(this, "_importance", void 0); _defineProperty(this, "_lightColor", void 0); _defineProperty(this, "_lightsEnabled", void 0); _defineProperty(this, "_lockScreenVisibility", void 0); _defineProperty(this, "_name", void 0); _defineProperty(this, "_showBadge", void 0); _defineProperty(this, "_sound", void 0); _defineProperty(this, "_vibrationEnabled", void 0); _defineProperty(this, "_vibrationPattern", void 0); if (!Object.values(_types.Importance).includes(importance)) { throw new Error(`AndroidChannel() Invalid Importance: ${importance}`); } this._channelId = channelId; this._name = name; this._importance = importance; } get bypassDnd() { return this._bypassDnd; } get channelId() { return this._channelId; } get description() { return this._description; } get group() { return this._group; } get importance() { return this._importance; } get lightColor() { return this._lightColor; } get lightsEnabled() { return this._lightsEnabled; } get lockScreenVisibility() { return this._lockScreenVisibility; } get name() { return this._name; } get showBadge() { return this._showBadge; } get sound() { return this._sound; } get vibrationEnabled() { return this._vibrationEnabled; } get vibrationPattern() { return this._vibrationPattern; } /** * * @param lightsEnabled * @returns {AndroidChannel} */ enableLights(lightsEnabled) { this._lightsEnabled = lightsEnabled; return this; } /** * * @param vibrationEnabled * @returns {AndroidChannel} */ enableVibration(vibrationEnabled) { this._vibrationEnabled = vibrationEnabled; return this; } /** * * @param bypassDnd * @returns {AndroidChannel} */ setBypassDnd(bypassDnd) { this._bypassDnd = bypassDnd; return this; } /** * * @param description * @returns {AndroidChannel} */ setDescription(description) { this._description = description; return this; } /** * * @param group * @returns {AndroidChannel} */ setGroup(groupId) { this._group = groupId; return this; } /** * * @param lightColor * @returns {AndroidChannel} */ setLightColor(lightColor) { this._lightColor = lightColor; return this; } /** * * @param lockScreenVisibility * @returns {AndroidChannel} */ setLockScreenVisibility(lockScreenVisibility) { if (!Object.values(_types.Visibility).includes(lockScreenVisibility)) { throw new Error(`AndroidChannel:setLockScreenVisibility Invalid Visibility: ${lockScreenVisibility}`); } this._lockScreenVisibility = lockScreenVisibility; return this; } /** * * @param showBadge * @returns {AndroidChannel} */ setShowBadge(showBadge) { this._showBadge = showBadge; return this; } /** * * @param sound * @returns {AndroidChannel} */ setSound(sound) { this._sound = sound; return this; } /** * * @param vibrationPattern * @returns {AndroidChannel} */ setVibrationPattern(vibrationPattern) { this._vibrationPattern = vibrationPattern; return this; } build() { if (!this._channelId) { throw new Error('AndroidChannel: Missing required `channelId` property'); } else if (!this._importance) { throw new Error('AndroidChannel: Missing required `importance` property'); } else if (!this._name) { throw new Error('AndroidChannel: Missing required `name` property'); } return { bypassDnd: this._bypassDnd, channelId: this._channelId, description: this._description, 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 }; } } exports.default = AndroidChannel;