176 lines
8.4 KiB
TypeScript
176 lines
8.4 KiB
TypeScript
/* Metro module 7862; source: modules/applications/ApplicationFrecencyStore.tsx; dependencies: [6, 7, 15, 17, 18, 1378, 1348, 4238, 670, 1909, 4393, 22, 566, 694, 2] */
|
|
function _fun62889(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#62889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:6, offset: 0x01b6bc09, size: 539 bytes, params: 8, frame: 20
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_3 = importDefault(7) /* metro dependency 7 */;
|
|
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 embeddedActivitiesStore = importDefault(1378) /* metro dependency 1378: EmbeddedActivitiesStore */;
|
|
const userSettingsProtoStore = importDefault(1348) /* metro dependency 1348: UserSettingsProtoStore */;
|
|
const FREQUENCY_ITEM_LIMIT = (require(4238) /* metro dependency 4238: ApplicationConstants */).FREQUENCY_ITEM_LIMIT;
|
|
const env0_9 = (require(670) /* metro dependency 670: UserSettingsConstants */).UserSettingsTypes;
|
|
const ApplicationCommandType = (require(1909) /* metro dependency 1909: Server */).ApplicationCommandType;
|
|
const CHAT = ApplicationCommandType.CHAT;
|
|
object = [CHAT];
|
|
const PRIMARY_ENTRY_POINT = ApplicationCommandType.PRIMARY_ENTRY_POINT;
|
|
object[1] = PRIMARY_ENTRY_POINT;
|
|
object = {pendingUsages: []};
|
|
let value = importDefault(4393) /* metro dependency 4393: Frecency */;
|
|
value = new value({computeBonus: function() {
|
|
return 100;
|
|
}, lookupKey: function(a0) {
|
|
return a0;
|
|
}, afterCompute: function() {
|
|
}, numFrequentlyItems: FREQUENCY_ITEM_LIMIT});
|
|
const PersistedStore = (importDefault(566) /* metro dependency 566: flux */).PersistedStore;
|
|
value = _fun62900(PersistedStore);
|
|
value.displayName = 'ApplicationFrecencyStore';
|
|
value.persistKey = 'ApplicationFrecency';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
|
|
{APPLICATION_COMMAND_USED: APPLICATION_COMMAND_USED, EMBEDDED_ACTIVITY_OPEN: function({applicationId}) {
|
|
trackApplicationUsage(applicationId);
|
|
}, USER_SETTINGS_PROTO_UPDATE: USER_SETTINGS_PROTO_UPDATE_62910});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/applications/ApplicationFrecencyStore.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_62890() { // fn#62890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:227, offset: 0x01b6be24, size: 94 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_62890_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function trackApplicationUsage(a0) { // fn#62893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:632, offset: 0x01b6be82, size: 86 bytes, params: 2, frame: 15
|
|
const pendingUsages = env0_11.pendingUsages;
|
|
const push = pendingUsages.push;
|
|
const object2 = {key: a0};
|
|
const Date = global.Date;
|
|
object2.timestamp = Date.now();
|
|
Reflect.apply(push, pendingUsages, [object2]);
|
|
env0_12.track(a0);
|
|
env0_12.compute();
|
|
}
|
|
|
|
function handleUserSettingsProtoStoreChange_62894() { // fn#62894, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:740, offset: 0x01b6bed8, size: 111 bytes, params: 1, frame: 17
|
|
const applicationFrecency = UserSettingsProtoStore.frecencyWithoutFetchingLatest.applicationFrecency;
|
|
const value2 = undefined;
|
|
const r7 = (applicationFrecency == null ? value2 : applicationFrecency.applications) ?? ({});
|
|
const binding = env0_12;
|
|
binding.overwriteHistory((importDefault(22) /* metro dependency 22 */).mapValues(r7, function(a0) {
|
|
var r3;
|
|
var object = {};
|
|
copyDataProperties(object, a0, r3);
|
|
var value = a0.recentUses.map(global.Number);
|
|
value = value.filter(_fun62896);
|
|
object['recentUses'] = value;
|
|
return object;
|
|
}), env0_11.pendingUsages);
|
|
return value2;
|
|
}
|
|
|
|
function _fun62900(a0) { // fn#62900, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:1026, offset: 0x01b6bf8a, size: 185 bytes, params: 2, frame: 16
|
|
const closure = ApplicationFrecencyStore;
|
|
env0_6(closure, a0);
|
|
return env0_3(closure, [{key: 'initialize', value: value_62902}, {key: 'getState', value: value_62903},
|
|
{key: 'hasPendingUsage', value: value_62904}, {key: 'getApplicationFrecencyWithoutLoadingLatest',
|
|
value: value_62905}, {key: 'getScoreWithoutLoadingLatest', value: value_62906},
|
|
{key: 'getTopApplicationsWithoutLoadingLatest', value: value_62907}]);
|
|
}
|
|
|
|
function APPLICATION_COMMAND_USED({command}) { // fn#62908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:2006, offset: 0x01b6c0db, size: 104 bytes, params: 2, frame: 14
|
|
var r1;
|
|
var r0;
|
|
var getLaunchState;
|
|
var applicationId;
|
|
var value4;
|
|
var trackApplicationUsageBinding;
|
|
var value;
|
|
const binding = env0_10;
|
|
const value2 = binding.includes(command.type);
|
|
if (value2) {
|
|
getLaunchState = EmbeddedActivitiesStore.getLaunchState;
|
|
applicationId = command.applicationId;
|
|
value4 = Reflect.apply(getLaunchState, EmbeddedActivitiesStore, [applicationId]);
|
|
r1 = value4 == null || !value4.isLaunching;
|
|
if (r1) {
|
|
trackApplicationUsageBinding = trackApplicationUsage;
|
|
applicationId = command.applicationId;
|
|
value = undefined;
|
|
trackApplicationUsageBinding(applicationId);
|
|
r1 = value;
|
|
}
|
|
r0 = r1;
|
|
} else {
|
|
r0 = !!value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function USER_SETTINGS_PROTO_UPDATE_62910({settings, wasSaved}) { // fn#62910, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:2332, offset: 0x01b6c15b, size: 62 bytes, params: 2, frame: 4
|
|
const type = settings.type;
|
|
const FRECENCY_AND_FAVORITES_SETTINGS = UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS;
|
|
if (type === FRECENCY_AND_FAVORITES_SETTINGS) {
|
|
if (wasSaved) {
|
|
env0_11.pendingUsages = [];
|
|
return undefined;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function _fun62895(a0) { // fn#62895, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:936, offset: 0x01b6bf47, size: 67 bytes, params: 2, frame: 13
|
|
const object2 = {};
|
|
copyDataProperties(object2, a0, undefined);
|
|
const recentUses = a0.recentUses;
|
|
const map = recentUses.map;
|
|
const Number = global.Number;
|
|
let value = Reflect.apply(map, recentUses, [Number]);
|
|
value = value.filter(function(a0) {
|
|
return a0 > 0;
|
|
});
|
|
object2['recentUses'] = value;
|
|
return object2;
|
|
}
|
|
|
|
function value_62902(a0) { // fn#62902, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:1376, offset: 0x01b6c043, size: 74 bytes, params: 2, frame: 14
|
|
var value;
|
|
if (a0 != null) {
|
|
value = environment.__proto__;
|
|
env1_11 = a0;
|
|
}
|
|
this.waitFor(EmbeddedActivitiesStore, UserSettingsProtoStore);
|
|
this.syncWith([UserSettingsProtoStore], handleUserSettingsProtoStoreChange_62894);
|
|
}
|
|
|
|
function value_62906(a0) { // fn#62906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8040:1715, offset: 0x01b6c0a7, size: 37 bytes, params: 2, frame: 11
|
|
const value = environment.__proto__;
|
|
return env1_12.getScore(a0) ?? 0;
|
|
}
|
|
|