diff --git a/app.json b/app.json index a2b45b8..3b5b2de 100644 --- a/app.json +++ b/app.json @@ -11,9 +11,9 @@ "ios": { "supportsTablet": true, "infoPlist": { - "NSPhotoLibraryUsageDescription": "Allow $(PRODUCT_NAME) to access your photos.", + "NSPhotoLibraryUsageDescription": "允许访问照片库,以便模型使用您照片库中的素材进行视频创作”(例如:上传您参加音乐节的现场图,生成一个音乐节体验Vlog", "NSPhotoLibraryAddUsageDescription": "需要保存图片到相册", - "NSLocationWhenInUseUsageDescription": "Allow $(PRODUCT_NAME) to access your location to get photo location data.", + "NSLocationWhenInUseUsageDescription": "允许获取位置信息,以便模型使用您的位置信息进行个性化创作”(例如:上传您去欧洲旅游的位置信息,结合在当地拍摄的照片,生成一个欧洲旅行攻略Vlog)", "ITSAppUsesNonExemptEncryption": false, "UIBackgroundModes": [ "fetch" @@ -61,7 +61,7 @@ [ "expo-location", { - "locationWhenInUsePermission": "允许 $(PRODUCT_NAME) 访问您的位置" + "locationWhenInUsePermission": "允许 $(PRODUCT_NAME) 获取位置信息,以便使用您的位置信息进行个性化创作.(例如:上传您去欧洲旅游的位置信息,结合在当地拍摄的照片,生成一个欧洲旅行攻略Vlog)" } ], [ @@ -73,8 +73,8 @@ [ "expo-media-library", { - "photosPermission": "Allow $(PRODUCT_NAME) to access your photos.", - "savePhotosPermission": "Allow $(PRODUCT_NAME) to save photos.", + "photosPermission": "允许 $(PRODUCT_NAME) 访问照片库,以便我们使用您照片库中的素材进行视频创作。(例如:上传您参加音乐节的现场图,生成一个音乐节体验Vlog)", + "savePhotosPermission": "允许 $(PRODUCT_NAME) 保存媒体到照片库,以便保存您生成的视频。(例如:生成音乐节体验Vlog后,保存到您的相册)", "isAccessMediaLocationEnabled": true } ], diff --git a/app/(tabs)/login.tsx b/app/(tabs)/login.tsx index 9aea541..e789d12 100644 --- a/app/(tabs)/login.tsx +++ b/app/(tabs)/login.tsx @@ -52,10 +52,6 @@ const LoginScreen = () => { router.setParams({ [key]: value }); } - useEffect(() => { - // setError('123') - }, []) - return ( item?.key === 'total_count') - 1 || 0} + // defaultIndex={carouselDataValue?.findIndex((item) => item?.key === 'total_count') - 1 || 0} modeConfig={{ parallaxScrollingScale: 1, parallaxScrollingOffset: 160, diff --git a/components/owner/delete.tsx b/components/owner/delete.tsx new file mode 100644 index 0000000..977f5fb --- /dev/null +++ b/components/owner/delete.tsx @@ -0,0 +1,204 @@ +import { useAuth } from '@/contexts/auth-context'; +import { fetchApi } from '@/lib/server-api-util'; +import { useRouter } from 'expo-router'; +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { Modal, Pressable, StyleSheet, View } from 'react-native'; +import { ThemedText } from '../ThemedText'; + +const DeleteModal = (props: { modalVisible: boolean, setModalVisible: (visible: boolean) => void, setSettingModalVisible: (visible: boolean) => void }) => { + const { modalVisible, setModalVisible, setSettingModalVisible } = props; + const { logout } = useAuth(); + const { t } = useTranslation(); + const router = useRouter(); + // 注销账号 + const handleDeleteAccount = () => { + fetchApi("/iam/delete-user", { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + }) + .then(async (res) => { + await logout(); + setModalVisible(false); + setSettingModalVisible(false); + router.replace('/login'); + }) + .catch(() => { + console.error("jwt has expired."); + }); + }; + + return ( + setModalVisible(false)} + > + + + + {t("generalSetting.delete", { ns: "personal" })} + + + setModalVisible(false)} + > + + {t("generalSetting.cancel", { ns: "personal" })} + + + + + {t("generalSetting.deleteAccount", { ns: "personal" })} + + + + + + + ); +}; + +const styles = StyleSheet.create({ + centeredView: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + backgroundColor: 'rgba(0,0,0,0.5)', + }, + modalView: { + width: '80%', + backgroundColor: 'white', + borderRadius: 16, + padding: 24, + alignItems: 'center', + shadowColor: '#000', + shadowOffset: { + width: 0, + height: 2, + }, + shadowOpacity: 0.25, + shadowRadius: 4, + elevation: 5, + marginBottom: 20, + }, + buttonContainer: { + flexDirection: 'row', + justifyContent: 'space-between', + width: '100%', + marginTop: 20, + }, + button: { + borderRadius: 20, + paddingVertical: 12, + paddingHorizontal: 20, + elevation: 2, + minWidth: 100, + alignItems: 'center', + }, + cancelButton: { + backgroundColor: '#F5F5F5', + marginRight: 12, + }, + deleteButton: { + backgroundColor: '#E2793F', + }, + cancelButtonText: { + color: '#4C320C', + fontWeight: '600', + }, + deleteButtonText: { + color: 'white', + fontWeight: '600', + }, + modalTitle: { + fontSize: 20, + fontWeight: 'bold', + color: '#4C320C', + }, + closeButton: { + fontSize: 28, + color: '#4C320C', + padding: 10, + }, + modalContent: { + flex: 1, + }, + modalText: { + fontSize: 16, + color: '#4C320C', + }, + premium: { + backgroundColor: "#FAF9F6", + padding: 16, + borderRadius: 24, + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', + }, + content: { + flex: 1, + flexDirection: 'column', + gap: 4, + backgroundColor: '#FAF9F6', + borderRadius: 24, + paddingVertical: 8 + }, + item: { + paddingHorizontal: 16, + paddingVertical: 8, + flexDirection: 'row', + justifyContent: 'space-between', + alignItems: 'center', + }, + itemText: { + fontSize: 14, + fontWeight: '600', + color: '#4C320C', + }, + upgradeButton: { + backgroundColor: '#E2793F', + borderRadius: 20, + paddingHorizontal: 16, + paddingVertical: 8, + }, + upgradeButtonText: { + color: '#fff', + fontSize: 14, + fontWeight: "600" + }, + switchContainer: { + width: 50, + height: 30, + borderRadius: 15, + justifyContent: 'center', + paddingHorizontal: 2, + }, + switchOn: { + backgroundColor: '#E2793F', + alignItems: 'flex-end', + }, + switchOff: { + backgroundColor: '#E5E5E5', + alignItems: 'flex-start', + }, + switchCircle: { + width: 26, + height: 26, + borderRadius: 13, + }, + switchCircleOn: { + backgroundColor: 'white', + }, + switchCircleOff: { + backgroundColor: '#A5A5A5', + }, +}); +export default DeleteModal; \ No newline at end of file diff --git a/components/owner/setting.tsx b/components/owner/setting.tsx index 2193ac5..bda9cde 100644 --- a/components/owner/setting.tsx +++ b/components/owner/setting.tsx @@ -1,3 +1,4 @@ +import DeleteSvg from '@/assets/icons/svg/delete.svg'; import LogoutSvg from '@/assets/icons/svg/logout.svg'; import RightArrowSvg from '@/assets/icons/svg/rightArrow.svg'; import { useAuth } from '@/contexts/auth-context'; @@ -9,6 +10,7 @@ import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Linking, Modal, Pressable, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { ThemedText } from '../ThemedText'; +import DeleteModal from './delete'; import LcensesModal from './qualification/lcenses'; import PrivacyModal from './qualification/privacy'; import CustomSwitch from './switch'; @@ -24,6 +26,8 @@ const SettingModal = (props: { modalVisible: boolean, setModalVisible: (visible: // 许可证弹窗 const [lcensesModalVisible, setLcensesModalVisible] = useState(false); + // 删除弹窗 + const [deleteModalVisible, setDeleteModalVisible] = useState(false); const { logout } = useAuth(); const router = useRouter(); // 打开设置 @@ -358,6 +362,11 @@ const SettingModal = (props: { modalVisible: boolean, setModalVisible: (visible: {t('generalSetting.logout', { ns: 'personal' })} + {/* 注销账号 */} + setDeleteModalVisible(true)}> + {t('generalSetting.deleteAccount', { ns: 'personal' })} + + @@ -367,6 +376,8 @@ const SettingModal = (props: { modalVisible: boolean, setModalVisible: (visible: {/* 通知 */} {/* */} + {/* 退出登录 */} + ); }; diff --git a/i18n/locales/en/personal.json b/i18n/locales/en/personal.json index e813114..0c5b742 100644 --- a/i18n/locales/en/personal.json +++ b/i18n/locales/en/personal.json @@ -85,6 +85,8 @@ "conversationsWithMemo": "Conversations with Memo", "setting": "Settings", "premium": "Upgrade to Premium", - "unlock": "Unlock more memory magic" + "unlock": "Unlock more memory magic", + "delete": "Are you sure you want to delete your account?", + "cancel": "Cancel" } } \ No newline at end of file diff --git a/i18n/locales/zh/personal.json b/i18n/locales/zh/personal.json index ce221a5..c1be2df 100644 --- a/i18n/locales/zh/personal.json +++ b/i18n/locales/zh/personal.json @@ -85,6 +85,8 @@ "conversationsWithMemo": "Memo对话", "setting": "设置", "premium": "升级至会员", - "unlock": "解锁更多记忆魔法" + "unlock": "解锁更多记忆魔法", + "delete": "确定要注销账号吗?", + "cancel": "取消" } } \ No newline at end of file