Files
discord-decomp/sources/modules/push_notifications/native/PushNotificationCacheManager.tsx
T
2026-07-27 16:20:00 +03:00

140 lines
7.3 KiB
TypeScript

/* Metro module 15814; source: modules/push_notifications/native/PushNotificationCacheManager.tsx; dependencies: [7, 6, 15, 17, 18, 11876, 1878, 3995, 10741, 4860, 2] */
function _fun121530(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#121530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16022:6, offset: 0x0254a3e7, size: 258 bytes, params: 8, frame: 18
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(7) /* metro dependency 7 */;
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(15) /* metro dependency 15 */;
const env0_5 = importDefault(17) /* metro dependency 17 */;
const env0_6 = importDefault(18) /* metro dependency 18 */;
const multiAccountStore = importDefault(11876) /* metro dependency 11876: MultiAccountStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
let value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
value = _fun121534(value);
value = new value();
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/push_notifications/native/PushNotificationCacheManager.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_121531() { // fn#121531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16022:168, offset: 0x0254a4e9, 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_121531_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun121534(a0) { // fn#121534, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16022:371, offset: 0x0254a54b, size: 42 bytes, params: 2, frame: 14
const closure = PushNotificationCacheManager;
env0_6(closure, a0);
return env0_2(closure);
}
function PushNotificationCacheManager(a0) { // fn#121535, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16022:383, offset: 0x0254a575, size: 283 bytes, params: 2, frame: 21
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, PushNotificationCacheManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_5(PushNotificationCacheManager);
binding = env1_4;
if (_isNativeReflectConstruct_121531()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_5(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
value.actions = {POST_CONNECTION_OPEN: POST_CONNECTION_OPEN_121536, CURRENT_USER_UPDATE: CURRENT_USER_UPDATE_121537,
LOGOUT: LOGOUT_121538};
const Map = global.Map;
const items3 = [[MultiAccountStore, _fun121539]];
const value4 = Object.create(Map.prototype, {constructor: {value: Map}});
const map = new Map(items3);
value.stores = map instanceof Object ? map : value4;
value.handleUserUpdate = handleUserUpdate_121540;
value.syncMultiAccountUsers = syncMultiAccountUsers;
value.handleLogout = handleLogout_121544;
return value;
}
function PushNotificationCacheManagerPOST_CONNECTION_OPEN() { // fn#121536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16022:685, owner: PushNotificationCacheManager.POST_CONNECTION_OPEN, offset: 0x0254a690, size: 19 bytes, params: 1, frame: 9
return env0_0.handleUserUpdate();
}
function _fun121539() { // fn#121539, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16022:805, offset: 0x0254a6a3, size: 19 bytes, params: 1, frame: 9
return env0_0.syncMultiAccountUsers();
}
function PushNotificationCacheManagerHandleUserUpdate() { // fn#121540, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16022:857, owner: PushNotificationCacheManager.handleUserUpdate, offset: 0x0254a6b6, size: 107 bytes, params: 1, frame: 15
let value = environment.__proto__.__proto__;
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
value = importDefault(10741) /* metro dependency 10741: PushNotification */;
value.setCurrentUser(currentUser.username, currentUser.id);
} else {
(importDefault(10741) /* metro dependency 10741: PushNotification */).setCurrentUser(null, null);
}
}
function syncMultiAccountUsers() { // fn#121541, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16022:994, owner: PushNotificationCacheManager.syncMultiAccountUsers, offset: 0x0254a721, size: 51 bytes, params: 1, frame: 12
var environment;
const value = environment.__proto__.__proto__;
(importDefault(10741) /* metro dependency 10741: PushNotification */).setMultiAccountUsers(buildMultiAccountUsers());
}
function PushNotificationCacheManagerHandleLogout() { // fn#121544, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16022:1266, owner: PushNotificationCacheManager.handleLogout, offset: 0x0254a7e6, size: 54 bytes, params: 1, frame: 11
const value = environment.__proto__.__proto__;
(importDefault(10741) /* metro dependency 10741: PushNotification */).clearPushNotificationLogs();
env0_0.handleUserUpdate();
}
function buildMultiAccountUsers() { // fn#121542, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16022:1028, owner: PushNotificationCacheManager.syncMultiAccountUsers.buildMultiAccountUsers, offset: 0x0254a754, size: 77 bytes, params: 1, frame: 12
var environment;
let value = environment.__proto__.__proto__.__proto__;
if (MultiAccountStore.canUseMultiAccountNotifications) {
value = MultiAccountStore.getValidUsers();
if (value.length < 2) {
return {};
}
value.forEach(_fun121543);
}
return {};
}
function _fun121543(a0) { // fn#121543, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16022:1183, offset: 0x0254a7a1, size: 69 bytes, params: 2, frame: 17
const binding = env0_0;
const id = a0.id;
let value = environment.__proto__.__proto__.__proto__.__proto__;
value = importDefault(3995) /* metro dependency 3995: UserUtils */;
const getUserTag = value.getUserTag;
binding[id] = Reflect.apply(getUserTag, value, [a0, {identifiable: 'always'}]);
}