249 lines
13 KiB
TypeScript
249 lines
13 KiB
TypeScript
/* Metro module 15647; source: modules/parent_tools/RestrictedHoursManager.tsx; dependencies: [6, 7, 15, 17, 18, 10907, 1878, 5116, 1244, 2224, 1898, 10909, 694, 5188, 15642, 4860, 2] */
|
|
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import Dispatcher from '../../Dispatcher.tsx'; /* Metro dependency 694 */
|
|
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import AutomaticLifecycleManager from '../../lib/AutomaticLifecycleManager.tsx'; /* Metro dependency 4860 */
|
|
import FamilyCenterStore from './FamilyCenterStore.tsx'; /* Metro dependency 5116 */
|
|
import NotificationSettingsStore from '../../stores/NotificationSettingsStore.tsx'; /* Metro dependency 10907 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as FamilyCenterV3ExperimentModule from './FamilyCenterV3Experiment.tsx'; /* Metro dependency 5188 */
|
|
import * as RestrictedHoursActionCreatorsNativeModule from './RestrictedHoursActionCreators.native.tsx'; /* Metro dependency 15642 */
|
|
|
|
function _fun119810(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#119810, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15855:6, offset: 0x0251a42a, size: 381 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const closure = function() {
|
|
return FamilyCenterStore.isCurrentUserInRestrictedHours();
|
|
};
|
|
const handleScheduleUpdate = function() {
|
|
checkAndUpdateModal();
|
|
scheduleUpcomingWarning();
|
|
};
|
|
const handleScreenDowntimeReminderChanged = function() {
|
|
scheduleUpcomingWarning();
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = AutomaticLifecycleManager;
|
|
value = _fun119823(value);
|
|
value = new value();
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/parent_tools/RestrictedHoursManager.tsx');
|
|
exports.default = value;
|
|
exports.getCurrentRestrictedHoursState = closure;
|
|
function _isNativeReflectConstruct_119811() { // fn#119811, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15855:178, offset: 0x0251a5a7, size: 98 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_119811_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function dispatchWarningIfNeeded(a0) { // fn#119815, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15855:485, offset: 0x0251a61c, size: 331 bytes, params: 2, frame: 25
|
|
var value3;
|
|
var JS_DAY_TO_DAY_OF_WEEK;
|
|
var date;
|
|
var property;
|
|
var moduleValue;
|
|
let rule = a0.rule;
|
|
const ruleId = rule.ruleId;
|
|
let startAtMs = a0.startAtMs;
|
|
if ('' + ruleId + ':' + startAtMs !== env0_14) {
|
|
rule = a0.rule;
|
|
startAtMs = a0.startAtMs;
|
|
value3 = (require(1244) /* metro dependency 1244: indexNative */).intl.string((importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */)['0JlDg0']);
|
|
JS_DAY_TO_DAY_OF_WEEK = (require(1898) /* metro dependency 1898: FamilyCenterModels */).JS_DAY_TO_DAY_OF_WEEK;
|
|
date = new global.Date(startAtMs);
|
|
property = JS_DAY_TO_DAY_OF_WEEK[date.getDay()];
|
|
moduleValue = require(10909) /* metro dependency 10909: FamilyCenterRestrictedHoursUtils */;
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'RESTRICTED_HOURS_WARNING',
|
|
title: value3,
|
|
subtitle: ('' + moduleValue.formatDays([property]) + ' ' + (require(10909) /* metro dependency 10909: FamilyCenterRestrictedHoursUtils */).getScheduleRuleDateRange(rule)).trim()});
|
|
}
|
|
}
|
|
|
|
function scheduleUpcomingWarning() { // fn#119816, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15855:877, offset: 0x0251a767, size: 435 bytes, params: 1, frame: 21
|
|
var restrictedSchedule;
|
|
var r6;
|
|
var r5;
|
|
var currentUser;
|
|
var nextStartInfo;
|
|
var minutesUntil;
|
|
var value8;
|
|
var value10;
|
|
const value2 = null;
|
|
if (value2 != env0_13) {
|
|
global.clearTimeout(env0_13);
|
|
}
|
|
let Date = global.Date;
|
|
let date = new Date();
|
|
const value5 = undefined;
|
|
const getIsFamilyCenterV3Enabled = FamilyCenterV3ExperimentModule.getIsFamilyCenterV3Enabled;
|
|
let object = {location: 'RestrictedHoursManager'};
|
|
if (Reflect.apply(getIsFamilyCenterV3Enabled, FamilyCenterV3ExperimentModule, [object])) {
|
|
if (NotificationSettingsStore.screenDowntimeReminder) {
|
|
currentUser = UserStore.getCurrentUser();
|
|
restrictedSchedule = value2 == currentUser ? value5 : currentUser.restrictedSchedule;
|
|
if (value2 == restrictedSchedule) {
|
|
r5 = value2;
|
|
} else {
|
|
nextStartInfo = restrictedSchedule.getNextStartInfo(date);
|
|
if (value2 == nextStartInfo) {
|
|
r6 = value2;
|
|
} else {
|
|
object = {};
|
|
minutesUntil = nextStartInfo.minutesUntil;
|
|
object.minutesUntil = minutesUntil;
|
|
Date = global.Date;
|
|
value8 = Object.create(Date.prototype, {constructor: {value: Date}});
|
|
date = new Date(date);
|
|
value10 = (date instanceof Object ? date : value8).setSeconds(0, 0);
|
|
minutesUntil = nextStartInfo.minutesUntil;
|
|
object.startAtMs = value10 + 60 * minutesUntil * 1000;
|
|
object.rule = nextStartInfo.rule;
|
|
r6 = object;
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value2;
|
|
}
|
|
} else {
|
|
r5 = value2;
|
|
}
|
|
if (value2 != r5) {
|
|
if (r5.minutesUntil <= 16) {
|
|
dispatchWarningIfNeeded(r5);
|
|
env0_13 = global.setTimeout(function() {
|
|
env1_13 = null;
|
|
scheduleUpcomingWarning();
|
|
}, 60000);
|
|
} else {
|
|
env0_13 = global.setTimeout(_fun119818, global.Math.max(0, 60 * (r5.minutesUntil - 16) * 1000));
|
|
}
|
|
}
|
|
return value5;
|
|
function _fun119818() { // fn#119818, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15855:1559, offset: 0x0251a91a, size: 21 bytes, params: 1, frame: 9
|
|
scheduleUpcomingWarning();
|
|
}
|
|
|
|
}
|
|
|
|
function checkAndUpdateModal() { // fn#119819, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15855:1603, offset: 0x0251a92f, size: 135 bytes, params: 1, frame: 14
|
|
var defaultImport;
|
|
var binding;
|
|
var moduleValue;
|
|
const currentRestrictedHoursState = getCurrentRestrictedHoursState();
|
|
if (currentRestrictedHoursState !== currentRestrictedHoursState2) {
|
|
currentRestrictedHoursState2 = currentRestrictedHoursState;
|
|
defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
defaultImport.dispatch({type: 'RESTRICTED_HOURS_STATE_CHANGE',
|
|
isInRestrictedHours: currentRestrictedHoursState2});
|
|
binding = currentRestrictedHoursState2;
|
|
moduleValue = require(15642) /* metro dependency 15642: RestrictedHoursActionCreatorsNative */;
|
|
if (binding) {
|
|
moduleValue.openRestrictedHoursModal();
|
|
} else {
|
|
moduleValue.closeRestrictedHoursModal();
|
|
}
|
|
scheduleUpcomingWarning();
|
|
}
|
|
}
|
|
|
|
function handleLogout_119820() { // fn#119820, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15855:1867, offset: 0x0251a9b6, size: 92 bytes, params: 1, frame: 14
|
|
(Dispatcher).dispatch({'type': 'RESTRICTED_HOURS_STATE_CHANGE',
|
|
'isInRestrictedHours': false});
|
|
if (env0_13 != null) {
|
|
global.clearTimeout(env0_13);
|
|
}
|
|
}
|
|
|
|
function _fun119823(a0) { // fn#119823, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15855:2181, offset: 0x0251aa29, size: 97 bytes, params: 2, frame: 16
|
|
const RestrictedHoursManager2 = RestrictedHoursManager;
|
|
Inherits(RestrictedHoursManager2, a0);
|
|
return CreateClass(RestrictedHoursManager2, [{key: '_initialize', value: value_119825}, {key: '_terminate',
|
|
value: value_119826}]);
|
|
function RestrictedHoursManager(a0) { // fn#119824, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15855:2193, offset: 0x0251aa8a, size: 230 bytes, params: 2, frame: 20
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_3;
|
|
binding(this, RestrictedHoursManager);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_6(RestrictedHoursManager);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_119811()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
const Map = global.Map;
|
|
const map = new Map();
|
|
const set = map.set;
|
|
const userStoreBinding = UserStore;
|
|
const handleScheduleUpdateBinding = handleScheduleUpdate;
|
|
const value6 = Reflect.apply(set, map, [userStoreBinding, handleScheduleUpdateBinding]);
|
|
value.stores = value6.set(FamilyCenterStore, handleScheduleUpdateBinding);
|
|
value.actions = {POST_CONNECTION_OPEN: handleScheduleUpdateBinding,
|
|
CURRENT_USER_UPDATE: handleScheduleUpdateBinding,
|
|
NOTIFICATIONS_SET_SCREEN_DOWNTIME_REMINDER: handleScreenDowntimeReminderChanged, LOGOUT: handleLogout_119820};
|
|
return value;
|
|
}
|
|
|
|
function value_119825() { // fn#119825, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15855:2802, offset: 0x0251ab70, size: 143 bytes, params: 1, frame: 15
|
|
currentRestrictedHoursState = getCurrentRestrictedHoursState();
|
|
const defaultImport = Dispatcher;
|
|
defaultImport.dispatch({type: 'RESTRICTED_HOURS_STATE_CHANGE', isInRestrictedHours: currentRestrictedHoursState});
|
|
if (currentRestrictedHoursState) {
|
|
(require(15642) /* metro dependency 15642: RestrictedHoursActionCreatorsNative */).openRestrictedHoursModal();
|
|
}
|
|
env1_12 = global.setInterval(checkAndUpdateModal, 60000);
|
|
scheduleUpcomingWarning();
|
|
}
|
|
|
|
function value_119826() { // fn#119826, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15855:3058, offset: 0x0251abff, size: 111 bytes, params: 1, frame: 13
|
|
if (env1_12 != null) {
|
|
global.clearInterval(env1_12);
|
|
}
|
|
if (env1_13 != null) {
|
|
global.clearTimeout(env1_13);
|
|
}
|
|
(RestrictedHoursActionCreatorsNativeModule).closeRestrictedHoursModal();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun119810, 15647, [6, 7, 15, 17, 18, 10907, 1878, 5116, 1244, 2224, 1898, 10909, 694, 5188, 15642, 4860,
|
|
2]) /* metro module 15647, dependencies: [6, 7, 15, 17, 18, 10907, 1878, 5116, 1244, 2224, 1898, 10909, 694, 5188, 15642, 4860, 2] */;
|