mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-17 18:37:04 -04:00
Fixes and ShowHiddenChannels improvements (#634)
~ Fixes #630 ~ Fixes #618
This commit is contained in:
parent
d482d33d6f
commit
586b26d2d4
11 changed files with 147 additions and 47 deletions
|
@ -42,6 +42,7 @@ const settings = definePluginSettings({
|
|||
});
|
||||
|
||||
let crashCount: number = 0;
|
||||
let lastCrashTimestamp: number = 0;
|
||||
|
||||
export default definePlugin({
|
||||
name: "CrashHandler",
|
||||
|
@ -80,6 +81,7 @@ export default definePlugin({
|
|||
});
|
||||
} catch { }
|
||||
|
||||
lastCrashTimestamp = Date.now();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -97,17 +99,21 @@ export default definePlugin({
|
|||
} catch (err) {
|
||||
CrashHandlerLogger.error("Failed to handle crash", err);
|
||||
return false;
|
||||
} finally {
|
||||
lastCrashTimestamp = Date.now();
|
||||
}
|
||||
},
|
||||
|
||||
handlePreventCrash(_this: ReactElement & { forceUpdate: () => void; }) {
|
||||
try {
|
||||
showNotification({
|
||||
color: "#eed202",
|
||||
title: "Discord has crashed!",
|
||||
body: "Attempting to recover...",
|
||||
});
|
||||
} catch { }
|
||||
if (Date.now() - lastCrashTimestamp >= 1_000) {
|
||||
try {
|
||||
showNotification({
|
||||
color: "#eed202",
|
||||
title: "Discord has crashed!",
|
||||
body: "Attempting to recover...",
|
||||
});
|
||||
} catch { }
|
||||
}
|
||||
|
||||
try {
|
||||
FluxDispatcher.dispatch({ type: "CONTEXT_MENU_CLOSE" });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue