@umituz/react-native-settings 4.20.58 → 4.20.59

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 (64) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +51 -0
  2. package/.github/ISSUE_TEMPLATE/documentation.md +52 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +63 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +84 -0
  5. package/AI_AGENT_GUIDELINES.md +367 -0
  6. package/ARCHITECTURE.md +246 -0
  7. package/CHANGELOG.md +67 -0
  8. package/CODE_OF_CONDUCT.md +75 -0
  9. package/CONTRIBUTING.md +107 -0
  10. package/DOCUMENTATION_MIGRATION.md +319 -0
  11. package/DOCUMENTATION_TEMPLATE.md +155 -0
  12. package/LICENSE +21 -0
  13. package/README.md +321 -498
  14. package/SECURITY.md +98 -0
  15. package/SETTINGS_SCREEN_GUIDE.md +185 -0
  16. package/TESTING.md +358 -0
  17. package/package.json +13 -2
  18. package/src/application/README.md +85 -271
  19. package/src/domains/about/README.md +85 -440
  20. package/src/domains/about/presentation/hooks/README.md +93 -348
  21. package/src/domains/appearance/README.md +95 -584
  22. package/src/domains/appearance/hooks/README.md +95 -303
  23. package/src/domains/appearance/infrastructure/services/README.md +83 -397
  24. package/src/domains/appearance/presentation/components/README.md +95 -489
  25. package/src/domains/cloud-sync/README.md +73 -439
  26. package/src/domains/cloud-sync/presentation/components/README.md +95 -493
  27. package/src/domains/dev/README.md +71 -457
  28. package/src/domains/disclaimer/README.md +77 -411
  29. package/src/domains/disclaimer/presentation/components/README.md +95 -392
  30. package/src/domains/faqs/README.md +86 -574
  31. package/src/domains/feedback/README.md +79 -553
  32. package/src/domains/feedback/presentation/hooks/README.md +93 -426
  33. package/src/domains/legal/README.md +88 -537
  34. package/src/domains/rating/README.md +73 -440
  35. package/src/domains/rating/presentation/components/README.md +95 -475
  36. package/src/domains/video-tutorials/README.md +77 -470
  37. package/src/domains/video-tutorials/presentation/components/README.md +95 -431
  38. package/src/infrastructure/README.md +78 -425
  39. package/src/infrastructure/repositories/README.md +88 -420
  40. package/src/infrastructure/services/README.md +74 -460
  41. package/src/presentation/components/README.md +97 -480
  42. package/src/presentation/components/SettingsErrorBoundary/README.md +48 -436
  43. package/src/presentation/components/SettingsFooter/README.md +48 -427
  44. package/src/presentation/components/SettingsItemCard/README.md +152 -391
  45. package/src/presentation/components/SettingsItemCard/STRATEGY.md +164 -0
  46. package/src/presentation/components/SettingsSection/README.md +47 -401
  47. package/src/presentation/hooks/README.md +95 -389
  48. package/src/presentation/hooks/mutations/README.md +99 -376
  49. package/src/presentation/hooks/queries/README.md +111 -353
  50. package/src/presentation/navigation/README.md +70 -502
  51. package/src/presentation/navigation/components/README.md +70 -295
  52. package/src/presentation/navigation/hooks/README.md +75 -367
  53. package/src/presentation/navigation/utils/README.md +100 -380
  54. package/src/presentation/screens/README.md +53 -504
  55. package/src/presentation/screens/components/SettingsContent/README.md +53 -382
  56. package/src/presentation/screens/components/SettingsHeader/README.md +48 -303
  57. package/src/presentation/screens/components/sections/CustomSettingsList/README.md +47 -359
  58. package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +81 -176
  59. package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +40 -297
  60. package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +47 -451
  61. package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +45 -361
  62. package/src/presentation/screens/hooks/README.md +64 -354
  63. package/src/presentation/screens/types/README.md +79 -409
  64. package/src/presentation/screens/utils/README.md +65 -255
@@ -1,493 +1,95 @@
1
- # CloudSyncSetting
2
-
3
- Component for displaying cloud synchronization status, last sync time, and sync controls.
4
-
5
- ## Features
6
-
7
- - **Status Display**: Shows current sync status (synced, syncing, error)
8
- - **Last Sync**: Shows relative time of last synchronization
9
- - **Manual Sync**: Trigger manual synchronization
10
- - **Progress**: Display sync progress
11
- - **Error Handling**: Show error messages and retry options
12
- - **Customizable**: Custom messages and styles
13
-
14
- ## Installation
15
-
16
- This component is part of `@umituz/react-native-settings`.
17
-
18
- ## Usage
19
-
20
- ### Basic Usage
21
-
22
- ```tsx
23
- import { CloudSyncSetting } from '@umituz/react-native-settings';
24
-
25
- function SettingsScreen() {
26
- return (
27
- <CloudSyncSetting
28
- status="synced"
29
- lastSync={new Date()}
30
- onSyncPress={() => console.log('Sync pressed')}
31
- />
32
- );
33
- }
34
- ```
35
-
36
- ### With Custom Status
37
-
38
- ```tsx
39
- function CloudSyncStatus() {
40
- const [status, setStatus] = useState('syncing');
41
-
42
- return (
43
- <CloudSyncSetting
44
- status={status}
45
- lastSync={new Date()}
46
- onSyncPress={() => {
47
- setStatus('syncing');
48
- // Perform sync
49
- setTimeout(() => setStatus('synced'), 2000);
50
- }}
51
- />
52
- );
53
- }
54
- ```
55
-
56
- ### With Error State
57
-
58
- ```tsx
59
- function CloudSyncWithError() {
60
- const [syncState, setSyncState] = useState({
61
- status: 'error',
62
- error: 'Network connection failed',
63
- lastSync: new Date(Date.now() - 3600000),
64
- });
65
-
66
- return (
67
- <CloudSyncSetting
68
- status={syncState.status}
69
- lastSync={syncState.lastSync}
70
- error={syncState.error}
71
- onSyncPress={() => retrySync()}
72
- onRetryPress={() => retrySync()}
73
- />
74
- );
75
- }
76
- ```
77
-
78
- ## Props
79
-
80
- ### CloudSyncSettingProps
81
-
82
- | Prop | Type | Default | Description |
83
- |------|------|---------|-------------|
84
- | `status` | `'synced' \| 'syncing' \| 'error'` | **Required** | Current sync status |
85
- | `lastSync` | `Date` | **Required** | Last sync timestamp |
86
- | `onSyncPress` | `() => void` | `undefined` | Manual sync handler |
87
- | `error` | `string` | `undefined` | Error message |
88
- | `onRetryPress` | `() => void` | `undefined` | Retry handler |
89
- | `syncMessage` | `string` | `undefined` | Custom sync message |
90
- | `showProgress` | `boolean` | `true` | Show progress indicator |
91
- | `title` | `string` | `'Cloud Sync'` | Custom title |
92
- | `description` | `string` | `undefined` | Custom description |
93
- | `style` | `ViewStyle` | `undefined` | Custom container style |
94
-
95
- ## Component Structure
96
-
97
- ```
98
- CloudSyncSetting
99
- ├── Icon (cloud icon with status indicator)
100
- ├── Content
101
- │ ├── Title
102
- │ ├── Status Message
103
- │ └── Last Sync Time
104
- └── Right Element
105
- ├── Sync Button (if syncing or manual sync)
106
- └── Retry Button (if error)
107
- ```
108
-
109
- ## Examples
110
-
111
- ### Synced State
112
-
113
- ```tsx
114
- <CloudSyncSetting
115
- status="synced"
116
- lastSync={new Date()}
117
- title="Cloud Sync"
118
- description="All data is up to date"
119
- />
120
- ```
121
-
122
- Shows:
123
- ```
124
- ☁️ Cloud Sync
125
- Synced
126
- Last synced: Just now
127
- ```
128
-
129
- ### Syncing State
130
-
131
- ```tsx
132
- <CloudSyncSetting
133
- status="syncing"
134
- lastSync={new Date(Date.now() - 3600000)}
135
- showProgress={true}
136
- />
137
- ```
138
-
139
- Shows:
140
- ```
141
- ☁️ Cloud Sync
142
- Syncing...
143
- Last synced: 1 hour ago
144
- [⏳ Syncing...]
145
- ```
146
-
147
- ### Error State
148
-
149
- ```tsx
150
- <CloudSyncSetting
151
- status="error"
152
- lastSync={new Date(Date.now() - 7200000)}
153
- error="Connection failed"
154
- onRetryPress={() => retry()}
155
- />
156
- ```
157
-
158
- Shows:
159
- ```
160
- ☁️ Cloud Sync
161
- ❌ Connection failed
162
- Last synced: 2 hours ago
163
- [Retry]
164
- ```
165
-
166
- ### With Custom Messages
167
-
168
- ```tsx
169
- <CloudSyncSetting
170
- status="synced"
171
- lastSync={new Date()}
172
- title="Backup"
173
- description="Last backup completed successfully"
174
- syncMessage="All files backed up"
175
- />
176
- ```
177
-
178
- ### Manual Sync Button
179
-
180
- ```tsx
181
- function ManualSync() {
182
- const [isSyncing, setIsSyncing] = useState(false);
183
- const [lastSync, setLastSync] = useState(new Date());
184
-
185
- const handleSync = useCallback(async () => {
186
- setIsSyncing(true);
187
- try {
188
- await performSync();
189
- setLastSync(new Date());
190
- } catch (error) {
191
- console.error('Sync failed:', error);
192
- } finally {
193
- setIsSyncing(false);
194
- }
195
- }, []);
196
-
197
- return (
198
- <CloudSyncSetting
199
- status={isSyncing ? 'syncing' : 'synced'}
200
- lastSync={lastSync}
201
- onSyncPress={handleSync}
202
- showProgress={isSyncing}
203
- />
204
- );
205
- }
206
- ```
207
-
208
- ### With Auto Sync
209
-
210
- ```tsx
211
- function AutoSync() {
212
- const [status, setStatus] = useState('synced');
213
- const [lastSync, setLastSync] = useState(new Date());
214
-
215
- useEffect(() => {
216
- // Auto sync every 5 minutes
217
- const interval = setInterval(async () => {
218
- setStatus('syncing');
219
- try {
220
- await performSync();
221
- setStatus('synced');
222
- setLastSync(new Date());
223
- } catch (error) {
224
- setStatus('error');
225
- }
226
- }, 5 * 60 * 1000);
227
-
228
- return () => clearInterval(interval);
229
- }, []);
230
-
231
- return (
232
- <CloudSyncSetting
233
- status={status}
234
- lastSync={lastSync}
235
- onSyncPress={() => performSync()}
236
- />
237
- );
238
- }
239
- ```
240
-
241
- ### With Detailed Status
242
-
243
- ```tsx
244
- function DetailedSyncStatus() {
245
- const syncInfo = {
246
- status: 'synced',
247
- lastSync: new Date(),
248
- itemsSynced: 152,
249
- totalItems: 152,
250
- conflictsResolved: 0,
251
- };
252
-
253
- return (
254
- <CloudSyncSetting
255
- status={syncInfo.status}
256
- lastSync={syncInfo.lastSync}
257
- description={`${syncInfo.itemsSynced} items synced`}
258
- syncMessage="No conflicts"
259
- />
260
- );
261
- }
262
- ```
263
-
264
- ## Status Types
265
-
266
- ### Synced
267
-
268
- Indicates successful synchronization.
269
-
270
- ```tsx
271
- <CloudSyncSetting
272
- status="synced"
273
- lastSync={new Date()}
274
- />
275
- ```
276
-
277
- Visual:
278
- - Green checkmark
279
- - "Synced" message
280
- - Last sync time
281
-
282
- ### Syncing
283
-
284
- Indicates active synchronization.
285
-
286
- ```tsx
287
- <CloudSyncSetting
288
- status="syncing"
289
- lastSync={new Date()}
290
- showProgress={true}
291
- />
292
- ```
293
-
294
- Visual:
295
- - Spinning indicator
296
- - "Syncing..." message
297
- - Last sync time
298
- - Progress bar (optional)
299
-
300
- ### Error
301
-
302
- Indicates synchronization failed.
303
-
304
- ```tsx
305
- <CloudSyncSetting
306
- status="error"
307
- lastSync={new Date()}
308
- error="Network error"
309
- onRetryPress={() => retry()}
310
- />
311
- ```
312
-
313
- Visual:
314
- - Red error icon
315
- - Error message
316
- - Last sync time
317
- - Retry button
318
-
319
- ## Time Formatting
320
-
321
- ### Relative Time Display
322
-
323
- The component uses relative time formatting:
324
-
325
- ```typescript
326
- // Examples:
327
- "Just now"
328
- "1 minute ago"
329
- "5 minutes ago"
330
- "1 hour ago"
331
- "2 hours ago"
332
- "1 day ago"
333
- "1 week ago"
334
- "1 month ago"
335
- ```
336
-
337
- ### Custom Time Format
338
-
339
- ```tsx
340
- function CustomTimeFormat() {
341
- const formatTime = (date: Date) => {
342
- return format(date, 'MMM d, yyyy h:mm a');
343
- };
344
-
345
- return (
346
- <CloudSyncSetting
347
- status="synced"
348
- lastSync={new Date()}
349
- description={`Last sync: ${formatTime(new Date())}`}
350
- />
351
- );
352
- }
353
- ```
354
-
355
- ## Styling
356
-
357
- ### Status Colors
358
-
359
- ```tsx
360
- // Synced - Green
361
- <CloudSyncSetting
362
- status="synced"
363
- lastSync={new Date()}
364
- />
365
-
366
- // Syncing - Blue
367
- <CloudSyncSetting
368
- status="syncing"
369
- lastSync={new Date()}
370
- />
371
-
372
- // Error - Red
373
- <CloudSyncSetting
374
- status="error"
375
- lastSync={new Date()}
376
- error="Sync failed"
377
- />
378
- ```
379
-
380
- ### Custom Styles
381
-
382
- ```tsx
383
- <CloudSyncSetting
384
- status="synced"
385
- lastSync={new Date()}
386
- style={{
387
- backgroundColor: '#f5f5f5',
388
- padding: 15,
389
- borderRadius: 10,
390
- }}
391
- />
392
- ```
393
-
394
- ### Icon Customization
395
-
396
- The component automatically selects icons based on status:
397
-
398
- ```typescript
399
- const icons = {
400
- synced: 'cloud-checkmark-outline', // Green
401
- syncing: 'cloud-sync-outline', // Blue, animated
402
- error: 'cloud-offline-outline', // Red
403
- };
404
- ```
405
-
406
- ## Error Handling
407
-
408
- ### Display Error Message
409
-
410
- ```tsx
411
- <CloudSyncSetting
412
- status="error"
413
- lastSync={new Date()}
414
- error="Failed to connect to server. Check your internet connection."
415
- />
416
- ```
417
-
418
- ### Retry Action
419
-
420
- ```tsx
421
- <CloudSyncSetting
422
- status="error"
423
- lastSync={new Date()}
424
- error="Sync failed"
425
- onRetryPress={async () => {
426
- try {
427
- await retrySync();
428
- } catch (error) {
429
- console.error('Retry failed:', error);
430
- }
431
- }}
432
- />
433
- ```
434
-
435
- ### Error Recovery
436
-
437
- ```tsx
438
- function ErrorRecovery() {
439
- const [state, setState] = useState({
440
- status: 'error',
441
- error: 'Connection failed',
442
- lastSync: new Date(),
443
- });
444
-
445
- const handleRetry = useCallback(async () => {
446
- setState(prev => ({ ...prev, status: 'syncing' }));
447
-
448
- try {
449
- await performSync();
450
- setState({
451
- status: 'synced',
452
- error: undefined,
453
- lastSync: new Date(),
454
- });
455
- } catch (error) {
456
- setState({
457
- status: 'error',
458
- error: error.message,
459
- lastSync: state.lastSync,
460
- });
461
- }
462
- }, [state.lastSync]);
463
-
464
- return (
465
- <CloudSyncSetting
466
- status={state.status}
467
- lastSync={state.lastSync}
468
- error={state.error}
469
- onRetryPress={handleRetry}
470
- />
471
- );
472
- }
473
- ```
474
-
475
- ## Best Practices
476
-
477
- 1. **Clear Status**: Always show current sync status
478
- 2. **Relative Time**: Use relative time for last sync
479
- 3. **Error Messages**: Provide clear, actionable error messages
480
- 4. **Retry Option**: Always provide retry on error
481
- 5. **Manual Sync**: Allow manual sync trigger
482
- 6. **Progress**: Show progress during sync
483
- 7. **Feedback**: Provide immediate feedback
484
-
485
- ## Related
486
-
487
- - **Cloud Sync Domain**: Cloud sync domain documentation
488
- - **Settings Screen**: Main settings screen
489
- - **SettingsItemCard**: Settings item component
490
-
491
- ## License
492
-
493
- MIT
1
+ # CloudSyncSetting Component
2
+
3
+ ## Purpose
4
+
5
+ Component for displaying cloud synchronization status, last sync time, and sync controls. Provides users with clear visibility into their data sync state and manual control over synchronization processes.
6
+
7
+ ## File Paths
8
+
9
+ - **CloudSyncSetting**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/cloud-sync/presentation/components/CloudSyncSetting.tsx`
10
+ - **Cloud Sync Components**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/cloud-sync/presentation/components/`
11
+ - **Cloud Sync Services**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/cloud-sync/services/`
12
+
13
+ ## Strategy
14
+
15
+ 1. **Clear Status Communication**: Uses visual indicators (colors, icons, animations) to instantly communicate sync status to users, reducing confusion about whether data is up to date.
16
+
17
+ 2. **Relative Time Display**: Shows last sync time in relative format ("Just now", "5 minutes ago") which is more user-friendly and easier to understand than absolute timestamps.
18
+
19
+ 3. **Manual Control**: Provides users with manual sync trigger buttons, giving them control over when synchronization occurs and peace of mind about data freshness.
20
+
21
+ 4. **Error Recovery**: Displays clear error messages with retry buttons when sync fails, allowing users to quickly recover from temporary network issues without technical knowledge.
22
+
23
+ 5. **Progress Feedback**: Shows progress indicators during active sync, keeping users informed about ongoing operations and preventing premature actions.
24
+
25
+ ## Restrictions
26
+
27
+ ### ❌ DO NOT
28
+
29
+ - Sync data unnecessarily or too frequently
30
+ - Hide sync status from users
31
+ - Display technical error messages directly
32
+ - Block UI during entire sync process
33
+ - Assume sync will always succeed
34
+
35
+ ### ❌ NEVER
36
+
37
+ - Allow simultaneous sync operations
38
+ - Ignore or suppress sync errors
39
+ - Show incorrect sync status
40
+ - Start sync without user consent in manual mode
41
+ - Bypass network availability checks
42
+
43
+ ### ❌ AVOID
44
+
45
+ - Excessive auto-sync frequency (minimum 5 minutes)
46
+ - Overly verbose sync status messages
47
+ - Confusing sync state transitions
48
+ - Silent background synces without user notification
49
+ - Blocking app startup on sync
50
+
51
+ ## Rules
52
+
53
+ ### ✅ ALWAYS
54
+
55
+ - Display current sync status clearly (synced/syncing/error)
56
+ - Show last sync time in user-friendly format
57
+ - Provide retry option when sync fails
58
+ - Use appropriate visual indicators for each status
59
+ - Show progress during active synchronization
60
+
61
+ ### ✅ MUST
62
+
63
+ - Update status immediately when sync state changes
64
+ - Handle network errors gracefully
65
+ - Provide manual sync trigger (onSyncPress)
66
+ - Display actionable error messages
67
+ - Prevent duplicate sync operations
68
+
69
+ ### ✅ SHOULD
70
+
71
+ - Implement auto-sync with reasonable intervals (5-15 min)
72
+ - Show sync statistics (items synced, conflicts)
73
+ - Use color coding for status (green=synced, blue=syncing, red=error)
74
+ - Allow users to disable auto-sync
75
+ - Sync on app foreground events
76
+ - Show sync success confirmation
77
+
78
+ ## AI Agent Guidelines
79
+
80
+ 1. **Status Management**: Always reflect the true sync state. Use "synced" when data is current, "syncing" during active sync operations, and "error" when the last sync attempt failed. Update status immediately on state changes.
81
+
82
+ 2. **Time Formatting**: Display last sync time in relative format for better UX. Use "Just now" for syncs under 1 minute, "X minutes ago" for recent syncs, "X hours ago" for same day, and date/time for older syncs.
83
+
84
+ 3. **Error Handling**: When sync fails, show user-friendly error messages that explain what went wrong and suggest solutions. Always provide a retry button for quick recovery. Log technical details for debugging while showing simplified messages to users.
85
+
86
+ 4. **Manual Sync**: Provide manual sync button even when auto-sync is enabled. Users appreciate control and want to trigger syncs after making important changes. Disable the button during active sync to prevent duplicate operations.
87
+
88
+ 5. **Auto-Sync Strategy**: Implement smart auto-sync that respects battery and network conditions. Sync on app foreground if more than 5 minutes have passed. Consider user activity - sync more frequently when actively using the app, less frequently when idle.
89
+
90
+ ## Reference
91
+
92
+ - **Component Implementation**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/cloud-sync/presentation/components/CloudSyncSetting.tsx`
93
+ - **Cloud Sync Services**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/cloud-sync/services/`
94
+ - **Cloud Sync Components**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/cloud-sync/presentation/components/`
95
+ - **Sync Hooks**: Check for cloud sync related hooks for state management