[UI] Open invite in modal (#28)

* [Metro > Common] Have url find openDeeplink

* [Constants] Make invite a URL

* [UI > General] Open invite modal
This commit is contained in:
Jack 2023-03-04 16:32:30 -05:00 committed by GitHub
parent 7d36903b2c
commit 6dff7f7119
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -1,3 +1,3 @@
export const DISCORD_SERVER = "n9QQ4XhhJP"; export const DISCORD_SERVER = "https://discord.gg/n9QQ4XhhJP";
export const GITHUB = "https://github.com/vendetta-mod"; export const GITHUB = "https://github.com/vendetta-mod";
export const HTTP_REGEX = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/; export const HTTP_REGEX = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/;

View file

@ -4,7 +4,7 @@ import { find, findByProps } from "@metro/filters";
export { constants } from "@metro/hoist"; export { constants } from "@metro/hoist";
export const channels = findByProps("getVoiceChannelId"); export const channels = findByProps("getVoiceChannelId");
export const i18n = findByProps("Messages"); export const i18n = findByProps("Messages");
export const url = findByProps("openURL"); export const url = findByProps("openDeeplink");
export const toasts = find(m => m.open && m.close && !m.startDrag && !m.init && !m.openReplay && !m.setAlwaysOnTop); export const toasts = find(m => m.open && m.close && !m.startDrag && !m.init && !m.openReplay && !m.setAlwaysOnTop);
export const stylesheet = findByProps("createThemedStyleSheet"); export const stylesheet = findByProps("createThemedStyleSheet");
export const clipboard = findByProps("setString", "getString", "hasString") as typeof import("@react-native-clipboard/clipboard").default; export const clipboard = findByProps("setString", "getString", "hasString") as typeof import("@react-native-clipboard/clipboard").default;

View file

@ -1,4 +1,4 @@
import { ReactNative as RN, url, invites } from "@metro/common"; import { ReactNative as RN, url } from "@metro/common";
import { getAssetIDByName } from "@ui/assets"; import { getAssetIDByName } from "@ui/assets";
import { Forms, Summary } from "@ui/components"; import { Forms, Summary } from "@ui/components";
import { DISCORD_SERVER, GITHUB } from "@lib/constants"; import { DISCORD_SERVER, GITHUB } from "@lib/constants";
@ -88,7 +88,7 @@ export default function General() {
label="Discord Server" label="Discord Server"
leading={<FormRow.Icon source={getAssetIDByName("Discord")} />} leading={<FormRow.Icon source={getAssetIDByName("Discord")} />}
trailing={FormRow.Arrow} trailing={FormRow.Arrow}
onPress={() => invites.acceptInviteAndTransitionToInviteChannel({ inviteKey: DISCORD_SERVER })} onPress={() => url.openDeeplink(DISCORD_SERVER)}
/> />
<FormDivider /> <FormDivider />
<FormRow <FormRow