161 lines
8.4 KiB
TypeScript
161 lines
8.4 KiB
TypeScript
/* Metro module 11663; source: modules/applications/ApplicationFrecencyHooks.tsx; dependencies: [31, 7862, 670, 1362, 566, 21, 5065, 2] */
|
|
function _fun89409(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#89409, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:6, offset: 0x0200cba2, size: 159 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
const applicationFrecencyStore = importDefault(7862) /* metro dependency 7862: ApplicationFrecencyStore */;
|
|
const env0_5 = (require(670) /* metro dependency 670: UserSettingsConstants */).UserSettingsTypes;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/applications/ApplicationFrecencyHooks.tsx');
|
|
exports.useSortApplicationsViaFrecency = useSortApplicationsViaFrecency;
|
|
}
|
|
|
|
function useSortApplicationsViaFrecency(a0, a1) { // fn#89410, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:262, offset: 0x0200cc41, size: 247 bytes, params: 3, frame: 18
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const binding = env0_3;
|
|
binding.useEffect(function() {
|
|
var FrecencyUserSettingsActionCreators = require(dependencyMap[3]).FrecencyUserSettingsActionCreators;
|
|
FrecencyUserSettingsActionCreators.loadIfUncached(UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS);
|
|
}, []);
|
|
const applicationFrecencyWithoutLoadingLatest = (require(566) /* metro dependency 566: flux */).useStateFromStores([ApplicationFrecencyStore],
|
|
function() {
|
|
return ApplicationFrecencyStore.getApplicationFrecencyWithoutLoadingLatest();
|
|
});
|
|
const value = binding.useMemo(_fun89413, [a0, a1]);
|
|
return binding.useMemo(_fun89423, [binding.useMemo(_fun89419, [value, applicationFrecencyWithoutLoadingLatest,
|
|
binding.useMemo(_fun89416, [a0, a1])]), value, applicationFrecencyWithoutLoadingLatest, a1]);
|
|
}
|
|
|
|
function _fun89413() { // fn#89413, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:528, offset: 0x0200cd81, size: 59 bytes, params: 1, frame: 12
|
|
return require == null || require.length === 0 ? env0_0 : env0_0.map(_fun89414);
|
|
}
|
|
|
|
function _fun89416() { // fn#89416, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:685, offset: 0x0200ce2f, size: 43 bytes, params: 1, frame: 12
|
|
return require?.filter(_fun89417);
|
|
}
|
|
|
|
function _fun89419() { // fn#89419, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:778, offset: 0x0200cea0, size: 161 bytes, params: 1, frame: 17
|
|
var r6;
|
|
var r5;
|
|
var binding;
|
|
if (env0_4 != null) {
|
|
env0_4.forEach(_fun89420);
|
|
}
|
|
applicationFrecencyWithoutLoadingLatest.compute();
|
|
if (env0_4 == null) {
|
|
r5 = undefined;
|
|
} else {
|
|
binding = env0_4;
|
|
r5 = binding.map(_fun89421);
|
|
r6 = binding;
|
|
}
|
|
r5 = r5 ?? [];
|
|
binding = env0_3;
|
|
const items3 = [];
|
|
arraySpread(items3, binding, 0, r6);
|
|
const push = items3.push;
|
|
const items2 = [];
|
|
arraySpread(items2, r5, 0, r6);
|
|
apply(push, items2, items3, r6);
|
|
items3.sort(_fun89422);
|
|
return items3;
|
|
}
|
|
|
|
function _fun89423() { // fn#89423, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:1243, offset: 0x0200d04e, size: 167 bytes, params: 1, frame: 17
|
|
if (require != null) {
|
|
require.forEach(_fun89424);
|
|
}
|
|
let binding = env0_3;
|
|
binding.forEach(_fun89425);
|
|
binding = env0_0;
|
|
const env0_2 = (binding == null || binding.application == null ? undefined : binding.application.id) ?? '';
|
|
binding = env0_5;
|
|
let value = binding.filter(_fun89426);
|
|
const items2 = [];
|
|
value = arraySpread(items2, value, 0, undefined);
|
|
arraySpread(items2, binding.filter(_fun89427), value, undefined);
|
|
return items2;
|
|
}
|
|
|
|
function _fun89414(a0) { // fn#89414, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:563, offset: 0x0200cdbc, size: 84 bytes, params: 2, frame: 15
|
|
var environment;
|
|
const env0_0 = a0;
|
|
const object2 = {};
|
|
copyDataProperties(object2, a0, undefined);
|
|
const value = environment.__proto__;
|
|
const r1 = require?.some(_fun89415);
|
|
object2['isUserApp'] = r1 != null && r1;
|
|
return object2;
|
|
}
|
|
|
|
function _fun89417(a0) { // fn#89417, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:714, offset: 0x0200ce5a, size: 39 bytes, params: 2, frame: 11
|
|
const env0_0 = a0;
|
|
const binding = env1_0;
|
|
return !binding.some(_fun89418);
|
|
}
|
|
|
|
function _fun89420(a0) { // fn#89420, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:809, offset: 0x0200cf41, size: 112 bytes, params: 2, frame: 16
|
|
let value = environment.__proto__.__proto__;
|
|
value = Reflect.apply((importDefault(21) /* metro dependency 21: SnowflakeUtils */).extractTimestamp, value,
|
|
[a0.id]);
|
|
const getEntry = applicationFrecencyWithoutLoadingLatest.getEntry;
|
|
if (Reflect.apply(getEntry, applicationFrecencyWithoutLoadingLatestBinding, [a0.application.id]) == null) {
|
|
applicationFrecencyWithoutLoadingLatestBinding = applicationFrecencyWithoutLoadingLatest;
|
|
applicationFrecencyWithoutLoadingLatestBinding.track(a0.application.id, {timestamp: value});
|
|
}
|
|
}
|
|
|
|
function _fun89421({application}) { // fn#89421, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:978, offset: 0x0200cfb1, size: 49 bytes, params: 2, frame: 13
|
|
const value = environment.__proto__.__proto__;
|
|
return (require(5065) /* metro dependency 5065: ApplicationCommandUtils */).getApplicationCommandSection(application,
|
|
true);
|
|
}
|
|
|
|
function _fun89422(a0, a1) { // fn#89422, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:1081, offset: 0x0200cfe2, size: 108 bytes, params: 3, frame: 16
|
|
let value = environment.__proto__;
|
|
const score = applicationFrecencyWithoutLoadingLatest.getScore(a1.id);
|
|
const value3 = 0;
|
|
const r4 = score ?? value3;
|
|
value = applicationFrecencyWithoutLoadingLatest.getScore(a0.id);
|
|
value = r4 - (value ?? value3);
|
|
return value3 !== value ? value : a0.name.localeCompare(a1.name);
|
|
}
|
|
|
|
function _fun89424(a0) { // fn#89424, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:1280, offset: 0x0200d0f5, size: 81 bytes, params: 2, frame: 14
|
|
let value = environment.__proto__.__proto__;
|
|
value = Reflect.apply((importDefault(21) /* metro dependency 21: SnowflakeUtils */).extractTimestamp, value,
|
|
[a0.id]);
|
|
if (env0_1 == null || value > env0_1) {
|
|
env0_0 = a0;
|
|
}
|
|
}
|
|
|
|
function _fun89425(a0) { // fn#89425, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:1361, offset: 0x0200d146, size: 130 bytes, params: 2, frame: 18
|
|
const Math = global.Math;
|
|
const max = Math.max;
|
|
let value = environment.__proto__;
|
|
value = applicationFrecencyWithoutLoadingLatest.getEntry(a0.id);
|
|
const value2 = undefined;
|
|
const r7 = (value == null ? value2 : value.recentUses) ?? [];
|
|
const items2 = [];
|
|
arraySpread(items2, r7, 0, r7);
|
|
if (env0_1 == null || apply(max, items2, Math, r7) > env0_1) {
|
|
env0_0 = a0;
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function _fun89427({id}) { // fn#89427, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:1596, offset: 0x0200d1c8, size: 21 bytes, params: 2, frame: 2
|
|
return id !== env0_2;
|
|
}
|
|
|
|
function _fun89415({application}) { // fn#89415, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:627, offset: 0x0200ce10, size: 31 bytes, params: 2, frame: 2
|
|
return application.id === env0_0.id;
|
|
}
|
|
|
|
function _fun89418({id}) { // fn#89418, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11849:726, offset: 0x0200ce81, size: 31 bytes, params: 2, frame: 2
|
|
return id === env0_0.application.id;
|
|
}
|
|
|