@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,525 +1,74 @@
1
1
  # Settings Screen
2
2
 
3
- Main settings screen component with modular architecture for displaying app settings in an organized, user-friendly interface.
4
-
5
- ## Features
6
-
7
- - **Modular Architecture**: Composable sections for different feature groups
8
- - **User Profile Header**: Optional user profile display
9
- - **Feature Detection**: Automatically detect available features
10
- - **Custom Sections**: Support for custom settings sections
11
- - **Error Boundaries**: Built-in error handling
12
- - **Responsive Design**: Adapts to different screen sizes
13
- - **Theme Support**: Automatic light/dark theme support
14
-
15
- ## Installation
16
-
17
- This component is part of `@umituz/react-native-settings`:
18
-
19
- ```bash
20
- npm install @umituz/react-native-settings
21
- ```
22
-
23
- ## Usage
24
-
25
- ### Basic Usage
26
-
27
- ```tsx
28
- import { SettingsScreen } from '@umituz/react-native-settings';
29
-
30
- function MySettingsScreen() {
31
- return (
32
- <SettingsScreen />
33
- );
34
- }
35
- ```
36
-
37
- ### With Configuration
38
-
39
- ```tsx
40
- import { SettingsScreen } from '@umituz/react-native-settings';
41
-
42
- function ConfiguredSettingsScreen() {
43
- const config = {
44
- appearance: true,
45
- language: false,
46
- notifications: true,
47
- privacy: true,
48
- support: true,
49
- about: true,
50
- legal: true,
51
- feedback: true,
52
- faqs: true,
53
- };
54
-
55
- return (
56
- <SettingsScreen
57
- config={config}
58
- showUserProfile={true}
59
- userProfile={{
60
- displayName: 'John Doe',
61
- userId: 'user123',
62
- avatarUrl: 'https://example.com/avatar.jpg',
63
- }}
64
- showFooter={true}
65
- appVersion="1.0.0"
66
- />
67
- );
68
- }
69
- ```
70
-
71
- ## Props
72
-
73
- ### SettingsScreenProps
74
-
75
- | Prop | Type | Default | Description |
76
- |------|------|---------|-------------|
77
- | `config` | `SettingsConfig` | `{}` | Configuration for which features to show |
78
- | `showUserProfile` | `boolean` | `undefined` | Show user profile header |
79
- | `userProfile` | `UserProfileProps` | `undefined` | User profile data |
80
- | `showFooter` | `boolean` | `true` | Show footer with version |
81
- | `footerText` | `string` | `undefined` | Custom footer text |
82
- | `appVersion` | `string` | `undefined` | App version number |
83
- | `customSections` | `CustomSettingsSection[]` | `[]` | Custom sections to render |
84
- | `showCloseButton` | `boolean` | `false` | Show close button in header |
85
- | `onClose` | `() => void` | `undefined` | Close button handler |
86
- | `featureOptions` | `FeatureOptions` | `undefined` | Feature detection options |
87
- | `devSettings` | `DevSettingsProps` | `undefined` | Dev settings (DEV mode only) |
88
-
89
- ### SettingsConfig
90
-
91
- ```typescript
92
- interface SettingsConfig {
93
- appearance?: boolean; // Show appearance settings
94
- language?: boolean; // Show language selection
95
- notifications?: boolean; // Show notification settings
96
- privacy?: boolean; // Show privacy settings
97
- support?: boolean; // Show support section
98
- about?: boolean; // Show about section
99
- legal?: boolean; // Show legal section
100
- feedback?: boolean; // Show feedback section
101
- faqs?: boolean; // Show FAQ section
102
- cloudSync?: boolean; // Show cloud sync settings
103
- // ... more feature flags
104
- }
105
- ```
106
-
107
- ### UserProfileProps
108
-
109
- ```typescript
110
- interface UserProfileProps {
111
- displayName?: string; // User display name
112
- userId?: string; // User ID
113
- isAnonymous?: boolean; // Anonymous user flag
114
- avatarUrl?: string; // Avatar image URL
115
- accountSettingsRoute?: string; // Navigation route
116
- onPress?: () => void; // Custom press handler
117
- anonymousDisplayName?: string; // Anonymous display name
118
- avatarServiceUrl?: string; // Avatar service base URL
119
- }
120
- ```
121
-
122
- ## Examples
123
-
124
- ### Minimal Settings
125
-
126
- ```tsx
127
- import { SettingsScreen } from '@umituz/react-native-settings';
128
-
129
- export default function MinimalSettings() {
130
- return <SettingsScreen />;
131
- }
132
- ```
133
-
134
- ### Custom Configuration
135
-
136
- ```tsx
137
- function CustomSettings() {
138
- return (
139
- <SettingsScreen
140
- config={{
141
- appearance: true,
142
- notifications: true,
143
- privacy: true,
144
- support: true,
145
- about: true,
146
- }}
147
- />
148
- );
149
- }
150
- ```
151
-
152
- ### With User Profile
153
-
154
- ```tsx
155
- function SettingsWithProfile() {
156
- return (
157
- <SettingsScreen
158
- showUserProfile={true}
159
- userProfile={{
160
- displayName: 'Jane Doe',
161
- userId: 'user456',
162
- avatarUrl: 'https://api.example.com/avatars/user456.jpg',
163
- onPress: () => navigation.navigate('AccountSettings'),
164
- }}
165
- />
166
- );
167
- }
168
- ```
169
-
170
- ### Anonymous User
171
-
172
- ```tsx
173
- function SettingsForAnonymous() {
174
- return (
175
- <SettingsScreen
176
- showUserProfile={true}
177
- userProfile={{
178
- isAnonymous: true,
179
- anonymousDisplayName: 'Guest User',
180
- onPress: () => navigation.navigate('SignUp'),
181
- }}
182
- />
183
- );
184
- }
185
- ```
186
-
187
- ### With Custom Sections
188
-
189
- ```tsx
190
- function SettingsWithCustomSections() {
191
- const customSections = [
192
- {
193
- title: 'INTEGRATIONS',
194
- items: [
195
- {
196
- icon: 'logo-google',
197
- title: 'Google',
198
- description: 'Connected',
199
- showSwitch: true,
200
- switchValue: googleEnabled,
201
- onSwitchChange: setGoogleEnabled,
202
- },
203
- {
204
- icon: 'logo-apple',
205
- title: 'Apple',
206
- description: 'Not connected',
207
- onPress: () => connectApple(),
208
- },
209
- ],
210
- },
211
- ];
212
-
213
- return (
214
- <SettingsScreen
215
- customSections={customSections}
216
- />
217
- );
218
- }
219
- ```
3
+ ## Purpose
220
4
 
221
- ### With Close Button
222
-
223
- ```tsx
224
- function ModalSettingsScreen() {
225
- return (
226
- <SettingsScreen
227
- showCloseButton={true}
228
- onClose={() => navigation.goBack()}
229
- />
230
- );
231
- }
232
- ```
233
-
234
- ### With Dev Settings
235
-
236
- ```tsx
237
- import { DevSettingsSection } from '@umituz/react-native-settings';
238
-
239
- function SettingsWithDevTools() {
240
- return (
241
- <SettingsScreen
242
- devSettings={{
243
- enabled: true,
244
- onAfterClear: async () => {
245
- await resetApp();
246
- Updates.reloadAsync();
247
- },
248
- }}
249
- />
250
- );
251
- }
252
- ```
253
-
254
- ### Complete Example
255
-
256
- ```tsx
257
- import React from 'react';
258
- import { SettingsScreen } from '@umituz/react-native-settings';
259
- import { useAuth } from './auth';
260
-
261
- export default function CompleteSettingsScreen() {
262
- const { user } = useAuth();
263
-
264
- const config = {
265
- appearance: true,
266
- notifications: true,
267
- privacy: true,
268
- support: true,
269
- about: true,
270
- legal: true,
271
- };
272
-
273
- const customSections = [
274
- {
275
- title: 'PRO FEATURES',
276
- items: [
277
- {
278
- icon: 'star-outline',
279
- title: 'Upgrade to Pro',
280
- description: 'Unlock all features',
281
- onPress: () => navigation.navigate('Upgrade'),
282
- },
283
- ],
284
- },
285
- ];
286
-
287
- return (
288
- <SettingsScreen
289
- config={config}
290
- showUserProfile={true}
291
- userProfile={{
292
- displayName: user?.displayName,
293
- userId: user?.uid,
294
- avatarUrl: user?.photoURL,
295
- onPress: () => navigation.navigate('Account'),
296
- }}
297
- showFooter={true}
298
- footerText={`Version ${Constants.expoConfig.version}`}
299
- customSections={customSections}
300
- showCloseButton={true}
301
- onClose={() => navigation.goBack()}
302
- devSettings={{
303
- onAfterClear: async () => {
304
- await signOut();
305
- navigation.reset('Welcome');
306
- },
307
- }}
308
- />
309
- );
310
- }
311
- ```
312
-
313
- ## Component Structure
314
-
315
- The SettingsScreen is composed of several sub-components:
316
-
317
- ```
318
- SettingsScreen
319
- ├── SettingsHeader # Header with title and close button
320
- └── SettingsContent # Main content area
321
- ├── UserProfileHeader # User profile display (optional)
322
- ├── Feature Sections # Dynamic sections based on config
323
- │ ├── AppearanceSection
324
- │ ├── IdentitySection
325
- │ ├── NotificationSection
326
- │ ├── PrivacySection
327
- │ ├── SupportSection
328
- │ ├── AboutSection
329
- │ └── LegalSection
330
- ├── Custom Sections # User-defined sections
331
- ├── Dev Settings # Development tools (DEV only)
332
- └── SettingsFooter # App version footer
333
- ```
334
-
335
- ## Custom Sections
336
-
337
- You can add custom settings sections using the `customSections` prop:
338
-
339
- ```tsx
340
- const customSections: CustomSettingsSection[] = [
341
- {
342
- title: 'SECTION TITLE',
343
- items: [
344
- {
345
- icon: 'icon-name',
346
- title: 'Item Title',
347
- description: 'Optional description',
348
- onPress: () => {},
349
- // OR
350
- showSwitch: true,
351
- switchValue: true,
352
- onSwitchChange: (value) => {},
353
- },
354
- ],
355
- },
356
- ];
357
- ```
358
-
359
- ### Custom Section Types
360
-
361
- **Navigation Items:**
362
-
363
- ```tsx
364
- {
365
- icon: 'chevron-forward-outline',
366
- title: 'Advanced Settings',
367
- onPress: () => navigation.navigate('Advanced'),
368
- }
369
- ```
370
-
371
- **Toggle Items:**
372
-
373
- ```tsx
374
- {
375
- icon: 'notifications-outline',
376
- title: 'Enable Feature',
377
- showSwitch: true,
378
- switchValue: enabled,
379
- onSwitchChange: setEnabled,
380
- }
381
- ```
382
-
383
- **Info Items:**
384
-
385
- ```tsx
386
- {
387
- icon: 'information-circle-outline',
388
- title: 'App Version',
389
- description: '1.0.0 (123)',
390
- }
391
- ```
392
-
393
- ## Feature Detection
394
-
395
- The screen uses feature detection to show/hide sections:
396
-
397
- ```tsx
398
- const featureOptions = {
399
- notificationServiceAvailable: true, // Enable notification features
400
- };
401
-
402
- <SettingsScreen
403
- featureOptions={featureOptions}
404
- />
405
- ```
406
-
407
- ## Styling
408
-
409
- All styling uses the design system tokens:
410
-
411
- ```tsx
412
- // Theme integration handled automatically
413
- // Supports light/dark mode switching
414
- // Responsive design for all screen sizes
415
- ```
416
-
417
- ## Error Handling
5
+ Main settings screen component with modular architecture for displaying app settings in an organized, user-friendly interface.
418
6
 
419
- The screen includes built-in error boundaries:
7
+ ## File Paths
420
8
 
421
- ```tsx
422
- <SettingsErrorBoundary>
423
- <SettingsScreen />
424
- </SettingsErrorBoundary>
425
- ```
9
+ - **Screen**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/SettingsScreen.tsx`
10
+ - **Components**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/components/`
11
+ - **Hooks**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/hooks/`
12
+ - **Utils**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/utils/`
13
+ - **Types**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/types/`
426
14
 
427
- Custom error messages:
15
+ ## Strategy
428
16
 
429
- ```tsx
430
- <SettingsScreen
431
- // Screen will use these translation keys for errors
432
- // "settings.error.title"
433
- // "settings.error.message"
434
- />
435
- ```
17
+ 1. **Modular Architecture**: Composable sections for different feature groups (appearance, language, notifications, etc.)
18
+ 2. **Configuration-Driven**: Uses configuration object to control which features and sections appear
19
+ 3. **Feature Detection**: Automatically detects available screens and features
20
+ 4. **User Profile Integration**: Optional user profile header for authenticated users
21
+ 5. **Custom Sections**: Support for app-specific settings sections
436
22
 
437
- ## Best Practices
23
+ ## Restrictions (Forbidden)
438
24
 
439
- 1. **Configuration**: Use `config` prop to control which sections appear
440
- 2. **User Profile**: Show user profile for signed-in users
441
- 3. **Custom Sections**: Add app-specific settings via `customSections`
442
- 4. **Version Info**: Always show app version in footer
443
- 5. **Error Boundaries**: Don't wrap in additional error boundaries
444
- 6. **Navigation**: Provide proper navigation handlers
445
- 7. **Dev Settings**: Include dev tools for development builds
446
- 8. **Feature Flags**: Use feature flags for experimental features
25
+ ### DO NOT
26
+ - DO NOT manually manage individual section rendering (use config object)
27
+ - DO NOT hardcode section order or visibility
28
+ - DO NOT bypass the configuration system
447
29
 
448
- ## Testing
30
+ ### NEVER
31
+ - ❌ NEVER wrap SettingsScreen in additional error boundaries (already included)
32
+ - ❌ NEVER modify sections directly without updating config
33
+ - ❌ NEVER use SettingsScreen for non-settings content
449
34
 
450
- ```tsx
451
- import { render, fireEvent } from '@testing-library/react-native';
452
- import { SettingsScreen } from '@umituz/react-native-settings';
35
+ ### AVOID
36
+ - AVOID mixing configuration methods (stick to config object)
37
+ - AVOID showing too many sections at once (6-8 maximum recommended)
38
+ - ❌ AVOID inconsistent section ordering across different app versions
453
39
 
454
- describe('SettingsScreen', () => {
455
- it('renders with default config', () => {
456
- const { getByText } = render(<SettingsScreen />);
457
- expect(getByText(/settings/i)).toBeTruthy();
458
- });
40
+ ## Rules (Mandatory)
459
41
 
460
- it('shows user profile when configured', () => {
461
- const { getByText } = render(
462
- <SettingsScreen
463
- showUserProfile={true}
464
- userProfile={{ displayName: 'John Doe' }}
465
- />
466
- );
467
- expect(getByText('John Doe')).toBeTruthy();
468
- });
42
+ ### ALWAYS
43
+ - ALWAYS use the config prop to control which sections appear
44
+ - ✅ ALWAYS normalize config before passing to screen components
45
+ - ✅ ALWAYS provide app version in footer for support purposes
46
+ - ALWAYS test with different configuration combinations
469
47
 
470
- it('renders custom sections', () => {
471
- const customSections = [
472
- {
473
- title: 'CUSTOM',
474
- items: [
475
- {
476
- icon: 'star',
477
- title: 'Custom Item',
478
- onPress: () => {},
479
- },
480
- ],
481
- },
482
- ];
48
+ ### MUST
49
+ - MUST include dev settings in development builds
50
+ - ✅ MUST handle empty state gracefully when no features are enabled
51
+ - ✅ MUST ensure proper navigation handlers are provided
483
52
 
484
- const { getByText } = render(
485
- <SettingsScreen customSections={customSections} />
486
- );
487
- expect(getByText('Custom Item')).toBeTruthy();
488
- });
489
- });
490
- ```
53
+ ### SHOULD
54
+ - SHOULD show user profile header for authenticated users
55
+ - ✅ SHOULD use custom sections for app-specific settings
56
+ - ✅ SHOULD include feature flags for experimental features
491
57
 
492
- ## Architecture
58
+ ## AI Agent Guidelines
493
59
 
494
- The SettingsScreen follows a clean architecture:
60
+ 1. **File Reference**: When modifying screen behavior, refer to `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/SettingsScreen.tsx`
61
+ 2. **Configuration**: Always use `normalizeSettingsConfig()` before passing config to the screen
62
+ 3. **Feature Detection**: Use `useFeatureDetection()` hook to automatically detect available features
63
+ 4. **Custom Sections**: Add app-specific settings via `customSections` prop, not by modifying core sections
64
+ 5. **Navigation**: Ensure all section press handlers have proper navigation callbacks
495
65
 
496
- ```
497
- presentation/screens/
498
- ├── SettingsScreen.tsx # Main screen component
499
- ├── components/
500
- │ ├── SettingsHeader.tsx # Header component
501
- │ ├── SettingsContent.tsx # Content composer
502
- │ └── sections/ # Section components
503
- │ ├── AppearanceSection.tsx
504
- │ ├── IdentitySection.tsx
505
- │ ├── NotificationSection.tsx
506
- │ ├── PrivacySection.tsx
507
- │ ├── SupportSection.tsx
508
- │ ├── AboutSection.tsx
509
- │ └── LegalSection.tsx
510
- ├── hooks/
511
- │ └── useFeatureDetection.ts # Feature detection logic
512
- ├── utils/
513
- │ └── normalizeConfig.ts # Config normalization
514
- └── types/ # TypeScript definitions
515
- ```
66
+ ## Component Reference
516
67
 
517
- ## Related
68
+ Sub-components:
69
+ - **SettingsHeader**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/components/SettingsHeader/SettingsHeader.tsx`
70
+ - **SettingsContent**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/components/SettingsContent/SettingsContent.tsx`
518
71
 
72
+ Related:
519
73
  - **Core Components**: SettingsItemCard, SettingsSection
520
- - **Domains**: Feature-specific domain documentation
521
- - **Design System**: UI components and theming
522
-
523
- ## License
524
-
525
- MIT
74
+ - **Feature Sections**: AppearanceSection, IdentitySection, NotificationSection, PrivacySection, SupportSection, AboutSection, LegalSection