@oxyhq/services 5.4.1 → 5.4.3
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/assets/icons/OxyServices.js +1 -1
- package/lib/commonjs/core/index.js +84 -2
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/index.js +22 -22
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/node/index.js +6 -6
- package/lib/commonjs/node/index.js.map +1 -1
- package/lib/commonjs/ui/components/Avatar.js +3 -3
- package/lib/commonjs/ui/components/Avatar.js.map +1 -1
- package/lib/commonjs/ui/components/FollowButton.js +3 -3
- package/lib/commonjs/ui/components/GroupedSection.js +1 -1
- package/lib/commonjs/ui/components/OxyLogo.js +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +13 -13
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInButton.js +2 -2
- package/lib/commonjs/ui/components/ProfileCard.js +2 -2
- package/lib/commonjs/ui/components/Section.js +1 -1
- package/lib/commonjs/ui/components/SectionTitle.js +1 -1
- package/lib/commonjs/ui/components/icon/index.js +1 -1
- package/lib/commonjs/ui/components/index.js +12 -12
- package/lib/commonjs/ui/context/OxyContext.js +20 -4
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/index.js +11 -11
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/navigation/OxyRouter.js +18 -18
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +18 -18
- 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 +45 -27
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +29 -22
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +3 -3
- package/lib/commonjs/ui/screens/AppInfoScreen.js +6 -6
- package/lib/commonjs/ui/screens/BillingManagementScreen.js +3 -3
- package/lib/commonjs/ui/screens/FileManagementScreen.js +324 -306
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +3 -3
- package/lib/commonjs/ui/screens/ProfileScreen.js +2 -2
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +2 -2
- package/lib/commonjs/ui/screens/SignInScreen.js +358 -310
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignUpScreen.js +483 -308
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +3 -3
- package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js +51 -26
- package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +2 -2
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -1
- package/lib/commonjs/ui/styles/index.js +2 -2
- package/lib/commonjs/ui/styles/theme.js +1 -1
- package/lib/commonjs/utils/index.js +1 -1
- package/lib/module/assets/icons/OxyServices.js +1 -1
- package/lib/module/assets/icons/OxyServices.js.map +1 -1
- package/lib/module/core/index.js +84 -2
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/index.js +10 -10
- package/lib/module/index.js.map +1 -1
- package/lib/module/node/index.js +4 -4
- package/lib/module/node/index.js.map +1 -1
- package/lib/module/ui/components/Avatar.js +2 -2
- package/lib/module/ui/components/Avatar.js.map +1 -1
- package/lib/module/ui/components/FollowButton.js +3 -3
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/GroupedSection.js +1 -1
- package/lib/module/ui/components/GroupedSection.js.map +1 -1
- package/lib/module/ui/components/OxyLogo.js +1 -1
- package/lib/module/ui/components/OxyLogo.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +10 -10
- package/lib/module/ui/components/OxyProvider.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/components/ProfileCard.js +2 -2
- package/lib/module/ui/components/ProfileCard.js.map +1 -1
- package/lib/module/ui/components/Section.js +1 -1
- package/lib/module/ui/components/Section.js.map +1 -1
- package/lib/module/ui/components/SectionTitle.js +1 -1
- package/lib/module/ui/components/SectionTitle.js.map +1 -1
- package/lib/module/ui/components/icon/index.js +1 -1
- package/lib/module/ui/components/icon/index.js.map +1 -1
- package/lib/module/ui/components/index.js +12 -12
- package/lib/module/ui/components/index.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +20 -4
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/index.js +10 -10
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/navigation/OxyRouter.js +18 -18
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +5 -5
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountManagementDemo.js +2 -2
- package/lib/module/ui/screens/AccountManagementDemo.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +46 -28
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +30 -23
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +3 -3
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +6 -6
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/BillingManagementScreen.js +3 -3
- package/lib/module/ui/screens/BillingManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +325 -307
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +3 -3
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +2 -2
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +2 -2
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +358 -310
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/SignUpScreen.js +486 -309
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js +3 -3
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaFAQScreen.js +52 -27
- package/lib/module/ui/screens/karma/KarmaFAQScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +2 -2
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
- package/lib/module/ui/styles/index.js +2 -2
- package/lib/module/ui/styles/index.js.map +1 -1
- package/lib/module/ui/styles/theme.js +1 -1
- package/lib/module/ui/styles/theme.js.map +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/core/index.d.ts +24 -0
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts.map +1 -1
- package/package.json +21 -5
- package/src/core/index.ts +68 -0
- package/src/ui/components/OxyProvider.tsx +5 -5
- package/src/ui/context/OxyContext.tsx +61 -41
- package/src/ui/screens/AccountOverviewScreen.tsx +44 -26
- package/src/ui/screens/AccountSettingsScreen.tsx +24 -18
- package/src/ui/screens/FileManagementScreen.tsx +246 -211
- package/src/ui/screens/SignInScreen.tsx +382 -326
- package/src/ui/screens/SignUpScreen.tsx +443 -273
- package/src/ui/screens/karma/KarmaFAQScreen.tsx +50 -29
- package/lib/commonjs/package.json +0 -1
- package/lib/module/package.json +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useMemo, useCallback } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
@@ -20,6 +20,15 @@ import { fontFamilies } from '../styles/fonts';
|
|
|
20
20
|
import { toast } from '../../lib/sonner';
|
|
21
21
|
import { Ionicons } from '@expo/vector-icons';
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* AccountOverviewScreen - Optimized for performance
|
|
25
|
+
*
|
|
26
|
+
* Performance optimizations implemented:
|
|
27
|
+
* - useMemo for theme calculations (only recalculates when theme changes)
|
|
28
|
+
* - useMemo for additional accounts filtering (only recalculates when dependencies change)
|
|
29
|
+
* - useCallback for event handlers to prevent unnecessary re-renders
|
|
30
|
+
* - React.memo wrapper to prevent re-renders when props haven't changed
|
|
31
|
+
*/
|
|
23
32
|
const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
24
33
|
onClose,
|
|
25
34
|
theme,
|
|
@@ -30,18 +39,26 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
30
39
|
const [additionalAccountsData, setAdditionalAccountsData] = useState<any[]>([]);
|
|
31
40
|
const [loadingAdditionalAccounts, setLoadingAdditionalAccounts] = useState(false);
|
|
32
41
|
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
// Memoize theme-related calculations to prevent unnecessary recalculations
|
|
43
|
+
const themeStyles = useMemo(() => {
|
|
44
|
+
const isDarkTheme = theme === 'dark';
|
|
45
|
+
return {
|
|
46
|
+
isDarkTheme,
|
|
47
|
+
textColor: isDarkTheme ? '#FFFFFF' : '#000000',
|
|
48
|
+
backgroundColor: isDarkTheme ? '#121212' : '#FFFFFF',
|
|
49
|
+
secondaryBackgroundColor: isDarkTheme ? '#222222' : '#F5F5F5',
|
|
50
|
+
borderColor: isDarkTheme ? '#444444' : '#E0E0E0',
|
|
51
|
+
primaryColor: '#d169e5',
|
|
52
|
+
dangerColor: '#D32F2F',
|
|
53
|
+
iconColor: isDarkTheme ? '#BBBBBB' : '#666666',
|
|
54
|
+
};
|
|
55
|
+
}, [theme]);
|
|
56
|
+
|
|
57
|
+
// Memoize additional accounts filtering to prevent recalculation on every render
|
|
58
|
+
const additionalAccounts = useMemo(() =>
|
|
59
|
+
sessions.filter(session =>
|
|
60
|
+
session.sessionId !== activeSessionId && session.userId !== user?.id
|
|
61
|
+
), [sessions, activeSessionId, user?.id]
|
|
45
62
|
);
|
|
46
63
|
|
|
47
64
|
// Load user profiles for additional accounts
|
|
@@ -98,7 +115,8 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
98
115
|
language: 'English',
|
|
99
116
|
};
|
|
100
117
|
|
|
101
|
-
|
|
118
|
+
// Memoize event handlers to prevent recreation on every render
|
|
119
|
+
const handleLogout = useCallback(async () => {
|
|
102
120
|
try {
|
|
103
121
|
await logout();
|
|
104
122
|
if (onClose) {
|
|
@@ -108,9 +126,9 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
108
126
|
console.error('Logout failed:', error);
|
|
109
127
|
toast.error('There was a problem signing you out. Please try again.');
|
|
110
128
|
}
|
|
111
|
-
};
|
|
129
|
+
}, [logout, onClose]);
|
|
112
130
|
|
|
113
|
-
const confirmLogout = () => {
|
|
131
|
+
const confirmLogout = useCallback(() => {
|
|
114
132
|
Alert.alert(
|
|
115
133
|
'Sign Out',
|
|
116
134
|
'Are you sure you want to sign out?',
|
|
@@ -127,13 +145,13 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
127
145
|
],
|
|
128
146
|
{ cancelable: true }
|
|
129
147
|
);
|
|
130
|
-
};
|
|
148
|
+
}, [handleLogout]);
|
|
131
149
|
|
|
132
|
-
const handleAddAccount = () => {
|
|
150
|
+
const handleAddAccount = useCallback(() => {
|
|
133
151
|
toast.info('Add another account feature coming soon!');
|
|
134
|
-
};
|
|
152
|
+
}, []);
|
|
135
153
|
|
|
136
|
-
const handleSignOutAll = () => {
|
|
154
|
+
const handleSignOutAll = useCallback(() => {
|
|
137
155
|
Alert.alert(
|
|
138
156
|
'Sign Out of All Accounts',
|
|
139
157
|
'Are you sure you want to sign out of all accounts?',
|
|
@@ -150,20 +168,20 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
150
168
|
],
|
|
151
169
|
{ cancelable: true }
|
|
152
170
|
);
|
|
153
|
-
};
|
|
171
|
+
}, [handleLogout]);
|
|
154
172
|
|
|
155
173
|
if (!user) {
|
|
156
174
|
return (
|
|
157
|
-
<View style={[styles.container, { backgroundColor }]}>
|
|
158
|
-
<Text style={[styles.message, { color: textColor }]}>Not signed in</Text>
|
|
175
|
+
<View style={[styles.container, { backgroundColor: themeStyles.backgroundColor }]}>
|
|
176
|
+
<Text style={[styles.message, { color: themeStyles.textColor }]}>Not signed in</Text>
|
|
159
177
|
</View>
|
|
160
178
|
);
|
|
161
179
|
}
|
|
162
180
|
|
|
163
181
|
if (isLoading) {
|
|
164
182
|
return (
|
|
165
|
-
<View style={[styles.container, { backgroundColor, justifyContent: 'center' }]}>
|
|
166
|
-
<ActivityIndicator size="large" color={primaryColor} />
|
|
183
|
+
<View style={[styles.container, { backgroundColor: themeStyles.backgroundColor, justifyContent: 'center' }]}>
|
|
184
|
+
<ActivityIndicator size="large" color={themeStyles.primaryColor} />
|
|
167
185
|
</View>
|
|
168
186
|
);
|
|
169
187
|
}
|
|
@@ -676,4 +694,4 @@ const styles = StyleSheet.create({
|
|
|
676
694
|
},
|
|
677
695
|
});
|
|
678
696
|
|
|
679
|
-
export default AccountOverviewScreen;
|
|
697
|
+
export default React.memo(AccountOverviewScreen);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
@@ -51,19 +51,25 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
51
51
|
const [tempLocation, setTempLocation] = useState('');
|
|
52
52
|
const [tempWebsite, setTempWebsite] = useState('');
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
54
|
+
// Memoize theme-related calculations to prevent unnecessary recalculations
|
|
55
|
+
const themeStyles = useMemo(() => {
|
|
56
|
+
const isDarkTheme = theme === 'dark';
|
|
57
|
+
return {
|
|
58
|
+
isDarkTheme,
|
|
59
|
+
backgroundColor: isDarkTheme ? '#121212' : '#f2f2f2',
|
|
60
|
+
primaryColor: '#007AFF',
|
|
61
|
+
};
|
|
62
|
+
}, [theme]);
|
|
57
63
|
|
|
58
|
-
//
|
|
59
|
-
const animateSaveButton = (toValue: number) => {
|
|
64
|
+
// Memoize animation function to prevent recreation on every render
|
|
65
|
+
const animateSaveButton = useCallback((toValue: number) => {
|
|
60
66
|
Animated.spring(saveButtonScale, {
|
|
61
67
|
toValue,
|
|
62
68
|
useNativeDriver: true,
|
|
63
69
|
tension: 150,
|
|
64
70
|
friction: 8,
|
|
65
71
|
}).start();
|
|
66
|
-
};
|
|
72
|
+
}, [saveButtonScale]);
|
|
67
73
|
|
|
68
74
|
// Load user data
|
|
69
75
|
useEffect(() => {
|
|
@@ -280,20 +286,20 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
280
286
|
style={[
|
|
281
287
|
config.multiline ? styles.editingFieldTextArea : styles.editingFieldInput,
|
|
282
288
|
{
|
|
283
|
-
backgroundColor: isDarkTheme ? '#333' : '#fff',
|
|
284
|
-
color: isDarkTheme ? '#fff' : '#000',
|
|
285
|
-
borderColor: primaryColor
|
|
289
|
+
backgroundColor: themeStyles.isDarkTheme ? '#333' : '#fff',
|
|
290
|
+
color: themeStyles.isDarkTheme ? '#fff' : '#000',
|
|
291
|
+
borderColor: themeStyles.primaryColor
|
|
286
292
|
}
|
|
287
293
|
]}
|
|
288
294
|
value={tempValue}
|
|
289
295
|
onChangeText={setTempValue}
|
|
290
296
|
placeholder={config.placeholder}
|
|
291
|
-
placeholderTextColor={isDarkTheme ? '#aaa' : '#999'}
|
|
297
|
+
placeholderTextColor={themeStyles.isDarkTheme ? '#aaa' : '#999'}
|
|
292
298
|
multiline={config.multiline}
|
|
293
299
|
numberOfLines={config.multiline ? 6 : 1}
|
|
294
300
|
keyboardType={config.keyboardType}
|
|
295
301
|
autoFocus
|
|
296
|
-
selectionColor={primaryColor}
|
|
302
|
+
selectionColor={themeStyles.primaryColor}
|
|
297
303
|
/>
|
|
298
304
|
</View>
|
|
299
305
|
</View>
|
|
@@ -340,14 +346,14 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
340
346
|
|
|
341
347
|
if (authLoading || !user) {
|
|
342
348
|
return (
|
|
343
|
-
<View style={[styles.container, { backgroundColor, justifyContent: 'center' }]}>
|
|
344
|
-
<ActivityIndicator size="large" color={primaryColor} />
|
|
349
|
+
<View style={[styles.container, { backgroundColor: themeStyles.backgroundColor, justifyContent: 'center' }]}>
|
|
350
|
+
<ActivityIndicator size="large" color={themeStyles.primaryColor} />
|
|
345
351
|
</View>
|
|
346
352
|
);
|
|
347
353
|
}
|
|
348
354
|
|
|
349
355
|
return (
|
|
350
|
-
<View style={[styles.container, { backgroundColor }]}>
|
|
356
|
+
<View style={[styles.container, { backgroundColor: themeStyles.backgroundColor }]}>
|
|
351
357
|
{/* Header */}
|
|
352
358
|
<View style={styles.header}>
|
|
353
359
|
{editingField ? (
|
|
@@ -401,9 +407,9 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
401
407
|
disabled={isSaving}
|
|
402
408
|
>
|
|
403
409
|
{isSaving ? (
|
|
404
|
-
<ActivityIndicator size="small" color={primaryColor} />
|
|
410
|
+
<ActivityIndicator size="small" color={themeStyles.primaryColor} />
|
|
405
411
|
) : (
|
|
406
|
-
<Ionicons name="checkmark" size={24} color={primaryColor} />
|
|
412
|
+
<Ionicons name="checkmark" size={24} color={themeStyles.primaryColor} />
|
|
407
413
|
)}
|
|
408
414
|
</TouchableOpacity>
|
|
409
415
|
</Animated.View>
|
|
@@ -799,4 +805,4 @@ const styles = StyleSheet.create({
|
|
|
799
805
|
},
|
|
800
806
|
});
|
|
801
807
|
|
|
802
|
-
export default AccountSettingsScreen;
|
|
808
|
+
export default React.memo(AccountSettingsScreen);
|