Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(mobile): 设置页新增用户协议入口并统一协议链接区域分流
Lizif5da2b646ec2
diff --git a/apps/mobile/app/settings.tsx b/apps/mobile/app/settings.tsxindex 8e6ce32b04..140b5874ae 100644--- a/apps/mobile/app/settings.tsx+++ b/apps/mobile/app/settings.tsx@@ -32,6 +32,7 @@ import {StatusDot,} from '@/components/MobilePrimitives';import { AUTH_API_BASE_URL, AUTH_REGION, DESKTOP_PACKAGE_VERSION, DEVICE_LINK_API_BASE_URL, IS_OTA_SELFHOST, REVIEW_MODE } from '@/config/env';+import { LEGAL_LINKS } from '@/config/legalLinks';import { useDeviceLink } from '@/device-link/DeviceLinkContext';import { buildMobileDeviceName } from '@/device-link/mobileDeviceIdentity';import { formatRemoteError } from '@/device-link/remoteStatus';@@ -61,9 +62,6 @@ type SelfDeviceNameQueuedWrite =const SETTINGS_DEVICE_TIMEOUT_MS = 12_000;// 显示语言选项:「跟随系统」在前,4 种具体语言在后(与 desktop LanguageSection 同序)。const LANGUAGE_OPTIONS: readonly LocalePreference[] = ['system', ...SUPPORTED_LOCALES];-const PRIVACY_POLICY_URL = AUTH_REGION === 'cn'- ? 'https://cindy.cn/privacy/'- : 'https://cindy.app/privacy/';export default function SettingsScreen() {const styles = useThemedStyles(makeStyles);@@ -189,7 +187,11 @@ export default function SettingsScreen() {}, []);const openPrivacyPolicy = useCallback(() => {- void Linking.openURL(PRIVACY_POLICY_URL).catch(() => undefined);+ void Linking.openURL(LEGAL_LINKS.privacyPolicy).catch(() => undefined);+ }, []);++ const openUserAgreement = useCallback(() => {+ void Linking.openURL(LEGAL_LINKS.termsOfService).catch(() => undefined);}, []);const checkForUpdate = useCallback(async () => {@@ -635,7 +637,8 @@ export default function SettingsScreen() {</SettingsGroup>) : null}- {/* 法律信息:隐私政策始终显示;App 备案号仅国内版显示。 */}+ {/* 法律信息:隐私政策/用户协议始终显示(链接区域分流走 legalLinks 单点);+ App 备案号仅国内版显示。 */}<SettingsGroup title={t('settings.legal.sectionTitle')}><ActionInfoRowaccessibilityLabel={t('settings.legal.openPrivacyPolicy')}@@ -646,6 +649,15 @@ export default function SettingsScreen() {testID="settings.privacyPolicy"value={t('settings.legal.view')}/>+ <ActionInfoRow+ accessibilityLabel={t('settings.legal.openUserAgreement')}+ accessibilityRole="link"+ key="user-agreement"+ label={t('settings.legal.userAgreement')}+ onPress={openUserAgreement}+ testID="settings.userAgreement"+ value={t('settings.legal.view')}+ />{AUTH_REGION === 'cn' ? (<InfoRowkey="app-filing-number"diff --git a/apps/mobile/src/__tests__/mobileSettings.test.ts b/apps/mobile/src/__tests__/mobileSettings.test.tsindex 952ed44776..c5b8247021 100644--- a/apps/mobile/src/__tests__/mobileSettings.test.ts+++ b/apps/mobile/src/__tests__/mobileSettings.test.ts@@ -170,26 +170,33 @@ describe('mobile settings overview', () => {expect(source).not.toContain('clearManualName');});- it('always shows the regional privacy policy above the cn-only App filing number', () => {+ it('always shows privacy policy + user agreement (regional links via legalLinks) above the cn-only App filing number', () => {const source = readTextLf(resolve(process.cwd(), 'app/settings.tsx'), 'utf8');const filingCardIndex = source.indexOf("<SettingsGroup title={t('settings.legal.sectionTitle')}>");const privacyRowIndex = source.indexOf('testID="settings.privacyPolicy"');- const regionGuardIndex = source.indexOf("{AUTH_REGION === 'cn' ? (", privacyRowIndex);+ const userAgreementRowIndex = source.indexOf('testID="settings.userAgreement"');+ const regionGuardIndex = source.indexOf("{AUTH_REGION === 'cn' ? (", userAgreementRowIndex);const filingNumberIndex = source.indexOf('testID="settings.appFilingNumber"');const accountActionsIndex = source.indexOf('testID="settings.accountActions"');- expect(source).toContain("const PRIVACY_POLICY_URL = AUTH_REGION === 'cn'");- expect(source).toContain("'https://cindy.cn/privacy/'");- expect(source).toContain("'https://cindy.app/privacy/'");- expect(source).toContain('Linking.openURL(PRIVACY_POLICY_URL)');+ // 链接不再本地写死:与登录页共用 legalLinks 区域分流单点(protocol.xd.cn/.com)+ expect(source).toContain("import { LEGAL_LINKS } from '@/config/legalLinks';");+ expect(source).toContain('Linking.openURL(LEGAL_LINKS.privacyPolicy)');+ expect(source).toContain('Linking.openURL(LEGAL_LINKS.termsOfService)');+ expect(source).not.toContain('PRIVACY_POLICY_URL');+ expect(source).not.toContain('cindy.cn/privacy');+ expect(source).not.toContain('cindy.app/privacy');expect(source).toContain("accessibilityLabel={t('settings.legal.openPrivacyPolicy')}");+ expect(source).toContain("accessibilityLabel={t('settings.legal.openUserAgreement')}");expect(source).toContain('accessibilityRole="link"');expect(source).toContain("label={t('settings.legal.privacyPolicy')}");+ expect(source).toContain("label={t('settings.legal.userAgreement')}");expect(source).toContain("label={t('settings.legal.appFilingNumber')}");expect(source).toContain('value="沪ICP备11033765号-89A"');expect(filingCardIndex).toBeGreaterThan(-1);expect(privacyRowIndex).toBeGreaterThan(filingCardIndex);- expect(regionGuardIndex).toBeGreaterThan(privacyRowIndex);+ expect(userAgreementRowIndex).toBeGreaterThan(privacyRowIndex);+ expect(regionGuardIndex).toBeGreaterThan(userAgreementRowIndex);expect(filingNumberIndex).toBeGreaterThan(regionGuardIndex);expect(accountActionsIndex).toBeGreaterThan(filingNumberIndex);});diff --git a/apps/mobile/src/i18n/locales/en/settings.json b/apps/mobile/src/i18n/locales/en/settings.jsonindex e542cdc400..da53d91847 100644--- a/apps/mobile/src/i18n/locales/en/settings.json+++ b/apps/mobile/src/i18n/locales/en/settings.json@@ -84,8 +84,10 @@"legal": {"sectionTitle": "Legal","privacyPolicy": "Privacy Policy",+ "userAgreement": "User Agreement","view": "View","openPrivacyPolicy": "Open the privacy policy",+ "openUserAgreement": "Open the user agreement","appFilingNumber": "App Filing Number"},"account": {diff --git a/apps/mobile/src/i18n/locales/ja/settings.json b/apps/mobile/src/i18n/locales/ja/settings.jsonindex 4fcf2ac1f3..3837f8864b 100644--- a/apps/mobile/src/i18n/locales/ja/settings.json+++ b/apps/mobile/src/i18n/locales/ja/settings.json@@ -84,8 +84,10 @@"legal": {"sectionTitle": "法的情報","privacyPolicy": "プライバシーポリシー",+ "userAgreement": "利用規約","view": "表示","openPrivacyPolicy": "プライバシーポリシーを開く",+ "openUserAgreement": "利用規約を開く","appFilingNumber": "アプリ届出番号"},"account": {diff --git a/apps/mobile/src/i18n/locales/ko/settings.json b/apps/mobile/src/i18n/locales/ko/settings.jsonindex 35a3a23956..9819996811 100644--- a/apps/mobile/src/i18n/locales/ko/settings.json+++ b/apps/mobile/src/i18n/locales/ko/settings.json@@ -84,8 +84,10 @@"legal": {"sectionTitle": "법적 정보","privacyPolicy": "개인정보 처리방침",+ "userAgreement": "이용약관","view": "보기","openPrivacyPolicy": "개인정보 처리방침 열기",+ "openUserAgreement": "이용약관 열기","appFilingNumber": "앱 등록 번호"},"account": {diff --git a/apps/mobile/src/i18n/locales/zh-CN/settings.json b/apps/mobile/src/i18n/locales/zh-CN/settings.jsonindex df19ff592e..cc8cd111cf 100644--- a/apps/mobile/src/i18n/locales/zh-CN/settings.json+++ b/apps/mobile/src/i18n/locales/zh-CN/settings.json@@ -84,8 +84,10 @@"legal": {"sectionTitle": "备案信息","privacyPolicy": "隐私政策",+ "userAgreement": "用户协议","view": "查看","openPrivacyPolicy": "打开隐私政策",+ "openUserAgreement": "打开用户协议","appFilingNumber": "App 备案号"},"account": {