@oxyhq/services 5.7.5 → 5.8.1
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/README.md +76 -76
- package/lib/commonjs/core/index.js +177 -102
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/index.js +88 -29
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/node/createAuth.js +585 -7
- package/lib/commonjs/node/createAuth.js.map +1 -1
- package/lib/commonjs/node/index.js +38 -1
- package/lib/commonjs/node/index.js.map +1 -1
- package/lib/commonjs/ui/components/Avatar.js +15 -6
- package/lib/commonjs/ui/components/Avatar.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedItem.js +58 -13
- package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedSection.js +7 -1
- package/lib/commonjs/ui/components/GroupedSection.js.map +1 -1
- package/lib/commonjs/ui/components/Header.js +322 -0
- package/lib/commonjs/ui/components/Header.js.map +1 -0
- package/lib/commonjs/ui/components/OxyProvider.js +23 -7
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/index.js +7 -0
- package/lib/commonjs/ui/components/index.js.map +1 -1
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +1 -1
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/commonjs/ui/components/internal/TextField.js +606 -546
- package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
- package/lib/commonjs/ui/components/internal/TextField.md +436 -0
- package/lib/commonjs/ui/context/OxyContext.js +122 -78
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionSocket.js +5 -2
- package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/commonjs/ui/navigation/OxyRouter.js +1 -1
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +6 -6
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountManagementDemo.js +3 -3
- package/lib/commonjs/ui/screens/AccountManagementDemo.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +241 -598
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +1151 -406
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +135 -237
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +246 -463
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +3 -3
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +808 -650
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js +51 -72
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +11 -29
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +30 -303
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignUpScreen.js +4 -4
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +19 -31
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +7 -10
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +11 -5
- package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +11 -4
- package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
- package/lib/commonjs/ui/stores/authStore.js +12 -0
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/styles/authStyles.js +337 -0
- package/lib/commonjs/ui/styles/authStyles.js.map +1 -0
- package/lib/commonjs/ui/styles/index.js +11 -0
- package/lib/commonjs/ui/styles/index.js.map +1 -1
- package/lib/module/core/index.js +177 -41
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/index.js +26 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/node/createAuth.js +584 -7
- package/lib/module/node/createAuth.js.map +1 -1
- package/lib/module/node/index.js +7 -1
- package/lib/module/node/index.js.map +1 -1
- package/lib/module/ui/components/Avatar.js +15 -6
- package/lib/module/ui/components/Avatar.js.map +1 -1
- package/lib/module/ui/components/GroupedItem.js +59 -14
- package/lib/module/ui/components/GroupedItem.js.map +1 -1
- package/lib/module/ui/components/GroupedSection.js +7 -1
- package/lib/module/ui/components/GroupedSection.js.map +1 -1
- package/lib/module/ui/components/Header.js +317 -0
- package/lib/module/ui/components/Header.js.map +1 -0
- package/lib/module/ui/components/OxyProvider.js +25 -9
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/index.js +1 -0
- package/lib/module/ui/components/index.js.map +1 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js +1 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/module/ui/components/internal/TextField.js +607 -547
- package/lib/module/ui/components/internal/TextField.js.map +1 -1
- package/lib/module/ui/components/internal/TextField.md +436 -0
- package/lib/module/ui/context/OxyContext.js +121 -77
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/useSessionSocket.js +5 -2
- package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/module/ui/navigation/OxyRouter.js +1 -1
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +6 -6
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountManagementDemo.js +3 -3
- package/lib/module/ui/screens/AccountManagementDemo.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +242 -597
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +1152 -407
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +135 -237
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +248 -465
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js +3 -3
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js +809 -651
- package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/module/ui/screens/RecoverAccountScreen.js +53 -74
- package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +11 -29
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +32 -305
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/SignUpScreen.js +5 -5
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInPasswordStep.js +19 -31
- package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInUsernameStep.js +7 -10
- package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignUpIdentityStep.js +11 -5
- package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignUpSecurityStep.js +11 -4
- package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +12 -0
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/styles/authStyles.js +332 -0
- package/lib/module/ui/styles/authStyles.js.map +1 -0
- package/lib/module/ui/styles/index.js +1 -0
- package/lib/module/ui/styles/index.js.map +1 -1
- package/lib/typescript/core/index.d.ts +68 -24
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +13 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/node/createAuth.d.ts +112 -0
- package/lib/typescript/node/createAuth.d.ts.map +1 -1
- package/lib/typescript/node/index.d.ts +2 -0
- package/lib/typescript/node/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/Avatar.d.ts.map +1 -1
- package/lib/typescript/ui/components/GroupedItem.d.ts +6 -0
- package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -1
- package/lib/typescript/ui/components/GroupedSection.d.ts +6 -0
- package/lib/typescript/ui/components/GroupedSection.d.ts.map +1 -1
- package/lib/typescript/ui/components/Header.d.ts +22 -0
- package/lib/typescript/ui/components/Header.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/components/index.d.ts +1 -0
- package/lib/typescript/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/TextField.d.ts +31 -16
- package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +5 -2
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/types.d.ts +9 -2
- package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +5 -1
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +1 -1
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +0 -1
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +1 -1
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/ui/styles/authStyles.d.ts +326 -0
- package/lib/typescript/ui/styles/authStyles.d.ts.map +1 -0
- package/lib/typescript/ui/styles/index.d.ts +1 -0
- package/lib/typescript/ui/styles/index.d.ts.map +1 -1
- package/package.json +1 -4
- package/src/core/index.ts +195 -41
- package/src/index.ts +72 -4
- package/src/node/createAuth.ts +623 -7
- package/src/node/index.ts +19 -1
- package/src/ui/components/Avatar.tsx +11 -5
- package/src/ui/components/GroupedItem.tsx +57 -9
- package/src/ui/components/GroupedSection.tsx +12 -0
- package/src/ui/components/Header.tsx +364 -0
- package/src/ui/components/OxyProvider.tsx +31 -15
- package/src/ui/components/index.ts +1 -0
- package/src/ui/components/internal/GroupedPillButtons.tsx +1 -1
- package/src/ui/components/internal/TextField.md +436 -0
- package/src/ui/components/internal/TextField.tsx +720 -620
- package/src/ui/context/OxyContext.tsx +150 -63
- package/src/ui/hooks/useSessionSocket.ts +5 -2
- package/src/ui/navigation/OxyRouter.tsx +1 -1
- package/src/ui/navigation/types.ts +10 -2
- package/src/ui/screens/AccountCenterScreen.tsx +5 -5
- package/src/ui/screens/AccountManagementDemo.tsx +9 -9
- package/src/ui/screens/AccountOverviewScreen.tsx +265 -414
- package/src/ui/screens/AccountSettingsScreen.tsx +1165 -403
- package/src/ui/screens/AccountSwitcherScreen.tsx +158 -202
- package/src/ui/screens/AppInfoScreen.tsx +270 -497
- package/src/ui/screens/FeedbackScreen.tsx +3 -3
- package/src/ui/screens/PaymentGatewayScreen.tsx +668 -365
- package/src/ui/screens/ProfileScreen.tsx +5 -5
- package/src/ui/screens/RecoverAccountScreen.tsx +46 -74
- package/src/ui/screens/SessionManagementScreen.tsx +14 -22
- package/src/ui/screens/SignInScreen.tsx +27 -294
- package/src/ui/screens/SignUpScreen.tsx +5 -5
- package/src/ui/screens/internal/SignInPasswordStep.tsx +11 -22
- package/src/ui/screens/internal/SignInUsernameStep.tsx +3 -10
- package/src/ui/screens/internal/SignUpIdentityStep.tsx +2 -5
- package/src/ui/screens/internal/SignUpSecurityStep.tsx +3 -4
- package/src/ui/stores/authStore.ts +12 -0
- package/src/ui/styles/authStyles.ts +352 -0
- package/src/ui/styles/index.ts +1 -0
- package/lib/commonjs/core/auth-manager.js +0 -440
- package/lib/commonjs/core/auth-manager.js.map +0 -1
- package/lib/commonjs/core/use-auth.js +0 -244
- package/lib/commonjs/core/use-auth.js.map +0 -1
- package/lib/module/core/auth-manager.js +0 -432
- package/lib/module/core/auth-manager.js.map +0 -1
- package/lib/module/core/use-auth.js +0 -235
- package/lib/module/core/use-auth.js.map +0 -1
- package/lib/typescript/core/auth-manager.d.ts +0 -136
- package/lib/typescript/core/auth-manager.d.ts.map +0 -1
- package/lib/typescript/core/use-auth.d.ts +0 -79
- package/lib/typescript/core/use-auth.d.ts.map +0 -1
- package/src/__tests__/middleware.test.ts +0 -105
- package/src/__tests__/setup.ts +0 -10
- package/src/__tests__/zero-config-auth.test.ts +0 -607
- package/src/core/auth-manager.ts +0 -500
- package/src/core/use-auth.tsx +0 -245
|
@@ -21,6 +21,7 @@ import { confirmAction } from '../utils/confirmAction';
|
|
|
21
21
|
import OxyIcon from '../components/icon/OxyIcon';
|
|
22
22
|
import { Ionicons } from '@expo/vector-icons';
|
|
23
23
|
import Avatar from '../components/Avatar';
|
|
24
|
+
import { Header, GroupedSection } from '../components';
|
|
24
25
|
|
|
25
26
|
interface SessionWithUser extends SecureClientSession {
|
|
26
27
|
userProfile?: User;
|
|
@@ -51,6 +52,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
51
52
|
switchSession,
|
|
52
53
|
removeSession,
|
|
53
54
|
logoutAll,
|
|
55
|
+
refreshSessions,
|
|
54
56
|
isLoading,
|
|
55
57
|
isAuthenticated
|
|
56
58
|
} = useOxy();
|
|
@@ -84,8 +86,20 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
84
86
|
shadow: isDarkTheme ? 'rgba(0,0,0,0.3)' : 'rgba(0,0,0,0.1)',
|
|
85
87
|
};
|
|
86
88
|
|
|
89
|
+
// Refresh sessions when screen loads
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (isAuthenticated && activeSessionId) {
|
|
92
|
+
refreshSessions();
|
|
93
|
+
}
|
|
94
|
+
}, [isAuthenticated, activeSessionId]);
|
|
95
|
+
|
|
87
96
|
// Load user profiles for sessions
|
|
88
97
|
useEffect(() => {
|
|
98
|
+
console.log('AccountSwitcherScreen - sessions changed:', sessions);
|
|
99
|
+
console.log('AccountSwitcherScreen - sessions length:', sessions.length);
|
|
100
|
+
console.log('AccountSwitcherScreen - activeSessionId:', activeSessionId);
|
|
101
|
+
console.log('AccountSwitcherScreen - isAuthenticated:', isAuthenticated);
|
|
102
|
+
|
|
89
103
|
const loadUserProfiles = async () => {
|
|
90
104
|
if (!sessions.length || !oxyServices) return;
|
|
91
105
|
|
|
@@ -162,44 +176,22 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
162
176
|
};
|
|
163
177
|
|
|
164
178
|
const handleLogoutAll = async () => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (typeof logoutAll !== 'function') {
|
|
182
|
-
console.error('🔴 ERROR: logoutAll is not a function!', typeof logoutAll);
|
|
183
|
-
toast.error('Logout function not available. Please try refreshing the app.');
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// TEMPORARY: Skip confirmation dialog to test direct logout
|
|
188
|
-
console.log('🔴 TESTING: Bypassing confirmation dialog for direct test');
|
|
189
|
-
try {
|
|
190
|
-
console.log('🔴 TESTING: About to call logoutAll() directly');
|
|
191
|
-
await logoutAll();
|
|
192
|
-
console.log('🔴 TESTING: logoutAll() completed successfully');
|
|
193
|
-
toast.success('All accounts signed out successfully!');
|
|
194
|
-
if (onClose) {
|
|
195
|
-
console.log('🔴 TESTING: Calling onClose');
|
|
196
|
-
onClose();
|
|
179
|
+
confirmAction(
|
|
180
|
+
'Are you sure you want to sign out of all accounts? This will remove all saved accounts from this device.',
|
|
181
|
+
async () => {
|
|
182
|
+
try {
|
|
183
|
+
await logoutAll();
|
|
184
|
+
toast.success('All accounts signed out successfully!');
|
|
185
|
+
if (onClose) {
|
|
186
|
+
onClose();
|
|
187
|
+
}
|
|
188
|
+
} catch (error) {
|
|
189
|
+
console.error('Logout all failed:', error);
|
|
190
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
191
|
+
toast.error(`There was a problem signing out: ${errorMessage}`);
|
|
192
|
+
}
|
|
197
193
|
}
|
|
198
|
-
|
|
199
|
-
console.error('🔴 TESTING: Logout all failed:', error);
|
|
200
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
201
|
-
toast.error(`There was a problem signing out: ${errorMessage}`);
|
|
202
|
-
}
|
|
194
|
+
);
|
|
203
195
|
};
|
|
204
196
|
|
|
205
197
|
// Device session management functions
|
|
@@ -269,17 +261,22 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
269
261
|
return (
|
|
270
262
|
<View style={[styles.container, { backgroundColor: '#f2f2f2' }]}>
|
|
271
263
|
{/* Header */}
|
|
272
|
-
<
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
{
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
264
|
+
<Header
|
|
265
|
+
title="Account Switcher"
|
|
266
|
+
theme={theme}
|
|
267
|
+
onBack={goBack}
|
|
268
|
+
onClose={onClose}
|
|
269
|
+
showBackButton={true}
|
|
270
|
+
showCloseButton={true}
|
|
271
|
+
elevation="subtle"
|
|
272
|
+
rightAction={{
|
|
273
|
+
icon: "refresh",
|
|
274
|
+
onPress: () => {
|
|
275
|
+
console.log('Manual refresh triggered');
|
|
276
|
+
refreshSessions();
|
|
277
|
+
}
|
|
278
|
+
}}
|
|
279
|
+
/>
|
|
283
280
|
|
|
284
281
|
<ScrollView style={styles.content}>
|
|
285
282
|
{isLoading ? (
|
|
@@ -410,56 +407,36 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
410
407
|
<View style={styles.section}>
|
|
411
408
|
<Text style={styles.sectionTitle}>Quick Actions</Text>
|
|
412
409
|
|
|
413
|
-
<
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
</TouchableOpacity>
|
|
444
|
-
|
|
445
|
-
<TouchableOpacity
|
|
446
|
-
style={[styles.settingItem, styles.lastSettingItem]}
|
|
447
|
-
onPress={handleLogoutAll}
|
|
448
|
-
disabled={sessionsWithUsers.length === 0}
|
|
449
|
-
>
|
|
450
|
-
<View style={styles.settingInfo}>
|
|
451
|
-
<OxyIcon name="log-out" size={20} color="#FF3B30" style={styles.settingIcon} />
|
|
452
|
-
<View>
|
|
453
|
-
<Text style={[styles.settingLabel, { color: sessionsWithUsers.length === 0 ? '#ccc' : '#FF3B30' }]}>
|
|
454
|
-
Sign Out All Accounts
|
|
455
|
-
</Text>
|
|
456
|
-
<Text style={styles.settingDescription}>
|
|
457
|
-
Remove all accounts from this device
|
|
458
|
-
</Text>
|
|
459
|
-
</View>
|
|
460
|
-
</View>
|
|
461
|
-
<OxyIcon name="chevron-forward" size={16} color="#ccc" />
|
|
462
|
-
</TouchableOpacity>
|
|
410
|
+
<GroupedSection
|
|
411
|
+
items={[
|
|
412
|
+
{
|
|
413
|
+
id: 'add-account',
|
|
414
|
+
icon: 'person-add',
|
|
415
|
+
iconColor: '#007AFF',
|
|
416
|
+
title: 'Add Another Account',
|
|
417
|
+
subtitle: 'Sign in with a different account',
|
|
418
|
+
onPress: () => navigate?.('SignIn'),
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
id: 'device-management',
|
|
422
|
+
icon: 'phone-portrait',
|
|
423
|
+
iconColor: '#5856D6',
|
|
424
|
+
title: `${showDeviceManagement ? 'Hide' : 'Manage'} Device Sessions`,
|
|
425
|
+
subtitle: 'View and manage sessions on other devices',
|
|
426
|
+
onPress: () => setShowDeviceManagement(!showDeviceManagement),
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
id: 'sign-out-all',
|
|
430
|
+
icon: 'log-out',
|
|
431
|
+
iconColor: '#FF3B30',
|
|
432
|
+
title: 'Sign Out All Accounts',
|
|
433
|
+
subtitle: 'Remove all accounts from this device',
|
|
434
|
+
onPress: handleLogoutAll,
|
|
435
|
+
disabled: sessionsWithUsers.length === 0,
|
|
436
|
+
},
|
|
437
|
+
]}
|
|
438
|
+
theme={theme}
|
|
439
|
+
/>
|
|
463
440
|
</View>
|
|
464
441
|
|
|
465
442
|
{/* Device Management Section */}
|
|
@@ -468,67 +445,62 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
468
445
|
<Text style={styles.sectionTitle}>Device Sessions</Text>
|
|
469
446
|
|
|
470
447
|
{loadingDeviceSessions ? (
|
|
471
|
-
<
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
448
|
+
<GroupedSection
|
|
449
|
+
items={[
|
|
450
|
+
{
|
|
451
|
+
id: 'loading-device-sessions',
|
|
452
|
+
icon: 'sync',
|
|
453
|
+
iconColor: '#007AFF',
|
|
454
|
+
title: 'Loading device sessions...',
|
|
455
|
+
subtitle: 'Please wait while we fetch your device sessions',
|
|
456
|
+
disabled: true,
|
|
457
|
+
customContent: (
|
|
458
|
+
<ActivityIndicator size="small" color="#007AFF" style={{ marginRight: 16 }} />
|
|
459
|
+
),
|
|
460
|
+
},
|
|
461
|
+
]}
|
|
462
|
+
theme={theme}
|
|
463
|
+
/>
|
|
477
464
|
) : deviceSessions.length === 0 ? (
|
|
478
|
-
<
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
465
|
+
<GroupedSection
|
|
466
|
+
items={[
|
|
467
|
+
{
|
|
468
|
+
id: 'no-device-sessions',
|
|
469
|
+
icon: 'phone-portrait',
|
|
470
|
+
iconColor: '#ccc',
|
|
471
|
+
title: 'No device sessions found',
|
|
472
|
+
subtitle: 'Device session management not available',
|
|
473
|
+
disabled: true,
|
|
474
|
+
},
|
|
475
|
+
]}
|
|
476
|
+
theme={theme}
|
|
477
|
+
/>
|
|
489
478
|
) : (
|
|
490
|
-
|
|
491
|
-
{deviceSessions.map((session, index) => (
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
<
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
<
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
</View>
|
|
516
|
-
{!session.isCurrent && (
|
|
517
|
-
<TouchableOpacity
|
|
518
|
-
style={styles.removeButton}
|
|
519
|
-
onPress={() => handleRemoteSessionLogout(session.sessionId, session.deviceName)}
|
|
520
|
-
disabled={remotingLogoutSessionId === session.sessionId}
|
|
521
|
-
>
|
|
522
|
-
{remotingLogoutSessionId === session.sessionId ? (
|
|
523
|
-
<ActivityIndicator size="small" color="#FF3B30" />
|
|
524
|
-
) : (
|
|
525
|
-
<OxyIcon name="log-out" size={16} color="#FF3B30" />
|
|
526
|
-
)}
|
|
527
|
-
</TouchableOpacity>
|
|
528
|
-
)}
|
|
529
|
-
</View>
|
|
530
|
-
))}
|
|
531
|
-
</>
|
|
479
|
+
<GroupedSection
|
|
480
|
+
items={deviceSessions.map((session, index) => ({
|
|
481
|
+
id: `device-session-${session.sessionId}`,
|
|
482
|
+
icon: session.isCurrent ? 'phone-portrait' : 'phone-portrait-outline',
|
|
483
|
+
iconColor: session.isCurrent ? '#34C759' : '#8E8E93',
|
|
484
|
+
title: `${session.deviceName} ${session.isCurrent ? '(This device)' : ''}`,
|
|
485
|
+
subtitle: `Last active: ${new Date(session.lastActive).toLocaleDateString()}`,
|
|
486
|
+
onPress: session.isCurrent ? undefined : () => handleRemoteSessionLogout(session.sessionId, session.deviceName),
|
|
487
|
+
disabled: session.isCurrent || remotingLogoutSessionId === session.sessionId,
|
|
488
|
+
customContent: !session.isCurrent ? (
|
|
489
|
+
<TouchableOpacity
|
|
490
|
+
style={styles.removeButton}
|
|
491
|
+
onPress={() => handleRemoteSessionLogout(session.sessionId, session.deviceName)}
|
|
492
|
+
disabled={remotingLogoutSessionId === session.sessionId}
|
|
493
|
+
>
|
|
494
|
+
{remotingLogoutSessionId === session.sessionId ? (
|
|
495
|
+
<ActivityIndicator size="small" color="#FF3B30" />
|
|
496
|
+
) : (
|
|
497
|
+
<OxyIcon name="log-out" size={16} color="#FF3B30" />
|
|
498
|
+
)}
|
|
499
|
+
</TouchableOpacity>
|
|
500
|
+
) : undefined,
|
|
501
|
+
}))}
|
|
502
|
+
theme={theme}
|
|
503
|
+
/>
|
|
532
504
|
)}
|
|
533
505
|
</View>
|
|
534
506
|
)}
|
|
@@ -536,21 +508,34 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
536
508
|
{/* Empty State */}
|
|
537
509
|
{sessionsWithUsers.length === 0 && (
|
|
538
510
|
<View style={styles.section}>
|
|
539
|
-
<
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
511
|
+
<GroupedSection
|
|
512
|
+
items={[
|
|
513
|
+
{
|
|
514
|
+
id: 'empty-state',
|
|
515
|
+
icon: 'person-outline',
|
|
516
|
+
iconColor: '#ccc',
|
|
517
|
+
title: 'No saved accounts',
|
|
518
|
+
subtitle: 'Add another account to switch between them quickly',
|
|
519
|
+
onPress: () => navigate?.('SignIn'),
|
|
520
|
+
customContent: (
|
|
521
|
+
<View style={styles.emptyStateContainer}>
|
|
522
|
+
<OxyIcon name="person-outline" size={48} color="#ccc" />
|
|
523
|
+
<Text style={styles.emptyStateTitle}>No saved accounts</Text>
|
|
524
|
+
<Text style={styles.emptyStateDescription}>
|
|
525
|
+
Add another account to switch between them quickly
|
|
526
|
+
</Text>
|
|
527
|
+
<TouchableOpacity
|
|
528
|
+
style={styles.addAccountButton}
|
|
529
|
+
onPress={() => navigate?.('SignIn')}
|
|
530
|
+
>
|
|
531
|
+
<Text style={styles.addAccountButtonText}>Add Account</Text>
|
|
532
|
+
</TouchableOpacity>
|
|
533
|
+
</View>
|
|
534
|
+
),
|
|
535
|
+
},
|
|
536
|
+
]}
|
|
537
|
+
theme={theme}
|
|
538
|
+
/>
|
|
554
539
|
</View>
|
|
555
540
|
)}
|
|
556
541
|
</>
|
|
@@ -565,33 +550,7 @@ const styles = StyleSheet.create({
|
|
|
565
550
|
flex: 1,
|
|
566
551
|
backgroundColor: '#f2f2f2',
|
|
567
552
|
},
|
|
568
|
-
|
|
569
|
-
paddingHorizontal: 20,
|
|
570
|
-
paddingTop: 60,
|
|
571
|
-
paddingBottom: 16,
|
|
572
|
-
backgroundColor: '#fff',
|
|
573
|
-
borderBottomWidth: 1,
|
|
574
|
-
borderBottomColor: '#e0e0e0',
|
|
575
|
-
flexDirection: 'row',
|
|
576
|
-
justifyContent: 'space-between',
|
|
577
|
-
alignItems: 'center',
|
|
578
|
-
},
|
|
579
|
-
headerTitle: {
|
|
580
|
-
fontSize: 24,
|
|
581
|
-
fontWeight: 'bold',
|
|
582
|
-
color: '#000',
|
|
583
|
-
},
|
|
584
|
-
backButton: {
|
|
585
|
-
padding: 8,
|
|
586
|
-
},
|
|
587
|
-
closeButton: {
|
|
588
|
-
padding: 8,
|
|
589
|
-
},
|
|
590
|
-
closeButtonText: {
|
|
591
|
-
fontSize: 24,
|
|
592
|
-
color: '#000',
|
|
593
|
-
fontWeight: '300',
|
|
594
|
-
},
|
|
553
|
+
|
|
595
554
|
content: {
|
|
596
555
|
flex: 1,
|
|
597
556
|
padding: 16,
|
|
@@ -632,9 +591,6 @@ const styles = StyleSheet.create({
|
|
|
632
591
|
alignItems: 'center',
|
|
633
592
|
flex: 1,
|
|
634
593
|
},
|
|
635
|
-
settingIcon: {
|
|
636
|
-
marginRight: 12,
|
|
637
|
-
},
|
|
638
594
|
settingLabel: {
|
|
639
595
|
fontSize: 16,
|
|
640
596
|
fontWeight: '500',
|