Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
136 lines
4.5 KiB
TypeScript
136 lines
4.5 KiB
TypeScript
// Module ID: 9434
|
|
// Function ID: 9435
|
|
// Name: ApplicationFrecencyStore
|
|
// Dependencies: [1957, 1220, 1349, 1084, 1895, 4675, 12, 504, 573, 2]
|
|
|
|
// Module 9434 (ApplicationFrecencyStore)
|
|
import _modDef12 from "module_12" /* 12 */;
|
|
import initializeDefault from "initialize" /* 504 */;
|
|
import DispatcherDefault from "Dispatcher" /* 573 */;
|
|
import FrecencyDefault from "Frecency" /* 4675 */;
|
|
import EmbeddedActivitiesStore from "EmbeddedActivitiesStore" /* 1957 */;
|
|
import UserSettingsProtoStore from "UserSettingsProtoStore" /* 1220 */;
|
|
|
|
function handleUserSettingsProtoStoreChange() {
|
|
const applicationFrecency = UserSettingsProtoStore.frecencyWithoutFetchingLatest.applicationFrecency;
|
|
let applications;
|
|
if (applicationFrecency != null) {
|
|
applications = applicationFrecency.applications;
|
|
}
|
|
if (applications == null) {
|
|
applications = {};
|
|
}
|
|
closure_7.overwriteHistory(_modDef12.mapValues(applications, (recentUses) => {
|
|
const obj = {};
|
|
const merged = Object.assign(recentUses);
|
|
recentUses = recentUses.recentUses;
|
|
const mapped = recentUses.map(Number);
|
|
obj.recentUses = mapped.filter((item) => item > 0);
|
|
return obj;
|
|
}), global.pendingUsages);
|
|
}
|
|
const UserSettingsTypes = fn(1084).UserSettingsTypes;
|
|
let items = [fn(1895).ApplicationCommandType.CHAT, fn(1895).ApplicationCommandType.PRIMARY_ENTRY_POINT];
|
|
let global = { pendingUsages: [] };
|
|
let obj = {
|
|
computeBonus() {
|
|
return 100;
|
|
},
|
|
lookupKey(arg0) {
|
|
return arg0;
|
|
},
|
|
afterCompute() {
|
|
|
|
},
|
|
numFrequentlyItems: fn(1349).FREQUENCY_ITEM_LIMIT
|
|
};
|
|
let closure_7 = new FrecencyDefault({
|
|
computeBonus() {
|
|
return 100;
|
|
},
|
|
lookupKey(arg0) {
|
|
return arg0;
|
|
},
|
|
afterCompute() {
|
|
|
|
},
|
|
numFrequentlyItems: fn(1349).FREQUENCY_ITEM_LIMIT
|
|
});
|
|
const PersistedStore = initializeDefault.PersistedStore;
|
|
class ApplicationFrecencyStore extends PersistedStore {
|
|
}
|
|
const prototype = ApplicationFrecencyStore.prototype;
|
|
prototype["initialize"] = function initialize(arg0) {
|
|
if (null != arg0) {
|
|
global = arg0;
|
|
}
|
|
this.waitFor(EmbeddedActivitiesStore, UserSettingsProtoStore);
|
|
items = [UserSettingsProtoStore];
|
|
this.syncWith(items, handleUserSettingsProtoStoreChange);
|
|
};
|
|
prototype["getState"] = function getState() {
|
|
return global;
|
|
};
|
|
prototype["hasPendingUsage"] = function hasPendingUsage() {
|
|
return global.pendingUsages.length > 0;
|
|
};
|
|
prototype["getApplicationFrecencyWithoutLoadingLatest"] = function getApplicationFrecencyWithoutLoadingLatest() {
|
|
return closure_7;
|
|
};
|
|
prototype["getScoreWithoutLoadingLatest"] = function getScoreWithoutLoadingLatest(id) {
|
|
let num = closure_7.getScore(id);
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
return num;
|
|
};
|
|
prototype["getTopApplicationsWithoutLoadingLatest"] = function getTopApplicationsWithoutLoadingLatest() {
|
|
return closure_7.frequently;
|
|
};
|
|
ApplicationFrecencyStore.displayName = "ApplicationFrecencyStore";
|
|
ApplicationFrecencyStore.persistKey = "ApplicationFrecency";
|
|
const applicationFrecencyStore = new ApplicationFrecencyStore(DispatcherDefault, {
|
|
APPLICATION_COMMAND_USED: function handleApplicationCommandUsed(command) {
|
|
command = command.command;
|
|
let hasItem = items.includes(command.type);
|
|
if (hasItem) {
|
|
const launchState = EmbeddedActivitiesStore.getLaunchState(command.applicationId);
|
|
let isLaunching;
|
|
if (launchState != null) {
|
|
isLaunching = launchState.isLaunching;
|
|
}
|
|
if (!isLaunching) {
|
|
const applicationId = command.applicationId;
|
|
const pendingUsages = global.pendingUsages;
|
|
const obj = { key: applicationId, timestamp: null };
|
|
const _Date = Date;
|
|
obj.timestamp = Date.now();
|
|
pendingUsages.push(obj);
|
|
closure_7.track(applicationId);
|
|
closure_7.compute();
|
|
}
|
|
hasItem = !isLaunching;
|
|
const tmp6 = !isLaunching;
|
|
}
|
|
return hasItem;
|
|
},
|
|
EMBEDDED_ACTIVITY_OPEN: function handleEmbeddedActivityOpen(applicationId) {
|
|
applicationId = applicationId.applicationId;
|
|
const pendingUsages = global.pendingUsages;
|
|
pendingUsages.push({ key: applicationId, timestamp: Date.now() });
|
|
closure_7.track(applicationId);
|
|
closure_7.compute();
|
|
},
|
|
USER_SETTINGS_PROTO_UPDATE: function handleUserSettingsProtoUpdate(settings) {
|
|
if (settings.settings.type === UserSettingsTypes.FRECENCY_AND_FAVORITES_SETTINGS) {
|
|
if (settings.wasSaved) {
|
|
global.pendingUsages = [];
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
});
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/applications/ApplicationFrecencyStore.tsx");
|
|
|
|
export default applicationFrecencyStore;
|