feat: 注销账号+文案
This commit is contained in:
parent
128175339b
commit
e7861d9ce9
10
app.json
10
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
|
||||
}
|
||||
],
|
||||
|
||||
@ -52,10 +52,6 @@ const LoginScreen = () => {
|
||||
router.setParams({ [key]: value });
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
// setError('123')
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<KeyboardAvoidingView
|
||||
style={{ flex: 1 }}
|
||||
|
||||
204
components/owner/delete.tsx
Normal file
204
components/owner/delete.tsx
Normal file
@ -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 (
|
||||
<Modal
|
||||
animationType="fade"
|
||||
transparent={true}
|
||||
visible={modalVisible}
|
||||
onRequestClose={() => setModalVisible(false)}
|
||||
>
|
||||
<View style={styles.centeredView}>
|
||||
<View style={styles.modalView}>
|
||||
<ThemedText style={styles.modalTitle}>
|
||||
{t("generalSetting.delete", { ns: "personal" })}
|
||||
</ThemedText>
|
||||
<View style={styles.buttonContainer}>
|
||||
<Pressable
|
||||
style={[styles.button, styles.cancelButton]}
|
||||
onPress={() => setModalVisible(false)}
|
||||
>
|
||||
<ThemedText style={styles.cancelButtonText}>
|
||||
{t("generalSetting.cancel", { ns: "personal" })}
|
||||
</ThemedText>
|
||||
</Pressable>
|
||||
<Pressable
|
||||
style={[styles.button, styles.deleteButton]}
|
||||
onPress={handleDeleteAccount}
|
||||
>
|
||||
<ThemedText style={styles.deleteButtonText}>
|
||||
{t("generalSetting.deleteAccount", { ns: "personal" })}
|
||||
</ThemedText>
|
||||
</Pressable>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
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;
|
||||
@ -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:
|
||||
<ThemedText style={{ color: '#E2793F', fontSize: 14, fontWeight: '600' }}>{t('generalSetting.logout', { ns: 'personal' })}</ThemedText>
|
||||
<LogoutSvg />
|
||||
</TouchableOpacity>
|
||||
{/* 注销账号 */}
|
||||
<TouchableOpacity style={[styles.premium, { marginVertical: 8 }]} onPress={() => setDeleteModalVisible(true)}>
|
||||
<ThemedText style={{ color: '#E2793F', fontSize: 14, fontWeight: '600' }}>{t('generalSetting.deleteAccount', { ns: 'personal' })}</ThemedText>
|
||||
<DeleteSvg />
|
||||
</TouchableOpacity>
|
||||
</ScrollView>
|
||||
</Pressable>
|
||||
</Pressable>
|
||||
@ -367,6 +376,8 @@ const SettingModal = (props: { modalVisible: boolean, setModalVisible: (visible:
|
||||
<LcensesModal modalVisible={lcensesModalVisible} setModalVisible={setLcensesModalVisible} />
|
||||
{/* 通知 */}
|
||||
{/* <AuthNotifications setNotificationsEnabled={setNotificationsEnabled} notificationsEnabled={notificationsEnabled} /> */}
|
||||
{/* 退出登录 */}
|
||||
<DeleteModal modalVisible={deleteModalVisible} setModalVisible={setDeleteModalVisible} setSettingModalVisible={setModalVisible} />
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
@ -83,6 +83,10 @@
|
||||
"videoLength": "Video Duration",
|
||||
"storiesCreated": "Stories Created",
|
||||
"conversationsWithMemo": "Conversations with Memo",
|
||||
"setting": "Settings"
|
||||
"setting": "Settings",
|
||||
"premium": "Upgrade to Premium",
|
||||
"unlock": "Unlock more memory magic",
|
||||
"delete": "Are you sure you want to delete your account?",
|
||||
"cancel": "Cancel"
|
||||
}
|
||||
}
|
||||
@ -83,6 +83,10 @@
|
||||
"videoLength": "视频时长",
|
||||
"storiesCreated": "创作视频",
|
||||
"conversationsWithMemo": "Memo对话",
|
||||
"setting": "设置"
|
||||
"setting": "设置",
|
||||
"premium": "升级至会员",
|
||||
"unlock": "解锁更多记忆魔法",
|
||||
"delete": "确定要注销账号吗?",
|
||||
"cancel": "取消"
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user