feat(mobile): openLinksInExternalApp setting

This commit is contained in:
DIYgod 2025-04-18 12:04:40 +08:00
parent 6d707bdbc9
commit 61c099b527
No known key found for this signature in database
9 changed files with 14 additions and 14 deletions

View File

@ -13,8 +13,8 @@ interface NativeModule {
}
const nativeModule = requireNativeModule("Helper") as NativeModule
export const openLink = (url: string, onDismiss?: () => void) => {
const { openLinksInApp } = getGeneralSettings()
if (!openLinksInApp) {
const { openLinksInExternalApp } = getGeneralSettings()
if (openLinksInExternalApp) {
openURL(url)
return
}

View File

@ -82,8 +82,8 @@ const parseSchemeLink = (url: string) => {
}
const openVideo = async (url: string) => {
const { openLinksInApp } = getGeneralSettings()
if (!openLinksInApp) {
const { openLinksInExternalApp } = getGeneralSettings()
if (openLinksInExternalApp) {
const schemeLink = parseSchemeLink(url)
try {
const isInstalled = !!schemeLink && (await Linking.canOpenURL(schemeLink))

View File

@ -84,7 +84,7 @@ export const GeneralScreen: NavigationControllerView = () => {
const expandLongSocialMedia = useGeneralSettingKey("autoExpandLongSocialMedia")
const markAsReadWhenScrolling = useGeneralSettingKey("scrollMarkUnread")
const markAsReadWhenInView = useGeneralSettingKey("renderMarkUnread")
const openLinksInApp = useGeneralSettingKey("openLinksInApp")
const openLinksInExternalApp = useGeneralSettingKey("openLinksInExternalApp")
return (
<SafeNavigationScrollView
@ -213,12 +213,12 @@ export const GeneralScreen: NavigationControllerView = () => {
<GroupedInsetListSectionHeader label={t("general.content")} />
<GroupedInsetListCard>
<GroupedInsetListCell label={t("general.open_links_in_app.label")}>
<GroupedInsetListCell label={t("general.open_links_in_external_app.label")}>
<Switch
size="sm"
value={openLinksInApp}
value={openLinksInExternalApp}
onValueChange={(value) => {
setGeneralSetting("openLinksInApp", value)
setGeneralSetting("openLinksInExternalApp", value)
}}
/>
</GroupedInsetListCell>

View File

@ -38,7 +38,7 @@ export default function Discover() {
<GoodLuck />
<View className="mt-12 flex-row items-center gap-1 px-6 pt-4">
<View className="mt-4 flex-row items-center gap-1 px-6 pt-4">
<Text className="text-label text-2xl font-bold leading-[1.1]">Categories</Text>
</View>

View File

@ -192,7 +192,7 @@
"general.minimize_to_tray.description": "Minimize to system tray when closing window",
"general.minimize_to_tray.label": "Minimize to tray",
"general.network": "Network",
"general.open_links_in_app.label": "Open links in app",
"general.open_links_in_external_app.label": "Open links in external app",
"general.privacy": "Privacy",
"general.proxy.description": "Set proxy for network traffic routing, e.g., socks://proxy.example.com:1080",
"general.proxy.label": "Proxy",

View File

@ -192,7 +192,7 @@
"general.minimize_to_tray.description": "关闭窗口时最小化到系统托盘。",
"general.minimize_to_tray.label": "最小化到托盘",
"general.network": "网络",
"general.open_links_in_app.label": "在应用内打开链接",
"general.open_links_in_external_app.label": "在外部应用内打开链接",
"general.privacy": "隐私",
"general.proxy.description": "代理网络请求例如socks://proxy.example.com:1080",
"general.proxy.label": "代理",

View File

@ -192,7 +192,7 @@
"general.minimize_to_tray.description": "關閉視窗時最小化到工作列通知區域",
"general.minimize_to_tray.label": "最小化到通知區域",
"general.network": "網路",
"general.open_links_in_app.label": "從 app 開啟連結",
"general.open_links_in_external_app.label": "在外部 app 開啟連結",
"general.privacy": "隱私",
"general.proxy.description": "設定 Proxy 伺服器來處理網路流量例如socks://proxy.example.com:1080",
"general.proxy.label": "Proxy 伺服器",

View File

@ -36,7 +36,7 @@ export const defaultGeneralSettings: GeneralSettings = {
enhancedSettings: false,
// @mobile
openLinksInApp: true,
openLinksInExternalApp: true,
}
export const defaultUISettings: UISettings = {

View File

@ -29,7 +29,7 @@ export interface GeneralSettings {
enhancedSettings: boolean
// @mobile
openLinksInApp: boolean
openLinksInExternalApp: boolean
}
export interface UISettings {