From c62d05e1b32361425474928004a92338d98ba200 Mon Sep 17 00:00:00 2001 From: V Date: Tue, 2 May 2023 02:50:51 +0200 Subject: Refactor ipc to be strongly typed and hide impl details (#1018) --- src/plugins/apiBadges.tsx | 3 +-- src/plugins/settings.tsx | 4 ++-- src/plugins/spotifyControls/SpotifyStore.ts | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/apiBadges.tsx b/src/plugins/apiBadges.tsx index a156b63..bf1906f 100644 --- a/src/plugins/apiBadges.tsx +++ b/src/plugins/apiBadges.tsx @@ -22,7 +22,6 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Flex } from "@components/Flex"; import { Heart } from "@components/Heart"; import { Devs } from "@utils/constants"; -import IpcEvents from "@utils/IpcEvents"; import Logger from "@utils/Logger"; import { Margins } from "@utils/margins"; import { closeModal, Modals, openModal } from "@utils/modal"; @@ -115,7 +114,7 @@ export default definePlugin({ const modalKey = openModal(props => ( { closeModal(modalKey); - VencordNative.ipc.invoke(IpcEvents.OPEN_EXTERNAL, "https://github.com/sponsors/Vendicated"); + VencordNative.native.openExternal("https://github.com/sponsors/Vendicated"); }}> diff --git a/src/plugins/settings.tsx b/src/plugins/settings.tsx index 5dec83c..6fd424c 100644 --- a/src/plugins/settings.tsx +++ b/src/plugins/settings.tsx @@ -155,12 +155,12 @@ export default definePlugin({ }, get electronVersion() { - return VencordNative.getVersions().electron || window.armcord?.electron || null; + return VencordNative.native.getVersions().electron || window.armcord?.electron || null; }, get chromiumVersion() { try { - return VencordNative.getVersions().chrome + return VencordNative.native.getVersions().chrome // @ts-ignore Typescript will add userAgentData IMMEDIATELY || navigator.userAgentData?.brands?.find(b => b.brand === "Chromium" || b.brand === "Google Chrome")?.version || null; diff --git a/src/plugins/spotifyControls/SpotifyStore.ts b/src/plugins/spotifyControls/SpotifyStore.ts index 723bc4c..2ceb30c 100644 --- a/src/plugins/spotifyControls/SpotifyStore.ts +++ b/src/plugins/spotifyControls/SpotifyStore.ts @@ -17,7 +17,6 @@ */ import { Settings } from "@api/settings"; -import IpcEvents from "@utils/IpcEvents"; import { proxyLazy } from "@utils/proxyLazy"; import { findByPropsLazy } from "@webpack"; import { Flux, FluxDispatcher } from "@webpack/common"; @@ -94,7 +93,7 @@ export const SpotifyStore = proxyLazy(() => { ? "spotify:" + path.replaceAll("/", (_, idx) => idx === 0 ? "" : ":") : "https://open.spotify.com" + path; - VencordNative.ipc.invoke(IpcEvents.OPEN_EXTERNAL, url); + VencordNative.native.openExternal(url); } // Need to keep track of this manually -- cgit