Skip to content

Commit 54f31fd

Browse files
committed
feat: add account deletion option
1 parent 1ed273e commit 54f31fd

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

i18n/mobile/profile/en.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
"PROFILE": {
33
"PROFILE_MENU_SHEET": {
44
"TEXT_LOGOUT": "Logout",
5-
"TEXT_ARCHIVED_CHATS": "Archived Chats"
5+
"TEXT_ARCHIVED_CHATS": "Archived Chats",
6+
"TEXT_DELETE_ACCOUNT": "Delete Account",
7+
"TEXT_DELETE_ACCOUNT_TITLE": "Are you sure you want to delete your account?",
8+
"TEXT_DELETE_ACCOUNT_MESSAGE": "This action will result in permanent data loss if we don't hear from you in the next 30 days.",
9+
"BUTTON_DELETE_ACCOUNT": "Yes, delete my account",
10+
"BUTTON_DONT_DELETE": "Don't delete",
11+
"TEXT_ACCOUNT_DELETION_REQUEST": "Your account deletion request has been submitted."
612
}
713
}
814
}

libs/mobile/shared/features/profile-menu-sheet/src/lib/component.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { BottomSheetModal } from '@gorhom/bottom-sheet';
22
import { useTranslation } from '@ronas-it/react-native-common-modules/i18n';
33
import { ReactElement, useRef } from 'react';
4+
import { Alert } from 'react-native';
45
import { useLogout } from '@open-webui-react-native/mobile/shared/features/use-logout';
56
import {
67
Avatar,
@@ -36,6 +37,25 @@ export function ProfileMenuSheet({ onArchivedChatsPress, ...restProps }: Profile
3637
onArchivedChatsPress();
3738
};
3839

40+
const handleDeleteAccountPress = (): void => {
41+
ToastService.show(translate('TEXT_ACCOUNT_DELETION_REQUEST'));
42+
};
43+
44+
const handleRequestDeleteAccountPress = async (): Promise<void> => {
45+
await closeActionsSheet();
46+
Alert.alert(
47+
translate('TEXT_DELETE_ACCOUNT_TITLE'),
48+
translate('TEXT_DELETE_ACCOUNT_MESSAGE'),
49+
[
50+
{ text: translate('BUTTON_DELETE_ACCOUNT'), style: 'destructive', onPress: handleDeleteAccountPress },
51+
{ text: translate('BUTTON_DONT_DELETE'), style: 'cancel' },
52+
],
53+
{
54+
userInterfaceStyle: 'dark',
55+
},
56+
);
57+
};
58+
3959
const actions: Array<ActionSheetItemProps> = [
4060
{
4161
title: translate('TEXT_ARCHIVED_CHATS'),
@@ -44,6 +64,12 @@ export function ProfileMenuSheet({ onArchivedChatsPress, ...restProps }: Profile
4464
? handleArchivedChatsPress
4565
: ToastService.showFeatureNotImplemented,
4666
},
67+
{
68+
title: translate('TEXT_DELETE_ACCOUNT'),
69+
iconName: 'trashCan',
70+
onPress: handleRequestDeleteAccountPress,
71+
isDanger: true,
72+
},
4773
{
4874
title: translate('TEXT_LOGOUT'),
4975
iconName: 'logout',

0 commit comments

Comments
 (0)