/* Metro module 10916; source: modules/notifications/FocusModeUtils.tsx; dependencies: [6876, 3796, 661, 3829, 1362, 1345, 683, 4647, 1244, 10917, 2] */ import AnalyticsUtils from '../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */ import SelfPresenceStore from '../../stores/SelfPresenceStore.tsx'; /* Metro dependency 6876 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as WrappersModule from '../../external/discord_common/js/packages/protos/google/protobuf/wrappers.tsx'; /* Metro dependency 1345 */ import * as UserSettingsProtoActionCreatorsModule from '../user_settings/UserSettingsProtoActionCreators.tsx'; /* Metro dependency 1362 */ import * as NotificationConstantsModule from './NotificationConstants.tsx'; /* Metro dependency 3796 */ import * as UserSettingsModule from '../user_settings/UserSettings.tsx'; /* Metro dependency 3829 */ function _fun83654(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#83654, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11102:6, offset: 0x01f227e8, size: 198 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/notifications/FocusModeUtils.tsx'); exports.useFocusModeEnabled = useFocusModeEnabled; exports.getFocusModeEnabled = getFocusModeEnabled; exports.setFocusMode = setFocusMode; function useFocusModeEnabled() { // fn#83655, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11102:289, offset: 0x01f228ae, size: 182 bytes, params: 1, frame: 15 var r1; var r0; var Date; var prototype; var value3; var date; var value4; var value5; const FocusMode = (UserSettingsModule).FocusMode; let value = FocusMode.useSetting(); const FocusModeExpiresAtSetting = (UserSettingsModule).FocusModeExpiresAtSetting; const value2 = FocusModeExpiresAtSetting.useSetting(); if (value) { value = value2 === '0'; if (value) { r1 = value; } else { Date = global.Date; value = global.Number(value2); prototype = Date.prototype; value3 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); value = date instanceof Object ? date : value3; value = value.getTime(); Date = global.Date; prototype = Date.prototype; value4 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); value5 = date instanceof Object ? date : value4; value -= value5.getTime(); value = value > 0; r1 = value; } r0 = r1; } else { r0 = value; } return r0; } function getFocusModeEnabled() { // fn#83656, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11102:503, offset: 0x01f22964, size: 175 bytes, params: 1, frame: 14 var Date; var prototype; var value3; var date; var value4; var value5; const FocusMode = (UserSettingsModule).FocusMode; let value = FocusMode.getSetting(); const FocusModeExpiresAtSetting = (UserSettingsModule).FocusModeExpiresAtSetting; const setting = FocusModeExpiresAtSetting.getSetting(); let r0 = value && setting != null; if (r0) { Date = global.Date; value = global.Number(setting); prototype = Date.prototype; value3 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); value = date instanceof Object ? date : value3; value = value.getTime(); Date = global.Date; prototype = Date.prototype; value4 = Object.create(prototype, {constructor: {value: Date}}); date = new Date(); value5 = date instanceof Object ? date : value4; value -= value5.getTime(); value = value > 0; r0 = value; } return r0; } function setFocusMode(a0, a1) { // fn#83657, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11102:708, offset: 0x01f22a13, size: 485 bytes, params: 3, frame: 22 var show; const intl = (IndexNativeModule).intl; const t = (IndexNativeModule).t; let value = a0; const env0_1 = a1; const FocusMode = (UserSettingsModule).FocusMode; const setting = FocusMode.getSetting(); const PreloadedUserSettingsActionCreators = (UserSettingsProtoActionCreatorsModule).PreloadedUserSettingsActionCreators; const updateAsync = PreloadedUserSettingsActionCreators.updateAsync; const UserSettingsDelay = (UserSettingsProtoActionCreatorsModule).UserSettingsDelay; const INFREQUENT_USER_ACTION = UserSettingsDelay.INFREQUENT_USER_ACTION; Reflect.apply(updateAsync, PreloadedUserSettingsActionCreators, ['notifications', _fun83658, INFREQUENT_USER_ACTION]); const defaultImport = AnalyticsUtils; const track = defaultImport.track; const NOTIFICATION_SETTINGS_UPDATED = AnalyticEvents.NOTIFICATION_SETTINGS_UPDATED; let object = {}; const ACCOUNT = NotificationSettingsUpdateType.ACCOUNT; object.update_type = ACCOUNT; object.quiet_mode_enabled = value; object.quiet_mode_enabled_old = setting; Reflect.apply(track, defaultImport, [NOTIFICATION_SETTINGS_UPDATED, object]); const status = SelfPresenceStore.getStatus(); const DND = StatusTypes.DND; if (status === DND && value && a1 == null) { value = importDefault(4647) /* metro dependency 4647: AlertActionCreators */; show = value.show; object = {}; object.title = intl.string(t['B+cbLS']); object.body = intl.string(t.CYVgLI); object.cancelText = intl.string(t.f3Pet9); object.confirmText = intl.string(t.BddRzS); object.onConfirm = function() { importDefault(dependencyMap[9])({nextStatus: StatusTypes.ONLINE}); }; Reflect.apply(show, value, [object]); } function _fun83658(a0) { // fn#83658, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11102:845, offset: 0x01f22bf8, size: 144 bytes, params: 2, frame: 16 var r1; let value = environment.__proto__; const BoolValue = (WrappersModule).BoolValue; const create = BoolValue.create; const binding = env0_0; a0.quietMode = Reflect.apply(create, BoolValue, [{value: binding}]); const value2 = '0'; if (binding) { if (require != null) { value = global.Date.now() + require; value = '' + value; r1 = value; } else { r1 = value2; } } else { r1 = value2; } a0.focusModeExpiresAtMs = r1; } } } global.__d(_fun83654, 10916, [6876, 3796, 661, 3829, 1362, 1345, 683, 4647, 1244, 10917, 2]) /* metro module 10916, dependencies: [6876, 3796, 661, 3829, 1362, 1345, 683, 4647, 1244, 10917, 2] */;