@umituz/react-native-settings 4.20.61 → 4.21.1
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/package.json +8 -60
- package/src/domains/gamification/README.md +343 -0
- package/src/domains/gamification/components/AchievementCard.tsx +142 -0
- package/src/domains/gamification/components/AchievementItem.tsx +182 -0
- package/src/domains/gamification/components/AchievementToast.tsx +122 -0
- package/src/domains/gamification/components/GamificationScreen/AchievementsList.tsx +84 -0
- package/src/domains/gamification/components/GamificationScreen/Header.tsx +29 -0
- package/src/domains/gamification/components/GamificationScreen/StatsGrid.tsx +51 -0
- package/src/domains/gamification/components/GamificationScreen/index.tsx +111 -0
- package/src/domains/gamification/components/GamificationScreen/styles.ts +43 -0
- package/src/domains/gamification/components/GamificationScreen/types.ts +77 -0
- package/src/domains/gamification/components/GamificationScreenWrapper.tsx +91 -0
- package/src/domains/gamification/components/GamificationSettingsItem.tsx +33 -0
- package/src/domains/gamification/components/LevelProgress.tsx +129 -0
- package/src/domains/gamification/components/PointsBadge.tsx +60 -0
- package/src/domains/gamification/components/StatsCard.tsx +89 -0
- package/src/domains/gamification/components/StreakDisplay.tsx +119 -0
- package/src/domains/gamification/components/index.ts +13 -0
- package/src/domains/gamification/examples/gamification.config.example.ts +70 -0
- package/src/domains/gamification/examples/localization.example.json +71 -0
- package/src/domains/gamification/hooks/useGamification.ts +91 -0
- package/src/domains/gamification/index.ts +65 -0
- package/src/domains/gamification/store/gamificationStore.ts +162 -0
- package/src/domains/gamification/types/index.ts +103 -0
- package/src/domains/gamification/types/settings.ts +28 -0
- package/src/domains/gamification/utils/calculations.ts +85 -0
- package/src/index.ts +18 -8
- package/src/presentation/navigation/SettingsStackNavigator.tsx +12 -0
- package/src/presentation/navigation/types.ts +2 -0
- package/src/presentation/navigation/utils/navigationScreenOptions.ts +7 -0
- package/src/presentation/screens/types/UserFeatureConfig.ts +2 -0
- package/src/presentation/utils/configCreators.ts +147 -0
- package/src/presentation/utils/index.ts +5 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -51
- package/.github/ISSUE_TEMPLATE/documentation.md +0 -52
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -63
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -84
- package/AI_AGENT_GUIDELINES.md +0 -367
- package/ARCHITECTURE.md +0 -246
- package/CHANGELOG.md +0 -67
- package/CODE_OF_CONDUCT.md +0 -75
- package/CONTRIBUTING.md +0 -107
- package/DOCUMENTATION_MIGRATION.md +0 -319
- package/DOCUMENTATION_TEMPLATE.md +0 -155
- package/SECURITY.md +0 -98
- package/SETTINGS_SCREEN_GUIDE.md +0 -185
- package/TESTING.md +0 -358
- package/src/__tests__/integration.test.tsx +0 -371
- package/src/__tests__/performance.test.tsx +0 -369
- package/src/__tests__/setup.test.tsx +0 -20
- package/src/__tests__/setup.ts +0 -154
- package/src/domains/about/__tests__/integration.test.tsx +0 -328
- package/src/domains/about/__tests__/types.d.ts +0 -5
- package/src/domains/about/domain/entities/__tests__/AppInfo.test.ts +0 -93
- package/src/domains/about/infrastructure/repositories/__tests__/AboutRepository.test.ts +0 -153
- package/src/domains/about/presentation/components/__tests__/AboutContent.simple.test.tsx +0 -178
- package/src/domains/about/presentation/components/__tests__/AboutContent.test.tsx +0 -293
- package/src/domains/about/presentation/components/__tests__/AboutHeader.test.tsx +0 -201
- package/src/domains/about/presentation/components/__tests__/AboutSettingItem.test.tsx +0 -71
- package/src/domains/about/presentation/hooks/__tests__/useAboutInfo.simple.test.tsx +0 -229
- package/src/domains/about/presentation/hooks/__tests__/useAboutInfo.test.tsx +0 -240
- package/src/domains/about/presentation/screens/__tests__/AboutScreen.simple.test.tsx +0 -199
- package/src/domains/about/presentation/screens/__tests__/AboutScreen.test.tsx +0 -366
- package/src/domains/about/utils/__tests__/index.test.ts +0 -408
- package/src/domains/appearance/__tests__/components/AppearanceScreen.test.tsx +0 -195
- package/src/domains/appearance/__tests__/hooks/index.test.tsx +0 -232
- package/src/domains/appearance/__tests__/integration/index.test.tsx +0 -207
- package/src/domains/appearance/__tests__/services/appearanceService.test.ts +0 -299
- package/src/domains/appearance/__tests__/setup.ts +0 -88
- package/src/domains/appearance/__tests__/stores/appearanceStore.test.tsx +0 -175
- package/src/domains/cloud-sync/presentation/components/__tests__/CloudSyncSetting.test.tsx +0 -78
- package/src/domains/legal/__tests__/ContentValidationService.test.ts +0 -195
- package/src/domains/legal/__tests__/StyleCacheService.test.ts +0 -110
- package/src/domains/legal/__tests__/UrlHandlerService.test.ts +0 -71
- package/src/domains/legal/__tests__/setup.ts +0 -82
- package/src/presentation/components/__tests__/SettingsErrorBoundary.test.tsx +0 -186
- package/src/presentation/screens/__tests__/SettingsScreen.test.tsx +0 -322
- package/src/presentation/screens/hooks/__tests__/useFeatureDetection.test.tsx +0 -261
package/AI_AGENT_GUIDELINES.md
DELETED
|
@@ -1,367 +0,0 @@
|
|
|
1
|
-
# AI Agent Development Guidelines
|
|
2
|
-
|
|
3
|
-
Comprehensive guidelines for AI agents when developing with `@umituz/react-native-settings`.
|
|
4
|
-
|
|
5
|
-
## Core Principles
|
|
6
|
-
|
|
7
|
-
### 1. No Code Examples in Documentation
|
|
8
|
-
- ❌ **FORBIDDEN**: Including code examples in README files
|
|
9
|
-
- ✅ **REQUIRED**: Reference file paths only
|
|
10
|
-
- ✅ **REQUIRED**: Describe patterns and strategies
|
|
11
|
-
- **REASON**: Code changes frequently, documentation stays valid
|
|
12
|
-
|
|
13
|
-
### 2. File Path References
|
|
14
|
-
When describing functionality:
|
|
15
|
-
- Always provide exact file path
|
|
16
|
-
- Use relative paths from package root
|
|
17
|
-
- Include `.tsx` or `.ts` extensions
|
|
18
|
-
- Format: `src/path/to/File.tsx`
|
|
19
|
-
|
|
20
|
-
### 3. Strategy-Based Documentation
|
|
21
|
-
Each component/module MUST include:
|
|
22
|
-
- **Strategy**: How to use it effectively
|
|
23
|
-
- **Restrictions**: What NOT to do
|
|
24
|
-
- **Rules**: What MUST be followed
|
|
25
|
-
- **AI Guidelines**: Specific AI agent instructions
|
|
26
|
-
|
|
27
|
-
## Component Development Rules
|
|
28
|
-
|
|
29
|
-
### When Creating Settings UI
|
|
30
|
-
|
|
31
|
-
#### ✅ ALWAYS
|
|
32
|
-
1. **Use Existing Components**
|
|
33
|
-
- Check if component exists in `src/presentation/components/`
|
|
34
|
-
- Import from `@umituz/react-native-settings`
|
|
35
|
-
- Reference implementation file
|
|
36
|
-
|
|
37
|
-
2. **Follow Domain Structure**
|
|
38
|
-
- Place feature in appropriate domain
|
|
39
|
-
- Use domain's existing patterns
|
|
40
|
-
- Reference similar features
|
|
41
|
-
|
|
42
|
-
3. **Type Safety**
|
|
43
|
-
- Use TypeScript for all files
|
|
44
|
-
- Define proper interfaces
|
|
45
|
-
- Export types
|
|
46
|
-
|
|
47
|
-
#### ❌ NEVER
|
|
48
|
-
1. **Create Duplicate Components**
|
|
49
|
-
- Don't recreate existing components
|
|
50
|
-
- Check component library first
|
|
51
|
-
- Extend if needed, don't duplicate
|
|
52
|
-
|
|
53
|
-
2. **Bypass Layers**
|
|
54
|
-
- Don't skip repository layer
|
|
55
|
-
- Don't access storage directly
|
|
56
|
-
- Follow DDD layering
|
|
57
|
-
|
|
58
|
-
3. **Hardcode Values**
|
|
59
|
-
- Use design system tokens
|
|
60
|
-
- Use constants file
|
|
61
|
-
- Don't hardcode colors, sizes
|
|
62
|
-
|
|
63
|
-
## File Organization
|
|
64
|
-
|
|
65
|
-
### Domain Structure
|
|
66
|
-
|
|
67
|
-
Each domain follows this pattern:
|
|
68
|
-
```
|
|
69
|
-
src/domains/{domain-name}/
|
|
70
|
-
├── domain/ # Business entities
|
|
71
|
-
├── application/ # Domain-specific application logic
|
|
72
|
-
├── infrastructure/ # Data persistence
|
|
73
|
-
├── presentation/ # UI components
|
|
74
|
-
│ ├── screens/
|
|
75
|
-
│ ├── components/
|
|
76
|
-
│ └── hooks/
|
|
77
|
-
├── types/ # Domain types
|
|
78
|
-
└── utils/ # Domain utilities
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Rules
|
|
82
|
-
- Place files in correct layer
|
|
83
|
-
- Follow existing patterns
|
|
84
|
-
- Use proper imports between layers
|
|
85
|
-
- Don't create circular dependencies
|
|
86
|
-
|
|
87
|
-
## Component Creation Checklist
|
|
88
|
-
|
|
89
|
-
Before creating a new component:
|
|
90
|
-
|
|
91
|
-
1. ✅ **Check Existing Components**
|
|
92
|
-
- Search `src/presentation/components/`
|
|
93
|
-
- Search domain's `presentation/components/`
|
|
94
|
-
- Check if similar component exists
|
|
95
|
-
|
|
96
|
-
2. ✅ **Follow Structure**
|
|
97
|
-
- Create in appropriate location
|
|
98
|
-
- Use proper naming conventions
|
|
99
|
-
- Add TypeScript types
|
|
100
|
-
|
|
101
|
-
3. ✅ **Documentation**
|
|
102
|
-
- Create README.md in component directory
|
|
103
|
-
- Follow documentation template
|
|
104
|
-
- Include Strategy/Restrictions/Rules
|
|
105
|
-
- NO CODE EXAMPLES
|
|
106
|
-
|
|
107
|
-
4. ✅ **Testing**
|
|
108
|
-
- Add test file alongside component
|
|
109
|
-
- Test file: `ComponentName.test.tsx`
|
|
110
|
-
- Follow testing patterns
|
|
111
|
-
|
|
112
|
-
## Import Rules
|
|
113
|
-
|
|
114
|
-
### From Package
|
|
115
|
-
```typescript
|
|
116
|
-
import { ComponentName } from '@umituz/react-native-settings';
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Relative Imports
|
|
120
|
-
```typescript
|
|
121
|
-
// Within same domain
|
|
122
|
-
import { ComponentName } from '../components/ComponentName';
|
|
123
|
-
|
|
124
|
-
// Across domains
|
|
125
|
-
import { ComponentName } from '../../domains/{domain}/presentation/components/ComponentName';
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### Restrictions
|
|
129
|
-
- ❌ Don't use deep relative imports (`../../../`)
|
|
130
|
-
- ❌ Don't import from implementation files directly
|
|
131
|
-
- ✅ Use barrel exports (`index.ts`)
|
|
132
|
-
|
|
133
|
-
## Naming Conventions
|
|
134
|
-
|
|
135
|
-
### Components
|
|
136
|
-
- PascalCase: `SettingsItemCard.tsx`
|
|
137
|
-
- Descriptive names
|
|
138
|
-
- Prefix with feature name if domain-specific
|
|
139
|
-
|
|
140
|
-
### Hooks
|
|
141
|
-
- camelCase with `use` prefix: `useSettings.ts`
|
|
142
|
-
- Domain hooks: `use{Feature}{Action}.ts`
|
|
143
|
-
|
|
144
|
-
### Utilities
|
|
145
|
-
- camelCase: `formatDate.ts`
|
|
146
|
-
- Descriptive action names: `normalizeConfig.ts`
|
|
147
|
-
|
|
148
|
-
### Types
|
|
149
|
-
- PascalCase for interfaces: `UserSettings.ts`
|
|
150
|
-
- Type suffix: `SettingsConfig.types.ts`
|
|
151
|
-
|
|
152
|
-
## Design System Usage
|
|
153
|
-
|
|
154
|
-
### ✅ ALWAYS Use Design System
|
|
155
|
-
```typescript
|
|
156
|
-
// Instead of:
|
|
157
|
-
color: '#2196F3'
|
|
158
|
-
fontSize: 16
|
|
159
|
-
|
|
160
|
-
// Use:
|
|
161
|
-
color: tokens.colors.primary
|
|
162
|
-
fontSize: tokens.typography.fontSize.base
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Tokens Reference
|
|
166
|
-
See: `src/presentation/design-system/tokens.ts`
|
|
167
|
-
- Colors: `tokens.colors.*`
|
|
168
|
-
- Spacing: `tokens.spacing.*`
|
|
169
|
-
- Typography: `tokens.typography.*`
|
|
170
|
-
- Border Radius: `tokens.borderRadius.*`
|
|
171
|
-
|
|
172
|
-
## TypeScript Rules
|
|
173
|
-
|
|
174
|
-
### ✅ MUST
|
|
175
|
-
- Type all props
|
|
176
|
-
- Type all function parameters
|
|
177
|
-
- Type all return values
|
|
178
|
-
- Export reusable types
|
|
179
|
-
- Use strict mode
|
|
180
|
-
|
|
181
|
-
### Type Definition Location
|
|
182
|
-
- Component types: Same file as component
|
|
183
|
-
- Shared types: `types/` directory
|
|
184
|
-
- Domain types: `src/domains/{domain}/types/`
|
|
185
|
-
|
|
186
|
-
## Error Handling
|
|
187
|
-
|
|
188
|
-
### ✅ ALWAYS
|
|
189
|
-
1. Use try-catch for async operations
|
|
190
|
-
2. Provide meaningful error messages
|
|
191
|
-
3. Log errors appropriately
|
|
192
|
-
4. Handle user-friendly errors
|
|
193
|
-
|
|
194
|
-
### Pattern
|
|
195
|
-
```typescript
|
|
196
|
-
// Check implementation files for patterns
|
|
197
|
-
// Repository: src/infrastructure/repositories/SettingsRepository.ts
|
|
198
|
-
// Service: src/infrastructure/services/SettingsService.ts
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Performance Rules
|
|
202
|
-
|
|
203
|
-
### ✅ ALWAYS
|
|
204
|
-
1. Use React.memo for expensive components
|
|
205
|
-
2. Use useCallback for handlers
|
|
206
|
-
3. Use useMemo for computed values
|
|
207
|
-
4. Avoid unnecessary re-renders
|
|
208
|
-
|
|
209
|
-
### ❌ NEVER
|
|
210
|
-
1. Define functions in render
|
|
211
|
-
2. Create objects in render
|
|
212
|
-
3. Skip optimization without reason
|
|
213
|
-
4. Ignore performance warnings
|
|
214
|
-
|
|
215
|
-
## Accessibility
|
|
216
|
-
|
|
217
|
-
### ✅ MUST
|
|
218
|
-
1. Add accessibilityLabel to interactive elements
|
|
219
|
-
2. Provide accessibilityHint for complex interactions
|
|
220
|
-
3. Support screen readers
|
|
221
|
-
4. Maintain proper touch target sizes (44x44 min)
|
|
222
|
-
|
|
223
|
-
## Testing Guidelines
|
|
224
|
-
|
|
225
|
-
### Test File Location
|
|
226
|
-
- Next to component: `ComponentName.test.tsx`
|
|
227
|
-
- In `__tests__` directory: `__tests__/ComponentName.test.tsx`
|
|
228
|
-
|
|
229
|
-
### What to Test
|
|
230
|
-
- Component rendering
|
|
231
|
-
- User interactions
|
|
232
|
-
- Props changes
|
|
233
|
-
- Error states
|
|
234
|
-
- Accessibility
|
|
235
|
-
|
|
236
|
-
### Pattern Reference
|
|
237
|
-
Check existing test files:
|
|
238
|
-
- `src/presentation/components/__tests__/SettingsItemCard.test.tsx`
|
|
239
|
-
- `src/domains/about/presentation/components/__tests__/AboutContent.test.tsx`
|
|
240
|
-
|
|
241
|
-
## Common Patterns
|
|
242
|
-
|
|
243
|
-
### Adding a New Settings Item
|
|
244
|
-
|
|
245
|
-
1. **Check Existing**: Look at `SettingsItemCard` usage
|
|
246
|
-
2. **Follow Pattern**: Use `SettingsItemCard` component
|
|
247
|
-
3. **Reference File**: `src/presentation/components/SettingsItemCard/SettingsItemCard.tsx`
|
|
248
|
-
4. **No Custom Code**: Don't create custom item cards
|
|
249
|
-
|
|
250
|
-
### Adding a New Domain
|
|
251
|
-
|
|
252
|
-
1. **Follow Structure**: Copy existing domain structure
|
|
253
|
-
2. **Reference**: Similar domain for patterns
|
|
254
|
-
3. **Layers**: domain/, application/, infrastructure/, presentation/
|
|
255
|
-
4. **Documentation**: Create domain README with strategy/restrictions/rules
|
|
256
|
-
|
|
257
|
-
### Adding Navigation
|
|
258
|
-
|
|
259
|
-
1. **Reference**: `src/presentation/navigation/`
|
|
260
|
-
2. **Use Wrappers**: Existing screen wrappers
|
|
261
|
-
3. **Follow Patterns**: See navigation utilities
|
|
262
|
-
4. **No Inline**: Don't inline navigation logic
|
|
263
|
-
|
|
264
|
-
## File Reference Patterns
|
|
265
|
-
|
|
266
|
-
When agent needs to implement something:
|
|
267
|
-
|
|
268
|
-
1. **Find Similar Implementation**
|
|
269
|
-
```
|
|
270
|
-
Search: Use Task tool with Explore agent
|
|
271
|
-
Pattern: Look for similar feature in existing code
|
|
272
|
-
Reference: Check READMEs for file paths
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
2. **Follow Existing Patterns**
|
|
276
|
-
```
|
|
277
|
-
Don't: Create from scratch
|
|
278
|
-
Do: Reference and adapt existing code
|
|
279
|
-
Verify: Check implementation file directly
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
3. **Check Documentation First**
|
|
283
|
-
```
|
|
284
|
-
1. Read component README
|
|
285
|
-
2. Check Strategy section
|
|
286
|
-
3. Follow Rules section
|
|
287
|
-
4. Reference file path
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
## Verification Steps
|
|
291
|
-
|
|
292
|
-
### Before Completing Task
|
|
293
|
-
|
|
294
|
-
1. ✅ **Checked Documentation**
|
|
295
|
-
- Read relevant README files
|
|
296
|
-
- Understood strategy and restrictions
|
|
297
|
-
- Know the file paths
|
|
298
|
-
|
|
299
|
-
2. ✅ **Referenced Implementation**
|
|
300
|
-
- Looked at similar components
|
|
301
|
-
- Followed existing patterns
|
|
302
|
-
- Used same imports
|
|
303
|
-
|
|
304
|
-
3. ✅ **Followed Rules**
|
|
305
|
-
- No code examples in docs
|
|
306
|
-
- All files properly typed
|
|
307
|
-
- Design system tokens used
|
|
308
|
-
- Error handling included
|
|
309
|
-
|
|
310
|
-
4. ✅ **Testing**
|
|
311
|
-
- Added tests if new component
|
|
312
|
-
- Verified existing tests pass
|
|
313
|
-
- Tested on both platforms if needed
|
|
314
|
-
|
|
315
|
-
## Quick Reference
|
|
316
|
-
|
|
317
|
-
### Common File Paths
|
|
318
|
-
|
|
319
|
-
```
|
|
320
|
-
Components:
|
|
321
|
-
src/presentation/components/SettingsItemCard/
|
|
322
|
-
src/presentation/screens/components/SettingsContent/
|
|
323
|
-
|
|
324
|
-
Domains:
|
|
325
|
-
src/domains/about/
|
|
326
|
-
src/domains/appearance/
|
|
327
|
-
src/domains/legal/
|
|
328
|
-
(etc.)
|
|
329
|
-
|
|
330
|
-
Configuration:
|
|
331
|
-
src/presentation/screens/types/SettingsConfig.ts
|
|
332
|
-
src/presentation/screens/utils/normalizeConfig.ts
|
|
333
|
-
|
|
334
|
-
Navigation:
|
|
335
|
-
src/presentation/navigation/components/
|
|
336
|
-
src/presentation/navigation/hooks/
|
|
337
|
-
src/presentation/navigation/utils/
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
### Key Import Patterns
|
|
341
|
-
|
|
342
|
-
```typescript
|
|
343
|
-
// From package
|
|
344
|
-
import { X } from '@umituz/react-native-settings';
|
|
345
|
-
|
|
346
|
-
// Domain components
|
|
347
|
-
import { X } from '../../domains/{domain}/presentation/components/X';
|
|
348
|
-
|
|
349
|
-
// Utilities
|
|
350
|
-
import { util } from '../../path/to/util';
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
## Summary
|
|
354
|
-
|
|
355
|
-
### Agent Approach
|
|
356
|
-
1. **Read Documentation First** - Check READMEs
|
|
357
|
-
2. **Reference Implementation** - Look at file paths
|
|
358
|
-
3. **Follow Patterns** - Don't create from scratch
|
|
359
|
-
4. **No Code Examples** - Keep docs code-free
|
|
360
|
-
5. **Strategy Over Syntax** - Focus on approach
|
|
361
|
-
|
|
362
|
-
### Success Criteria
|
|
363
|
-
- ✅ Uses existing components
|
|
364
|
-
- ✅ Follows domain structure
|
|
365
|
-
- ✅ Includes proper documentation
|
|
366
|
-
- ✅ No code examples in docs
|
|
367
|
-
- ✅ File paths referenced correctly
|
package/ARCHITECTURE.md
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
# Architecture Overview
|
|
2
|
-
|
|
3
|
-
Comprehensive architecture documentation for the `@umituz/react-native-settings` package following Domain-Driven Design (DDD) principles.
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
This document defines the architectural principles, structural organization, and design patterns governing the `@umituz/react-native-settings` package. It serves as the authoritative reference for understanding the system's layered architecture, domain organization, and interaction patterns between components.
|
|
8
|
-
|
|
9
|
-
## File Paths
|
|
10
|
-
|
|
11
|
-
**Base Directory**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/`
|
|
12
|
-
|
|
13
|
-
**Key Structure**:
|
|
14
|
-
- `/src/domains/` - Domain-specific modules
|
|
15
|
-
- `/src/application/` - Application layer interfaces
|
|
16
|
-
- `/src/infrastructure/` - Infrastructure implementations
|
|
17
|
-
- `/src/presentation/` - UI components and screens
|
|
18
|
-
|
|
19
|
-
## Architecture Layers
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
┌─────────────────────────────────────────┐
|
|
23
|
-
│ Presentation Layer │
|
|
24
|
-
│ (UI Components, Screens, Hooks) │
|
|
25
|
-
└─────────────────────────────────────────┘
|
|
26
|
-
↓
|
|
27
|
-
┌─────────────────────────────────────────┐
|
|
28
|
-
│ Application Layer │
|
|
29
|
-
│ (Business Logic, Interfaces) │
|
|
30
|
-
└─────────────────────────────────────────┘
|
|
31
|
-
↓
|
|
32
|
-
┌─────────────────────────────────────────┐
|
|
33
|
-
│ Infrastructure Layer │
|
|
34
|
-
│ (Data Persistence, Services) │
|
|
35
|
-
└─────────────────────────────────────────┘
|
|
36
|
-
↓
|
|
37
|
-
┌─────────────────────────────────────────┐
|
|
38
|
-
│ Domain Layer │
|
|
39
|
-
│ (Business Entities, Rules) │
|
|
40
|
-
└─────────────────────────────────────────┘
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Layer Responsibilities
|
|
44
|
-
|
|
45
|
-
**Presentation Layer**: UI rendering and user interaction handling
|
|
46
|
-
**Application Layer**: Business logic orchestration and interface definitions
|
|
47
|
-
**Infrastructure Layer**: Data persistence and external service implementations
|
|
48
|
-
**Domain Layer**: Business entities, rules, and domain-specific logic
|
|
49
|
-
|
|
50
|
-
## Directory Structure
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
src/
|
|
54
|
-
├── domains/ # Business domains
|
|
55
|
-
│ ├── about/
|
|
56
|
-
│ ├── appearance/
|
|
57
|
-
│ ├── legal/
|
|
58
|
-
│ ├── disclaimer/
|
|
59
|
-
│ ├── feedback/
|
|
60
|
-
│ ├── faqs/
|
|
61
|
-
│ ├── rating/
|
|
62
|
-
│ ├── video-tutorials/
|
|
63
|
-
│ ├── cloud-sync/
|
|
64
|
-
│ └── dev/
|
|
65
|
-
├── application/ # Application layer
|
|
66
|
-
│ └── ports/ # Layer interfaces
|
|
67
|
-
├── infrastructure/ # Infrastructure layer
|
|
68
|
-
│ ├── repositories/ # Data repositories
|
|
69
|
-
│ └── services/ # Business services
|
|
70
|
-
└── presentation/ # Presentation layer
|
|
71
|
-
├── components/ # Shared components
|
|
72
|
-
├── screens/ # Screens
|
|
73
|
-
├── hooks/ # Presentation hooks
|
|
74
|
-
└── navigation/ # Navigation
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Domain Organization
|
|
78
|
-
|
|
79
|
-
Each domain follows a consistent self-contained structure:
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
domain/
|
|
83
|
-
├── domain/ # Business entities
|
|
84
|
-
├── application/ # Domain-specific application logic
|
|
85
|
-
├── infrastructure/ # Domain-specific infrastructure
|
|
86
|
-
├── presentation/ # Domain-specific UI
|
|
87
|
-
├── types/ # Domain types
|
|
88
|
-
└── utils/ # Domain utilities
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Domain Examples
|
|
92
|
-
|
|
93
|
-
**About Domain**: Application information, version details, developer contact
|
|
94
|
-
**Appearance Domain**: Theme settings, language preferences, display options
|
|
95
|
-
**Legal Domain**: Terms of service, privacy policy, legal notices
|
|
96
|
-
**Disclaimer Domain**: Usage disclaimers, liability statements
|
|
97
|
-
**Feedback Domain**: User feedback collection, issue reporting
|
|
98
|
-
**FAQs Domain**: Frequently asked questions and answers
|
|
99
|
-
**Rating Domain**: App store ratings, review prompts
|
|
100
|
-
**Video Tutorials Domain**: Tutorial videos, help content
|
|
101
|
-
**Cloud Sync Domain**: Data synchronization, backup/restore
|
|
102
|
-
**Dev Domain**: Development tools, debugging features
|
|
103
|
-
|
|
104
|
-
## Data Flow Patterns
|
|
105
|
-
|
|
106
|
-
### Reading Settings
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
User → UI Component → Hook → Query → Service → Repository → Storage
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Updating Settings
|
|
113
|
-
|
|
114
|
-
```
|
|
115
|
-
User → UI → Mutation Hook → Service → Repository → Storage
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## Design Patterns
|
|
119
|
-
|
|
120
|
-
### Repository Pattern
|
|
121
|
-
Separates data access logic from business logic through interface-based abstractions
|
|
122
|
-
|
|
123
|
-
### Dependency Injection
|
|
124
|
-
Inject dependencies through constructors for testability and flexibility
|
|
125
|
-
|
|
126
|
-
### Factory Pattern
|
|
127
|
-
Create objects with factory functions for consistent object creation
|
|
128
|
-
|
|
129
|
-
### Observer Pattern
|
|
130
|
-
React hooks and TanStack Query use observer pattern for reactive state management
|
|
131
|
-
|
|
132
|
-
## Strategy
|
|
133
|
-
|
|
134
|
-
1. **Domain-Driven Organization**: Structure the codebase around business domains rather than technical layers, ensuring each domain is self-contained with its own entities, logic, and presentation
|
|
135
|
-
|
|
136
|
-
2. **Layered Architecture**: Maintain clear separation between presentation, application, infrastructure, and domain layers with unidirectional dependencies flowing from outer to inner layers
|
|
137
|
-
|
|
138
|
-
3. **Interface-Based Design**: Define clear interfaces between layers and components to enable loose coupling, testability, and independent evolution of components
|
|
139
|
-
|
|
140
|
-
4. **Dependency Inversion**: Depend on abstractions rather than concrete implementations, allowing for easy substitution of implementations (e.g., different storage backends)
|
|
141
|
-
|
|
142
|
-
5. **Single Responsibility Principle**: Each component, service, and module should have one reason to change, ensuring focused, maintainable code
|
|
143
|
-
|
|
144
|
-
## Restrictions
|
|
145
|
-
|
|
146
|
-
### ❌ DO NOT
|
|
147
|
-
|
|
148
|
-
- Skip architectural layers when communicating between components (e.g., Presentation must not directly access Storage)
|
|
149
|
-
- Create circular dependencies between layers or domains
|
|
150
|
-
- Mix concerns within a single layer (e.g., business logic in presentation components)
|
|
151
|
-
- Access external services directly from domain or presentation layers
|
|
152
|
-
- Duplicate business logic across multiple domains or components
|
|
153
|
-
|
|
154
|
-
### ❌ NEVER
|
|
155
|
-
|
|
156
|
-
- Allow presentation components to directly access infrastructure implementations
|
|
157
|
-
- Create dependencies from inner layers (domain/infrastructure) to outer layers (presentation)
|
|
158
|
-
- Implement business rules in UI components or hooks
|
|
159
|
-
- Share mutable state between different domains without proper encapsulation
|
|
160
|
-
- Bypass repository interfaces when accessing data
|
|
161
|
-
|
|
162
|
-
### ❌ AVOID
|
|
163
|
-
|
|
164
|
-
- Creating tightly coupled dependencies between different domains
|
|
165
|
-
- Implementing complex business logic in presentation layer hooks
|
|
166
|
-
- Using global state or singletons for sharing data between layers
|
|
167
|
-
- Making infrastructure details (e.g., storage implementation) visible to other layers
|
|
168
|
-
- Creating overly complex abstractions that don't serve a clear purpose
|
|
169
|
-
|
|
170
|
-
## Rules
|
|
171
|
-
|
|
172
|
-
### ✅ ALWAYS
|
|
173
|
-
|
|
174
|
-
- Use interfaces to define contracts between layers and components
|
|
175
|
-
- Follow dependency injection patterns for passing dependencies
|
|
176
|
-
- Implement proper error handling at each layer with consistent error types
|
|
177
|
-
- Maintain type safety with TypeScript throughout the architecture
|
|
178
|
-
- Write tests that verify behavior at each architectural layer
|
|
179
|
-
|
|
180
|
-
### ✅ MUST
|
|
181
|
-
|
|
182
|
-
- Ensure all data access goes through repository interfaces
|
|
183
|
-
- Keep domain entities and business rules independent of infrastructure
|
|
184
|
-
- Implement proper separation of concerns in all components
|
|
185
|
-
- Use async/await for all asynchronous operations
|
|
186
|
-
- Handle edge cases and errors gracefully at each layer
|
|
187
|
-
|
|
188
|
-
### ✅ SHOULD
|
|
189
|
-
|
|
190
|
-
- Prefer composition over inheritance when sharing behavior
|
|
191
|
-
- Keep interfaces focused and cohesive (small, related sets of methods)
|
|
192
|
-
- Use factory functions for creating complex objects with dependencies
|
|
193
|
-
- Implement proper logging at each layer for debugging and monitoring
|
|
194
|
-
- Maintain consistency in naming conventions across all layers
|
|
195
|
-
|
|
196
|
-
## AI Agent Guidelines
|
|
197
|
-
|
|
198
|
-
### Architecture Modifications
|
|
199
|
-
|
|
200
|
-
When modifying the architecture:
|
|
201
|
-
|
|
202
|
-
1. **Layer Adherence**: Always respect the layered architecture and maintain unidirectional dependencies from outer to inner layers
|
|
203
|
-
2. **Domain Boundaries**: Keep domains self-contained and minimize inter-domain dependencies
|
|
204
|
-
3. **Interface Stability**: When changing interfaces, maintain backward compatibility or provide migration paths
|
|
205
|
-
4. **Incremental Changes**: Make architectural changes incrementally, ensuring tests pass at each step
|
|
206
|
-
|
|
207
|
-
### Adding New Features
|
|
208
|
-
|
|
209
|
-
When adding new features:
|
|
210
|
-
|
|
211
|
-
1. **Domain Identification**: Determine which domain the feature belongs to, or create a new domain if appropriate
|
|
212
|
-
2. **Layer Placement**: Place each piece of functionality in the appropriate layer following the architecture patterns
|
|
213
|
-
3. **Interface Design**: Design clear interfaces before implementing functionality
|
|
214
|
-
4. **Dependency Management**: Use dependency injection to pass dependencies and enable testing
|
|
215
|
-
|
|
216
|
-
### Refactoring Guidelines
|
|
217
|
-
|
|
218
|
-
When refactoring existing code:
|
|
219
|
-
|
|
220
|
-
1. **Maintain Contracts**: Keep existing interfaces stable; internal refactoring should not break external contracts
|
|
221
|
-
2. **Test Coverage**: Ensure comprehensive test coverage before and after refactoring
|
|
222
|
-
3. **Gradual Migration**: Refactor incrementally, maintaining functionality at each step
|
|
223
|
-
4. **Documentation Updates**: Update architecture documentation to reflect significant structural changes
|
|
224
|
-
|
|
225
|
-
### Code Review Checklist
|
|
226
|
-
|
|
227
|
-
Review should verify:
|
|
228
|
-
|
|
229
|
-
- Layer separation is maintained
|
|
230
|
-
- Dependencies flow in correct direction (outer → inner)
|
|
231
|
-
- Interfaces are well-defined and cohesive
|
|
232
|
-
- Domain logic is properly encapsulated
|
|
233
|
-
- Error handling is consistent across layers
|
|
234
|
-
- Tests cover all architectural layers
|
|
235
|
-
- No circular dependencies exist
|
|
236
|
-
- Type safety is maintained throughout
|
|
237
|
-
|
|
238
|
-
## Related Documentation
|
|
239
|
-
|
|
240
|
-
- **TESTING.md**: Comprehensive testing strategies for each architectural layer
|
|
241
|
-
- **Domain READMEs**: Individual domain-specific documentation
|
|
242
|
-
- **Component Documentation**: UI component usage and patterns
|
|
243
|
-
|
|
244
|
-
## License
|
|
245
|
-
|
|
246
|
-
MIT
|
package/CHANGELOG.md
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [4.20.58] - 2025-01-08
|
|
9
|
-
|
|
10
|
-
### Added
|
|
11
|
-
- Complete documentation migration to new format
|
|
12
|
-
- AI Agent Guidelines for all components
|
|
13
|
-
- Strategy-based documentation without code examples
|
|
14
|
-
- File path references in all documentation
|
|
15
|
-
- CONTRIBUTING.md guide
|
|
16
|
-
- LICENSE file
|
|
17
|
-
|
|
18
|
-
### Changed
|
|
19
|
-
- All README files now use Purpose/Strategy/Restrictions/Rules format
|
|
20
|
-
- ARCHITECTURE.md updated to new documentation style
|
|
21
|
-
- TESTING.md updated to new documentation style
|
|
22
|
-
- Removed all code examples from documentation
|
|
23
|
-
- Added AI-friendly guidelines throughout
|
|
24
|
-
|
|
25
|
-
### Fixed
|
|
26
|
-
- Documentation consistency across all files
|
|
27
|
-
- Missing file path references
|
|
28
|
-
- Incomplete AI guidelines
|
|
29
|
-
|
|
30
|
-
## [4.20.57] - Previous Releases
|
|
31
|
-
|
|
32
|
-
### Features
|
|
33
|
-
- Settings screen with modular sections
|
|
34
|
-
- Theme management (light, dark, auto)
|
|
35
|
-
- Language selection
|
|
36
|
-
- Notification preferences
|
|
37
|
-
- About screen with app info
|
|
38
|
-
- Legal documents (privacy, terms)
|
|
39
|
-
- Disclaimer system
|
|
40
|
-
- Feedback collection
|
|
41
|
-
- FAQ management
|
|
42
|
-
- Rating prompts
|
|
43
|
-
- Video tutorials
|
|
44
|
-
- Cloud sync support
|
|
45
|
-
- Development utilities
|
|
46
|
-
|
|
47
|
-
### Architecture
|
|
48
|
-
- Domain-Driven Design (DDD)
|
|
49
|
-
- Four-layer architecture
|
|
50
|
-
- Repository pattern
|
|
51
|
-
- Service layer
|
|
52
|
-
- TanStack Query integration
|
|
53
|
-
- Type-safe implementation
|
|
54
|
-
|
|
55
|
-
## Documentation Format
|
|
56
|
-
|
|
57
|
-
From version 4.20.58 onwards, all documentation follows:
|
|
58
|
-
- No code examples
|
|
59
|
-
- Strategy-based approach
|
|
60
|
-
- File path references
|
|
61
|
-
- Clear restrictions (❌ DO NOT, ❌ NEVER, ❌ AVOID)
|
|
62
|
-
- Mandatory rules (✅ ALWAYS, ✅ MUST, ✅ SHOULD)
|
|
63
|
-
- AI Agent Guidelines
|
|
64
|
-
|
|
65
|
-
## License
|
|
66
|
-
|
|
67
|
-
MIT License - see LICENSE file for details
|