@umituz/react-native-settings 4.20.56 → 4.20.57
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/README.md +145 -3
- package/package.json +1 -2
- package/src/application/README.md +322 -0
- package/src/domains/about/README.md +452 -0
- package/src/domains/about/presentation/hooks/README.md +350 -0
- package/src/domains/appearance/README.md +596 -0
- package/src/domains/appearance/hooks/README.md +366 -0
- package/src/domains/appearance/infrastructure/services/README.md +455 -0
- package/src/domains/cloud-sync/README.md +451 -0
- package/src/domains/cloud-sync/presentation/components/README.md +493 -0
- package/src/domains/dev/README.md +477 -0
- package/src/domains/disclaimer/README.md +421 -0
- package/src/domains/disclaimer/presentation/components/README.md +394 -0
- package/src/domains/faqs/README.md +586 -0
- package/src/domains/feedback/README.md +565 -0
- package/src/domains/feedback/presentation/hooks/README.md +428 -0
- package/src/domains/legal/README.md +549 -0
- package/src/domains/rating/README.md +452 -0
- package/src/domains/rating/presentation/components/README.md +475 -0
- package/src/domains/video-tutorials/README.md +482 -0
- package/src/domains/video-tutorials/presentation/components/README.md +433 -0
- package/src/infrastructure/README.md +509 -0
- package/src/infrastructure/repositories/README.md +475 -0
- package/src/infrastructure/services/README.md +510 -0
- package/src/presentation/components/README.md +482 -0
- package/src/presentation/components/SettingsErrorBoundary/README.md +461 -0
- package/src/presentation/components/SettingsFooter/README.md +446 -0
- package/src/presentation/components/SettingsItemCard/README.md +457 -0
- package/src/presentation/components/SettingsSection/README.md +421 -0
- package/src/presentation/hooks/README.md +413 -0
- package/src/presentation/hooks/mutations/README.md +430 -0
- package/src/presentation/hooks/queries/README.md +441 -0
- package/src/presentation/navigation/README.md +532 -0
- package/src/presentation/navigation/components/README.md +330 -0
- package/src/presentation/navigation/hooks/README.md +399 -0
- package/src/presentation/navigation/utils/README.md +442 -0
- package/src/presentation/screens/README.md +525 -0
- package/src/presentation/screens/components/SettingsContent/README.md +404 -0
- package/src/presentation/screens/components/SettingsHeader/README.md +322 -0
- package/src/presentation/screens/components/sections/CustomSettingsList/README.md +388 -0
- package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +232 -0
- package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +325 -0
- package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +480 -0
- package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +391 -0
- package/src/presentation/screens/hooks/README.md +383 -0
- package/src/presentation/screens/types/README.md +439 -0
- package/src/presentation/screens/utils/README.md +288 -0
|
@@ -0,0 +1,493 @@
|
|
|
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
|