@umituz/react-native-settings 4.20.56 → 4.20.58

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 (49) hide show
  1. package/README.md +146 -4
  2. package/package.json +1 -2
  3. package/src/__tests__/setup.ts +1 -4
  4. package/src/application/README.md +322 -0
  5. package/src/domains/about/README.md +452 -0
  6. package/src/domains/about/presentation/hooks/README.md +350 -0
  7. package/src/domains/appearance/README.md +596 -0
  8. package/src/domains/appearance/hooks/README.md +366 -0
  9. package/src/domains/appearance/infrastructure/services/README.md +455 -0
  10. package/src/domains/appearance/presentation/components/README.md +493 -0
  11. package/src/domains/cloud-sync/README.md +451 -0
  12. package/src/domains/cloud-sync/presentation/components/README.md +493 -0
  13. package/src/domains/dev/README.md +477 -0
  14. package/src/domains/disclaimer/README.md +421 -0
  15. package/src/domains/disclaimer/presentation/components/README.md +394 -0
  16. package/src/domains/faqs/README.md +586 -0
  17. package/src/domains/feedback/README.md +565 -0
  18. package/src/domains/feedback/presentation/hooks/README.md +428 -0
  19. package/src/domains/legal/README.md +549 -0
  20. package/src/domains/rating/README.md +452 -0
  21. package/src/domains/rating/presentation/components/README.md +475 -0
  22. package/src/domains/video-tutorials/README.md +482 -0
  23. package/src/domains/video-tutorials/presentation/components/README.md +433 -0
  24. package/src/infrastructure/README.md +509 -0
  25. package/src/infrastructure/repositories/README.md +475 -0
  26. package/src/infrastructure/services/README.md +510 -0
  27. package/src/presentation/components/README.md +482 -0
  28. package/src/presentation/components/SettingsErrorBoundary/README.md +455 -0
  29. package/src/presentation/components/SettingsFooter/README.md +446 -0
  30. package/src/presentation/components/SettingsItemCard/README.md +457 -0
  31. package/src/presentation/components/SettingsSection/README.md +421 -0
  32. package/src/presentation/hooks/README.md +413 -0
  33. package/src/presentation/hooks/mutations/README.md +430 -0
  34. package/src/presentation/hooks/queries/README.md +441 -0
  35. package/src/presentation/navigation/README.md +532 -0
  36. package/src/presentation/navigation/components/README.md +330 -0
  37. package/src/presentation/navigation/hooks/README.md +399 -0
  38. package/src/presentation/navigation/utils/README.md +442 -0
  39. package/src/presentation/screens/README.md +525 -0
  40. package/src/presentation/screens/components/SettingsContent/README.md +404 -0
  41. package/src/presentation/screens/components/SettingsHeader/README.md +322 -0
  42. package/src/presentation/screens/components/sections/CustomSettingsList/README.md +388 -0
  43. package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +232 -0
  44. package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +325 -0
  45. package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +480 -0
  46. package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +391 -0
  47. package/src/presentation/screens/hooks/README.md +383 -0
  48. package/src/presentation/screens/types/README.md +439 -0
  49. package/src/presentation/screens/utils/README.md +288 -0
@@ -0,0 +1,477 @@
1
+ # Dev Domain
2
+
3
+ The Dev domain provides development-only utilities and settings for debugging and testing your React Native app during development.
4
+
5
+ ## Features
6
+
7
+ - **Development Mode Only**: Components only render in `__DEV__` mode
8
+ - **Storage Clearing**: Reset app to initial state
9
+ - **Custom Dev Tools**: Add custom development utilities
10
+ - **Safe Production**: No dev code in production builds
11
+ - **Confirmation Dialogs**: Prevent accidental data loss
12
+
13
+ ## Installation
14
+
15
+ This domain is part of `@umituz/react-native-settings`. Install the package to use it:
16
+
17
+ ```bash
18
+ npm install @umituz/react-native-settings
19
+ ```
20
+
21
+ ## Components
22
+
23
+ ### DevSettingsSection
24
+
25
+ Development settings section with storage clearing and custom dev tools. Only visible in `__DEV__` mode.
26
+
27
+ ```tsx
28
+ import { DevSettingsSection } from '@umituz/react-native-settings';
29
+
30
+ function MySettings() {
31
+ return (
32
+ <ScrollView>
33
+ {/* Regular settings */}
34
+
35
+ <DevSettingsSection
36
+ onAfterClear={async () => {
37
+ // Reload app after clearing
38
+ Updates.reloadAsync();
39
+ }}
40
+ />
41
+ </ScrollView>
42
+ );
43
+ }
44
+ ```
45
+
46
+ #### Props
47
+
48
+ | Prop | Type | Default | Description |
49
+ |------|------|---------|-------------|
50
+ | `enabled` | `boolean` | `true` in `__DEV__` | Enable dev section |
51
+ | `onAfterClear` | `() => Promise<void>` | `undefined` | Callback after clearing storage |
52
+ | `texts` | `Partial<DevTexts>` | `undefined` | Custom texts (English defaults) |
53
+ | `customDevComponents` | `ReactNode[]` | `[]` | Custom dev components |
54
+
55
+ ### StorageClearSetting
56
+
57
+ Individual setting component for clearing app storage.
58
+
59
+ ```tsx
60
+ import { StorageClearSetting } from '@umituz/react-native-settings';
61
+
62
+ function StorageClearButton() {
63
+ return (
64
+ <StorageClearSetting
65
+ title="Clear Storage"
66
+ description="Reset all data"
67
+ onClear={() => console.log('Storage cleared')}
68
+ />
69
+ );
70
+ }
71
+ ```
72
+
73
+ #### Props
74
+
75
+ | Prop | Type | Default | Description |
76
+ |------|------|---------|-------------|
77
+ | `title` | `string` | `'Clear All Data'` | Button title |
78
+ | `description` | `string` | `'Reset app to initial state'` | Button description |
79
+ | `onClear` | `() => void` | `undefined` | Clear handler |
80
+
81
+ ## Examples
82
+
83
+ ### Basic Dev Settings
84
+
85
+ ```tsx
86
+ import { DevSettingsSection } from '@umituz/react-native-settings';
87
+
88
+ function SettingsScreen() {
89
+ return (
90
+ <ScreenLayout>
91
+ {/* Regular settings */}
92
+ <SettingsItemCard title="General" onPress={() => {}} />
93
+ <SettingsItemCard title="Appearance" onPress={() => {}} />
94
+
95
+ {/* Dev settings - only visible in __DEV__ mode */}
96
+ <DevSettingsSection
97
+ onAfterClear={async () => {
98
+ // Reset app state and reload
99
+ await resetAppState();
100
+ Updates.reloadAsync();
101
+ }}
102
+ />
103
+ </ScreenLayout>
104
+ );
105
+ }
106
+ ```
107
+
108
+ ### With Custom Texts
109
+
110
+ ```tsx
111
+ function CustomDevSettings() {
112
+ return (
113
+ <DevSettingsSection
114
+ texts={{
115
+ sectionTitle: 'Developer Tools',
116
+ clearTitle: 'Reset Application',
117
+ clearDescription: 'Clear all local data and reset',
118
+ confirmTitle: 'Confirm Reset',
119
+ confirmMessage: 'Are you sure you want to reset? All data will be lost.',
120
+ cancelButton: 'Cancel',
121
+ confirmButton: 'Reset',
122
+ }}
123
+ onAfterClear={async () => {
124
+ // Custom clear logic
125
+ await clearData();
126
+ await resetOnboarding();
127
+ }}
128
+ />
129
+ );
130
+ }
131
+ ```
132
+
133
+ ### With Custom Dev Components
134
+
135
+ ```tsx
136
+ import { DevSettingsSection, SettingsItemCard } from '@umituz/react-native-settings';
137
+
138
+ function DevSettingsWithCustomTools() {
139
+ const [mockMode, setMockMode] = useState(false);
140
+
141
+ return (
142
+ <DevSettingsSection
143
+ customDevComponents={[
144
+ <SettingsItemCard
145
+ key="mock-mode"
146
+ icon="flask"
147
+ title="Mock API Mode"
148
+ value={mockMode ? 'Enabled' : 'Disabled'}
149
+ onPress={() => setMockMode(!mockMode)}
150
+ />,
151
+ <SettingsItemCard
152
+ key="debug-logs"
153
+ icon="bug"
154
+ title="Show Debug Logs"
155
+ onPress={() => console.log('Showing logs...')}
156
+ />,
157
+ <SettingsItemCard
158
+ key="test-data"
159
+ icon="database"
160
+ title="Load Test Data"
161
+ onPress={() => loadTestData()}
162
+ />,
163
+ ]}
164
+ onAfterClear={async () => {
165
+ await reloadApp();
166
+ }}
167
+ />
168
+ );
169
+ }
170
+ ```
171
+
172
+ ### Complete Dev Tools
173
+
174
+ ```tsx
175
+ import { DevSettingsSection } from '@umituz/react-native-settings';
176
+ import { SettingsItemCard } from '@umituz/react-native-settings';
177
+
178
+ function CompleteDevSettings() {
179
+ const [devMode, setDevMode] = useState({
180
+ mockApi: false,
181
+ showLogs: false,
182
+ forceError: false,
183
+ });
184
+
185
+ return (
186
+ <DevSettingsSection
187
+ texts={{
188
+ sectionTitle: 'Developer Tools',
189
+ clearTitle: 'Reset App State',
190
+ clearDescription: 'Clear all data and reload',
191
+ }}
192
+ customDevComponents={[
193
+ // Mock API Toggle
194
+ <SettingsItemCard
195
+ key="mock-api"
196
+ icon="flask"
197
+ title="Mock API"
198
+ value={devMode.mockApi ? 'ON' : 'OFF'}
199
+ onPress={() => setDevMode(prev => ({
200
+ ...prev,
201
+ mockApi: !prev.mockApi,
202
+ }))}
203
+ />,
204
+
205
+ // Debug Logs
206
+ <SettingsItemCard
207
+ key="debug-logs"
208
+ icon="terminal"
209
+ title="Debug Logs"
210
+ value={devMode.showLogs ? 'Visible' : 'Hidden'}
211
+ onPress={() => setDevMode(prev => ({
212
+ ...prev,
213
+ showLogs: !prev.showLogs,
214
+ }))}
215
+ />,
216
+
217
+ // Network Inspector
218
+ <SettingsItemCard
219
+ key="network-inspector"
220
+ icon="globe"
221
+ title="Network Inspector"
222
+ onPress={() => openNetworkInspector()}
223
+ />,
224
+
225
+ // Test Notifications
226
+ <SettingsItemCard
227
+ key="test-notifications"
228
+ icon="bell"
229
+ title="Test Notification"
230
+ onPress={() => sendTestNotification()}
231
+ />,
232
+
233
+ // Performance Monitor
234
+ <SettingsItemCard
235
+ key="perf-monitor"
236
+ icon="activity"
237
+ title="Performance Monitor"
238
+ onPress={() => openPerformanceMonitor()}
239
+ />,
240
+
241
+ // Load Test Data
242
+ <SettingsItemCard
243
+ key="load-test-data"
244
+ icon="database"
245
+ title="Load Test Data"
246
+ onPress={() => loadTestData()}
247
+ />,
248
+
249
+ // Force Error
250
+ <SettingsItemCard
251
+ key="force-error"
252
+ icon="alert-octagon"
253
+ title="Force Test Error"
254
+ onPress={() => throw new Error('Test error')}
255
+ iconColor="#DC2626"
256
+ />,
257
+ ]}
258
+ onAfterClear={async () => {
259
+ // Reset and reload
260
+ await resetApp();
261
+ Updates.reloadAsync();
262
+ }}
263
+ />
264
+ );
265
+ }
266
+ ```
267
+
268
+ ### Onboarding Reset
269
+
270
+ ```tsx
271
+ import { DevSettingsSection } from '@umituz/react-native-settings';
272
+ import { SettingsItemCard } from '@umituz/react-native-settings';
273
+
274
+ function DevSettingsWithOnboardingReset() {
275
+ const resetOnboarding = async () => {
276
+ await AsyncStorage.removeItem('onboarding_completed');
277
+ await AsyncStorage.removeItem('onboarding_version');
278
+ };
279
+
280
+ return (
281
+ <DevSettingsSection
282
+ customDevComponents={[
283
+ <SettingsItemCard
284
+ key="reset-onboarding"
285
+ icon="refresh-cw"
286
+ title="Reset Onboarding"
287
+ description="Show onboarding again on next launch"
288
+ onPress={resetOnboarding}
289
+ />,
290
+ ]}
291
+ onAfterClear={async () => {
292
+ await resetOnboarding();
293
+ await reloadApp();
294
+ }}
295
+ />
296
+ );
297
+ }
298
+ ```
299
+
300
+ ### Feature Flags
301
+
302
+ ```tsx
303
+ import { DevSettingsSection } from '@umituz/react-native-settings';
304
+ import { SettingsItemCard } from '@umituz/react-native-settings';
305
+
306
+ function DevSettingsWithFeatureFlags() {
307
+ const [features, setFeatures] = useState({
308
+ newFeature: false,
309
+ experimentalUI: false,
310
+ betaIntegration: false,
311
+ });
312
+
313
+ const toggleFeature = (featureName: string) => {
314
+ setFeatures(prev => ({
315
+ ...prev,
316
+ [featureName]: !prev[featureName],
317
+ }));
318
+ };
319
+
320
+ return (
321
+ <DevSettingsSection
322
+ customDevComponents={[
323
+ <SettingsItemCard
324
+ key="feature-new"
325
+ icon="zap"
326
+ title="New Feature"
327
+ value={features.newFeature ? 'Enabled' : 'Disabled'}
328
+ onPress={() => toggleFeature('newFeature')}
329
+ />,
330
+ <SettingsItemCard
331
+ key="feature-ui"
332
+ icon="layout"
333
+ title="Experimental UI"
334
+ value={features.experimentalUI ? 'Enabled' : 'Disabled'}
335
+ onPress={() => toggleFeature('experimentalUI')}
336
+ />,
337
+ <SettingsItemCard
338
+ key="feature-beta"
339
+ icon="package"
340
+ title="Beta Integration"
341
+ value={features.betaIntegration ? 'Enabled' : 'Disabled'}
342
+ onPress={() => toggleFeature('betaIntegration')}
343
+ />,
344
+ ]}
345
+ onAfterClear={resetApp}
346
+ />
347
+ );
348
+ }
349
+ ```
350
+
351
+ ## Default Texts
352
+
353
+ The component uses these default texts (English only, as it's a dev-only feature):
354
+
355
+ ```typescript
356
+ const DEFAULT_TEXTS = {
357
+ sectionTitle: "Developer",
358
+ clearTitle: "Clear All Data",
359
+ clearDescription: "Reset app to initial state (DEV only)",
360
+ confirmTitle: "Clear All Data?",
361
+ confirmMessage: "This will clear all app data and reset to initial state. This action cannot be undone.",
362
+ cancelButton: "Cancel",
363
+ confirmButton: "Clear",
364
+ successTitle: "Success",
365
+ successMessage: "All data cleared. Restarting app...",
366
+ errorTitle: "Error",
367
+ errorMessage: "Failed to clear data",
368
+ };
369
+ ```
370
+
371
+ ## Architecture
372
+
373
+ ```
374
+ src/domains/dev/
375
+ ├── presentation/
376
+ │ └── components/
377
+ │ ├── DevSettingsSection.tsx # Main dev settings section
378
+ │ └── StorageClearSetting.tsx # Storage clear component
379
+ └── index.ts # Public API exports
380
+ ```
381
+
382
+ ## Best Practices
383
+
384
+ 1. **Dev Only**: Always verify components only render in `__DEV__` mode
385
+ 2. **Clear Warnings**: Show clear warnings before destructive actions
386
+ 3. **Confirm Actions**: Require confirmation for data clearing
387
+ 4. **Custom Tools**: Add relevant debugging tools for your app
388
+ 5. **Safe Defaults**: Don't enable dangerous features by default
389
+ 6. **Production Safety**: Double-check no dev code leaks to production
390
+ 7. **App Reload**: Always reload the app after clearing storage
391
+ 8. **Reset State**: Reset all app state after clearing storage
392
+
393
+ ## Testing
394
+
395
+ ```tsx
396
+ import { render, fireEvent } from '@testing-library/react-native';
397
+ import { DevSettingsSection } from '@umituz/react-native-settings';
398
+
399
+ describe('DevSettingsSection', () => {
400
+ // Mock __DEV__
401
+ const originalDev = __DEV__;
402
+
403
+ beforeAll(() => {
404
+ (global as any).__DEV__ = true;
405
+ });
406
+
407
+ afterAll(() => {
408
+ (global as any).__DEV__ = originalDev;
409
+ });
410
+
411
+ it('renders in dev mode', () => {
412
+ const { getByText } = render(
413
+ <DevSettingsSection />
414
+ );
415
+
416
+ expect(getByText(/developer/i)).toBeTruthy();
417
+ });
418
+
419
+ it('does not render in production', () => {
420
+ (global as any).__DEV__ = false;
421
+
422
+ const { queryByText } = render(
423
+ <DevSettingsSection />
424
+ );
425
+
426
+ expect(queryByText(/developer/i)).toBeNull();
427
+ });
428
+
429
+ it('shows confirmation dialog before clearing', () => {
430
+ const mockClear = jest.fn();
431
+ const { getByText } = render(
432
+ <DevSettingsSection onAfterClear={mockClear} />
433
+ );
434
+
435
+ fireEvent.press(getByText(/clear all data/i));
436
+
437
+ // Should show alert
438
+ expect(Alert.alert).toHaveBeenCalled();
439
+ });
440
+
441
+ it('calls onAfterClear after confirmation', async () => {
442
+ const mockClear = jest.fn();
443
+ const { getByText } = render(
444
+ <DevSettingsSection onAfterClear={mockClear} />
445
+ );
446
+
447
+ // Trigger clear and confirm
448
+ fireEvent.press(getByText(/clear all data/i));
449
+
450
+ // Get alert buttons and press confirm
451
+ const alertCalls = (Alert.alert as jest.Mock).mock.calls;
452
+ const confirmButton = alertCalls[0][2][1]; // Second button is confirm
453
+
454
+ await confirmButton.onPress();
455
+
456
+ expect(mockClear).toHaveBeenCalled();
457
+ });
458
+ });
459
+ ```
460
+
461
+ ## Related
462
+
463
+ - **Settings**: Main settings management
464
+ - **Storage**: Data persistence and clearing
465
+ - **Cloud Sync**: Cloud synchronization utilities
466
+
467
+ ## Important Notes
468
+
469
+ ⚠️ **Development Only**: These components are designed for development use only and should never appear in production builds.
470
+
471
+ ⚠️ **Data Loss**: The "Clear All Data" button will permanently delete all app data. Always use with confirmation dialogs.
472
+
473
+ ⚠️ **No Localization**: Dev components use hardcoded English text since they don't need localization support.
474
+
475
+ ## License
476
+
477
+ MIT