@umituz/react-native-settings 4.20.58 → 4.20.60

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 (68) 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/SettingsStackNavigator.tsx +2 -0
  52. package/src/presentation/navigation/components/README.md +70 -295
  53. package/src/presentation/navigation/components/wrappers/SettingsScreenWrapper.tsx +3 -0
  54. package/src/presentation/navigation/hooks/README.md +75 -367
  55. package/src/presentation/navigation/types.ts +1 -0
  56. package/src/presentation/navigation/utils/README.md +100 -380
  57. package/src/presentation/screens/README.md +53 -504
  58. package/src/presentation/screens/SettingsScreen.tsx +4 -2
  59. package/src/presentation/screens/components/SettingsContent/README.md +53 -382
  60. package/src/presentation/screens/components/SettingsHeader/README.md +48 -303
  61. package/src/presentation/screens/components/sections/CustomSettingsList/README.md +47 -359
  62. package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +81 -176
  63. package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +40 -297
  64. package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +47 -451
  65. package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +45 -361
  66. package/src/presentation/screens/hooks/README.md +64 -354
  67. package/src/presentation/screens/types/README.md +79 -409
  68. package/src/presentation/screens/utils/README.md +65 -255
@@ -1,462 +1,76 @@
1
1
  # Dev Domain
2
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
- ```
3
+ ## Purpose
4
+
5
+ Provides development-only utilities and settings for debugging and testing with storage clearing, custom dev tools, and safe production builds.
6
+
7
+ ## File Paths
8
+
9
+ **Components:**
10
+ - `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/dev/presentation/components/DevSettingsSection.tsx`
11
+ - `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/dev/presentation/components/StorageClearSetting.tsx`
12
+
13
+ **Index:**
14
+ - `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/dev/index.ts`
15
+
16
+ ## Strategy
17
+
18
+ 1. **Development Mode Only**: Components only render in `__DEV__` mode - never in production
19
+ 2. **Storage Management**: Provide safe storage clearing with confirmation dialogs
20
+ 3. **Custom Tools**: Support adding custom dev tools through customDevComponents prop
21
+ 4. **Confirmation Dialogs**: Prevent accidental data loss with proper confirmation flows
22
+ 5. **Safe Production**: Ensure no dev code leaks into production builds
23
+
24
+ ## Restrictions (Forbidden)
25
+
26
+ ### DO NOT
27
+ - ❌ DO NOT use DevSettingsSection in production builds (only renders in __DEV__)
28
+ - DO NOT bypass confirmation dialogs for storage clearing
29
+ - ❌ DO NOT use dev components without proper error handling
30
+ - DO NOT include sensitive data in custom dev tools
31
+
32
+ ### NEVER
33
+ - NEVER use dev components in production - they only render in __DEV__ mode
34
+ - ❌ NEVER clear storage without user confirmation
35
+ - ❌ NEVER add production features to dev settings section
36
+ - ❌ NEVER store sensitive data (API keys, secrets) in dev tools
37
+
38
+ ### AVOID
39
+ - ❌ AVOID creating custom dev sections when DevSettingsSection can be configured
40
+ - ❌ AVOID mixing dev tools with production settings
41
+ - ❌ AVOID using dev components without understanding they're __DEV__ only
42
+ - ❌ AVOID adding dev tools that could affect production data
43
+
44
+ ## Rules
45
+
46
+ ### ALWAYS
47
+ - ✅ ALWAYS verify components only render in __DEV__ mode
48
+ - ALWAYS show confirmation dialogs before clearing storage
49
+ - ✅ ALWAYS reload the app after clearing storage
50
+ - ALWAYS provide clear warnings before destructive actions
51
+ - ALWAYS use enabled prop to control dev section visibility
52
+
53
+ ### MUST
54
+ - ✅ MUST provide onAfterClear callback for post-clear operations
55
+ - ✅ MUST confirm before clearing all data
56
+ - ✅ MUST reset all app state after clearing storage
57
+ - MUST ensure no dev code leaks to production
58
+ - ✅ MUST use safe defaults for dangerous features
59
+
60
+ ### SHOULD
61
+ - ✅ SHOULD add relevant debugging tools for the app
62
+ - SHOULD provide clear warnings before destructive actions
63
+ - ✅ SHOULD reset app state and reload after clearing storage
64
+ - ✅ SHOULD use customDevComponents for app-specific dev tools
65
+ - ✅ SHOULD test that dev section doesn't appear in production
66
+
67
+ ## AI Agent Guidelines
68
+
69
+ 1. **Development Only**: Always remember these components only render in __DEV__ mode - never in production
70
+ 2. **Confirmation**: Always require confirmation before storage clearing - never skip confirmation dialogs
71
+ 3. **Custom Tools**: Use customDevComponents prop to add app-specific dev tools
72
+ 4. **Post-Clear**: Always reload the app after clearing storage using onAfterClear callback
73
+ 5. **Testing**: Always verify dev section doesn't appear in production builds
460
74
 
461
75
  ## Related
462
76