diff --git a/src/core/plugins/quickinstall/url.tsx b/src/core/plugins/quickinstall/url.tsx
index e2b8e12..5e46ee1 100644
--- a/src/core/plugins/quickinstall/url.tsx
+++ b/src/core/plugins/quickinstall/url.tsx
@@ -5,17 +5,17 @@ import { installTheme } from "@lib/addons/themes";
import { findAssetId } from "@lib/api/assets";
import { isThemeSupported } from "@lib/api/native/loader";
import { after, instead } from "@lib/api/patcher";
-import { VD_PROXY_PREFIX,VD_THEMES_CHANNEL_ID } from "@lib/utils/constants";
+import { VD_PROXY_PREFIX, VD_THEMES_CHANNEL_ID } from "@lib/utils/constants";
import { lazyDestructure } from "@lib/utils/lazy";
-import { channels, url } from "@metro/common";
+import { channels } from "@metro/common";
import { byMutableProp } from "@metro/filters";
import { findExports } from "@metro/finders";
import { findByProps, findByPropsLazy } from "@metro/wrappers";
import { showToast } from "@ui/toasts";
+import { Linking } from "react-native";
const showSimpleActionSheet = findExports(byMutableProp("showSimpleActionSheet"));
const handleClick = findByPropsLazy("handleClick");
-const { openURL } = lazyDestructure(() => url);
const { getChannelId } = lazyDestructure(() => channels);
const { getChannel } = lazyDestructure(() => findByProps("getChannel"));
@@ -75,7 +75,7 @@ export default () => {
confirmText: Strings.INSTALL,
cancelText: Strings.CANCEL,
secondaryConfirmText: Strings.OPEN_IN_BROWSER,
- onConfirmSecondary: () => openURL(url),
+ onConfirmSecondary: () => Linking.openURL(url),
});
})
);
diff --git a/src/core/ui/settings/pages/General/index.tsx b/src/core/ui/settings/pages/General/index.tsx
index d4c95ad..d45553e 100644
--- a/src/core/ui/settings/pages/General/index.tsx
+++ b/src/core/ui/settings/pages/General/index.tsx
@@ -9,9 +9,9 @@ import { BundleUpdaterManager } from "@lib/api/native/modules";
import { settings } from "@lib/api/settings";
import { openAlert } from "@lib/ui/alerts";
import { DISCORD_SERVER, GITHUB } from "@lib/utils/constants";
-import { NavigationNative, url } from "@metro/common";
+import { NavigationNative } from "@metro/common";
import { AlertActionButton, AlertActions, AlertModal, Stack, TableRow, TableRowGroup, TableSwitchRow } from "@metro/common/components";
-import { ScrollView } from "react-native";
+import { Linking, ScrollView } from "react-native";
export default function General() {
useProxy(settings);
@@ -48,13 +48,13 @@ export default function General() {
arrow={true}
label={Strings.DISCORD_SERVER}
icon={}
- onPress={() => url.openDeeplink(DISCORD_SERVER)}
+ onPress={() => Linking.openURL(DISCORD_SERVER)}
/>
}
- onPress={() => url.openURL(GITHUB)}
+ onPress={() => Linking.openURL(GITHUB)}
/>
diff --git a/src/metro/common/index.ts b/src/metro/common/index.ts
index 5bb4226..4292e50 100644
--- a/src/metro/common/index.ts
+++ b/src/metro/common/index.ts
@@ -2,6 +2,7 @@ import { lazyDestructure } from "@lib/utils/lazy";
import { findByFilePathLazy, findByProps, findByPropsLazy } from "@metro/wrappers";
import type { Dispatcher } from "./types/flux";
+import { Linking } from "react-native";
export * as components from "./components";
@@ -9,7 +10,21 @@ export * as components from "./components";
export const constants = findByPropsLazy("Fonts", "Permissions");
export const channels = findByPropsLazy("getVoiceChannelId");
export const i18n = findByPropsLazy("Messages");
-export const url = findByPropsLazy("openURL", "openDeeplink");
+
+// Polyfill LinkingUtils
+const openURL = (url: string) => Linking.openURL(url);
+export const url = nativeModuleProxy.NativeLinkingModule || nativeModuleProxy.DCDLinkingManager ? {
+ openURL,
+ openDeeplink: openURL,
+ handleSupportedURL: openURL,
+ isDiscordConnectOauth2Deeplink: () => {
+ console.warn("url.isDiscordConnectOauth2Deeplink is not implemented and will always return false");
+ return false;
+ },
+ showLongPressUrlActionSheet: () => console.warn("url.showLongPressUrlActionSheet is not implemented"),
+ handleMessageLinking: findByFilePathLazy("modules/links/native/handleContentLinking.tsx", true),
+} : findByPropsLazy("openURL", "openDeeplink");
+
export const clipboard = findByPropsLazy("setString", "getString", "hasString");
export const assets = findByPropsLazy("registerAsset");
export const invites = findByPropsLazy("acceptInviteAndTransitionToInviteChannel");