@oxyhq/services 5.4.4 → 5.4.5
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/core/index.js +22 -3
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/index.js +50 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/FollowButton.js +79 -31
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInButton.js +2 -2
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +11 -1
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/index.js +13 -0
- package/lib/commonjs/ui/hooks/index.js.map +1 -0
- package/lib/commonjs/ui/hooks/useFollow.js +184 -0
- package/lib/commonjs/ui/hooks/useFollow.js.map +1 -0
- package/lib/commonjs/ui/index.js +25 -1
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +4 -3
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +7 -6
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +3 -2
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +3 -2
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +6 -8
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +5 -4
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/store/index.js +219 -4
- package/lib/commonjs/ui/store/index.js.map +1 -1
- package/lib/module/core/index.js +22 -3
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/index.js +6 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/FollowButton.js +80 -32
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/OxySignInButton.js +2 -2
- package/lib/module/ui/components/OxySignInButton.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +11 -1
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/index.js +4 -0
- package/lib/module/ui/hooks/index.js.map +1 -0
- package/lib/module/ui/hooks/useFollow.js +180 -0
- package/lib/module/ui/hooks/useFollow.js.map +1 -0
- package/lib/module/ui/index.js +9 -0
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +4 -3
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +7 -6
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +3 -2
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +3 -2
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +6 -8
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +1 -1
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js +5 -4
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/module/ui/store/index.js +215 -4
- package/lib/module/ui/store/index.js.map +1 -1
- package/lib/typescript/core/index.d.ts +16 -3
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +4 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/FollowButton.d.ts +1 -0
- package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/index.d.ts +2 -0
- package/lib/typescript/ui/hooks/index.d.ts.map +1 -0
- package/lib/typescript/ui/hooks/useFollow.d.ts +43 -0
- package/lib/typescript/ui/hooks/useFollow.d.ts.map +1 -0
- package/lib/typescript/ui/index.d.ts +3 -0
- package/lib/typescript/ui/index.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountCenterScreen.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/store/index.d.ts +47 -0
- package/lib/typescript/ui/store/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/index.ts +88 -3
- package/src/index.ts +19 -3
- package/src/ui/components/FollowButton.tsx +114 -56
- package/src/ui/components/OxySignInButton.tsx +2 -2
- package/src/ui/context/OxyContext.tsx +12 -2
- package/src/ui/hooks/index.ts +1 -0
- package/src/ui/hooks/useFollow.ts +173 -0
- package/src/ui/index.ts +9 -0
- package/src/ui/screens/AccountCenterScreen.tsx +17 -15
- package/src/ui/screens/AccountOverviewScreen.tsx +25 -25
- package/src/ui/screens/AccountSettingsScreen.tsx +30 -30
- package/src/ui/screens/AccountSwitcherScreen.tsx +34 -33
- package/src/ui/screens/AppInfoScreen.tsx +153 -155
- package/src/ui/screens/SignInScreen.tsx +2 -2
- package/src/ui/screens/karma/KarmaCenterScreen.tsx +4 -4
- package/src/ui/store/index.ts +197 -3
|
@@ -34,7 +34,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
34
34
|
theme,
|
|
35
35
|
navigate,
|
|
36
36
|
}) => {
|
|
37
|
-
const { user, logout, isLoading, sessions, activeSessionId, oxyServices } = useOxy();
|
|
37
|
+
const { user, logout, isLoading, sessions, activeSessionId, oxyServices, isAuthenticated } = useOxy();
|
|
38
38
|
const [showMoreAccounts, setShowMoreAccounts] = useState(false);
|
|
39
39
|
const [additionalAccountsData, setAdditionalAccountsData] = useState<any[]>([]);
|
|
40
40
|
const [loadingAdditionalAccounts, setLoadingAdditionalAccounts] = useState(false);
|
|
@@ -55,8 +55,8 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
55
55
|
}, [theme]);
|
|
56
56
|
|
|
57
57
|
// Memoize additional accounts filtering to prevent recalculation on every render
|
|
58
|
-
const additionalAccounts = useMemo(() =>
|
|
59
|
-
sessions.filter(session =>
|
|
58
|
+
const additionalAccounts = useMemo(() =>
|
|
59
|
+
sessions.filter(session =>
|
|
60
60
|
session.sessionId !== activeSessionId && session.userId !== user?.id
|
|
61
61
|
), [sessions, activeSessionId, user?.id]
|
|
62
62
|
);
|
|
@@ -170,7 +170,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
170
170
|
);
|
|
171
171
|
}, [handleLogout]);
|
|
172
172
|
|
|
173
|
-
if (!
|
|
173
|
+
if (!isAuthenticated) {
|
|
174
174
|
return (
|
|
175
175
|
<View style={[styles.container, { backgroundColor: themeStyles.backgroundColor }]}>
|
|
176
176
|
<Text style={[styles.message, { color: themeStyles.textColor }]}>Not signed in</Text>
|
|
@@ -202,7 +202,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
202
202
|
{/* User Profile Section */}
|
|
203
203
|
<View style={styles.section}>
|
|
204
204
|
<Text style={styles.sectionTitle}>Profile</Text>
|
|
205
|
-
|
|
205
|
+
|
|
206
206
|
<View style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem]}>
|
|
207
207
|
<View style={styles.userIcon}>
|
|
208
208
|
<Avatar
|
|
@@ -215,9 +215,9 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
215
215
|
<View style={styles.settingInfo}>
|
|
216
216
|
<View>
|
|
217
217
|
<Text style={styles.settingLabel}>
|
|
218
|
-
{typeof user.name === 'string' ? user.name : user.name?.full || user.name?.first || user.username}
|
|
218
|
+
{user ? (typeof user.name === 'string' ? user.name : user.name?.full || user.name?.first || user.username) : 'Loading...'}
|
|
219
219
|
</Text>
|
|
220
|
-
<Text style={styles.settingDescription}>{user.email || user.username}</Text>
|
|
220
|
+
<Text style={styles.settingDescription}>{user ? (user.email || user.username) : 'Loading...'}</Text>
|
|
221
221
|
</View>
|
|
222
222
|
</View>
|
|
223
223
|
<TouchableOpacity
|
|
@@ -232,8 +232,8 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
232
232
|
{/* Account Settings */}
|
|
233
233
|
<View style={styles.section}>
|
|
234
234
|
<Text style={styles.sectionTitle}>Account Settings</Text>
|
|
235
|
-
|
|
236
|
-
<TouchableOpacity
|
|
235
|
+
|
|
236
|
+
<TouchableOpacity
|
|
237
237
|
style={[styles.settingItem, styles.firstSettingItem]}
|
|
238
238
|
onPress={() => navigate?.('AccountSettings', { activeTab: 'profile' })}
|
|
239
239
|
>
|
|
@@ -247,7 +247,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
247
247
|
<OxyIcon name="chevron-forward" size={16} color="#ccc" />
|
|
248
248
|
</TouchableOpacity>
|
|
249
249
|
|
|
250
|
-
<TouchableOpacity
|
|
250
|
+
<TouchableOpacity
|
|
251
251
|
style={styles.settingItem}
|
|
252
252
|
onPress={() => navigate?.('AccountSettings', { activeTab: 'password' })}
|
|
253
253
|
>
|
|
@@ -261,7 +261,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
261
261
|
<OxyIcon name="chevron-forward" size={16} color="#ccc" />
|
|
262
262
|
</TouchableOpacity>
|
|
263
263
|
|
|
264
|
-
<TouchableOpacity
|
|
264
|
+
<TouchableOpacity
|
|
265
265
|
style={styles.settingItem}
|
|
266
266
|
onPress={() => navigate?.('AccountSettings', { activeTab: 'notifications' })}
|
|
267
267
|
>
|
|
@@ -275,7 +275,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
275
275
|
<OxyIcon name="chevron-forward" size={16} color="#ccc" />
|
|
276
276
|
</TouchableOpacity>
|
|
277
277
|
|
|
278
|
-
<TouchableOpacity
|
|
278
|
+
<TouchableOpacity
|
|
279
279
|
style={[styles.settingItem]}
|
|
280
280
|
onPress={() => navigate?.('PremiumSubscription')}
|
|
281
281
|
>
|
|
@@ -283,14 +283,14 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
283
283
|
<OxyIcon name="star" size={20} color="#FFD700" style={styles.settingIcon} />
|
|
284
284
|
<View>
|
|
285
285
|
<Text style={styles.settingLabel}>Oxy+ Subscriptions</Text>
|
|
286
|
-
<Text style={styles.settingDescription}>{user
|
|
286
|
+
<Text style={styles.settingDescription}>{user?.isPremium ? 'Manage your premium plan' : 'Upgrade to premium features'}</Text>
|
|
287
287
|
</View>
|
|
288
288
|
</View>
|
|
289
289
|
<OxyIcon name="chevron-forward" size={16} color="#ccc" />
|
|
290
290
|
</TouchableOpacity>
|
|
291
291
|
|
|
292
|
-
{user
|
|
293
|
-
<TouchableOpacity
|
|
292
|
+
{user?.isPremium && (
|
|
293
|
+
<TouchableOpacity
|
|
294
294
|
style={[styles.settingItem, styles.lastSettingItem]}
|
|
295
295
|
onPress={() => navigate?.('BillingManagement')}
|
|
296
296
|
>
|
|
@@ -310,7 +310,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
310
310
|
{showMoreAccounts && (
|
|
311
311
|
<View style={styles.section}>
|
|
312
312
|
<Text style={styles.sectionTitle}>Additional Accounts{additionalAccountsData.length > 0 ? ` (${additionalAccountsData.length})` : ''}</Text>
|
|
313
|
-
|
|
313
|
+
|
|
314
314
|
{loadingAdditionalAccounts ? (
|
|
315
315
|
<View style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem]}>
|
|
316
316
|
<View style={styles.loadingContainer}>
|
|
@@ -324,7 +324,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
324
324
|
<TouchableOpacity
|
|
325
325
|
key={account.id}
|
|
326
326
|
style={[
|
|
327
|
-
styles.settingItem,
|
|
327
|
+
styles.settingItem,
|
|
328
328
|
index === 0 && styles.firstSettingItem,
|
|
329
329
|
index === additionalAccountsData.length - 1 && styles.lastSettingItem
|
|
330
330
|
]}
|
|
@@ -348,7 +348,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
348
348
|
<View style={styles.settingInfo}>
|
|
349
349
|
<View>
|
|
350
350
|
<Text style={styles.settingLabel}>
|
|
351
|
-
{typeof account.name === 'object'
|
|
351
|
+
{typeof account.name === 'object'
|
|
352
352
|
? account.name?.full || account.name?.first || account.username
|
|
353
353
|
: account.name || account.username
|
|
354
354
|
}
|
|
@@ -378,7 +378,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
378
378
|
{showMoreAccounts && (
|
|
379
379
|
<View style={styles.section}>
|
|
380
380
|
<Text style={styles.sectionTitle}>Account Management</Text>
|
|
381
|
-
|
|
381
|
+
|
|
382
382
|
<TouchableOpacity
|
|
383
383
|
style={[styles.settingItem, styles.firstSettingItem]}
|
|
384
384
|
onPress={handleAddAccount}
|
|
@@ -412,7 +412,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
412
412
|
{/* Quick Actions */}
|
|
413
413
|
<View style={styles.section}>
|
|
414
414
|
<Text style={styles.sectionTitle}>Quick Actions</Text>
|
|
415
|
-
|
|
415
|
+
|
|
416
416
|
<TouchableOpacity
|
|
417
417
|
style={[styles.settingItem, styles.firstSettingItem]}
|
|
418
418
|
onPress={() => setShowMoreAccounts(!showMoreAccounts)}
|
|
@@ -424,9 +424,9 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
424
424
|
{showMoreAccounts ? 'Hide' : 'Show'} Account Switcher
|
|
425
425
|
</Text>
|
|
426
426
|
<Text style={styles.settingDescription}>
|
|
427
|
-
{showMoreAccounts
|
|
428
|
-
? 'Hide account switcher'
|
|
429
|
-
: additionalAccountsData.length > 0
|
|
427
|
+
{showMoreAccounts
|
|
428
|
+
? 'Hide account switcher'
|
|
429
|
+
: additionalAccountsData.length > 0
|
|
430
430
|
? `Switch between ${additionalAccountsData.length + 1} accounts`
|
|
431
431
|
: loadingAdditionalAccounts
|
|
432
432
|
? 'Loading additional accounts...'
|
|
@@ -470,7 +470,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
470
470
|
{/* Support & Settings */}
|
|
471
471
|
<View style={styles.section}>
|
|
472
472
|
<Text style={styles.sectionTitle}>Support & Settings</Text>
|
|
473
|
-
|
|
473
|
+
|
|
474
474
|
<TouchableOpacity
|
|
475
475
|
style={[styles.settingItem, styles.firstSettingItem]}
|
|
476
476
|
onPress={() => toast.info('Account preferences coming soon!')}
|
|
@@ -544,7 +544,7 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
544
544
|
|
|
545
545
|
{/* Sign Out */}
|
|
546
546
|
<View style={styles.section}>
|
|
547
|
-
<TouchableOpacity
|
|
547
|
+
<TouchableOpacity
|
|
548
548
|
style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem, styles.signOutButton]}
|
|
549
549
|
onPress={confirmLogout}
|
|
550
550
|
>
|
|
@@ -24,7 +24,7 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
24
24
|
goBack,
|
|
25
25
|
navigate,
|
|
26
26
|
}) => {
|
|
27
|
-
const { user, oxyServices, isLoading: authLoading } = useOxy();
|
|
27
|
+
const { user, oxyServices, isLoading: authLoading, isAuthenticated } = useOxy();
|
|
28
28
|
const [isLoading, setIsLoading] = useState(false);
|
|
29
29
|
const [isSaving, setIsSaving] = useState(false);
|
|
30
30
|
|
|
@@ -74,10 +74,10 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
74
74
|
// Load user data
|
|
75
75
|
useEffect(() => {
|
|
76
76
|
if (user) {
|
|
77
|
-
const userDisplayName = typeof user.name === 'string'
|
|
78
|
-
? user.name
|
|
77
|
+
const userDisplayName = typeof user.name === 'string'
|
|
78
|
+
? user.name
|
|
79
79
|
: user.name?.full || user.name?.first || '';
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
setDisplayName(userDisplayName);
|
|
82
82
|
setUsername(user.username || '');
|
|
83
83
|
setEmail(user.email || '');
|
|
@@ -115,9 +115,9 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
115
115
|
|
|
116
116
|
await oxyServices.updateProfile(updates);
|
|
117
117
|
toast.success('Profile updated successfully');
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
animateSaveButton(1); // Scale back to normal
|
|
120
|
-
|
|
120
|
+
|
|
121
121
|
if (onClose) {
|
|
122
122
|
onClose();
|
|
123
123
|
} else if (goBack) {
|
|
@@ -182,7 +182,7 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
182
182
|
|
|
183
183
|
const saveField = (type: string) => {
|
|
184
184
|
animateSaveButton(0.95); // Scale down slightly for animation
|
|
185
|
-
|
|
185
|
+
|
|
186
186
|
switch (type) {
|
|
187
187
|
case 'displayName':
|
|
188
188
|
setDisplayName(tempDisplayName);
|
|
@@ -203,7 +203,7 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
203
203
|
setWebsite(tempWebsite);
|
|
204
204
|
break;
|
|
205
205
|
}
|
|
206
|
-
|
|
206
|
+
|
|
207
207
|
// Brief delay for animation, then reset and close editing
|
|
208
208
|
setTimeout(() => {
|
|
209
209
|
animateSaveButton(1);
|
|
@@ -263,7 +263,7 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
263
263
|
default: return '';
|
|
264
264
|
}
|
|
265
265
|
})();
|
|
266
|
-
|
|
266
|
+
|
|
267
267
|
const setTempValue = (text: string) => {
|
|
268
268
|
switch (type) {
|
|
269
269
|
case 'displayName': setTempDisplayName(text); break;
|
|
@@ -285,7 +285,7 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
285
285
|
<TextInput
|
|
286
286
|
style={[
|
|
287
287
|
config.multiline ? styles.editingFieldTextArea : styles.editingFieldInput,
|
|
288
|
-
{
|
|
288
|
+
{
|
|
289
289
|
backgroundColor: themeStyles.isDarkTheme ? '#333' : '#fff',
|
|
290
290
|
color: themeStyles.isDarkTheme ? '#fff' : '#000',
|
|
291
291
|
borderColor: themeStyles.primaryColor
|
|
@@ -326,7 +326,7 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
326
326
|
];
|
|
327
327
|
|
|
328
328
|
return (
|
|
329
|
-
<TouchableOpacity
|
|
329
|
+
<TouchableOpacity
|
|
330
330
|
style={itemStyles}
|
|
331
331
|
onPress={() => startEditing(type, value)}
|
|
332
332
|
>
|
|
@@ -344,7 +344,7 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
344
344
|
);
|
|
345
345
|
};
|
|
346
346
|
|
|
347
|
-
if (authLoading || !
|
|
347
|
+
if (authLoading || !isAuthenticated) {
|
|
348
348
|
return (
|
|
349
349
|
<View style={[styles.container, { backgroundColor: themeStyles.backgroundColor, justifyContent: 'center' }]}>
|
|
350
350
|
<ActivityIndicator size="large" color={themeStyles.primaryColor} />
|
|
@@ -363,14 +363,14 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
363
363
|
<Ionicons name="close" size={24} color="#666" />
|
|
364
364
|
</TouchableOpacity>
|
|
365
365
|
<Animated.View style={{ transform: [{ scale: saveButtonScale }] }}>
|
|
366
|
-
<TouchableOpacity
|
|
366
|
+
<TouchableOpacity
|
|
367
367
|
style={[
|
|
368
|
-
styles.saveHeaderButton,
|
|
369
|
-
{
|
|
368
|
+
styles.saveHeaderButton,
|
|
369
|
+
{
|
|
370
370
|
opacity: isSaving ? 0.7 : 1,
|
|
371
371
|
backgroundColor: editingField ? getFieldIcon(editingField).color : '#007AFF'
|
|
372
372
|
}
|
|
373
|
-
]}
|
|
373
|
+
]}
|
|
374
374
|
onPress={() => saveField(editingField)}
|
|
375
375
|
disabled={isSaving}
|
|
376
376
|
>
|
|
@@ -384,11 +384,11 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
384
384
|
</View>
|
|
385
385
|
<View style={styles.editingHeaderBottom}>
|
|
386
386
|
<View style={styles.headerTitleWithIcon}>
|
|
387
|
-
<OxyIcon
|
|
388
|
-
name={getFieldIcon(editingField).name}
|
|
389
|
-
size={50}
|
|
390
|
-
color={getFieldIcon(editingField).color}
|
|
391
|
-
style={styles.headerIcon}
|
|
387
|
+
<OxyIcon
|
|
388
|
+
name={getFieldIcon(editingField).name}
|
|
389
|
+
size={50}
|
|
390
|
+
color={getFieldIcon(editingField).color}
|
|
391
|
+
style={styles.headerIcon}
|
|
392
392
|
/>
|
|
393
393
|
<Text style={styles.headerTitleLarge}>{getFieldLabel(editingField)}</Text>
|
|
394
394
|
</View>
|
|
@@ -401,8 +401,8 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
401
401
|
</TouchableOpacity>
|
|
402
402
|
<Text style={styles.headerTitle}>Account Settings</Text>
|
|
403
403
|
<Animated.View style={{ transform: [{ scale: saveButtonScale }] }}>
|
|
404
|
-
<TouchableOpacity
|
|
405
|
-
style={[styles.saveIconButton, { opacity: isSaving ? 0.7 : 1 }]}
|
|
404
|
+
<TouchableOpacity
|
|
405
|
+
style={[styles.saveIconButton, { opacity: isSaving ? 0.7 : 1 }]}
|
|
406
406
|
onPress={handleSave}
|
|
407
407
|
disabled={isSaving}
|
|
408
408
|
>
|
|
@@ -429,8 +429,8 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
429
429
|
{/* Profile Picture Section */}
|
|
430
430
|
<View style={styles.section}>
|
|
431
431
|
<Text style={styles.sectionTitle}>Profile Picture</Text>
|
|
432
|
-
|
|
433
|
-
<TouchableOpacity
|
|
432
|
+
|
|
433
|
+
<TouchableOpacity
|
|
434
434
|
style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem]}
|
|
435
435
|
onPress={handleAvatarUpdate}
|
|
436
436
|
>
|
|
@@ -457,7 +457,7 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
457
457
|
{/* Basic Information */}
|
|
458
458
|
<View style={styles.section}>
|
|
459
459
|
<Text style={styles.sectionTitle}>Basic Information</Text>
|
|
460
|
-
|
|
460
|
+
|
|
461
461
|
{renderField(
|
|
462
462
|
'displayName',
|
|
463
463
|
'Display Name',
|
|
@@ -501,7 +501,7 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
501
501
|
{/* About You */}
|
|
502
502
|
<View style={styles.section}>
|
|
503
503
|
<Text style={styles.sectionTitle}>About You</Text>
|
|
504
|
-
|
|
504
|
+
|
|
505
505
|
{renderField(
|
|
506
506
|
'bio',
|
|
507
507
|
'Bio',
|
|
@@ -545,8 +545,8 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
545
545
|
{/* Quick Actions */}
|
|
546
546
|
<View style={styles.section}>
|
|
547
547
|
<Text style={styles.sectionTitle}>Quick Actions</Text>
|
|
548
|
-
|
|
549
|
-
<TouchableOpacity
|
|
548
|
+
|
|
549
|
+
<TouchableOpacity
|
|
550
550
|
style={[styles.settingItem, styles.firstSettingItem]}
|
|
551
551
|
onPress={() => toast.info('Privacy settings coming soon!')}
|
|
552
552
|
>
|
|
@@ -560,7 +560,7 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
560
560
|
<OxyIcon name="chevron-forward" size={16} color="#ccc" />
|
|
561
561
|
</TouchableOpacity>
|
|
562
562
|
|
|
563
|
-
<TouchableOpacity
|
|
563
|
+
<TouchableOpacity
|
|
564
564
|
style={[styles.settingItem, styles.lastSettingItem]}
|
|
565
565
|
onPress={() => toast.info('Account verification coming soon!')}
|
|
566
566
|
>
|
|
@@ -43,20 +43,21 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
43
43
|
goBack,
|
|
44
44
|
oxyServices,
|
|
45
45
|
}) => {
|
|
46
|
-
const {
|
|
47
|
-
user,
|
|
48
|
-
sessions,
|
|
46
|
+
const {
|
|
47
|
+
user,
|
|
48
|
+
sessions,
|
|
49
49
|
activeSessionId,
|
|
50
|
-
switchSession,
|
|
51
|
-
removeSession,
|
|
50
|
+
switchSession,
|
|
51
|
+
removeSession,
|
|
52
52
|
logoutAll,
|
|
53
|
-
isLoading
|
|
53
|
+
isLoading,
|
|
54
|
+
isAuthenticated
|
|
54
55
|
} = useOxy();
|
|
55
56
|
|
|
56
57
|
const [sessionsWithUsers, setSessionsWithUsers] = useState<SessionWithUser[]>([]);
|
|
57
58
|
const [switchingToUserId, setSwitchingToUserId] = useState<string | null>(null);
|
|
58
59
|
const [removingUserId, setRemovingUserId] = useState<string | null>(null);
|
|
59
|
-
|
|
60
|
+
|
|
60
61
|
// Device session management state
|
|
61
62
|
const [showDeviceManagement, setShowDeviceManagement] = useState(false);
|
|
62
63
|
const [deviceSessions, setDeviceSessions] = useState<DeviceSession[]>([]);
|
|
@@ -66,7 +67,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
66
67
|
|
|
67
68
|
const screenWidth = Dimensions.get('window').width;
|
|
68
69
|
const isDarkTheme = theme === 'dark';
|
|
69
|
-
|
|
70
|
+
|
|
70
71
|
// Modern color scheme
|
|
71
72
|
const colors = {
|
|
72
73
|
background: isDarkTheme ? '#000000' : '#FFFFFF',
|
|
@@ -99,19 +100,19 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
99
100
|
try {
|
|
100
101
|
// Try to get user profile using the session
|
|
101
102
|
const userProfile = await oxyServices.getUserBySession(session.sessionId);
|
|
102
|
-
|
|
103
|
-
setSessionsWithUsers(prev =>
|
|
104
|
-
prev.map(s =>
|
|
105
|
-
s.sessionId === session.sessionId
|
|
103
|
+
|
|
104
|
+
setSessionsWithUsers(prev =>
|
|
105
|
+
prev.map(s =>
|
|
106
|
+
s.sessionId === session.sessionId
|
|
106
107
|
? { ...s, userProfile, isLoadingProfile: false }
|
|
107
108
|
: s
|
|
108
109
|
)
|
|
109
110
|
);
|
|
110
111
|
} catch (error) {
|
|
111
112
|
console.error(`Failed to load profile for session ${session.sessionId}:`, error);
|
|
112
|
-
setSessionsWithUsers(prev =>
|
|
113
|
-
prev.map(s =>
|
|
114
|
-
s.sessionId === session.sessionId
|
|
113
|
+
setSessionsWithUsers(prev =>
|
|
114
|
+
prev.map(s =>
|
|
115
|
+
s.sessionId === session.sessionId
|
|
115
116
|
? { ...s, isLoadingProfile: false }
|
|
116
117
|
: s
|
|
117
118
|
)
|
|
@@ -145,7 +146,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
145
146
|
const sessionToRemove = sessionsWithUsers.find(s => s.sessionId === sessionId);
|
|
146
147
|
if (!sessionToRemove) return;
|
|
147
148
|
|
|
148
|
-
const displayName = typeof sessionToRemove.userProfile?.name === 'object'
|
|
149
|
+
const displayName = typeof sessionToRemove.userProfile?.name === 'object'
|
|
149
150
|
? sessionToRemove.userProfile.name.full || sessionToRemove.userProfile.name.first || sessionToRemove.userProfile.username
|
|
150
151
|
: sessionToRemove.userProfile?.name || sessionToRemove.userProfile?.username || 'this account';
|
|
151
152
|
|
|
@@ -187,20 +188,20 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
187
188
|
console.log('🔴 sessions array:', sessions);
|
|
188
189
|
console.log('🔴 isLoading:', isLoading);
|
|
189
190
|
console.log('🔴 logoutAll function type:', typeof logoutAll);
|
|
190
|
-
|
|
191
|
+
|
|
191
192
|
// Check if we have the required data
|
|
192
193
|
if (!activeSessionId) {
|
|
193
194
|
console.error('🔴 ERROR: No activeSessionId found!');
|
|
194
195
|
toast.error('No active session found. You may already be logged out.');
|
|
195
196
|
return;
|
|
196
197
|
}
|
|
197
|
-
|
|
198
|
+
|
|
198
199
|
if (typeof logoutAll !== 'function') {
|
|
199
200
|
console.error('🔴 ERROR: logoutAll is not a function!', typeof logoutAll);
|
|
200
201
|
toast.error('Logout function not available. Please try refreshing the app.');
|
|
201
202
|
return;
|
|
202
203
|
}
|
|
203
|
-
|
|
204
|
+
|
|
204
205
|
// TEMPORARY: Skip confirmation dialog to test direct logout
|
|
205
206
|
console.log('🔴 TESTING: Bypassing confirmation dialog for direct test');
|
|
206
207
|
try {
|
|
@@ -222,7 +223,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
222
223
|
// Device session management functions
|
|
223
224
|
const loadAllDeviceSessions = async () => {
|
|
224
225
|
if (!oxyServices || !user?.sessionId) return;
|
|
225
|
-
|
|
226
|
+
|
|
226
227
|
setLoadingDeviceSessions(true);
|
|
227
228
|
try {
|
|
228
229
|
// This would call the API to get all device sessions for the current user
|
|
@@ -270,7 +271,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
270
271
|
|
|
271
272
|
const handleLogoutAllDevices = async () => {
|
|
272
273
|
const otherDevicesCount = deviceSessions.filter(session => !session.isCurrent).length;
|
|
273
|
-
|
|
274
|
+
|
|
274
275
|
if (otherDevicesCount === 0) {
|
|
275
276
|
toast.info('No other device sessions found to sign out from.');
|
|
276
277
|
return;
|
|
@@ -331,10 +332,10 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
331
332
|
) : (
|
|
332
333
|
<>
|
|
333
334
|
{/* Current Account */}
|
|
334
|
-
{user && (
|
|
335
|
+
{isAuthenticated && user && (
|
|
335
336
|
<View style={styles.section}>
|
|
336
337
|
<Text style={styles.sectionTitle}>Current Account</Text>
|
|
337
|
-
|
|
338
|
+
|
|
338
339
|
<View style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem, styles.currentAccountCard]}>
|
|
339
340
|
<View style={styles.userIcon}>
|
|
340
341
|
{user.avatar?.url ? (
|
|
@@ -371,7 +372,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
371
372
|
<Text style={styles.sectionTitle}>
|
|
372
373
|
Other Accounts ({sessionsWithUsers.filter(s => s.sessionId !== activeSessionId).length})
|
|
373
374
|
</Text>
|
|
374
|
-
|
|
375
|
+
|
|
375
376
|
{sessionsWithUsers
|
|
376
377
|
.filter(s => s.sessionId !== activeSessionId)
|
|
377
378
|
.map((sessionWithUser, index, filteredArray) => {
|
|
@@ -381,8 +382,8 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
381
382
|
const isRemoving = removingUserId === sessionWithUser.sessionId;
|
|
382
383
|
const { userProfile, isLoadingProfile } = sessionWithUser;
|
|
383
384
|
|
|
384
|
-
const displayName = typeof userProfile?.name === 'object'
|
|
385
|
-
? userProfile.name.full || userProfile.name.first || userProfile.username
|
|
385
|
+
const displayName = typeof userProfile?.name === 'object'
|
|
386
|
+
? userProfile.name.full || userProfile.name.first || userProfile.username
|
|
386
387
|
: userProfile?.name || userProfile?.username || 'Unknown User';
|
|
387
388
|
|
|
388
389
|
return (
|
|
@@ -450,7 +451,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
450
451
|
{/* Quick Actions */}
|
|
451
452
|
<View style={styles.section}>
|
|
452
453
|
<Text style={styles.sectionTitle}>Quick Actions</Text>
|
|
453
|
-
|
|
454
|
+
|
|
454
455
|
<TouchableOpacity
|
|
455
456
|
style={[styles.settingItem, styles.firstSettingItem]}
|
|
456
457
|
onPress={() => navigate?.('SignIn')}
|
|
@@ -507,7 +508,7 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
507
508
|
{showDeviceManagement && (
|
|
508
509
|
<View style={styles.section}>
|
|
509
510
|
<Text style={styles.sectionTitle}>Device Sessions</Text>
|
|
510
|
-
|
|
511
|
+
|
|
511
512
|
{loadingDeviceSessions ? (
|
|
512
513
|
<View style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem]}>
|
|
513
514
|
<View style={styles.loadingContainer}>
|
|
@@ -539,11 +540,11 @@ const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
|
|
|
539
540
|
]}
|
|
540
541
|
>
|
|
541
542
|
<View style={styles.settingInfo}>
|
|
542
|
-
<OxyIcon
|
|
543
|
-
name={session.isCurrent ? "phone-portrait" : "phone-portrait-outline"}
|
|
544
|
-
size={20}
|
|
545
|
-
color={session.isCurrent ? "#34C759" : "#8E8E93"}
|
|
546
|
-
style={styles.settingIcon}
|
|
543
|
+
<OxyIcon
|
|
544
|
+
name={session.isCurrent ? "phone-portrait" : "phone-portrait-outline"}
|
|
545
|
+
size={20}
|
|
546
|
+
color={session.isCurrent ? "#34C759" : "#8E8E93"}
|
|
547
|
+
style={styles.settingIcon}
|
|
547
548
|
/>
|
|
548
549
|
<View>
|
|
549
550
|
<Text style={styles.settingLabel}>
|