[Settings > General] Accept discord server invite in-app (#4)

* [Settings > General] Make Discord Server button accept invite in-app

* [Settings > General] My changes

Co-authored-by: Beef <beefers@riseup.net>
This commit is contained in:
Jack 2023-01-17 02:33:45 -05:00 committed by Beef
parent 71f687e345
commit da83d4756a
3 changed files with 7 additions and 6 deletions

View file

@ -1,2 +1,2 @@
export const DISCORD_SERVER = "https://discord.gg/n9QQ4XhhJP"; export const DISCORD_SERVER = "n9QQ4XhhJP";
export const GITHUB = "https://github.com/vendetta-mod"; export const GITHUB = "https://github.com/vendetta-mod";

View file

@ -9,6 +9,7 @@ export const toasts = find(m => m.open && m.close && !m.startDrag && !m.init &&
export const stylesheet = findByProps("createThemedStyleSheet"); export const stylesheet = findByProps("createThemedStyleSheet");
export const clipboard = findByProps("setString", "getString", "hasString"); export const clipboard = findByProps("setString", "getString", "hasString");
export const assets = findByProps("registerAsset"); export const assets = findByProps("registerAsset");
export const invites = findByProps("acceptInviteAndTransitionToInviteChannel");
export const navigation = findByProps("pushLazy"); export const navigation = findByProps("pushLazy");
export const navigationStack = findByProps("createStackNavigator"); export const navigationStack = findByProps("createStackNavigator");
export const NavigationNative = findByProps("NavigationContainer"); export const NavigationNative = findByProps("NavigationContainer");

View file

@ -1,4 +1,4 @@
import { ReactNative as RN, url } from "@metro/common"; import { ReactNative as RN, url, invites } from "@metro/common";
import { DISCORD_SERVER, GITHUB } from "@lib/constants"; import { DISCORD_SERVER, GITHUB } from "@lib/constants";
import { getAssetIDByName } from "@ui/assets"; import { getAssetIDByName } from "@ui/assets";
import { Forms } from "@ui/components"; import { Forms } from "@ui/components";
@ -7,7 +7,7 @@ import Version from "@ui/settings/components/Version";
import settings from "@lib/settings"; import settings from "@lib/settings";
const { FormRow, FormSwitchRow, FormSection, FormDivider } = Forms; const { FormRow, FormSwitchRow, FormSection, FormDivider } = Forms;
const debugInfo = getDebugInfo() const debugInfo = getDebugInfo();
export default function General() { export default function General() {
const [devSettings, setDevSettings] = React.useState(settings.developerSettings || false); const [devSettings, setDevSettings] = React.useState(settings.developerSettings || false);
@ -73,14 +73,14 @@ export default function General() {
} }
]; ];
return ( return (
<RN.ScrollView> <RN.ScrollView>
<FormSection title="Links"> <FormSection title="Links">
<FormRow <FormRow
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={() => url.openURL(DISCORD_SERVER)} onPress={() => invites.acceptInviteAndTransitionToInviteChannel({ inviteKey: DISCORD_SERVER })}
/> />
<FormDivider /> <FormDivider />
<FormRow <FormRow
@ -113,7 +113,7 @@ export default function General() {
onPress={() => RN.NativeModules.BundleUpdaterManager.reload()} onPress={() => RN.NativeModules.BundleUpdaterManager.reload()}
/> />
<FormDivider /> <FormDivider />
<FormSwitchRow <FormSwitchRow
label="Developer Settings" label="Developer Settings"
leading={<FormRow.Icon source={getAssetIDByName("ic_progress_wrench_24px")} />} leading={<FormRow.Icon source={getAssetIDByName("ic_progress_wrench_24px")} />}
value={devSettings} value={devSettings}