114 lines
3.5 KiB
TypeScript
114 lines
3.5 KiB
TypeScript
// Metro module 5691 (f5692).
|
|
import { ApplicationFlags } from "../../Constants";
|
|
import { hasApplicationFlag } from "../applications/utils/ApplicationFlagUtils";
|
|
import Module589 from "../../_bundle/Module589";
|
|
import { DeveloperMode } from "../user_settings/UserSettings";
|
|
import Dispatcher from "../../Dispatcher";
|
|
import { HermesBuiltin } from "../../_hermes/prelude";
|
|
let c3525_3 = {
|
|
lastUsedObject: {},
|
|
useActivityUrlOverride: false,
|
|
activityUrlOverride: null,
|
|
filter: ""
|
|
};
|
|
let c3525_4 = {
|
|
INITIALIZED: "INITIALIZED",
|
|
LOADING: "LOADING",
|
|
LOADED: "LOADED",
|
|
ERROR: "ERROR"
|
|
};
|
|
let INITIALIZED = c3525_4.INITIALIZED;
|
|
let c3525_6 = [];
|
|
class DeveloperActivityShelfStore extends Module589.PersistedStore {
|
|
static displayName = "DeveloperActivityShelfStore";
|
|
static persistKey = "DeveloperActivityShelfStore";
|
|
static migrations = [(a0) => {
|
|
delete a0["isEnabled"];
|
|
return {
|
|
...a0
|
|
};
|
|
}];
|
|
initialize(a0) {
|
|
let r3 = a0;
|
|
const r2 = {
|
|
lastUsedObject: {},
|
|
useActivityUrlOverride: false,
|
|
activityUrlOverride: null,
|
|
filter: ""
|
|
};
|
|
if (a0 == null) {
|
|
r3 = {};
|
|
}
|
|
HermesBuiltin.copyDataProperties(r2, r3);
|
|
c3525_3 = r2;
|
|
}
|
|
getState() {
|
|
return c3525_3;
|
|
}
|
|
getIsEnabled() {
|
|
return DeveloperMode.getSetting() && c3525_6.length > 0;
|
|
}
|
|
getLastUsedObject() {
|
|
return c3525_3.lastUsedObject;
|
|
}
|
|
getUseActivityUrlOverride() {
|
|
return this.getIsEnabled() && c3525_3.useActivityUrlOverride;
|
|
}
|
|
getActivityUrlOverride() {
|
|
return this.getIsEnabled() ? c3525_3.activityUrlOverride : null;
|
|
}
|
|
getFetchState() {
|
|
return INITIALIZED;
|
|
}
|
|
getFilter() {
|
|
return this.getIsEnabled() ? c3525_3.filter : "";
|
|
}
|
|
getDeveloperShelfItems() {
|
|
return this.getIsEnabled() ? c3525_6 : [];
|
|
}
|
|
inDevModeForApplication(c15001_0) {
|
|
return this.getIsEnabled() && c3525_6.find((item) => item.id === c15001_0) != null;
|
|
}
|
|
}
|
|
const developerActivityShelfStore = new DeveloperActivityShelfStore(Dispatcher, {
|
|
LOGOUT: function reset() {
|
|
c3525_3 = {
|
|
lastUsedObject: {},
|
|
useActivityUrlOverride: false,
|
|
activityUrlOverride: null,
|
|
filter: ""
|
|
};
|
|
INITIALIZED = c3525_4.INITIALIZED;
|
|
c3525_6 = [];
|
|
},
|
|
DEVELOPER_ACTIVITY_SHELF_TOGGLE_USE_ACTIVITY_URL_OVERRIDE: function handleToggleUseActivityUrlOverride() {
|
|
c3525_3.useActivityUrlOverride = !c3525_3.useActivityUrlOverride;
|
|
},
|
|
DEVELOPER_ACTIVITY_SHELF_SET_ACTIVITY_URL_OVERRIDE: function handleSetActivityUrlOverride(a0) {
|
|
c3525_3.activityUrlOverride = a0.activityUrlOverride;
|
|
},
|
|
DEVELOPER_ACTIVITY_SHELF_MARK_ACTIVITY_USED: function handleMarkActivityUsed({ applicationId, timestamp }) {
|
|
if (c3525_6.find((item) => item.id === applicationId) == null) {
|
|
return false;
|
|
}
|
|
c3525_3.lastUsedObject[applicationId] = timestamp;
|
|
},
|
|
DEVELOPER_ACTIVITY_SHELF_FETCH_START: () => {
|
|
INITIALIZED = c3525_4.LOADING;
|
|
},
|
|
DEVELOPER_ACTIVITY_SHELF_FETCH_SUCCESS: function handleEmbeddedActivitiesFetchDeveloperApplicationsSuccess({ applications }) {
|
|
INITIALIZED = c3525_4.LOADED;
|
|
c3525_6 = applications.filter((application) => hasApplicationFlag(application, ApplicationFlags.EMBEDDED));
|
|
},
|
|
DEVELOPER_ACTIVITY_SHELF_FETCH_FAIL: function handleEmbeddedActivitiesFetchDeveloperApplicationsFail(a0) {
|
|
a0.type;
|
|
INITIALIZED = c3525_4.ERROR;
|
|
},
|
|
DEVELOPER_ACTIVITY_SHELF_UPDATE_FILTER: function handleUpdateFilter(a0) {
|
|
c3525_3.filter = a0.filter;
|
|
},
|
|
USER_SETTINGS_PROTO_UPDATE: () => {}
|
|
});
|
|
export default developerActivityShelfStore;
|
|
export { c3525_4 as DevShelfFetchState };
|