@oxyhq/services 6.9.44 → 6.9.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/ui/components/OxyPayButton.js +4 -2
- package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInButton.js +83 -82
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
- package/lib/commonjs/ui/components/SettingRow.js +11 -5
- package/lib/commonjs/ui/components/SettingRow.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +76 -121
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js +32 -18
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/commonjs/ui/components/icon/OxyIcon.js +5 -4
- package/lib/commonjs/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +11 -9
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js +3 -2
- package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js +83 -219
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js.map +1 -1
- package/lib/commonjs/ui/constants/theme.js +2 -2
- package/lib/commonjs/ui/constants/theme.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +12 -10
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +70 -79
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +22 -10
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +141 -81
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js +21 -9
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +83 -50
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HistoryViewScreen.js +80 -101
- package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +66 -93
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +101 -66
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/utils/fileManagement.js +0 -21
- package/lib/commonjs/ui/utils/fileManagement.js.map +1 -1
- package/lib/module/ui/components/OxyPayButton.js +4 -2
- package/lib/module/ui/components/OxyPayButton.js.map +1 -1
- package/lib/module/ui/components/OxySignInButton.js +84 -83
- package/lib/module/ui/components/OxySignInButton.js.map +1 -1
- package/lib/module/ui/components/SettingRow.js +11 -5
- package/lib/module/ui/components/SettingRow.js.map +1 -1
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js +76 -122
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/module/ui/components/fileManagement/UploadPreview.js +32 -19
- package/lib/module/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/module/ui/components/icon/OxyIcon.js +5 -4
- package/lib/module/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js +11 -9
- package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/module/ui/components/internal/PinInput.js +3 -2
- package/lib/module/ui/components/internal/PinInput.js.map +1 -1
- package/lib/module/ui/components/modals/DeleteAccountModal.js +83 -220
- package/lib/module/ui/components/modals/DeleteAccountModal.js.map +1 -1
- package/lib/module/ui/constants/theme.js +2 -2
- package/lib/module/ui/constants/theme.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +11 -10
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +71 -80
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +22 -10
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +140 -81
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountVerificationScreen.js +22 -10
- package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +85 -52
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/HistoryViewScreen.js +80 -101
- package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +66 -94
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +101 -67
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/utils/fileManagement.js +0 -20
- package/lib/module/ui/utils/fileManagement.js.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyPayButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts +0 -1
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/SettingRow.d.ts +2 -2
- package/lib/typescript/commonjs/ui/components/SettingRow.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts +3 -4
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/UploadPreview.d.ts +2 -3
- package/lib/typescript/commonjs/ui/components/fileManagement/UploadPreview.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/icon/OxyIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/internal/PinInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts +2 -2
- package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts +0 -4
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyPayButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts +0 -1
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/SettingRow.d.ts +2 -2
- package/lib/typescript/module/ui/components/SettingRow.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts +3 -4
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/fileManagement/UploadPreview.d.ts +2 -3
- package/lib/typescript/module/ui/components/fileManagement/UploadPreview.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/icon/OxyIcon.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/internal/PinInput.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts +2 -2
- package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/fileManagement.d.ts +0 -4
- package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/ui/components/OxyPayButton.tsx +5 -3
- package/src/ui/components/OxySignInButton.tsx +82 -81
- package/src/ui/components/SettingRow.tsx +14 -7
- package/src/ui/components/fileManagement/FileDetailsModal.tsx +69 -99
- package/src/ui/components/fileManagement/UploadPreview.tsx +58 -46
- package/src/ui/components/icon/OxyIcon.tsx +5 -4
- package/src/ui/components/internal/GroupedPillButtons.tsx +15 -12
- package/src/ui/components/internal/PinInput.tsx +4 -3
- package/src/ui/components/modals/DeleteAccountModal.tsx +79 -221
- package/src/ui/constants/theme.ts +2 -2
- package/src/ui/screens/AccountCenterScreen.tsx +34 -136
- package/src/ui/screens/AccountOverviewScreen.tsx +63 -98
- package/src/ui/screens/AccountSettingsScreen.tsx +21 -7
- package/src/ui/screens/AccountSwitcherScreen.tsx +135 -87
- package/src/ui/screens/AccountVerificationScreen.tsx +24 -16
- package/src/ui/screens/FileManagementScreen.tsx +62 -54
- package/src/ui/screens/HistoryViewScreen.tsx +57 -204
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +73 -93
- package/src/ui/screens/SessionManagementScreen.tsx +101 -73
- package/src/ui/utils/fileManagement.ts +0 -30
- package/lib/commonjs/ui/utils/confirmAction.js +0 -28
- package/lib/commonjs/ui/utils/confirmAction.js.map +0 -1
- package/lib/module/ui/utils/confirmAction.js +0 -25
- package/lib/module/ui/utils/confirmAction.js.map +0 -1
- package/lib/typescript/commonjs/ui/utils/confirmAction.d.ts +0 -7
- package/lib/typescript/commonjs/ui/utils/confirmAction.d.ts.map +0 -1
- package/lib/typescript/module/ui/utils/confirmAction.d.ts +0 -7
- package/lib/typescript/module/ui/utils/confirmAction.d.ts.map +0 -1
- package/src/ui/utils/confirmAction.ts +0 -23
|
@@ -11,8 +11,9 @@ import { useCallback, useMemo } from 'react';
|
|
|
11
11
|
import type { BaseScreenProps } from '../types/navigation';
|
|
12
12
|
import { packageInfo } from '@oxyhq/core';
|
|
13
13
|
import { toast } from '../../lib/sonner';
|
|
14
|
-
import { confirmAction } from '../utils/confirmAction';
|
|
15
14
|
import { fontFamilies } from '../styles/fonts';
|
|
15
|
+
import * as Prompt from '@oxyhq/bloom/prompt';
|
|
16
|
+
import { usePromptControl } from '@oxyhq/bloom/prompt';
|
|
16
17
|
import ProfileCard from '../components/ProfileCard';
|
|
17
18
|
import Section from '../components/Section';
|
|
18
19
|
import QuickActions from '../components/QuickActions';
|
|
@@ -31,7 +32,6 @@ const AccountCenterScreen: React.FC<BaseScreenProps> = ({
|
|
|
31
32
|
theme,
|
|
32
33
|
navigate,
|
|
33
34
|
}) => {
|
|
34
|
-
// Use useOxy() hook for OxyContext values
|
|
35
35
|
const { user, logout, isLoading, sessions, isAuthenticated, managedAccounts } = useOxy();
|
|
36
36
|
const { t } = useI18n();
|
|
37
37
|
const bloomTheme = useTheme();
|
|
@@ -39,8 +39,8 @@ const AccountCenterScreen: React.FC<BaseScreenProps> = ({
|
|
|
39
39
|
const normalizedTheme = normalizeTheme(theme);
|
|
40
40
|
const dangerColor = bloomTheme.colors.error;
|
|
41
41
|
const colors = Colors[normalizeColorScheme(colorScheme, normalizedTheme)];
|
|
42
|
+
const logoutPrompt = usePromptControl();
|
|
42
43
|
|
|
43
|
-
// Memoized logout handler - prevents unnecessary re-renders
|
|
44
44
|
const handleLogout = useCallback(async () => {
|
|
45
45
|
try {
|
|
46
46
|
await logout();
|
|
@@ -55,14 +55,6 @@ const AccountCenterScreen: React.FC<BaseScreenProps> = ({
|
|
|
55
55
|
}
|
|
56
56
|
}, [logout, onClose, t]);
|
|
57
57
|
|
|
58
|
-
// Memoized confirm logout handler - prevents unnecessary re-renders
|
|
59
|
-
const confirmLogout = useCallback(() => {
|
|
60
|
-
confirmAction(
|
|
61
|
-
t('common.confirms.signOut') || 'Are you sure you want to sign out?',
|
|
62
|
-
handleLogout
|
|
63
|
-
);
|
|
64
|
-
}, [handleLogout, t]);
|
|
65
|
-
|
|
66
58
|
if (!isAuthenticated) {
|
|
67
59
|
return (
|
|
68
60
|
<View style={[styles.container, { backgroundColor: bloomTheme.colors.background }]}>
|
|
@@ -81,7 +73,6 @@ const AccountCenterScreen: React.FC<BaseScreenProps> = ({
|
|
|
81
73
|
|
|
82
74
|
return (
|
|
83
75
|
<View style={[styles.container, { backgroundColor: bloomTheme.colors.background }]}>
|
|
84
|
-
{/* Header with user profile */}
|
|
85
76
|
{user && (
|
|
86
77
|
<ProfileCard
|
|
87
78
|
user={user}
|
|
@@ -93,7 +84,6 @@ const AccountCenterScreen: React.FC<BaseScreenProps> = ({
|
|
|
93
84
|
)}
|
|
94
85
|
|
|
95
86
|
<ScrollView style={styles.scrollView} contentContainerStyle={styles.scrollContainer} showsVerticalScrollIndicator={false}>
|
|
96
|
-
{/* Quick Actions */}
|
|
97
87
|
<Section title={t('accountCenter.sections.quickActions') || 'Quick Actions'} isFirst={true}>
|
|
98
88
|
<QuickActions
|
|
99
89
|
theme={normalizedTheme}
|
|
@@ -105,144 +95,58 @@ const AccountCenterScreen: React.FC<BaseScreenProps> = ({
|
|
|
105
95
|
...(user?.isPremium ? [{ id: 'billing', icon: 'card', iconColor: colors.iconPersonalInfo, title: t('accountCenter.quickActions.billing') || 'Billing', onPress: () => navigate?.('PaymentGateway') }] : []),
|
|
106
96
|
...(sessions && sessions.length > 1 ? [{ id: 'switch', icon: 'swap-horizontal', iconColor: colors.iconStorage, title: t('accountCenter.quickActions.switch') || 'Switch', onPress: () => navigate?.('AccountSwitcher') }] : []),
|
|
107
97
|
], [user?.isPremium, sessions, navigate, t, colors])}
|
|
108
|
-
|
|
109
98
|
/>
|
|
110
99
|
</Section>
|
|
111
100
|
|
|
112
|
-
{/* Account Management */}
|
|
113
101
|
<SettingsListGroup title={t('accountCenter.sections.accountManagement') || 'Account Management'}>
|
|
114
|
-
<SettingsListItem
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
/>
|
|
120
|
-
<SettingsListItem
|
|
121
|
-
icon={<SettingsIcon name="cog" color={colors.iconData} />}
|
|
122
|
-
title={t('accountCenter.items.editProfile.title') || 'Edit Profile'}
|
|
123
|
-
description={t('accountCenter.items.editProfile.subtitle') || 'Manage your profile and preferences'}
|
|
124
|
-
onPress={() => navigate?.('AccountSettings')}
|
|
125
|
-
/>
|
|
126
|
-
<SettingsListItem
|
|
127
|
-
icon={<SettingsIcon name="shield-check" color={colors.iconSecurity} />}
|
|
128
|
-
title={t('accountCenter.items.manageSessions.title') || 'Manage Sessions'}
|
|
129
|
-
description={t('accountCenter.items.manageSessions.subtitle') || 'Security and active devices'}
|
|
130
|
-
onPress={() => navigate?.('SessionManagement')}
|
|
131
|
-
/>
|
|
132
|
-
<SettingsListItem
|
|
133
|
-
icon={<SettingsIcon name="folder" color={colors.iconStorage} />}
|
|
134
|
-
title={t('accountCenter.items.fileManagement.title') || 'File Management'}
|
|
135
|
-
description={t('accountCenter.items.fileManagement.subtitle') || 'Upload, download, and manage your files'}
|
|
136
|
-
onPress={() => navigate?.('FileManagement')}
|
|
137
|
-
/>
|
|
138
|
-
<SettingsListItem
|
|
139
|
-
icon={<SettingsIcon name="star" color={colors.iconPayments} />}
|
|
140
|
-
title={t('accountCenter.items.premium.title') || 'Oxy+ Subscriptions'}
|
|
141
|
-
description={user?.isPremium ? (t('accountCenter.items.premium.manage') || 'Manage your premium plan') : (t('accountCenter.items.premium.upgrade') || 'Upgrade to premium features')}
|
|
142
|
-
onPress={() => navigate?.('PremiumSubscription')}
|
|
143
|
-
/>
|
|
102
|
+
<SettingsListItem icon={<SettingsIcon name="account-circle" color={colors.iconSecurity} />} title={t('accountCenter.items.accountOverview.title') || 'Account Overview'} description={t('accountCenter.items.accountOverview.subtitle') || 'Complete account information'} onPress={() => navigate?.('AccountOverview')} />
|
|
103
|
+
<SettingsListItem icon={<SettingsIcon name="cog" color={colors.iconData} />} title={t('accountCenter.items.editProfile.title') || 'Edit Profile'} description={t('accountCenter.items.editProfile.subtitle') || 'Manage your profile and preferences'} onPress={() => navigate?.('AccountSettings')} />
|
|
104
|
+
<SettingsListItem icon={<SettingsIcon name="shield-check" color={colors.iconSecurity} />} title={t('accountCenter.items.manageSessions.title') || 'Manage Sessions'} description={t('accountCenter.items.manageSessions.subtitle') || 'Security and active devices'} onPress={() => navigate?.('SessionManagement')} />
|
|
105
|
+
<SettingsListItem icon={<SettingsIcon name="folder" color={colors.iconStorage} />} title={t('accountCenter.items.fileManagement.title') || 'File Management'} description={t('accountCenter.items.fileManagement.subtitle') || 'Upload, download, and manage your files'} onPress={() => navigate?.('FileManagement')} />
|
|
106
|
+
<SettingsListItem icon={<SettingsIcon name="star" color={colors.iconPayments} />} title={t('accountCenter.items.premium.title') || 'Oxy+ Subscriptions'} description={user?.isPremium ? (t('accountCenter.items.premium.manage') || 'Manage your premium plan') : (t('accountCenter.items.premium.upgrade') || 'Upgrade to premium features')} onPress={() => navigate?.('PremiumSubscription')} />
|
|
144
107
|
{user?.isPremium ? (
|
|
145
|
-
<SettingsListItem
|
|
146
|
-
icon={<SettingsIcon name="credit-card" color={colors.iconPersonalInfo} />}
|
|
147
|
-
title={t('accountCenter.items.billing.title') || 'Billing Management'}
|
|
148
|
-
description={t('accountCenter.items.billing.subtitle') || 'Payment methods and invoices'}
|
|
149
|
-
onPress={() => navigate?.('PaymentGateway')}
|
|
150
|
-
/>
|
|
108
|
+
<SettingsListItem icon={<SettingsIcon name="credit-card" color={colors.iconPersonalInfo} />} title={t('accountCenter.items.billing.title') || 'Billing Management'} description={t('accountCenter.items.billing.subtitle') || 'Payment methods and invoices'} onPress={() => navigate?.('PaymentGateway')} />
|
|
151
109
|
) : null}
|
|
152
110
|
</SettingsListGroup>
|
|
153
111
|
|
|
154
|
-
{/* Multi-Account Management */}
|
|
155
112
|
{sessions && sessions.length > 1 && (
|
|
156
113
|
<SettingsListGroup title={t('accountCenter.sections.multiAccount') || 'Multi-Account'}>
|
|
157
|
-
<SettingsListItem
|
|
158
|
-
|
|
159
|
-
title={t('accountCenter.items.switchAccount.title') || 'Switch Account'}
|
|
160
|
-
description={t('accountCenter.items.switchAccount.subtitle', { count: sessions.length }) || `${sessions.length} accounts available`}
|
|
161
|
-
onPress={() => navigate?.('AccountSwitcher')}
|
|
162
|
-
/>
|
|
163
|
-
<SettingsListItem
|
|
164
|
-
icon={<SettingsIcon name="account-plus" color={colors.iconPersonalInfo} />}
|
|
165
|
-
title={t('accountCenter.items.addAccount.title') || 'Add Another Account'}
|
|
166
|
-
description={t('accountCenter.items.addAccount.subtitle') || 'Sign in with a different account'}
|
|
167
|
-
onPress={() => navigate?.('OxyAuth')}
|
|
168
|
-
/>
|
|
114
|
+
<SettingsListItem icon={<SettingsIcon name="account-group" color={colors.iconStorage} />} title={t('accountCenter.items.switchAccount.title') || 'Switch Account'} description={t('accountCenter.items.switchAccount.subtitle', { count: sessions.length }) || `${sessions.length} accounts available`} onPress={() => navigate?.('AccountSwitcher')} />
|
|
115
|
+
<SettingsListItem icon={<SettingsIcon name="account-plus" color={colors.iconPersonalInfo} />} title={t('accountCenter.items.addAccount.title') || 'Add Another Account'} description={t('accountCenter.items.addAccount.subtitle') || 'Sign in with a different account'} onPress={() => navigate?.('OxyAuth')} />
|
|
169
116
|
</SettingsListGroup>
|
|
170
117
|
)}
|
|
171
118
|
|
|
172
|
-
{/* Single Account Setup */}
|
|
173
119
|
{(!sessions || sessions.length <= 1) && (
|
|
174
120
|
<SettingsListGroup title={t('accountCenter.sections.addAccount') || 'Add Account'}>
|
|
175
|
-
<SettingsListItem
|
|
176
|
-
icon={<SettingsIcon name="account-plus" color={colors.iconPersonalInfo} />}
|
|
177
|
-
title={t('accountCenter.items.addAccount.title') || 'Add Another Account'}
|
|
178
|
-
description={t('accountCenter.items.addAccount.subtitle') || 'Sign in with a different account'}
|
|
179
|
-
onPress={() => navigate?.('OxyAuth')}
|
|
180
|
-
/>
|
|
121
|
+
<SettingsListItem icon={<SettingsIcon name="account-plus" color={colors.iconPersonalInfo} />} title={t('accountCenter.items.addAccount.title') || 'Add Another Account'} description={t('accountCenter.items.addAccount.subtitle') || 'Sign in with a different account'} onPress={() => navigate?.('OxyAuth')} />
|
|
181
122
|
</SettingsListGroup>
|
|
182
123
|
)}
|
|
183
124
|
|
|
184
|
-
{/* Managed Accounts */}
|
|
185
125
|
{isAuthenticated && (
|
|
186
126
|
<SettingsListGroup title="Managed Accounts">
|
|
187
|
-
<SettingsListItem
|
|
188
|
-
|
|
189
|
-
title="Manage Identities"
|
|
190
|
-
description={managedAccounts.length > 0
|
|
191
|
-
? `${managedAccounts.length} managed ${managedAccounts.length === 1 ? 'identity' : 'identities'}`
|
|
192
|
-
: 'Sub-accounts you control'}
|
|
193
|
-
onPress={() => navigate?.('AccountSwitcher')}
|
|
194
|
-
/>
|
|
195
|
-
<SettingsListItem
|
|
196
|
-
icon={<SettingsIcon name="account-plus" color={colors.iconPersonalInfo} />}
|
|
197
|
-
title="Create New Identity"
|
|
198
|
-
description="Add a managed sub-account"
|
|
199
|
-
onPress={() => navigate?.('CreateManagedAccount')}
|
|
200
|
-
/>
|
|
127
|
+
<SettingsListItem icon={<SettingsIcon name="account-switch" color={colors.iconStorage} />} title="Manage Identities" description={managedAccounts.length > 0 ? `${managedAccounts.length} managed ${managedAccounts.length === 1 ? 'identity' : 'identities'}` : 'Sub-accounts you control'} onPress={() => navigate?.('AccountSwitcher')} />
|
|
128
|
+
<SettingsListItem icon={<SettingsIcon name="account-plus" color={colors.iconPersonalInfo} />} title="Create New Identity" description="Add a managed sub-account" onPress={() => navigate?.('CreateManagedAccount')} />
|
|
201
129
|
</SettingsListGroup>
|
|
202
130
|
)}
|
|
203
131
|
|
|
204
|
-
{/* Additional Options */}
|
|
205
132
|
<SettingsListGroup title={t('accountCenter.sections.moreOptions') || 'More Options'}>
|
|
206
133
|
{Platform.OS !== 'web' ? (
|
|
207
|
-
<SettingsListItem
|
|
208
|
-
icon={<SettingsIcon name="bell" color={colors.iconStorage} />}
|
|
209
|
-
title={t('accountCenter.items.notifications.title') || 'Notifications'}
|
|
210
|
-
description={t('accountCenter.items.notifications.subtitle') || 'Manage notification settings'}
|
|
211
|
-
onPress={() => navigate?.('AccountSettings', { activeTab: 'notifications' })}
|
|
212
|
-
/>
|
|
134
|
+
<SettingsListItem icon={<SettingsIcon name="bell" color={colors.iconStorage} />} title={t('accountCenter.items.notifications.title') || 'Notifications'} description={t('accountCenter.items.notifications.subtitle') || 'Manage notification settings'} onPress={() => navigate?.('AccountSettings', { activeTab: 'notifications' })} />
|
|
213
135
|
) : null}
|
|
214
|
-
<SettingsListItem
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
description={t('language.subtitle') || 'Choose your preferred language'}
|
|
218
|
-
onPress={() => navigate?.('LanguageSelector')}
|
|
219
|
-
/>
|
|
220
|
-
<SettingsListItem
|
|
221
|
-
icon={<SettingsIcon name="help-circle" color={colors.iconSecurity} />}
|
|
222
|
-
title={t('accountOverview.items.help.title') || 'Help & Support'}
|
|
223
|
-
description={t('accountOverview.items.help.subtitle') || 'Get help and contact support'}
|
|
224
|
-
onPress={() => navigate?.('HelpSupport')}
|
|
225
|
-
/>
|
|
226
|
-
<SettingsListItem
|
|
227
|
-
icon={<SettingsIcon name="information" color="#8E8E93" />}
|
|
228
|
-
title={t('accountCenter.items.appInfo.title') || 'App Information'}
|
|
229
|
-
description={t('accountCenter.items.appInfo.subtitle') || 'Version and system details'}
|
|
230
|
-
onPress={() => navigate?.('AppInfo')}
|
|
231
|
-
/>
|
|
136
|
+
<SettingsListItem icon={<SettingsIcon name="translate" color={colors.iconPersonalInfo} />} title={t('language.title') || 'Language'} description={t('language.subtitle') || 'Choose your preferred language'} onPress={() => navigate?.('LanguageSelector')} />
|
|
137
|
+
<SettingsListItem icon={<SettingsIcon name="help-circle" color={colors.iconSecurity} />} title={t('accountOverview.items.help.title') || 'Help & Support'} description={t('accountOverview.items.help.subtitle') || 'Get help and contact support'} onPress={() => navigate?.('HelpSupport')} />
|
|
138
|
+
<SettingsListItem icon={<SettingsIcon name="information" color="#8E8E93" />} title={t('accountCenter.items.appInfo.title') || 'App Information'} description={t('accountCenter.items.appInfo.subtitle') || 'Version and system details'} onPress={() => navigate?.('AppInfo')} />
|
|
232
139
|
</SettingsListGroup>
|
|
233
140
|
|
|
234
|
-
{/* Sign Out Section */}
|
|
235
141
|
<SettingsListGroup>
|
|
236
142
|
<SettingsListItem
|
|
237
143
|
icon={<SettingsIcon name="logout" color={dangerColor} />}
|
|
238
144
|
title={isLoading ? (t('accountCenter.signingOut') || 'Signing out...') : (t('common.actions.signOut') || 'Sign Out')}
|
|
239
|
-
onPress={
|
|
145
|
+
onPress={() => logoutPrompt.open()}
|
|
240
146
|
destructive={true}
|
|
241
147
|
showChevron={false}
|
|
242
148
|
disabled={isLoading}
|
|
243
|
-
rightElement={isLoading ? (
|
|
244
|
-
<ActivityIndicator color={dangerColor} size="small" />
|
|
245
|
-
) : undefined}
|
|
149
|
+
rightElement={isLoading ? (<ActivityIndicator color={dangerColor} size="small" />) : undefined}
|
|
246
150
|
/>
|
|
247
151
|
</SettingsListGroup>
|
|
248
152
|
|
|
@@ -252,32 +156,26 @@ const AccountCenterScreen: React.FC<BaseScreenProps> = ({
|
|
|
252
156
|
</Text>
|
|
253
157
|
</View>
|
|
254
158
|
</ScrollView>
|
|
159
|
+
|
|
160
|
+
<Prompt.Basic
|
|
161
|
+
control={logoutPrompt}
|
|
162
|
+
title={t('common.actions.signOut') || 'Sign Out'}
|
|
163
|
+
description={t('common.confirms.signOut') || 'Are you sure you want to sign out?'}
|
|
164
|
+
onConfirm={handleLogout}
|
|
165
|
+
confirmButtonCta={t('common.actions.signOut') || 'Sign Out'}
|
|
166
|
+
confirmButtonColor="negative"
|
|
167
|
+
/>
|
|
255
168
|
</View>
|
|
256
169
|
);
|
|
257
170
|
};
|
|
258
171
|
|
|
259
172
|
const styles = StyleSheet.create({
|
|
260
|
-
container: {
|
|
261
|
-
|
|
262
|
-
},
|
|
263
|
-
scrollView: {
|
|
264
|
-
flex: 1,
|
|
265
|
-
},
|
|
173
|
+
container: { flex: 1 },
|
|
174
|
+
scrollView: { flex: 1 },
|
|
266
175
|
scrollContainer: screenContentStyle,
|
|
267
|
-
versionContainer: {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
marginBottom: 20,
|
|
271
|
-
},
|
|
272
|
-
versionText: {
|
|
273
|
-
fontSize: 12,
|
|
274
|
-
fontFamily: fontFamilies.inter,
|
|
275
|
-
},
|
|
276
|
-
message: {
|
|
277
|
-
fontSize: 16,
|
|
278
|
-
textAlign: 'center',
|
|
279
|
-
marginTop: 24,
|
|
280
|
-
},
|
|
176
|
+
versionContainer: { alignItems: 'center', marginTop: 20, marginBottom: 20 },
|
|
177
|
+
versionText: { fontSize: 12, fontFamily: fontFamilies.inter },
|
|
178
|
+
message: { fontSize: 16, textAlign: 'center', marginTop: 24 },
|
|
281
179
|
});
|
|
282
180
|
|
|
283
181
|
export default AccountCenterScreen;
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
StyleSheet,
|
|
7
7
|
ActivityIndicator,
|
|
8
8
|
ScrollView,
|
|
9
|
-
Alert,
|
|
10
9
|
Platform,
|
|
11
10
|
Image,
|
|
12
11
|
TextStyle,
|
|
@@ -18,8 +17,9 @@ import Avatar from '../components/Avatar';
|
|
|
18
17
|
import OxyIcon from '../components/icon/OxyIcon';
|
|
19
18
|
import { fontFamilies } from '../styles/fonts';
|
|
20
19
|
import { toast } from '../../lib/sonner';
|
|
21
|
-
import { confirmAction } from '../utils/confirmAction';
|
|
22
20
|
import { Ionicons } from '@expo/vector-icons';
|
|
21
|
+
import * as Prompt from '@oxyhq/bloom/prompt';
|
|
22
|
+
import { usePromptControl } from '@oxyhq/bloom/prompt';
|
|
23
23
|
import { Section, GroupedSection, GroupedItem } from '../components';
|
|
24
24
|
import { SettingsIcon } from '../components/SettingsIcon';
|
|
25
25
|
import { useI18n } from '../hooks/useI18n';
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
createScreenContentStyle,
|
|
38
38
|
} from '../constants/spacing';
|
|
39
39
|
import { DeleteAccountModal } from '../components/modals';
|
|
40
|
+
import { useDialogControl } from '@oxyhq/bloom/dialog';
|
|
40
41
|
import { SettingsListGroup, SettingsListItem } from '@oxyhq/bloom/settings-list';
|
|
41
42
|
|
|
42
43
|
// Optional Lottie import - gracefully handle if not available
|
|
@@ -87,7 +88,10 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
87
88
|
const [showMoreAccounts, setShowMoreAccounts] = useState(false);
|
|
88
89
|
const [additionalAccountsData, setAdditionalAccountsData] = useState<any[]>([]);
|
|
89
90
|
const [loadingAdditionalAccounts, setLoadingAdditionalAccounts] = useState(false);
|
|
90
|
-
const
|
|
91
|
+
const deleteAccountControl = useDialogControl();
|
|
92
|
+
const logoutPrompt = usePromptControl();
|
|
93
|
+
const signOutAllPrompt = usePromptControl();
|
|
94
|
+
const downloadDataPrompt = usePromptControl();
|
|
91
95
|
const lottieRef = useRef<any>(null);
|
|
92
96
|
const hasPlayedRef = useRef(false);
|
|
93
97
|
const insets = useSafeAreaInsets();
|
|
@@ -199,110 +203,44 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
199
203
|
}
|
|
200
204
|
}, [logout, onClose]);
|
|
201
205
|
|
|
202
|
-
const confirmLogout = useCallback(() => {
|
|
203
|
-
confirmAction(t('common.confirms.signOut'), handleLogout);
|
|
204
|
-
}, [handleLogout]);
|
|
205
|
-
|
|
206
206
|
const handleAddAccount = useCallback(() => {
|
|
207
207
|
toast.info(t('accountOverview.addAccountComing'));
|
|
208
208
|
}, [t]);
|
|
209
209
|
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
}, [handleLogout]);
|
|
213
|
-
|
|
214
|
-
const handleDownloadData = useCallback(async () => {
|
|
215
|
-
if (!oxyServices || !user) {
|
|
216
|
-
toast.error(t('accountOverview.items.downloadData.error') || 'Service not available');
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
|
|
210
|
+
const performDownload = useCallback(async (format: 'json' | 'csv') => {
|
|
211
|
+
if (!oxyServices || !user) { toast.error(t('accountOverview.items.downloadData.error') || 'Service not available'); return; }
|
|
220
212
|
try {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
try {
|
|
233
|
-
toast.loading(t('accountOverview.items.downloadData.downloading') || 'Preparing download...');
|
|
234
|
-
const blob = await oxyServices.downloadAccountData('json');
|
|
235
|
-
|
|
236
|
-
// Create download link for web
|
|
237
|
-
if (Platform.OS === 'web') {
|
|
238
|
-
const url = URL.createObjectURL(blob);
|
|
239
|
-
const link = document.createElement('a');
|
|
240
|
-
link.href = url;
|
|
241
|
-
link.download = `account-data-${Date.now()}.json`;
|
|
242
|
-
document.body.appendChild(link);
|
|
243
|
-
link.click();
|
|
244
|
-
document.body.removeChild(link);
|
|
245
|
-
URL.revokeObjectURL(url);
|
|
246
|
-
toast.success(t('accountOverview.items.downloadData.success') || 'Data downloaded successfully');
|
|
247
|
-
} else {
|
|
248
|
-
// For React Native, you'd need to use a library like expo-file-system
|
|
249
|
-
toast.success(t('accountOverview.items.downloadData.success') || 'Data downloaded successfully');
|
|
250
|
-
}
|
|
251
|
-
} catch (error: unknown) {
|
|
252
|
-
if (__DEV__) {
|
|
253
|
-
console.error('Failed to download data:', error);
|
|
254
|
-
}
|
|
255
|
-
toast.error((error instanceof Error ? error.message : null) || t('accountOverview.items.downloadData.error') || 'Failed to download data');
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
text: 'CSV',
|
|
261
|
-
onPress: async () => {
|
|
262
|
-
try {
|
|
263
|
-
toast.loading(t('accountOverview.items.downloadData.downloading') || 'Preparing download...');
|
|
264
|
-
const blob = await oxyServices.downloadAccountData('csv');
|
|
265
|
-
|
|
266
|
-
// Create download link for web
|
|
267
|
-
if (Platform.OS === 'web') {
|
|
268
|
-
const url = URL.createObjectURL(blob);
|
|
269
|
-
const link = document.createElement('a');
|
|
270
|
-
link.href = url;
|
|
271
|
-
link.download = `account-data-${Date.now()}.csv`;
|
|
272
|
-
document.body.appendChild(link);
|
|
273
|
-
link.click();
|
|
274
|
-
document.body.removeChild(link);
|
|
275
|
-
URL.revokeObjectURL(url);
|
|
276
|
-
toast.success(t('accountOverview.items.downloadData.success') || 'Data downloaded successfully');
|
|
277
|
-
} else {
|
|
278
|
-
// For React Native, you'd need to use a library like expo-file-system
|
|
279
|
-
toast.success(t('accountOverview.items.downloadData.success') || 'Data downloaded successfully');
|
|
280
|
-
}
|
|
281
|
-
} catch (error: unknown) {
|
|
282
|
-
if (__DEV__) {
|
|
283
|
-
console.error('Failed to download data:', error);
|
|
284
|
-
}
|
|
285
|
-
toast.error((error instanceof Error ? error.message : null) || t('accountOverview.items.downloadData.error') || 'Failed to download data');
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
},
|
|
289
|
-
]
|
|
290
|
-
);
|
|
291
|
-
} catch (error: unknown) {
|
|
292
|
-
if (__DEV__) {
|
|
293
|
-
console.error('Failed to initiate download:', error);
|
|
213
|
+
toast.loading(t('accountOverview.items.downloadData.downloading') || 'Preparing download...');
|
|
214
|
+
const blob = await oxyServices.downloadAccountData(format);
|
|
215
|
+
if (Platform.OS === 'web') {
|
|
216
|
+
const url = URL.createObjectURL(blob);
|
|
217
|
+
const link = document.createElement('a');
|
|
218
|
+
link.href = url;
|
|
219
|
+
link.download = `account-data-${Date.now()}.${format}`;
|
|
220
|
+
document.body.appendChild(link);
|
|
221
|
+
link.click();
|
|
222
|
+
document.body.removeChild(link);
|
|
223
|
+
URL.revokeObjectURL(url);
|
|
294
224
|
}
|
|
225
|
+
toast.success(t('accountOverview.items.downloadData.success') || 'Data downloaded successfully');
|
|
226
|
+
} catch (error: unknown) {
|
|
227
|
+
if (__DEV__) { console.error('Failed to download data:', error); }
|
|
295
228
|
toast.error((error instanceof Error ? error.message : null) || t('accountOverview.items.downloadData.error') || 'Failed to download data');
|
|
296
229
|
}
|
|
297
230
|
}, [oxyServices, user, t]);
|
|
298
231
|
|
|
232
|
+
const handleDownloadData = useCallback(() => {
|
|
233
|
+
if (!oxyServices || !user) { toast.error(t('accountOverview.items.downloadData.error') || 'Service not available'); return; }
|
|
234
|
+
downloadDataPrompt.open();
|
|
235
|
+
}, [oxyServices, user, t, downloadDataPrompt]);
|
|
236
|
+
|
|
299
237
|
const handleDeleteAccount = useCallback(() => {
|
|
300
238
|
if (!user) {
|
|
301
239
|
toast.error(t('accountOverview.items.deleteAccount.error') || 'User not available');
|
|
302
240
|
return;
|
|
303
241
|
}
|
|
304
|
-
|
|
305
|
-
}, [user, t]);
|
|
242
|
+
deleteAccountControl.open();
|
|
243
|
+
}, [user, t, deleteAccountControl]);
|
|
306
244
|
|
|
307
245
|
const handleConfirmDelete = useCallback(async (password: string) => {
|
|
308
246
|
if (!oxyServices || !user) {
|
|
@@ -311,7 +249,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
311
249
|
|
|
312
250
|
await oxyServices.deleteAccount(password);
|
|
313
251
|
toast.success(t('accountOverview.items.deleteAccount.success') || 'Account deleted successfully');
|
|
314
|
-
|
|
252
|
+
deleteAccountControl.close();
|
|
315
253
|
await logout();
|
|
316
254
|
if (onClose) {
|
|
317
255
|
onClose();
|
|
@@ -514,7 +452,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
514
452
|
icon={<SettingsIcon name="logout" color={baseThemeColors.iconSharing} />}
|
|
515
453
|
title={t('accountOverview.items.signOutAll.title') || 'Sign out of all accounts'}
|
|
516
454
|
description={t('accountOverview.items.signOutAll.subtitle') || 'Remove all accounts from this device'}
|
|
517
|
-
onPress={
|
|
455
|
+
onPress={() => signOutAllPrompt.open()}
|
|
518
456
|
/>
|
|
519
457
|
</SettingsListGroup>
|
|
520
458
|
)}
|
|
@@ -619,23 +557,50 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
619
557
|
icon={<SettingsIcon name="logout" color="#FF3B30" />}
|
|
620
558
|
title={t('accountOverview.items.signOut.title')}
|
|
621
559
|
description={t('accountOverview.items.signOut.subtitle')}
|
|
622
|
-
onPress={
|
|
560
|
+
onPress={() => logoutPrompt.open()}
|
|
623
561
|
destructive={true}
|
|
624
562
|
showChevron={false}
|
|
625
563
|
/>
|
|
626
564
|
</SettingsListGroup>
|
|
627
565
|
</ScrollView>
|
|
628
566
|
|
|
629
|
-
{/* Delete Account
|
|
567
|
+
{/* Delete Account Dialog */}
|
|
630
568
|
{user && (
|
|
631
569
|
<DeleteAccountModal
|
|
632
|
-
|
|
570
|
+
control={deleteAccountControl}
|
|
633
571
|
username={user.username || ''}
|
|
634
|
-
onClose={() => setShowDeleteModal(false)}
|
|
635
572
|
onDelete={handleConfirmDelete}
|
|
636
573
|
t={t}
|
|
637
574
|
/>
|
|
638
575
|
)}
|
|
576
|
+
|
|
577
|
+
<Prompt.Basic
|
|
578
|
+
control={logoutPrompt}
|
|
579
|
+
title={t('accountOverview.items.signOut.title') || 'Sign Out'}
|
|
580
|
+
description={t('common.confirms.signOut') || 'Are you sure you want to sign out?'}
|
|
581
|
+
onConfirm={handleLogout}
|
|
582
|
+
confirmButtonCta={t('accountOverview.items.signOut.title') || 'Sign Out'}
|
|
583
|
+
confirmButtonColor="negative"
|
|
584
|
+
/>
|
|
585
|
+
<Prompt.Basic
|
|
586
|
+
control={signOutAllPrompt}
|
|
587
|
+
title={t('accountOverview.items.signOutAll.title') || 'Sign Out All'}
|
|
588
|
+
description={t('common.confirms.signOutAll') || 'Are you sure you want to sign out of all accounts?'}
|
|
589
|
+
onConfirm={handleLogout}
|
|
590
|
+
confirmButtonCta={t('accountOverview.items.signOutAll.title') || 'Sign Out All'}
|
|
591
|
+
confirmButtonColor="negative"
|
|
592
|
+
/>
|
|
593
|
+
<Prompt.Outer control={downloadDataPrompt}>
|
|
594
|
+
<Prompt.Content>
|
|
595
|
+
<Prompt.TitleText>{t('accountOverview.items.downloadData.confirmTitle') || 'Download Account Data'}</Prompt.TitleText>
|
|
596
|
+
<Prompt.DescriptionText>{t('accountOverview.items.downloadData.confirmMessage') || 'Choose the format for your account data export:'}</Prompt.DescriptionText>
|
|
597
|
+
</Prompt.Content>
|
|
598
|
+
<Prompt.Actions>
|
|
599
|
+
<Prompt.Action cta="JSON" onPress={() => performDownload('json')} color="primary" />
|
|
600
|
+
<Prompt.Action cta="CSV" onPress={() => performDownload('csv')} color="primary_subtle" />
|
|
601
|
+
<Prompt.Cancel cta={t('common.cancel') || 'Cancel'} />
|
|
602
|
+
</Prompt.Actions>
|
|
603
|
+
</Prompt.Outer>
|
|
639
604
|
</View>
|
|
640
605
|
);
|
|
641
606
|
};
|
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
import type { BaseScreenProps } from '../types/navigation';
|
|
13
13
|
import { toast } from '../../lib/sonner';
|
|
14
14
|
import { fontFamilies } from '../styles/fonts';
|
|
15
|
-
import
|
|
15
|
+
import * as Prompt from '@oxyhq/bloom/prompt';
|
|
16
|
+
import { usePromptControl } from '@oxyhq/bloom/prompt';
|
|
16
17
|
import { useAuthStore } from '../stores/authStore';
|
|
17
18
|
import { GroupedSection } from '../components';
|
|
18
19
|
import { useI18n } from '../hooks/useI18n';
|
|
@@ -54,6 +55,9 @@ const AccountSettingsScreen: React.FC<BaseScreenProps & { initialField?: string;
|
|
|
54
55
|
const { data: user, isLoading: userLoading } = useCurrentUser({ enabled: isAuthenticated });
|
|
55
56
|
const uploadAvatarMutation = useUploadAvatar();
|
|
56
57
|
|
|
58
|
+
// Prompt controls
|
|
59
|
+
const removeAvatarPrompt = usePromptControl();
|
|
60
|
+
|
|
57
61
|
// Fallback to store for backward compatibility
|
|
58
62
|
const userFromStore = useAuthStore((state) => state.user);
|
|
59
63
|
const finalUser = user || userFromStore;
|
|
@@ -259,12 +263,14 @@ const AccountSettingsScreen: React.FC<BaseScreenProps & { initialField?: string;
|
|
|
259
263
|
}
|
|
260
264
|
}, [initialSection, sectionYPositions]);
|
|
261
265
|
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
const handleAvatarRemoveConfirmed = useCallback(() => {
|
|
267
|
+
setAvatarFileId('');
|
|
268
|
+
toast.success(t('editProfile.toasts.avatarRemoved') || 'Avatar removed');
|
|
269
|
+
}, [t]);
|
|
270
|
+
|
|
271
|
+
const handleAvatarRemove = useCallback(() => {
|
|
272
|
+
removeAvatarPrompt.open();
|
|
273
|
+
}, [removeAvatarPrompt]);
|
|
268
274
|
|
|
269
275
|
const { openAvatarPicker } = useOxy();
|
|
270
276
|
|
|
@@ -573,6 +579,14 @@ const AccountSettingsScreen: React.FC<BaseScreenProps & { initialField?: string;
|
|
|
573
579
|
</View>
|
|
574
580
|
</View>
|
|
575
581
|
</ScrollView>
|
|
582
|
+
<Prompt.Basic
|
|
583
|
+
control={removeAvatarPrompt}
|
|
584
|
+
title={t('editProfile.confirms.removeAvatarTitle') || 'Remove Avatar'}
|
|
585
|
+
description={t('editProfile.confirms.removeAvatar') || 'Remove your profile picture?'}
|
|
586
|
+
onConfirm={handleAvatarRemoveConfirmed}
|
|
587
|
+
confirmButtonCta={t('common.remove') || 'Remove'}
|
|
588
|
+
confirmButtonColor='negative'
|
|
589
|
+
/>
|
|
576
590
|
</View>
|
|
577
591
|
);
|
|
578
592
|
};
|