From 847dc0f69c37b5b11c7d8211df8fe8db214ee72c Mon Sep 17 00:00:00 2001 From: jinyaqiu Date: Thu, 24 Jul 2025 20:48:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8B=B1=E6=96=87=E4=B8=8D=E5=B1=95?= =?UTF-8?q?=E7=A4=BAicp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(tabs)/setting.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/(tabs)/setting.tsx b/app/(tabs)/setting.tsx index cc9cdfb..5c679fc 100644 --- a/app/(tabs)/setting.tsx +++ b/app/(tabs)/setting.tsx @@ -14,6 +14,7 @@ import { fetchApi } from '@/lib/server-api-util'; import { Address, User } from '@/types/user'; import * as Location from 'expo-location'; import { useRouter } from 'expo-router'; +import * as SecureStore from 'expo-secure-store'; import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Linking, Platform, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; @@ -23,6 +24,16 @@ const Setting = (props: { modalVisible: boolean, setModalVisible: (visible: bool const { modalVisible, setModalVisible, userInfo } = props; const insets = useSafeAreaInsets(); const { t } = useTranslation(); + // 判断当前语言环境 + let language = ""; + const getLanguage = async () => { + if (Platform.OS === 'web') { + language = localStorage.getItem('i18nextLng') || ""; + } else { + language = await SecureStore.getItemAsync('i18nextLng') || ""; + } + } + const [modalType, setModalType] = useState<'ai' | 'terms' | 'privacy' | 'user'>('ai'); // 协议弹窗 const [privacyModalVisible, setPrivacyModalVisible] = useState(false); @@ -180,6 +191,11 @@ const Setting = (props: { modalVisible: boolean, setModalVisible: (visible: bool } }, [modalVisible]) + // 获取语言环境 + useEffect(() => { + getLanguage(); + }, []) + return ( - Linking.openURL("https://beian.miit.gov.cn/")} > + Linking.openURL("https://beian.miit.gov.cn/")} > {t('lcenses.ICP', { ns: 'personal' })}沪ICP备2025133004号-2A