@oxyhq/services 5.13.4 → 5.13.10

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 (170) hide show
  1. package/lib/commonjs/core/HttpClient.js +1 -1
  2. package/lib/commonjs/core/HttpClient.js.map +1 -1
  3. package/lib/commonjs/core/OxyServices.js +83 -30
  4. package/lib/commonjs/core/OxyServices.js.map +1 -1
  5. package/lib/commonjs/core/index.js +0 -7
  6. package/lib/commonjs/core/index.js.map +1 -1
  7. package/lib/commonjs/i18n/locales/en-US.json +222 -6
  8. package/lib/commonjs/index.js +0 -7
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/lib/sonner.js.map +1 -1
  11. package/lib/commonjs/ui/components/GroupedItem.js +24 -22
  12. package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
  13. package/lib/commonjs/ui/components/OxyProvider.js +35 -14
  14. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  15. package/lib/commonjs/ui/navigation/routes.js +36 -1
  16. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  17. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +150 -5
  18. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  19. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +475 -319
  20. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  21. package/lib/commonjs/ui/screens/AccountVerificationScreen.js +217 -0
  22. package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -0
  23. package/lib/commonjs/ui/screens/FileManagementScreen.js +911 -213
  24. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  25. package/lib/commonjs/ui/screens/HelpSupportScreen.js +131 -0
  26. package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -0
  27. package/lib/commonjs/ui/screens/HistoryViewScreen.js +258 -0
  28. package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -0
  29. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +211 -0
  30. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js.map +1 -0
  31. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +0 -1
  32. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  33. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +307 -0
  34. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -0
  35. package/lib/commonjs/ui/screens/ProfileScreen.js +1 -7
  36. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  37. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +205 -0
  38. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -0
  39. package/lib/commonjs/ui/screens/SearchSettingsScreen.js +239 -0
  40. package/lib/commonjs/ui/screens/SearchSettingsScreen.js.map +1 -0
  41. package/lib/commonjs/ui/screens/SignInScreen.js +14 -29
  42. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
  43. package/lib/commonjs/utils/asyncUtils.js +1 -0
  44. package/lib/commonjs/utils/asyncUtils.js.map +1 -1
  45. package/lib/commonjs/utils/cache.js +4 -4
  46. package/lib/commonjs/utils/cache.js.map +1 -1
  47. package/lib/commonjs/utils/index.js +0 -6
  48. package/lib/commonjs/utils/index.js.map +1 -1
  49. package/lib/module/core/HttpClient.js +1 -1
  50. package/lib/module/core/HttpClient.js.map +1 -1
  51. package/lib/module/core/OxyServices.js +82 -29
  52. package/lib/module/core/OxyServices.js.map +1 -1
  53. package/lib/module/core/index.js +1 -1
  54. package/lib/module/core/index.js.map +1 -1
  55. package/lib/module/i18n/locales/en-US.json +222 -6
  56. package/lib/module/index.js +1 -1
  57. package/lib/module/index.js.map +1 -1
  58. package/lib/module/lib/sonner.js.map +1 -1
  59. package/lib/module/ui/components/GroupedItem.js +24 -22
  60. package/lib/module/ui/components/GroupedItem.js.map +1 -1
  61. package/lib/module/ui/components/OxyProvider.js +40 -17
  62. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  63. package/lib/module/ui/navigation/routes.js +36 -1
  64. package/lib/module/ui/navigation/routes.js.map +1 -1
  65. package/lib/module/ui/screens/AccountOverviewScreen.js +151 -6
  66. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  67. package/lib/module/ui/screens/AccountSettingsScreen.js +475 -319
  68. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  69. package/lib/module/ui/screens/AccountVerificationScreen.js +212 -0
  70. package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -0
  71. package/lib/module/ui/screens/FileManagementScreen.js +913 -212
  72. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  73. package/lib/module/ui/screens/HelpSupportScreen.js +126 -0
  74. package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -0
  75. package/lib/module/ui/screens/HistoryViewScreen.js +253 -0
  76. package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -0
  77. package/lib/module/ui/screens/LegalDocumentsScreen.js +206 -0
  78. package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -0
  79. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +0 -1
  80. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  81. package/lib/module/ui/screens/PrivacySettingsScreen.js +302 -0
  82. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -0
  83. package/lib/module/ui/screens/ProfileScreen.js +1 -7
  84. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  85. package/lib/module/ui/screens/SavesCollectionsScreen.js +200 -0
  86. package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -0
  87. package/lib/module/ui/screens/SearchSettingsScreen.js +234 -0
  88. package/lib/module/ui/screens/SearchSettingsScreen.js.map +1 -0
  89. package/lib/module/ui/screens/SignInScreen.js +14 -29
  90. package/lib/module/ui/screens/SignInScreen.js.map +1 -1
  91. package/lib/module/utils/asyncUtils.js +1 -0
  92. package/lib/module/utils/asyncUtils.js.map +1 -1
  93. package/lib/module/utils/cache.js +3 -3
  94. package/lib/module/utils/cache.js.map +1 -1
  95. package/lib/module/utils/index.js +1 -1
  96. package/lib/module/utils/index.js.map +1 -1
  97. package/lib/typescript/core/OxyServices.d.ts +30 -24
  98. package/lib/typescript/core/OxyServices.d.ts.map +1 -1
  99. package/lib/typescript/core/index.d.ts +1 -1
  100. package/lib/typescript/core/index.d.ts.map +1 -1
  101. package/lib/typescript/index.d.ts +1 -1
  102. package/lib/typescript/index.d.ts.map +1 -1
  103. package/lib/typescript/lib/sonner.d.ts +1 -0
  104. package/lib/typescript/lib/sonner.d.ts.map +1 -1
  105. package/lib/typescript/types/expo-document-picker.d.ts +36 -0
  106. package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -1
  107. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
  108. package/lib/typescript/ui/navigation/routes.d.ts +1 -1
  109. package/lib/typescript/ui/navigation/routes.d.ts.map +1 -1
  110. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  111. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  112. package/lib/typescript/ui/screens/AccountVerificationScreen.d.ts +5 -0
  113. package/lib/typescript/ui/screens/AccountVerificationScreen.d.ts.map +1 -0
  114. package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
  115. package/lib/typescript/ui/screens/HelpSupportScreen.d.ts +5 -0
  116. package/lib/typescript/ui/screens/HelpSupportScreen.d.ts.map +1 -0
  117. package/lib/typescript/ui/screens/HistoryViewScreen.d.ts +5 -0
  118. package/lib/typescript/ui/screens/HistoryViewScreen.d.ts.map +1 -0
  119. package/lib/typescript/ui/screens/LegalDocumentsScreen.d.ts +5 -0
  120. package/lib/typescript/ui/screens/LegalDocumentsScreen.d.ts.map +1 -0
  121. package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  122. package/lib/typescript/ui/screens/PrivacySettingsScreen.d.ts +5 -0
  123. package/lib/typescript/ui/screens/PrivacySettingsScreen.d.ts.map +1 -0
  124. package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +1 -1
  125. package/lib/typescript/ui/screens/SavesCollectionsScreen.d.ts +5 -0
  126. package/lib/typescript/ui/screens/SavesCollectionsScreen.d.ts.map +1 -0
  127. package/lib/typescript/ui/screens/SearchSettingsScreen.d.ts +5 -0
  128. package/lib/typescript/ui/screens/SearchSettingsScreen.d.ts.map +1 -0
  129. package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
  130. package/lib/typescript/utils/asyncUtils.d.ts.map +1 -1
  131. package/lib/typescript/utils/cache.d.ts +3 -3
  132. package/lib/typescript/utils/cache.d.ts.map +1 -1
  133. package/lib/typescript/utils/index.d.ts +1 -1
  134. package/lib/typescript/utils/index.d.ts.map +1 -1
  135. package/package.json +1 -1
  136. package/src/core/HttpClient.ts +1 -1
  137. package/src/core/OxyServices.ts +80 -30
  138. package/src/core/index.ts +1 -1
  139. package/src/i18n/locales/en-US.json +222 -6
  140. package/src/index.ts +1 -1
  141. package/src/lib/sonner.ts +1 -0
  142. package/src/types/expo-document-picker.d.ts +36 -0
  143. package/src/ui/components/GroupedItem.tsx +23 -21
  144. package/src/ui/components/OxyProvider.tsx +33 -11
  145. package/src/ui/navigation/routes.ts +42 -0
  146. package/src/ui/screens/AccountOverviewScreen.tsx +175 -5
  147. package/src/ui/screens/AccountSettingsScreen.tsx +521 -360
  148. package/src/ui/screens/AccountVerificationScreen.tsx +235 -0
  149. package/src/ui/screens/FileManagementScreen.tsx +934 -208
  150. package/src/ui/screens/HelpSupportScreen.tsx +143 -0
  151. package/src/ui/screens/HistoryViewScreen.tsx +280 -0
  152. package/src/ui/screens/LegalDocumentsScreen.tsx +220 -0
  153. package/src/ui/screens/PremiumSubscriptionScreen.tsx +0 -1
  154. package/src/ui/screens/PrivacySettingsScreen.tsx +332 -0
  155. package/src/ui/screens/ProfileScreen.tsx +1 -8
  156. package/src/ui/screens/SavesCollectionsScreen.tsx +222 -0
  157. package/src/ui/screens/SearchSettingsScreen.tsx +219 -0
  158. package/src/ui/screens/SignInScreen.tsx +19 -35
  159. package/src/utils/asyncUtils.ts +1 -0
  160. package/src/utils/cache.ts +3 -3
  161. package/src/utils/index.ts +1 -1
  162. package/lib/commonjs/ui/components/StepBasedScreen.README.md +0 -337
  163. package/lib/commonjs/ui/components/internal/TextField.md +0 -436
  164. package/lib/commonjs/ui/styles/FONTS.md +0 -126
  165. package/lib/module/ui/components/StepBasedScreen.README.md +0 -337
  166. package/lib/module/ui/components/internal/TextField.md +0 -436
  167. package/lib/module/ui/styles/FONTS.md +0 -126
  168. package/src/ui/components/StepBasedScreen.README.md +0 -337
  169. package/src/ui/components/internal/TextField.md +0 -436
  170. package/src/ui/styles/FONTS.md +0 -126
@@ -0,0 +1,219 @@
1
+ import React, { useState, useCallback, useMemo, useEffect } from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ TouchableOpacity,
6
+ StyleSheet,
7
+ ScrollView,
8
+ Switch,
9
+ ActivityIndicator,
10
+ } from 'react-native';
11
+ import type { BaseScreenProps } from '../navigation/types';
12
+ import { useOxy } from '../context/OxyContext';
13
+ import { toast } from '../../lib/sonner';
14
+ import { Header, Section, GroupedSection } from '../components';
15
+ import { useI18n } from '../hooks/useI18n';
16
+
17
+ const SearchSettingsScreen: React.FC<BaseScreenProps> = ({
18
+ onClose,
19
+ theme,
20
+ goBack,
21
+ }) => {
22
+ const { oxyServices, user } = useOxy();
23
+ const { t } = useI18n();
24
+ const [safeSearch, setSafeSearch] = useState(false);
25
+ const [searchPersonalization, setSearchPersonalization] = useState(true);
26
+ const [isLoading, setIsLoading] = useState(true);
27
+ const [isSaving, setIsSaving] = useState(false);
28
+
29
+ // Load settings
30
+ useEffect(() => {
31
+ const loadSettings = async () => {
32
+ try {
33
+ setIsLoading(true);
34
+ if (user?.id && oxyServices) {
35
+ // Load from user's privacy settings
36
+ const userData = await oxyServices.getCurrentUser();
37
+ const privacySettings = (userData as any)?.privacySettings || {};
38
+
39
+ // SafeSearch is typically stored in privacySettings.autoFilter or a separate field
40
+ setSafeSearch(privacySettings.autoFilter ?? false);
41
+ setSearchPersonalization(privacySettings.dataSharing ?? true);
42
+ }
43
+ } catch (error) {
44
+ console.error('Failed to load search settings:', error);
45
+ } finally {
46
+ setIsLoading(false);
47
+ }
48
+ };
49
+
50
+ loadSettings();
51
+ }, [user?.id, oxyServices]);
52
+
53
+ const handleSafeSearchToggle = useCallback(async (value: boolean) => {
54
+ try {
55
+ setIsSaving(true);
56
+ setSafeSearch(value);
57
+
58
+ if (user?.id && oxyServices) {
59
+ // Update privacy settings
60
+ await oxyServices.updateProfile({
61
+ privacySettings: {
62
+ autoFilter: value,
63
+ },
64
+ });
65
+ toast.success(t('searchSettings.safeSearch.updated') || 'SafeSearch setting updated');
66
+ }
67
+ } catch (error) {
68
+ console.error('Failed to update SafeSearch:', error);
69
+ toast.error(t('searchSettings.safeSearch.error') || 'Failed to update SafeSearch');
70
+ setSafeSearch(!value); // Revert on error
71
+ } finally {
72
+ setIsSaving(false);
73
+ }
74
+ }, [user?.id, oxyServices, t]);
75
+
76
+ const handlePersonalizationToggle = useCallback(async (value: boolean) => {
77
+ try {
78
+ setIsSaving(true);
79
+ setSearchPersonalization(value);
80
+
81
+ if (user?.id && oxyServices) {
82
+ // Update privacy settings
83
+ await oxyServices.updateProfile({
84
+ privacySettings: {
85
+ dataSharing: value,
86
+ },
87
+ });
88
+ toast.success(t('searchSettings.personalization.updated') || 'Search personalization updated');
89
+ }
90
+ } catch (error) {
91
+ console.error('Failed to update personalization:', error);
92
+ toast.error(t('searchSettings.personalization.error') || 'Failed to update personalization');
93
+ setSearchPersonalization(!value); // Revert on error
94
+ } finally {
95
+ setIsSaving(false);
96
+ }
97
+ }, [user?.id, oxyServices, t]);
98
+
99
+ const themeStyles = useMemo(() => {
100
+ const isDarkTheme = theme === 'dark';
101
+ return {
102
+ textColor: isDarkTheme ? '#FFFFFF' : '#000000',
103
+ backgroundColor: isDarkTheme ? '#121212' : '#FFFFFF',
104
+ secondaryBackgroundColor: isDarkTheme ? '#222222' : '#F5F5F5',
105
+ borderColor: isDarkTheme ? '#444444' : '#E0E0E0',
106
+ };
107
+ }, [theme]);
108
+
109
+ if (isLoading) {
110
+ return (
111
+ <View style={[styles.container, { backgroundColor: themeStyles.backgroundColor }]}>
112
+ <Header
113
+ title={t('searchSettings.title') || 'Search Settings'}
114
+ theme={theme}
115
+ onBack={goBack || onClose}
116
+ variant="minimal"
117
+ elevation="subtle"
118
+ />
119
+ <View style={styles.loadingContainer}>
120
+ <ActivityIndicator size="large" color={themeStyles.textColor} />
121
+ </View>
122
+ </View>
123
+ );
124
+ }
125
+
126
+ return (
127
+ <View style={[styles.container, { backgroundColor: themeStyles.backgroundColor }]}>
128
+ <Header
129
+ title={t('searchSettings.title') || 'Search Settings'}
130
+ theme={theme}
131
+ onBack={goBack || onClose}
132
+ variant="minimal"
133
+ elevation="subtle"
134
+ />
135
+
136
+ <ScrollView style={styles.content}>
137
+ {/* SafeSearch */}
138
+ <Section title={t('searchSettings.safeSearch.title') || 'SafeSearch'} theme={theme} isFirst={true}>
139
+ <View style={[styles.settingRow, { borderBottomColor: themeStyles.borderColor }]}>
140
+ <View style={styles.settingInfo}>
141
+ <Text style={[styles.settingTitle, { color: themeStyles.textColor }]}>
142
+ {t('searchSettings.safeSearch.label') || 'Enable SafeSearch'}
143
+ </Text>
144
+ <Text style={[styles.settingDescription, { color: themeStyles.textColor }]}>
145
+ {t('searchSettings.safeSearch.description') || 'Filter out explicit content from search results'}
146
+ </Text>
147
+ </View>
148
+ <Switch
149
+ value={safeSearch}
150
+ onValueChange={handleSafeSearchToggle}
151
+ disabled={isSaving}
152
+ trackColor={{ false: '#767577', true: '#d169e5' }}
153
+ thumbColor={safeSearch ? '#fff' : '#f4f3f4'}
154
+ />
155
+ </View>
156
+ </Section>
157
+
158
+ {/* Search Personalization */}
159
+ <Section title={t('searchSettings.personalization.title') || 'Search Personalization'} theme={theme}>
160
+ <View style={[styles.settingRow, { borderBottomColor: themeStyles.borderColor }]}>
161
+ <View style={styles.settingInfo}>
162
+ <Text style={[styles.settingTitle, { color: themeStyles.textColor }]}>
163
+ {t('searchSettings.personalization.label') || 'Personalized Search'}
164
+ </Text>
165
+ <Text style={[styles.settingDescription, { color: themeStyles.textColor }]}>
166
+ {t('searchSettings.personalization.description') || 'Use your activity to improve search results'}
167
+ </Text>
168
+ </View>
169
+ <Switch
170
+ value={searchPersonalization}
171
+ onValueChange={handlePersonalizationToggle}
172
+ disabled={isSaving}
173
+ trackColor={{ false: '#767577', true: '#d169e5' }}
174
+ thumbColor={searchPersonalization ? '#fff' : '#f4f3f4'}
175
+ />
176
+ </View>
177
+ </Section>
178
+ </ScrollView>
179
+ </View>
180
+ );
181
+ };
182
+
183
+ const styles = StyleSheet.create({
184
+ container: {
185
+ flex: 1,
186
+ },
187
+ content: {
188
+ flex: 1,
189
+ padding: 16,
190
+ },
191
+ loadingContainer: {
192
+ flex: 1,
193
+ alignItems: 'center',
194
+ justifyContent: 'center',
195
+ },
196
+ settingRow: {
197
+ flexDirection: 'row',
198
+ justifyContent: 'space-between',
199
+ alignItems: 'center',
200
+ paddingVertical: 16,
201
+ borderBottomWidth: 1,
202
+ },
203
+ settingInfo: {
204
+ flex: 1,
205
+ marginRight: 16,
206
+ },
207
+ settingTitle: {
208
+ fontSize: 16,
209
+ fontWeight: '500',
210
+ marginBottom: 4,
211
+ },
212
+ settingDescription: {
213
+ fontSize: 14,
214
+ opacity: 0.7,
215
+ },
216
+ });
217
+
218
+ export default React.memo(SearchSettingsScreen);
219
+
@@ -42,10 +42,7 @@ const SignInScreen: React.FC<BaseScreenProps> = ({
42
42
 
43
43
  // Username validation using core services with caching
44
44
  const validateUsername = useCallback(async (usernameToValidate: string) => {
45
- if (__DEV__) console.log('🔍 Validating username:', usernameToValidate);
46
-
47
45
  if (!usernameToValidate || usernameToValidate.length < 3) {
48
- if (__DEV__) console.log('❌ Username too short');
49
46
  setValidationStatus('invalid');
50
47
  setErrorMessage('Username must be at least 3 characters.');
51
48
  return false;
@@ -53,7 +50,7 @@ const SignInScreen: React.FC<BaseScreenProps> = ({
53
50
 
54
51
  // Safety check for oxyServices
55
52
  if (!oxyServices || typeof oxyServices.getProfileByUsername !== 'function') {
56
- console.error('🚨 oxyServices not available or getProfileByUsername not found');
53
+ console.error('oxyServices not available or getProfileByUsername not found');
57
54
  setValidationStatus('invalid');
58
55
  setErrorMessage('Service unavailable. Please try again.');
59
56
  return false;
@@ -62,62 +59,51 @@ const SignInScreen: React.FC<BaseScreenProps> = ({
62
59
  const offlineDetected = typeof navigator !== 'undefined' && navigator.onLine === false;
63
60
 
64
61
  if (offlineDetected) {
65
- if (__DEV__) console.log('⚠️ Offline detected, skipping username validation');
66
62
  setValidationStatus('invalid');
67
63
  setErrorMessage('No connection. Check your internet connection and try again.');
68
64
  return false;
69
65
  }
70
66
 
71
- if (__DEV__) console.log('🔄 Validating username with API...');
72
67
  setIsValidating(true);
73
68
  setValidationStatus('validating');
74
69
 
75
70
  try {
76
71
  // Check if username exists
77
72
  const profile = await oxyServices.getProfileByUsername(usernameToValidate);
78
- if (__DEV__) console.log('📋 Profile response:', profile);
79
73
 
80
- if (profile && profile.username) {
74
+ // Handle case where profile might be wrapped in a data property (defensive check)
75
+ const userProfile = (profile as any)?.data || profile;
76
+
77
+ if (userProfile?.username) {
81
78
  const profileData = {
82
- displayName: profile.name?.full || profile.name?.first || profile.username,
83
- name: profile.username,
84
- avatar: profile.avatar,
85
- id: profile.id
79
+ displayName: userProfile.name?.full || userProfile.name?.first || userProfile.username,
80
+ name: userProfile.username,
81
+ avatar: userProfile.avatar,
82
+ id: userProfile.id
86
83
  };
87
84
 
88
- if (__DEV__) console.log('✅ Username is valid:', profileData);
89
85
  setUserProfile(profileData);
90
-
86
+
91
87
  // Check if this account is already signed in
92
- const profileUserId = profile.id?.toString();
88
+ const profileUserId = userProfile.id?.toString();
93
89
  const existing = sessions?.find(s => {
94
90
  const sessionUserId = s.userId?.toString();
95
91
  return sessionUserId === profileUserId;
96
92
  });
97
-
98
- if (existing) {
99
- setExistingSession(existing);
100
- if (__DEV__) console.log('✅ Account already signed in:', existing);
101
- } else {
102
- setExistingSession(null);
103
- }
104
-
93
+
94
+ setExistingSession(existing || null);
105
95
  setValidationStatus('valid');
106
96
  setErrorMessage('');
107
97
 
108
98
  return true;
109
- } else {
110
- if (__DEV__) console.log('❌ Username not found');
111
- setValidationStatus('invalid');
112
- setErrorMessage('Username not found.');
113
- return false;
114
99
  }
115
- } catch (error: any) {
116
- if (__DEV__) console.log('🚨 Validation error:', error);
117
100
 
101
+ setValidationStatus('invalid');
102
+ setErrorMessage('Username not found.');
103
+ return false;
104
+ } catch (error: any) {
118
105
  // If user not found (404), username doesn't exist
119
106
  if (error?.status === 404 || error?.code === 'USER_NOT_FOUND') {
120
- console.log('❌ Username not found (404)');
121
107
  setValidationStatus('invalid');
122
108
  setErrorMessage('Username not found.');
123
109
  return false;
@@ -147,7 +133,6 @@ const SignInScreen: React.FC<BaseScreenProps> = ({
147
133
 
148
134
  // Input change handlers
149
135
  const handleUsernameChange = useCallback((text: string) => {
150
- console.log('🔄 SignInScreen handleUsernameChange called:', text);
151
136
  setUsername(text);
152
137
  if (errorMessage) setErrorMessage('');
153
138
  setValidationStatus('idle');
@@ -183,7 +168,7 @@ const SignInScreen: React.FC<BaseScreenProps> = ({
183
168
 
184
169
  const handleContinueWithExistingAccount = useCallback(async () => {
185
170
  if (!existingSession) return;
186
-
171
+
187
172
  try {
188
173
  setErrorMessage('');
189
174
  await switchSession(existingSession.sessionId);
@@ -206,7 +191,7 @@ const SignInScreen: React.FC<BaseScreenProps> = ({
206
191
  setErrorMessage('Please enter a valid username first.');
207
192
  return;
208
193
  }
209
-
194
+
210
195
  try {
211
196
  setErrorMessage('');
212
197
  const user = await login(username, password);
@@ -238,7 +223,6 @@ const SignInScreen: React.FC<BaseScreenProps> = ({
238
223
  const handleComplete = useCallback(async (stepData: any[]) => {
239
224
  // The sign-in is handled by the password step component
240
225
  // This callback is here for interface compatibility
241
- if (__DEV__) console.log('Sign-in flow completed');
242
226
  }, []);
243
227
 
244
228
  // Step data for the reusable component
@@ -204,6 +204,7 @@ export async function withTimeout<T>(
204
204
  export function createAsyncCache<T>(
205
205
  ttl: number = 5 * 60 * 1000 // 5 minutes default
206
206
  ) {
207
+ // Re-export from centralized cache utility
207
208
  const cache = new TTLCache<T>(ttl);
208
209
  registerCacheForCleanup(cache);
209
210
 
@@ -251,10 +251,10 @@ export function unregisterCacheFromCleanup(cache: TTLCache<any>): void {
251
251
  }
252
252
 
253
253
  /**
254
- * Stop all cache cleanup intervals
255
- * Useful for tests to prevent Jest from hanging
254
+ * Stop all cleanup intervals (useful for testing)
255
+ * This will clear the interval and unregister all caches
256
256
  */
257
- export function stopAllCacheCleanup(): void {
257
+ export function stopAllCleanupIntervals(): void {
258
258
  if (cleanupInterval) {
259
259
  clearInterval(cleanupInterval);
260
260
  cleanupInterval = null;
@@ -5,7 +5,7 @@ export type { DeviceFingerprint, StoredDeviceInfo } from './deviceManager';
5
5
  export { RequestDeduplicator, RequestQueue, SimpleLogger } from './requestUtils';
6
6
 
7
7
  // Cache utilities
8
- export { TTLCache, createCache, registerCacheForCleanup, unregisterCacheFromCleanup, stopAllCacheCleanup } from './cache';
8
+ export { TTLCache, createCache, registerCacheForCleanup, unregisterCacheFromCleanup } from './cache';
9
9
  export type { CacheStats } from './cache';
10
10
 
11
11
  // Session utilities