decord/alpha/source/modules/notifications/native/NotifSettingsUtils.android.tsx

217 lines
6.8 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 14626
// Function ID: 14627
// Name: NotifSettingsUtils
2026-10-09 10:00:15 +00:00
// Dependencies: [14622, 1126, 14627, 14628, 1255, 2]
2026-07-20 16:05:17 +00:00
2026-10-09 10:00:15 +00:00
// Module 14626 (NotifSettingsUtils)
2026-10-03 08:58:59 +00:00
import intl2 from "intl" /* 1126 */;
2026-10-09 10:00:15 +00:00
import react_nativeDefault from "react-native" /* 14627 */;
import NotificationSettingsConstants from "NotificationSettingsConstants" /* 14622 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let map, map1, notifType;
let c3;
let closure_4;
let hasOwnProperty;
let tmp;
2026-10-09 10:00:15 +00:00
const SentryUtilsDefault = tmp(1255);
2026-07-29 08:29:29 +00:00
function inferImportanceFromBehavior(visibility) {
if (!("ringtone" in visibility)) {
2026-10-03 08:58:59 +00:00
let HIGH;
2026-07-29 08:29:29 +00:00
if ("popup" !== visibility.visibility) {
if ("hidden" === visibility.visibility) {
2026-10-03 08:58:59 +00:00
HIGH = constants.MIN;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
HIGH = visibility.sound ? tmp2.DEFAULT : tmp2.LOW;
2026-07-20 16:05:17 +00:00
}
}
return HIGH;
}
HIGH = constants.HIGH;
}
function formatCategory(id) {
2026-10-03 08:58:59 +00:00
let intl;
const obj = { id: id.string_id, name: intl.string(id.title) };
intl = intl2.intl;
2026-07-20 16:05:17 +00:00
return obj;
}
2026-10-03 08:58:59 +00:00
function formatSetting(item10022, arg1) {
let intl;
let ringtone;
let tmp = arg1;
const obj = { id: item10022.string_id, groupId: item10022.category, name: intl.string(item10022.title), importance: tmp, ringtone, badge: item10022.behavior.badge, vibrate: item10022.behavior.vibrate };
intl = intl2.intl;
if (arg1 == null) {
2026-07-29 08:29:29 +00:00
const behavior = item10022.behavior;
if (!("ringtone" in behavior)) {
2026-10-03 08:58:59 +00:00
let HIGH;
2026-07-29 08:29:29 +00:00
if ("popup" !== behavior.visibility) {
if ("hidden" === behavior.visibility) {
2026-10-03 08:58:59 +00:00
HIGH = constants.MIN;
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
HIGH = behavior.sound ? tmp2.DEFAULT : tmp2.LOW;
2026-07-29 08:29:29 +00:00
}
}
2026-10-03 08:58:59 +00:00
tmp = HIGH;
2026-07-29 08:29:29 +00:00
}
HIGH = constants.HIGH;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
ringtone = undefined;
if ("ringtone" in item10022.behavior) {
ringtone = item10022.behavior.ringtone;
}
return obj;
2026-07-20 16:05:17 +00:00
}
function buildChannelsAndMapping() {
2026-10-03 08:58:59 +00:00
let mappings;
let settings;
function computeInheritedImportances(mappings) {
2026-08-24 06:08:38 +00:00
map = new Map();
2026-10-03 08:58:59 +00:00
const tmp = react_nativeDefault;
2026-07-29 08:29:29 +00:00
let prop;
if (tmp != null) {
prop = tmp.getAndroidNotifChannelStates;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (null == prop) {
return map;
} else {
const _Map2 = Map;
2026-10-03 08:58:59 +00:00
const self3 = this;
const self4 = this;
2026-08-24 06:08:38 +00:00
map1 = new Map();
2026-07-29 08:29:29 +00:00
const propResult = prop();
for (const item10020 of propResult) {
let result = map1.set(item10020.channelId, item10020.importance);
continue;
}
const _Map = Map;
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
2026-07-29 08:29:29 +00:00
const map2 = new Map();
for (const item10036 of closure_1_5) {
2026-07-29 08:29:29 +00:00
let result1 = map2.set(item10036.id, item10036);
continue;
}
const iter = mappings[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let notifSetting = nextResult.notifSetting;
2026-10-03 08:58:59 +00:00
let tmp15 = closure_1_4[nextResult.notifType];
if (null != tmp15) {
for (const item10055 of tmp15) {
2026-07-29 08:29:29 +00:00
if (item10055 !== notifSetting) {
2026-10-03 08:58:59 +00:00
let value = map2.get(tmp18);
let tmp22 = value;
2026-07-29 08:29:29 +00:00
if (null != value) {
2026-10-03 08:58:59 +00:00
let value2 = map1.get(tmp22.string_id);
let tmp25 = value2;
if (null != value2) {
2026-10-03 08:58:59 +00:00
if (tmp25 !== inferImportanceFromBehavior(tmp22.behavior)) {
let result2 = map.set(notifSetting, tmp25);
2026-07-29 08:29:29 +00:00
obj4.return();
break;
2026-07-20 16:05:17 +00:00
}
}
}
}
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
continue;
}
return map;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
}
2026-10-09 10:00:15 +00:00
const obj = map(14628);
2026-10-03 08:58:59 +00:00
const assignedNotifSettingsAndMappings = obj.getAssignedNotifSettingsAndMappings();
({ settings, mappings } = assignedNotifSettingsAndMappings);
const obj2 = computeInheritedImportances(mappings);
2026-07-23 10:11:24 +00:00
let items = [];
2026-07-29 08:29:29 +00:00
map = new Map();
for (const item10022 of settings) {
let arr = items.push(formatSetting(item10022, obj2.get(item10022.id)));
let result = map.set(item10022.id, item10022.string_id);
continue;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const obj3 = {
mapping: mappings.flatMap((notifType) => {
let items;
notifType = notifType.notifType;
const value = map.get(notifType.notifSetting);
2026-07-20 16:05:17 +00:00
if (null == value) {
2026-10-03 08:58:59 +00:00
items = [];
2026-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +00:00
items = { type: notifType, channel: value };
2026-07-20 16:05:17 +00:00
}
return items;
}),
channels: items,
2026-07-29 08:29:29 +00:00
inheritedImportances: obj2
2026-07-20 16:05:17 +00:00
};
2026-10-03 08:58:59 +00:00
return obj3;
2026-07-20 16:05:17 +00:00
}
({ NOTIF_CATEGORIES: c3, NOTIF_SETTING_MAPPING: closure_4, NOTIF_SETTINGS: hasOwnProperty } = NotificationSettingsConstants);
const constants = { NONE: 0, [0]: "NONE", MIN: 1, [1]: "MIN", LOW: 2, [2]: "LOW", DEFAULT: 3, [3]: "DEFAULT", HIGH: 4, [4]: "HIGH" };
2026-10-03 08:58:59 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
clear() {
2026-10-03 08:58:59 +00:00
let registerAndroidNotifGroupsAndChannels;
let registerAndroidNotifTypeMappings;
let obj = react_nativeDefault;
2026-07-29 08:29:29 +00:00
if (obj == null) {
2026-07-20 16:05:17 +00:00
obj = {};
}
({ registerAndroidNotifGroupsAndChannels, registerAndroidNotifTypeMappings } = obj);
if (null != registerAndroidNotifGroupsAndChannels) {
const result = registerAndroidNotifGroupsAndChannels([], []);
}
if (null != registerAndroidNotifTypeMappings) {
const result1 = registerAndroidNotifTypeMappings([]);
}
},
registerDeclarativeNotificationCategories() {
2026-10-03 08:58:59 +00:00
let arr;
let channels;
let inheritedImportances;
let mapping;
let obj3;
let registerAndroidNotifGroupsAndChannels;
let registerAndroidNotifTypeMappings;
const tmp = importDefault;
const tmp2 = dependencyMap;
let obj = react_nativeDefault;
2026-07-29 08:29:29 +00:00
if (obj == null) {
2026-07-20 16:05:17 +00:00
obj = {};
}
({ registerAndroidNotifGroupsAndChannels, registerAndroidNotifTypeMappings } = obj);
if (null != registerAndroidNotifGroupsAndChannels) {
if (null != registerAndroidNotifTypeMappings) {
2026-07-29 08:29:29 +00:00
({ channels, inheritedImportances, mapping } = buildChannelsAndMapping());
2026-10-03 08:58:59 +00:00
buildChannelsAndMapping();
const obj2 = { message: "Registering declarative notification categories", data: obj3 };
obj3 = {
channels: channels.map((id) => id.id),
inheritedImportances: arr.map((item) => {
let tmp;
let tmp2;
[tmp, tmp2] = item;
return "NotifSettings#" + tmp + " -> " + tmp2;
})
};
const addBreadcrumb = SentryUtilsDefault.addBreadcrumb;
SentryUtilsDefault;
2026-07-20 16:05:17 +00:00
const _Array = Array;
2026-10-03 08:58:59 +00:00
arr = Array.from(inheritedImportances.entries());
addBreadcrumb(obj2);
const result = registerAndroidNotifGroupsAndChannels(_false.map(formatCategory), channels);
2026-07-29 08:29:29 +00:00
const result1 = registerAndroidNotifTypeMappings(mapping);
2026-07-20 16:05:17 +00:00
return true;
}
}
return false;
}
};
2026-10-03 08:58:59 +00:00
let result = size.fileFinishedImporting("modules/notifications/native/NotifSettingsUtils.android.tsx");
export default obj;