92 lines
5.2 KiB
TypeScript
92 lines
5.2 KiB
TypeScript
/* Metro module 10939; source: modules/notifications/NotificationUtils.tsx; dependencies: [4864, 661, 670, 1244, 21, 1391, 3787, 566, 2] */
|
|
function _fun83871(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#83871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11125:6, offset: 0x01f2c3f1, size: 238 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */;
|
|
const env0_5 = (require(661) /* metro dependency 661: Constants */).UserNotificationSettings;
|
|
const userSettingsConstantsModule = require(670) /* metro dependency 670: UserSettingsConstants */;
|
|
const env0_6 = userSettingsConstantsModule.MuteUntilSeconds;
|
|
const env0_7 = userSettingsConstantsModule.ChannelNotificationSettingsFlags;
|
|
const env0_8 = {'ignoreMute': false, 'ignoreUnreadSetting': true, 'ignoreNotificationSetting': false};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/notifications/NotificationUtils.tsx');
|
|
exports.getMuteTimeOptions = getMuteTimeOptions;
|
|
exports.filterOverrides = filterOverrides;
|
|
exports.useShouldUseNewNotificationSystem = function() {
|
|
return require(dependencyMap[7]).useStateFromStores([UserGuildSettingsStore], _fun83876);
|
|
};
|
|
exports.shouldShowUseNewNotificationSystem = function() {
|
|
return UserGuildSettingsStore.useNewNotifications;
|
|
};
|
|
}
|
|
|
|
function getMuteTimeOptions() { // fn#83872, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11125:381, offset: 0x01f2c4df, size: 468 bytes, params: 1, frame: 18
|
|
var object2;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
let string = intl.string;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
const MINUTES_15 = MuteUntilSeconds.MINUTES_15;
|
|
const items2 = [{id: '15-minutes', label: Reflect.apply(string, intl, [t['8ot6gv']]), value: MINUTES_15}];
|
|
string = intl.string;
|
|
const UMWBZr = t.UMWBZr;
|
|
const HOURS_1 = MuteUntilSeconds.HOURS_1;
|
|
items2[1] = {id: '1-hour', label: Reflect.apply(string, intl, [UMWBZr]), value: HOURS_1};
|
|
string = intl.string;
|
|
const QmYWtu = t.QmYWtu;
|
|
const HOURS_3 = MuteUntilSeconds.HOURS_3;
|
|
items2[2] = {id: '3-hours', label: Reflect.apply(string, intl, [QmYWtu]), value: HOURS_3};
|
|
string = intl.string;
|
|
const EpAXPC = t.EpAXPC;
|
|
const HOURS_8 = MuteUntilSeconds.HOURS_8;
|
|
items2[3] = {id: '8-hours', label: Reflect.apply(string, intl, [EpAXPC]), value: HOURS_8};
|
|
object2 = {id: '24-hours'};
|
|
object2.label = intl.string(t['755t4q']);
|
|
const HOURS_24 = MuteUntilSeconds.HOURS_24;
|
|
object2.value = HOURS_24;
|
|
items2[4] = object2;
|
|
const ALWAYS = MuteUntilSeconds.ALWAYS;
|
|
items2[5] = {id: 'forever', label: intl.string(t.r3LawO), value: ALWAYS};
|
|
return items2;
|
|
}
|
|
|
|
function filterOverrides(a0) { // fn#83873, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11125:900, offset: 0x01f2c6b3, size: 81 bytes, params: 2, frame: 14
|
|
let value = a1;
|
|
const env0_0 = a0;
|
|
const env0_1 = value !== undefined ? value : env0_8;
|
|
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
|
|
value = value.keys(a0);
|
|
return value.filter(_fun83874);
|
|
}
|
|
|
|
function useShouldUseNewNotificationSystem() { // fn#83875, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11125:1297, offset: 0x01f2c81a, size: 59 bytes, params: 1, frame: 13
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStores([UserGuildSettingsStore], function() {
|
|
return UserGuildSettingsStore.useNewNotifications;
|
|
});
|
|
}
|
|
|
|
function _fun83874(a0) { // fn#83874, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11125:963, offset: 0x01f2c704, size: 278 bytes, params: 2, frame: 22
|
|
var moduleValue2;
|
|
const binding = env0_0;
|
|
const message_notifications = binding[a0].message_notifications;
|
|
const NULL = UserNotificationSettings.NULL;
|
|
const value3 = message_notifications !== NULL;
|
|
const flagUtilsModule = importAll(1391) /* metro dependency 1391: FlagUtils */;
|
|
const hasFlag = flagUtilsModule.hasFlag;
|
|
const flags = binding[a0].flags;
|
|
const value4 = 0;
|
|
let r1 = flags ?? value4;
|
|
const UNREADS_ALL_MESSAGES = ChannelNotificationSettingsFlags.UNREADS_ALL_MESSAGES;
|
|
const hasFlag2 = Reflect.apply(hasFlag, flagUtilsModule, [r1, UNREADS_ALL_MESSAGES]);
|
|
if (hasFlag2) {
|
|
r1 = hasFlag2;
|
|
} else {
|
|
moduleValue2 = flagUtilsModule;
|
|
r1 = moduleValue2.hasFlag(env0_0[a0].flags ?? value4, ChannelNotificationSettingsFlags.UNREADS_ONLY_MENTIONS);
|
|
}
|
|
let r0 = !env0_1.ignoreUnreadSetting && r1;
|
|
r0 = !r0 ? !env0_1.ignoreNotificationSetting && value3 : r0;
|
|
r0 = !r0 ? !env0_1.ignoreMute && (require(3787) /* metro dependency 3787: MuteTimers */).computeIsMuted(env0_0[a0]) : r0;
|
|
return r0;
|
|
}
|
|
|