diff --git a/plugins/FixConnecting/manifest.json b/plugins/FixConnecting/manifest.json new file mode 100644 index 0000000..2830938 --- /dev/null +++ b/plugins/FixConnecting/manifest.json @@ -0,0 +1,14 @@ +{ + "name": "FixConnecting", + "description": "Fix the annoying Connecting bug (enmity port)", + "authors": [ + { + "name": "sapphire", + "id": "757982547861962752" + } + ], + "main": "src/index.ts", + "vendetta": { + "icon": "badconnection" + } +} \ No newline at end of file diff --git a/plugins/FixConnecting/src/index.ts b/plugins/FixConnecting/src/index.ts new file mode 100644 index 0000000..c17786d --- /dev/null +++ b/plugins/FixConnecting/src/index.ts @@ -0,0 +1,23 @@ +// https://github.com/m4fn3/FixConnecting/blob/master/src/index.tsx + +import { findByProps, findByStoreName } from "@vendetta/metro" +import { FluxDispatcher } from "@vendetta/metro/common" +import { after } from "@vendetta/patcher" +import { getAssetIDByName } from "@vendetta/ui/assets" +import { showToast } from "@vendetta/ui/toasts" + +const startSession = findByProps("startSession") +const AuthenticationStore = findByStoreName("AuthenticationStore") + +const unpatch = after("startSession", startSession, () => { + unpatch() + setTimeout(() => { + let session_id = AuthenticationStore.getSessionId() + if (!session_id) { + FluxDispatcher?.dispatch({type: "APP_STATE_UPDATE", state: "active"}) + showToast("Automatically fixed Connecting bug!", getAssetIDByName("Check")) + } + }, 300) +}) + +export const onUnload = () => unpatch() \ No newline at end of file