@umituz/react-native-settings 4.20.57 → 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.
- package/.github/ISSUE_TEMPLATE/bug_report.md +51 -0
- package/.github/ISSUE_TEMPLATE/documentation.md +52 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +63 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +84 -0
- package/AI_AGENT_GUIDELINES.md +367 -0
- package/ARCHITECTURE.md +246 -0
- package/CHANGELOG.md +67 -0
- package/CODE_OF_CONDUCT.md +75 -0
- package/CONTRIBUTING.md +107 -0
- package/DOCUMENTATION_MIGRATION.md +319 -0
- package/DOCUMENTATION_TEMPLATE.md +155 -0
- package/LICENSE +21 -0
- package/README.md +321 -498
- package/SECURITY.md +98 -0
- package/SETTINGS_SCREEN_GUIDE.md +185 -0
- package/TESTING.md +358 -0
- package/package.json +13 -2
- package/src/__tests__/setup.ts +1 -4
- package/src/application/README.md +85 -271
- package/src/domains/about/README.md +85 -440
- package/src/domains/about/presentation/hooks/README.md +93 -348
- package/src/domains/appearance/README.md +95 -584
- package/src/domains/appearance/hooks/README.md +95 -303
- package/src/domains/appearance/infrastructure/services/README.md +83 -397
- package/src/domains/appearance/presentation/components/README.md +99 -0
- package/src/domains/cloud-sync/README.md +73 -439
- package/src/domains/cloud-sync/presentation/components/README.md +95 -493
- package/src/domains/dev/README.md +71 -457
- package/src/domains/disclaimer/README.md +77 -411
- package/src/domains/disclaimer/presentation/components/README.md +95 -392
- package/src/domains/faqs/README.md +86 -574
- package/src/domains/feedback/README.md +79 -553
- package/src/domains/feedback/presentation/hooks/README.md +93 -426
- package/src/domains/legal/README.md +88 -537
- package/src/domains/rating/README.md +73 -440
- package/src/domains/rating/presentation/components/README.md +95 -475
- package/src/domains/video-tutorials/README.md +77 -470
- package/src/domains/video-tutorials/presentation/components/README.md +95 -431
- package/src/infrastructure/README.md +78 -425
- package/src/infrastructure/repositories/README.md +88 -420
- package/src/infrastructure/services/README.md +74 -460
- package/src/presentation/components/README.md +97 -480
- package/src/presentation/components/SettingsErrorBoundary/README.md +48 -442
- package/src/presentation/components/SettingsFooter/README.md +48 -427
- package/src/presentation/components/SettingsItemCard/README.md +153 -392
- package/src/presentation/components/SettingsItemCard/STRATEGY.md +164 -0
- package/src/presentation/components/SettingsSection/README.md +47 -401
- package/src/presentation/hooks/README.md +95 -389
- package/src/presentation/hooks/mutations/README.md +99 -376
- package/src/presentation/hooks/queries/README.md +111 -353
- package/src/presentation/navigation/README.md +70 -502
- package/src/presentation/navigation/components/README.md +70 -295
- package/src/presentation/navigation/hooks/README.md +75 -367
- package/src/presentation/navigation/utils/README.md +100 -380
- package/src/presentation/screens/README.md +53 -504
- package/src/presentation/screens/components/SettingsContent/README.md +53 -382
- package/src/presentation/screens/components/SettingsHeader/README.md +48 -303
- package/src/presentation/screens/components/sections/CustomSettingsList/README.md +47 -359
- package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +81 -176
- package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +40 -297
- package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +47 -451
- package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +45 -361
- package/src/presentation/screens/hooks/README.md +64 -354
- package/src/presentation/screens/types/README.md +79 -409
- package/src/presentation/screens/utils/README.md +65 -255
|
@@ -1,462 +1,76 @@
|
|
|
1
1
|
# Dev Domain
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
|