Files
discord-decomp/stores/DefaultRouteStore.tsx
T
2026-11-01 12:12:55 +02:00

66 lines
1.7 KiB
TypeScript

// Metro module 4010 (f4011).
import { Routes } from "../Constants";
import Module589 from "../_bundle/Module589";
import { Storage } from "../_bundle/Module595";
import Dispatcher from "../Dispatcher";
let c2287_3 = {
lastViewedPath: null,
lastViewedNonVoicePath: null
};
let c2287_4 = c2287_3;
let c2287_5 = "LAST_VIEWED_PATH";
class DefaultRouteStore extends Module589.PersistedStore {
static displayName = "DefaultRouteStore";
static persistKey = "DefaultRouteStore";
static migrations = [() => {
const lastViewedPath = Storage.get(c2287_5, null);
Storage.remove(c2287_5);
return {
lastViewedPath
};
}];
initialize(r2 = c2287_3) {
if (r2 == null) {
r2 = c2287_3;
}
c2287_4 = r2;
}
get defaultRoute() {
let lastViewedPath = c2287_4.lastViewedPath;
if (lastViewedPath == null) {
lastViewedPath = Routes.ME;
}
return lastViewedPath;
}
get lastNonVoiceRoute() {
let lastViewedNonVoicePath = c2287_4.lastViewedNonVoicePath;
if (lastViewedNonVoicePath == null) {
lastViewedNonVoicePath = Routes.ME;
}
return lastViewedNonVoicePath;
}
get fallbackRoute() {
return Routes.ME;
}
getState() {
return c2287_4;
}
}
const defaultRouteStore = new DefaultRouteStore(Dispatcher, {
SAVE_LAST_ROUTE: function handleSaveRoute(a0) {
c2287_4.lastViewedPath = a0.path;
return true;
},
SAVE_LAST_NON_VOICE_ROUTE: function handleSaveLastNonVoiceRoute(a0) {
c2287_4.lastViewedNonVoicePath = a0.path;
return true;
},
LOGOUT: function handleLogout() {
c2287_4 = {
lastViewedPath: null,
lastViewedNonVoicePath: null
};
}
});
export default defaultRouteStore;