@oxyhq/services 5.3.2 → 5.3.4

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.
Files changed (29) hide show
  1. package/lib/commonjs/ui/context/OxyContext.js +58 -7
  2. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  3. package/lib/commonjs/ui/navigation/OxyRouter.js +5 -0
  4. package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
  5. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +70 -26
  6. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  7. package/lib/commonjs/ui/screens/ModernAccountSwitcherScreen.js +532 -0
  8. package/lib/commonjs/ui/screens/ModernAccountSwitcherScreen.js.map +1 -0
  9. package/lib/module/ui/context/OxyContext.js +58 -7
  10. package/lib/module/ui/context/OxyContext.js.map +1 -1
  11. package/lib/module/ui/navigation/OxyRouter.js +5 -0
  12. package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
  13. package/lib/module/ui/screens/AccountSwitcherScreen.js +72 -28
  14. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  15. package/lib/module/ui/screens/ModernAccountSwitcherScreen.js +527 -0
  16. package/lib/module/ui/screens/ModernAccountSwitcherScreen.js.map +1 -0
  17. package/lib/typescript/models/secureSession.d.ts +2 -0
  18. package/lib/typescript/models/secureSession.d.ts.map +1 -1
  19. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  20. package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
  21. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
  22. package/lib/typescript/ui/screens/ModernAccountSwitcherScreen.d.ts +5 -0
  23. package/lib/typescript/ui/screens/ModernAccountSwitcherScreen.d.ts.map +1 -0
  24. package/package.json +1 -1
  25. package/src/models/secureSession.ts +3 -0
  26. package/src/ui/context/OxyContext.tsx +66 -7
  27. package/src/ui/navigation/OxyRouter.tsx +5 -0
  28. package/src/ui/screens/AccountSwitcherScreen.tsx +85 -25
  29. package/src/ui/screens/ModernAccountSwitcherScreen.tsx +552 -0
@@ -0,0 +1,532 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _OxyContext = require("../context/OxyContext");
10
+ var _fonts = require("../styles/fonts");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
+ const ModernAccountSwitcherScreen = ({
14
+ onClose,
15
+ theme,
16
+ navigate,
17
+ goBack,
18
+ oxyServices
19
+ }) => {
20
+ const {
21
+ user,
22
+ sessions,
23
+ activeSessionId,
24
+ switchSession,
25
+ removeSession,
26
+ logoutAll,
27
+ isLoading
28
+ } = (0, _OxyContext.useOxy)();
29
+ const [sessionsWithUsers, setSessionsWithUsers] = (0, _react.useState)([]);
30
+ const [switchingToUserId, setSwitchingToUserId] = (0, _react.useState)(null);
31
+ const [removingUserId, setRemovingUserId] = (0, _react.useState)(null);
32
+ const screenWidth = _reactNative.Dimensions.get('window').width;
33
+ const isDarkTheme = theme === 'dark';
34
+
35
+ // Modern color scheme
36
+ const colors = {
37
+ background: isDarkTheme ? '#000000' : '#FFFFFF',
38
+ surface: isDarkTheme ? '#1C1C1E' : '#F2F2F7',
39
+ card: isDarkTheme ? '#2C2C2E' : '#FFFFFF',
40
+ text: isDarkTheme ? '#FFFFFF' : '#000000',
41
+ secondaryText: isDarkTheme ? '#8E8E93' : '#6D6D70',
42
+ accent: '#007AFF',
43
+ destructive: '#FF3B30',
44
+ success: '#34C759',
45
+ border: isDarkTheme ? '#38383A' : '#C6C6C8',
46
+ activeCard: isDarkTheme ? '#0A84FF20' : '#007AFF15',
47
+ shadow: isDarkTheme ? 'rgba(0,0,0,0.3)' : 'rgba(0,0,0,0.1)'
48
+ };
49
+
50
+ // Load user profiles for sessions
51
+ (0, _react.useEffect)(() => {
52
+ const loadUserProfiles = async () => {
53
+ if (!sessions.length || !oxyServices) return;
54
+ const updatedSessions = sessions.map(session => ({
55
+ ...session,
56
+ isLoadingProfile: true
57
+ }));
58
+ setSessionsWithUsers(updatedSessions);
59
+
60
+ // Load profiles for each session
61
+ for (let i = 0; i < sessions.length; i++) {
62
+ const session = sessions[i];
63
+ try {
64
+ // Try to get user profile using the session
65
+ const userProfile = await oxyServices.getUserBySession(session.sessionId);
66
+ setSessionsWithUsers(prev => prev.map(s => s.sessionId === session.sessionId ? {
67
+ ...s,
68
+ userProfile,
69
+ isLoadingProfile: false
70
+ } : s));
71
+ } catch (error) {
72
+ console.error(`Failed to load profile for session ${session.sessionId}:`, error);
73
+ setSessionsWithUsers(prev => prev.map(s => s.sessionId === session.sessionId ? {
74
+ ...s,
75
+ isLoadingProfile: false
76
+ } : s));
77
+ }
78
+ }
79
+ };
80
+ loadUserProfiles();
81
+ }, [sessions, oxyServices]);
82
+ const handleSwitchSession = async sessionId => {
83
+ if (sessionId === user?.sessionId) return; // Already active session
84
+
85
+ setSwitchingToUserId(sessionId);
86
+ try {
87
+ await switchSession(sessionId);
88
+ _reactNative.Alert.alert('Success', 'Account switched successfully!');
89
+ if (onClose) {
90
+ onClose();
91
+ }
92
+ } catch (error) {
93
+ console.error('Switch session failed:', error);
94
+ _reactNative.Alert.alert('Switch Failed', 'There was a problem switching accounts. Please try again.');
95
+ } finally {
96
+ setSwitchingToUserId(null);
97
+ }
98
+ };
99
+ const handleRemoveSession = async sessionId => {
100
+ const sessionToRemove = sessionsWithUsers.find(s => s.sessionId === sessionId);
101
+ if (!sessionToRemove) return;
102
+ const displayName = typeof sessionToRemove.userProfile?.name === 'object' ? sessionToRemove.userProfile.name.full || sessionToRemove.userProfile.name.first || sessionToRemove.userProfile.username : sessionToRemove.userProfile?.name || sessionToRemove.userProfile?.username || 'this account';
103
+ _reactNative.Alert.alert('Remove Account', `Are you sure you want to remove ${displayName} from this device? You'll need to sign in again to access this account.`, [{
104
+ text: 'Cancel',
105
+ style: 'cancel'
106
+ }, {
107
+ text: 'Remove',
108
+ style: 'destructive',
109
+ onPress: async () => {
110
+ setRemovingUserId(sessionId);
111
+ try {
112
+ await removeSession(sessionId);
113
+ _reactNative.Alert.alert('Success', 'Account removed successfully!');
114
+ } catch (error) {
115
+ console.error('Remove session failed:', error);
116
+ _reactNative.Alert.alert('Remove Failed', 'There was a problem removing the account. Please try again.');
117
+ } finally {
118
+ setRemovingUserId(null);
119
+ }
120
+ }
121
+ }], {
122
+ cancelable: true
123
+ });
124
+ };
125
+ const handleLogoutAll = async () => {
126
+ _reactNative.Alert.alert('Sign Out All', 'Are you sure you want to sign out of all accounts on this device?', [{
127
+ text: 'Cancel',
128
+ style: 'cancel'
129
+ }, {
130
+ text: 'Sign Out All',
131
+ style: 'destructive',
132
+ onPress: async () => {
133
+ try {
134
+ await logoutAll();
135
+ _reactNative.Alert.alert('Success', 'All accounts signed out successfully!');
136
+ if (onClose) {
137
+ onClose();
138
+ }
139
+ } catch (error) {
140
+ console.error('Logout all failed:', error);
141
+ _reactNative.Alert.alert('Logout Failed', 'There was a problem signing out. Please try again.');
142
+ }
143
+ }
144
+ }], {
145
+ cancelable: true
146
+ });
147
+ };
148
+ const renderSessionItem = sessionWithUser => {
149
+ const isActive = sessionWithUser.sessionId === activeSessionId;
150
+ const isSwitching = switchingToUserId === sessionWithUser.sessionId;
151
+ const isRemoving = removingUserId === sessionWithUser.sessionId;
152
+ const {
153
+ userProfile,
154
+ isLoadingProfile
155
+ } = sessionWithUser;
156
+ const displayName = typeof userProfile?.name === 'object' ? userProfile.name.full || userProfile.name.first || userProfile.username : userProfile?.name || userProfile?.username || 'Unknown User';
157
+ const username = userProfile?.username || 'unknown';
158
+ const avatarUrl = userProfile?.avatar?.url;
159
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
160
+ style: [styles.sessionCard, {
161
+ backgroundColor: isActive ? colors.activeCard : colors.card,
162
+ borderColor: isActive ? colors.accent : colors.border,
163
+ borderWidth: isActive ? 2 : 1,
164
+ shadowColor: colors.shadow
165
+ }],
166
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
167
+ style: styles.sessionHeader,
168
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
169
+ style: styles.avatarContainer,
170
+ children: [isLoadingProfile ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
171
+ style: [styles.avatarPlaceholder, {
172
+ backgroundColor: colors.surface
173
+ }],
174
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
175
+ size: "small",
176
+ color: colors.accent
177
+ })
178
+ }) : avatarUrl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
179
+ source: {
180
+ uri: avatarUrl
181
+ },
182
+ style: styles.avatar
183
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
184
+ style: [styles.avatarPlaceholder, {
185
+ backgroundColor: colors.surface
186
+ }],
187
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
188
+ style: [styles.avatarText, {
189
+ color: colors.accent
190
+ }],
191
+ children: displayName.charAt(0).toUpperCase()
192
+ })
193
+ }), isActive && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
194
+ style: [styles.activeBadge, {
195
+ backgroundColor: colors.success
196
+ }],
197
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
198
+ style: styles.activeBadgeText,
199
+ children: "\u2713"
200
+ })
201
+ })]
202
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
203
+ style: styles.userInfo,
204
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
205
+ style: [styles.displayName, {
206
+ color: colors.text
207
+ }],
208
+ numberOfLines: 1,
209
+ children: displayName
210
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
211
+ style: [styles.username, {
212
+ color: colors.secondaryText
213
+ }],
214
+ numberOfLines: 1,
215
+ children: ["@", username]
216
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
217
+ style: [styles.lastActive, {
218
+ color: colors.secondaryText
219
+ }],
220
+ numberOfLines: 1,
221
+ children: ["Last active: ", new Date(sessionWithUser.lastActive).toLocaleDateString()]
222
+ })]
223
+ })]
224
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
225
+ style: styles.sessionActions,
226
+ children: [!isActive && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
227
+ style: [styles.switchButton, {
228
+ borderColor: colors.accent,
229
+ backgroundColor: colors.background
230
+ }],
231
+ onPress: () => handleSwitchSession(sessionWithUser.sessionId),
232
+ disabled: isSwitching || isRemoving,
233
+ children: isSwitching ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
234
+ color: colors.accent,
235
+ size: "small"
236
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
237
+ style: [styles.switchButtonText, {
238
+ color: colors.accent
239
+ }],
240
+ children: "Switch"
241
+ })
242
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
243
+ style: [styles.removeButton, {
244
+ borderColor: colors.destructive,
245
+ backgroundColor: colors.background
246
+ }],
247
+ onPress: () => handleRemoveSession(sessionWithUser.sessionId),
248
+ disabled: isSwitching || isRemoving,
249
+ children: isRemoving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
250
+ color: colors.destructive,
251
+ size: "small"
252
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
253
+ style: [styles.removeButtonText, {
254
+ color: colors.destructive
255
+ }],
256
+ children: "Remove"
257
+ })
258
+ })]
259
+ })]
260
+ }, sessionWithUser.sessionId);
261
+ };
262
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
263
+ style: [styles.container, {
264
+ backgroundColor: colors.background
265
+ }],
266
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
267
+ style: styles.header,
268
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
269
+ style: styles.backButton,
270
+ onPress: goBack,
271
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
272
+ style: [styles.backButtonText, {
273
+ color: colors.accent
274
+ }],
275
+ children: "\u2039 Back"
276
+ })
277
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
278
+ style: [styles.title, {
279
+ color: colors.text
280
+ }],
281
+ children: "Accounts"
282
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
283
+ style: styles.headerSpacer
284
+ })]
285
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
286
+ style: styles.content,
287
+ showsVerticalScrollIndicator: false,
288
+ contentContainerStyle: styles.scrollContent,
289
+ children: isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
290
+ style: styles.loadingContainer,
291
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
292
+ size: "large",
293
+ color: colors.accent
294
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
295
+ style: [styles.loadingText, {
296
+ color: colors.secondaryText
297
+ }],
298
+ children: "Loading accounts..."
299
+ })]
300
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
301
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
302
+ style: [styles.sectionTitle, {
303
+ color: colors.text
304
+ }],
305
+ children: ["Saved Accounts (", sessionsWithUsers.length, ")"]
306
+ }), sessionsWithUsers.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
307
+ style: styles.emptyState,
308
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
309
+ style: [styles.emptyText, {
310
+ color: colors.secondaryText
311
+ }],
312
+ children: "No saved accounts found"
313
+ })
314
+ }) : sessionsWithUsers.map(renderSessionItem), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
315
+ style: styles.actionsSection,
316
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
317
+ style: [styles.actionButton, {
318
+ borderColor: colors.border,
319
+ backgroundColor: colors.card
320
+ }],
321
+ onPress: () => navigate?.('SignIn'),
322
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
323
+ style: [styles.actionButtonText, {
324
+ color: colors.text
325
+ }],
326
+ children: "+ Add Another Account"
327
+ })
328
+ }), sessionsWithUsers.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
329
+ style: [styles.actionButton, styles.dangerButton, {
330
+ borderColor: colors.destructive,
331
+ backgroundColor: colors.background
332
+ }],
333
+ onPress: handleLogoutAll,
334
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
335
+ style: [styles.dangerButtonText, {
336
+ color: colors.destructive
337
+ }],
338
+ children: "Sign Out All Accounts"
339
+ })
340
+ })]
341
+ })]
342
+ })
343
+ })]
344
+ });
345
+ };
346
+ const styles = _reactNative.StyleSheet.create({
347
+ container: {
348
+ flex: 1
349
+ },
350
+ header: {
351
+ flexDirection: 'row',
352
+ alignItems: 'center',
353
+ justifyContent: 'space-between',
354
+ paddingHorizontal: 20,
355
+ paddingTop: 20,
356
+ paddingBottom: 10
357
+ },
358
+ backButton: {
359
+ padding: 8
360
+ },
361
+ backButtonText: {
362
+ fontSize: 18,
363
+ fontFamily: _fonts.fontFamilies.phuduMedium
364
+ },
365
+ title: {
366
+ fontSize: 24,
367
+ fontFamily: _fonts.fontFamilies.phuduBold,
368
+ textAlign: 'center'
369
+ },
370
+ headerSpacer: {
371
+ width: 40
372
+ },
373
+ content: {
374
+ flex: 1,
375
+ paddingHorizontal: 20
376
+ },
377
+ scrollContent: {
378
+ paddingBottom: 40
379
+ },
380
+ loadingContainer: {
381
+ flex: 1,
382
+ justifyContent: 'center',
383
+ alignItems: 'center',
384
+ paddingTop: 60
385
+ },
386
+ loadingText: {
387
+ marginTop: 16,
388
+ fontSize: 16,
389
+ fontFamily: _fonts.fontFamilies.phudu
390
+ },
391
+ sectionTitle: {
392
+ fontSize: 20,
393
+ fontFamily: _fonts.fontFamilies.phuduSemiBold,
394
+ marginBottom: 20,
395
+ marginTop: 10
396
+ },
397
+ emptyState: {
398
+ alignItems: 'center',
399
+ paddingVertical: 40
400
+ },
401
+ emptyText: {
402
+ fontSize: 16,
403
+ fontFamily: _fonts.fontFamilies.phudu,
404
+ textAlign: 'center'
405
+ },
406
+ sessionCard: {
407
+ borderRadius: 16,
408
+ marginBottom: 16,
409
+ padding: 20,
410
+ shadowOffset: {
411
+ width: 0,
412
+ height: 2
413
+ },
414
+ shadowOpacity: 0.1,
415
+ shadowRadius: 8,
416
+ elevation: 3
417
+ },
418
+ sessionHeader: {
419
+ flexDirection: 'row',
420
+ alignItems: 'center',
421
+ marginBottom: 16
422
+ },
423
+ avatarContainer: {
424
+ position: 'relative',
425
+ marginRight: 16
426
+ },
427
+ avatar: {
428
+ width: 60,
429
+ height: 60,
430
+ borderRadius: 30
431
+ },
432
+ avatarPlaceholder: {
433
+ width: 60,
434
+ height: 60,
435
+ borderRadius: 30,
436
+ justifyContent: 'center',
437
+ alignItems: 'center'
438
+ },
439
+ avatarText: {
440
+ fontSize: 24,
441
+ fontFamily: _fonts.fontFamilies.phuduBold
442
+ },
443
+ activeBadge: {
444
+ position: 'absolute',
445
+ bottom: -2,
446
+ right: -2,
447
+ width: 20,
448
+ height: 20,
449
+ borderRadius: 10,
450
+ justifyContent: 'center',
451
+ alignItems: 'center'
452
+ },
453
+ activeBadgeText: {
454
+ color: 'white',
455
+ fontSize: 12,
456
+ fontFamily: _fonts.fontFamilies.phuduBold
457
+ },
458
+ userInfo: {
459
+ flex: 1,
460
+ justifyContent: 'center'
461
+ },
462
+ displayName: {
463
+ fontSize: 18,
464
+ fontFamily: _fonts.fontFamilies.phuduSemiBold,
465
+ marginBottom: 4
466
+ },
467
+ username: {
468
+ fontSize: 14,
469
+ fontFamily: _fonts.fontFamilies.phudu,
470
+ marginBottom: 4
471
+ },
472
+ lastActive: {
473
+ fontSize: 12,
474
+ fontFamily: _fonts.fontFamilies.phudu
475
+ },
476
+ sessionActions: {
477
+ flexDirection: 'row',
478
+ justifyContent: 'space-between',
479
+ gap: 12
480
+ },
481
+ switchButton: {
482
+ flex: 1,
483
+ paddingVertical: 12,
484
+ paddingHorizontal: 20,
485
+ borderWidth: 1,
486
+ borderRadius: 8,
487
+ alignItems: 'center',
488
+ justifyContent: 'center'
489
+ },
490
+ switchButtonText: {
491
+ fontSize: 14,
492
+ fontFamily: _fonts.fontFamilies.phuduSemiBold
493
+ },
494
+ removeButton: {
495
+ flex: 1,
496
+ paddingVertical: 12,
497
+ paddingHorizontal: 20,
498
+ borderWidth: 1,
499
+ borderRadius: 8,
500
+ alignItems: 'center',
501
+ justifyContent: 'center'
502
+ },
503
+ removeButtonText: {
504
+ fontSize: 14,
505
+ fontFamily: _fonts.fontFamilies.phuduSemiBold
506
+ },
507
+ actionsSection: {
508
+ marginTop: 40,
509
+ gap: 16
510
+ },
511
+ actionButton: {
512
+ paddingVertical: 16,
513
+ paddingHorizontal: 20,
514
+ borderWidth: 1,
515
+ borderRadius: 12,
516
+ alignItems: 'center',
517
+ justifyContent: 'center'
518
+ },
519
+ actionButtonText: {
520
+ fontSize: 16,
521
+ fontFamily: _fonts.fontFamilies.phuduSemiBold
522
+ },
523
+ dangerButton: {
524
+ // Additional styles for danger buttons if needed
525
+ },
526
+ dangerButtonText: {
527
+ fontSize: 16,
528
+ fontFamily: _fonts.fontFamilies.phuduSemiBold
529
+ }
530
+ });
531
+ var _default = exports.default = ModernAccountSwitcherScreen;
532
+ //# sourceMappingURL=ModernAccountSwitcherScreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_OxyContext","_fonts","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ModernAccountSwitcherScreen","onClose","theme","navigate","goBack","oxyServices","user","sessions","activeSessionId","switchSession","removeSession","logoutAll","isLoading","useOxy","sessionsWithUsers","setSessionsWithUsers","useState","switchingToUserId","setSwitchingToUserId","removingUserId","setRemovingUserId","screenWidth","Dimensions","width","isDarkTheme","colors","background","surface","card","text","secondaryText","accent","destructive","success","border","activeCard","shadow","useEffect","loadUserProfiles","length","updatedSessions","map","session","isLoadingProfile","userProfile","getUserBySession","sessionId","prev","s","error","console","handleSwitchSession","Alert","alert","handleRemoveSession","sessionToRemove","find","displayName","name","full","first","username","style","onPress","cancelable","handleLogoutAll","renderSessionItem","sessionWithUser","isActive","isSwitching","isRemoving","avatarUrl","avatar","url","jsxs","View","styles","sessionCard","backgroundColor","borderColor","borderWidth","shadowColor","children","sessionHeader","avatarContainer","jsx","avatarPlaceholder","ActivityIndicator","size","color","Image","source","uri","Text","avatarText","charAt","toUpperCase","activeBadge","activeBadgeText","userInfo","numberOfLines","lastActive","Date","toLocaleDateString","sessionActions","TouchableOpacity","switchButton","disabled","switchButtonText","removeButton","removeButtonText","container","header","backButton","backButtonText","title","headerSpacer","ScrollView","content","showsVerticalScrollIndicator","contentContainerStyle","scrollContent","loadingContainer","loadingText","Fragment","sectionTitle","emptyState","emptyText","actionsSection","actionButton","actionButtonText","dangerButton","dangerButtonText","StyleSheet","create","flex","flexDirection","alignItems","justifyContent","paddingHorizontal","paddingTop","paddingBottom","padding","fontSize","fontFamily","fontFamilies","phuduMedium","phuduBold","textAlign","marginTop","phudu","phuduSemiBold","marginBottom","paddingVertical","borderRadius","shadowOffset","height","shadowOpacity","shadowRadius","elevation","position","marginRight","bottom","right","gap","_default","exports"],"sourceRoot":"../../../../src","sources":["ui/screens/ModernAccountSwitcherScreen.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAaA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAA+C,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,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ACfjB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EACpB,CAAC;EACD9B,gBAAgB,EAAE;IACdmC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAEC,mBAAY,CAACM;EAC7B,CAAC;EACD1C,YAAY,EAAE;IACV0B,IAAI,EAAE,CAAC;IACPkB,eAAe,EAAE,EAAE;IACnBd,iBAAiB,EAAE,EAAE;IACrB3D,WAAW,EAAE,CAAC;IACd0E,YAAY,EAAE,CAAC;IACfjB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EACpB,CAAC;EACD5B,gBAAgB,EAAE;IACdiC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAEC,mBAAY,CAACM;EAC7B,CAAC;EACDvB,cAAc,EAAE;IACZqB,SAAS,EAAE,EAAE;IACbe,GAAG,EAAE;EACT,CAAC;EACDnC,YAAY,EAAE;IACVwB,eAAe,EAAE,EAAE;IACnBd,iBAAiB,EAAE,EAAE;IACrB3D,WAAW,EAAE,CAAC;IACd0E,YAAY,EAAE,EAAE;IAChBjB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EACpB,CAAC;EACDR,gBAAgB,EAAE;IACda,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAEC,mBAAY,CAACM;EAC7B,CAAC;EACDpB,YAAY,EAAE;IACV;EAAA,CACH;EACDC,gBAAgB,EAAE;IACdW,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAEC,mBAAY,CAACM;EAC7B;AACJ,CAAC,CAAC;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAA/K,OAAA,GAEYS,2BAA2B","ignoreList":[]}
@@ -105,9 +105,40 @@ export const OxyContextProvider = ({
105
105
  console.log('SecureAuth - activeSessionId:', storedActiveSessionId);
106
106
  if (sessionsData) {
107
107
  const parsedSessions = JSON.parse(sessionsData);
108
- setSessions(parsedSessions);
109
- if (storedActiveSessionId && parsedSessions.length > 0) {
110
- const activeSession = parsedSessions.find(s => s.sessionId === storedActiveSessionId);
108
+
109
+ // Migrate old session format to include user info
110
+ const migratedSessions = [];
111
+ let shouldUpdateStorage = false;
112
+ for (const session of parsedSessions) {
113
+ if (!session.userId || !session.username) {
114
+ // Session is missing user info, try to fetch it
115
+ try {
116
+ const sessionUser = await oxyServices.getUserBySession(session.sessionId);
117
+ migratedSessions.push({
118
+ ...session,
119
+ userId: sessionUser.id,
120
+ username: sessionUser.username
121
+ });
122
+ shouldUpdateStorage = true;
123
+ console.log(`Migrated session ${session.sessionId} for user ${sessionUser.username}`);
124
+ } catch (error) {
125
+ // Session might be invalid, skip it
126
+ console.log(`Removing invalid session ${session.sessionId}:`, error);
127
+ shouldUpdateStorage = true;
128
+ }
129
+ } else {
130
+ // Session already has user info
131
+ migratedSessions.push(session);
132
+ }
133
+ }
134
+
135
+ // Update storage if we made changes
136
+ if (shouldUpdateStorage) {
137
+ await saveSessionsToStorage(migratedSessions);
138
+ }
139
+ setSessions(migratedSessions);
140
+ if (storedActiveSessionId && migratedSessions.length > 0) {
141
+ const activeSession = migratedSessions.find(s => s.sessionId === storedActiveSessionId);
111
142
  if (activeSession) {
112
143
  console.log('SecureAuth - activeSession found:', activeSession);
113
144
 
@@ -243,16 +274,36 @@ export const OxyContextProvider = ({
243
274
  console.log('SecureAuth - Using device ID:', deviceInfo.deviceId);
244
275
  const response = await oxyServices.secureLogin(username, password, deviceName || deviceInfo.deviceName || DeviceManager.getDefaultDeviceName(), deviceFingerprint);
245
276
 
246
- // Create client session object
277
+ // Create client session object with user info for duplicate detection
247
278
  const clientSession = {
248
279
  sessionId: response.sessionId,
249
280
  deviceId: response.deviceId,
250
281
  expiresAt: response.expiresAt,
251
- lastActive: new Date().toISOString()
282
+ lastActive: new Date().toISOString(),
283
+ userId: response.user.id,
284
+ username: response.user.username
252
285
  };
253
286
 
254
- // Add to sessions list
255
- const updatedSessions = [...sessions, clientSession];
287
+ // Check if this user already has a session (prevent duplicate accounts)
288
+ const existingUserSessionIndex = sessions.findIndex(s => s.userId === response.user.id || s.username === response.user.username);
289
+ let updatedSessions;
290
+ if (existingUserSessionIndex !== -1) {
291
+ // User already has a session - replace it with the new one (reused session scenario)
292
+ const existingSession = sessions[existingUserSessionIndex];
293
+ updatedSessions = [...sessions];
294
+ updatedSessions[existingUserSessionIndex] = clientSession;
295
+ console.log(`Reusing/updating existing session for user ${response.user.username}. Previous session: ${existingSession.sessionId}, New session: ${response.sessionId}`);
296
+
297
+ // If the replaced session was the active one, update active session
298
+ if (activeSessionId === existingSession.sessionId) {
299
+ setActiveSessionId(response.sessionId);
300
+ await saveActiveSessionId(response.sessionId);
301
+ }
302
+ } else {
303
+ // Add new session for new user
304
+ updatedSessions = [...sessions, clientSession];
305
+ console.log(`Added new session for user ${response.user.username} on device ${response.deviceId}`);
306
+ }
256
307
  setSessions(updatedSessions);
257
308
  await saveSessionsToStorage(updatedSessions);
258
309