@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.
- 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/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 +95 -489
- 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 -436
- package/src/presentation/components/SettingsFooter/README.md +48 -427
- package/src/presentation/components/SettingsItemCard/README.md +152 -391
- 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,542 +1,93 @@
|
|
|
1
1
|
# Legal 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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
#### Props
|
|
92
|
-
|
|
93
|
-
| Prop | Type | Default | Description |
|
|
94
|
-
|------|------|---------|-------------|
|
|
95
|
-
| `content` | `string` | `undefined` | Privacy policy content |
|
|
96
|
-
| `url` | `string` | `undefined` | External privacy policy URL |
|
|
97
|
-
| `title` | `string` | `'Privacy Policy'` | Screen title |
|
|
98
|
-
| `viewOnlineText` | `string` | `undefined` | "View online" label text |
|
|
99
|
-
| `openText` | `string` | `'Open'` | Open button text |
|
|
100
|
-
| `onUrlPress` | `() => void` | `undefined` | Custom URL press handler |
|
|
101
|
-
| `testID` | `string` | `undefined` | Test ID for testing |
|
|
102
|
-
|
|
103
|
-
### TermsOfServiceScreen
|
|
104
|
-
|
|
105
|
-
Dedicated screen for displaying terms of service content.
|
|
106
|
-
|
|
107
|
-
```tsx
|
|
108
|
-
import { TermsOfServiceScreen } from '@umituz/react-native-settings';
|
|
109
|
-
|
|
110
|
-
function MyTermsScreen() {
|
|
111
|
-
return (
|
|
112
|
-
<TermsOfServiceScreen
|
|
113
|
-
content="Your terms of service content here..."
|
|
114
|
-
title="Terms of Service"
|
|
115
|
-
viewOnlineText="View full terms online"
|
|
116
|
-
openText="Open in Browser"
|
|
117
|
-
url="https://yourapp.com/terms"
|
|
118
|
-
/>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
#### Props
|
|
124
|
-
|
|
125
|
-
| Prop | Type | Default | Description |
|
|
126
|
-
|------|------|---------|-------------|
|
|
127
|
-
| `content` | `string` | `undefined` | Terms content |
|
|
128
|
-
| `url` | `string` | `undefined` | External terms URL |
|
|
129
|
-
| `title` | `string` | `'Terms of Service'` | Screen title |
|
|
130
|
-
| `viewOnlineText` | `string` | `undefined` | "View online" label text |
|
|
131
|
-
| `openText` | `string` | `'Open'` | Open button text |
|
|
132
|
-
| `onUrlPress` | `() => void` | `undefined` | Custom URL press handler |
|
|
133
|
-
| `testID` | `string` | `undefined` | Test ID for testing |
|
|
134
|
-
|
|
135
|
-
### LegalContentScreen
|
|
136
|
-
|
|
137
|
-
Generic screen for displaying any legal document content.
|
|
138
|
-
|
|
139
|
-
```tsx
|
|
140
|
-
import { LegalContentScreen } from '@umituz/react-native-settings';
|
|
141
|
-
import { StyleSheet } from 'react-native';
|
|
142
|
-
|
|
143
|
-
const createStyles = (tokens: any) => StyleSheet.create({
|
|
144
|
-
container: {
|
|
145
|
-
flex: 1,
|
|
146
|
-
},
|
|
147
|
-
scrollContent: {
|
|
148
|
-
padding: 16,
|
|
149
|
-
},
|
|
150
|
-
content: {
|
|
151
|
-
paddingBottom: 32,
|
|
152
|
-
},
|
|
153
|
-
title: {
|
|
154
|
-
marginBottom: 16,
|
|
155
|
-
},
|
|
156
|
-
text: {
|
|
157
|
-
lineHeight: 24,
|
|
158
|
-
},
|
|
159
|
-
urlContainer: {
|
|
160
|
-
marginTop: 24,
|
|
161
|
-
padding: 16,
|
|
162
|
-
borderRadius: 8,
|
|
163
|
-
},
|
|
164
|
-
urlText: {
|
|
165
|
-
marginBottom: 12,
|
|
166
|
-
},
|
|
167
|
-
urlButton: {
|
|
168
|
-
marginTop: 8,
|
|
169
|
-
},
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
function MyLegalDocumentScreen() {
|
|
173
|
-
return (
|
|
174
|
-
<LegalContentScreen
|
|
175
|
-
content="Legal document content..."
|
|
176
|
-
title="Legal Document"
|
|
177
|
-
viewOnlineText="View online"
|
|
178
|
-
openText="Open"
|
|
179
|
-
url="https://yourapp.com/legal"
|
|
180
|
-
styleCacheKey="my-legal-document"
|
|
181
|
-
createStyles={createStyles}
|
|
182
|
-
/>
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
#### Props
|
|
188
|
-
|
|
189
|
-
| Prop | Type | Default | Description |
|
|
190
|
-
|------|------|---------|-------------|
|
|
191
|
-
| `content` | `string` | `undefined` | Document content |
|
|
192
|
-
| `url` | `string` | `undefined` | External document URL |
|
|
193
|
-
| `title` | `string` | **Required** | Screen title |
|
|
194
|
-
| `viewOnlineText` | `string` | `undefined` | "View online" label text |
|
|
195
|
-
| `openText` | `string` | `undefined` | Open button text |
|
|
196
|
-
| `onUrlPress` | `() => void` | `undefined` | Custom URL press handler |
|
|
197
|
-
| `testID` | `string` | `undefined` | Test ID for testing |
|
|
198
|
-
| `styleCacheKey` | `string` | **Required** | Unique key for style caching |
|
|
199
|
-
| `createStyles` | `(tokens) => StyleSheet` | **Required** | Stylesheet factory function |
|
|
200
|
-
|
|
201
|
-
## Components (Internal)
|
|
202
|
-
|
|
203
|
-
These components are used internally by the screens but can also be used directly:
|
|
204
|
-
|
|
205
|
-
### LegalScreenHeader
|
|
206
|
-
|
|
207
|
-
Header component for legal screens.
|
|
208
|
-
|
|
209
|
-
```tsx
|
|
210
|
-
import { LegalScreenHeader } from '@umituz/react-native-settings';
|
|
211
|
-
|
|
212
|
-
<LegalScreenHeader
|
|
213
|
-
title="Legal Information"
|
|
214
|
-
description="Please review our legal documents"
|
|
215
|
-
/>
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### LegalDocumentsList
|
|
219
|
-
|
|
220
|
-
List component for displaying legal documents.
|
|
221
|
-
|
|
222
|
-
```tsx
|
|
223
|
-
import { LegalDocumentsList } from '@umituz/react-native-settings';
|
|
224
|
-
|
|
225
|
-
<LegalDocumentsList
|
|
226
|
-
documentsHeader="Legal Documents"
|
|
227
|
-
privacyTitle="Privacy Policy"
|
|
228
|
-
privacyDescription="How we handle your data"
|
|
229
|
-
termsTitle="Terms of Service"
|
|
230
|
-
termsDescription="Rules and guidelines"
|
|
231
|
-
onPrivacyPress={handlePrivacy}
|
|
232
|
-
onTermsPress={handleTerms}
|
|
233
|
-
/>
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### LegalLinks
|
|
237
|
-
|
|
238
|
-
Component for rendering legal document links.
|
|
239
|
-
|
|
240
|
-
```tsx
|
|
241
|
-
import { LegalLinks } from '@umituz/react-native-settings';
|
|
242
|
-
|
|
243
|
-
<LegalLinks
|
|
244
|
-
items={[
|
|
245
|
-
{
|
|
246
|
-
title: 'Privacy Policy',
|
|
247
|
-
description: 'Learn about our data practices',
|
|
248
|
-
onPress: () => navigateToPrivacy(),
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
title: 'Terms of Service',
|
|
252
|
-
description: 'Rules for using our service',
|
|
253
|
-
onPress: () => navigateToTerms(),
|
|
254
|
-
},
|
|
255
|
-
]}
|
|
256
|
-
/>
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### LegalSection
|
|
260
|
-
|
|
261
|
-
Section container for legal content.
|
|
262
|
-
|
|
263
|
-
```tsx
|
|
264
|
-
import { LegalSection } from '@umituz/react-native-settings';
|
|
265
|
-
|
|
266
|
-
<LegalSection title="Important">
|
|
267
|
-
<Text>Please read these documents carefully</Text>
|
|
268
|
-
</LegalSection>
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
### LegalItem
|
|
272
|
-
|
|
273
|
-
Individual legal document item.
|
|
274
|
-
|
|
275
|
-
```tsx
|
|
276
|
-
import { LegalItem } from '@umituz/react-native-settings';
|
|
277
|
-
|
|
278
|
-
<LegalItem
|
|
279
|
-
title="Privacy Policy"
|
|
280
|
-
description="Last updated: Jan 2025"
|
|
281
|
-
onPress={() => console.log('Navigate to privacy')}
|
|
282
|
-
/>
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
## Services
|
|
286
|
-
|
|
287
|
-
### UrlHandlerService
|
|
288
|
-
|
|
289
|
-
Service for handling external URL opening.
|
|
290
|
-
|
|
291
|
-
```typescript
|
|
292
|
-
import { UrlHandlerService } from '@umituz/react-native-settings';
|
|
293
|
-
|
|
294
|
-
// Open URL in browser
|
|
295
|
-
await UrlHandlerService.openUrl('https://example.com/privacy');
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### ContentValidationService
|
|
299
|
-
|
|
300
|
-
Service for validating legal screen content.
|
|
301
|
-
|
|
302
|
-
```typescript
|
|
303
|
-
import { ContentValidationService } from '@umituz/react-native-settings';
|
|
304
|
-
|
|
305
|
-
// Validate screen has proper content
|
|
306
|
-
ContentValidationService.validateScreenContent(
|
|
307
|
-
content,
|
|
308
|
-
url,
|
|
309
|
-
title,
|
|
310
|
-
viewOnlineText,
|
|
311
|
-
openText,
|
|
312
|
-
styleCacheKey
|
|
313
|
-
);
|
|
314
|
-
|
|
315
|
-
// Check if URL section should be shown
|
|
316
|
-
const showUrl = ContentValidationService.shouldShowUrlSection(url, onUrlPress);
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
### StyleCacheService
|
|
320
|
-
|
|
321
|
-
Service for caching styles to optimize performance.
|
|
322
|
-
|
|
323
|
-
```typescript
|
|
324
|
-
import { StyleCacheService } from '@umituz/react-native-settings';
|
|
325
|
-
|
|
326
|
-
// Create cache key from tokens
|
|
327
|
-
const cacheKey = StyleCacheService.createTokenCacheKey(tokens);
|
|
328
|
-
|
|
329
|
-
// Get or create cached styles
|
|
330
|
-
const styles = StyleCacheService.getCachedStyles(
|
|
331
|
-
'privacy-policy',
|
|
332
|
-
cacheKey,
|
|
333
|
-
() => createStyles(tokens)
|
|
334
|
-
);
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
## Examples
|
|
338
|
-
|
|
339
|
-
### Basic Legal Hub
|
|
340
|
-
|
|
341
|
-
```tsx
|
|
342
|
-
import React from 'react';
|
|
343
|
-
import { View } from 'react-native';
|
|
344
|
-
import { LegalScreen } from '@umituz/react-native-settings';
|
|
345
|
-
import { useNavigation } from '@react-navigation/native';
|
|
346
|
-
|
|
347
|
-
export default function LegalHub() {
|
|
348
|
-
const navigation = useNavigation();
|
|
349
|
-
|
|
350
|
-
return (
|
|
351
|
-
<View style={{ flex: 1 }}>
|
|
352
|
-
<LegalScreen
|
|
353
|
-
title="Legal Information"
|
|
354
|
-
description="Please review our legal documents"
|
|
355
|
-
onPrivacyPress={() => navigation.navigate('PrivacyPolicy')}
|
|
356
|
-
onTermsPress={() => navigation.navigate('TermsOfService')}
|
|
357
|
-
/>
|
|
358
|
-
</View>
|
|
359
|
-
);
|
|
360
|
-
}
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
### Privacy Policy with Content
|
|
364
|
-
|
|
365
|
-
```tsx
|
|
366
|
-
import { PrivacyPolicyScreen } from '@umituz/react-native-settings';
|
|
367
|
-
|
|
368
|
-
const PRIVACY_CONTENT = `
|
|
369
|
-
# Privacy Policy
|
|
370
|
-
|
|
371
|
-
We collect minimal data to provide our services...
|
|
372
|
-
|
|
373
|
-
## Data Collection
|
|
374
|
-
|
|
375
|
-
We collect the following information:
|
|
376
|
-
- Email address
|
|
377
|
-
- Usage statistics
|
|
378
|
-
- Crash reports
|
|
379
|
-
|
|
380
|
-
## Data Usage
|
|
381
|
-
|
|
382
|
-
Your data is used to:
|
|
383
|
-
- Improve our services
|
|
384
|
-
- Fix bugs
|
|
385
|
-
- Send important updates
|
|
386
|
-
`;
|
|
387
|
-
|
|
388
|
-
export default function PrivacyPolicy() {
|
|
389
|
-
return (
|
|
390
|
-
<PrivacyPolicyScreen
|
|
391
|
-
content={PRIVACY_CONTENT}
|
|
392
|
-
title="Privacy Policy"
|
|
393
|
-
/>
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### Terms with External URL
|
|
399
|
-
|
|
400
|
-
```tsx
|
|
401
|
-
import { TermsOfServiceScreen } from '@umituz/react-native-settings';
|
|
402
|
-
|
|
403
|
-
export default function TermsOfService() {
|
|
404
|
-
return (
|
|
405
|
-
<TermsOfServiceScreen
|
|
406
|
-
title="Terms of Service"
|
|
407
|
-
viewOnlineText="Read our full terms and conditions online"
|
|
408
|
-
openText="View Terms"
|
|
409
|
-
url="https://myapp.com/terms"
|
|
410
|
-
/>
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
### Custom Legal Document
|
|
416
|
-
|
|
417
|
-
```tsx
|
|
418
|
-
import { LegalContentScreen } from '@umituz/react-native-settings';
|
|
419
|
-
import { StyleSheet } from 'react-native';
|
|
420
|
-
|
|
421
|
-
const createStyles = (tokens: any) => StyleSheet.create({
|
|
422
|
-
container: { flex: 1 },
|
|
423
|
-
scrollContent: { padding: 20 },
|
|
424
|
-
content: { paddingBottom: 40 },
|
|
425
|
-
title: { marginBottom: 20, fontSize: 28 },
|
|
426
|
-
text: { lineHeight: 26, fontSize: 16 },
|
|
427
|
-
urlContainer: { marginTop: 30, padding: 20 },
|
|
428
|
-
urlText: { marginBottom: 12 },
|
|
429
|
-
urlButton: { marginTop: 10 },
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
export default function LicenseAgreement() {
|
|
433
|
-
return (
|
|
434
|
-
<LegalContentScreen
|
|
435
|
-
title="License Agreement"
|
|
436
|
-
content="This is the content of the license agreement..."
|
|
437
|
-
url="https://myapp.com/license"
|
|
438
|
-
viewOnlineText="View license online"
|
|
439
|
-
openText="Open License"
|
|
440
|
-
styleCacheKey="license-agreement"
|
|
441
|
-
createStyles={createStyles}
|
|
442
|
-
/>
|
|
443
|
-
);
|
|
444
|
-
}
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
### With Navigation Integration
|
|
448
|
-
|
|
449
|
-
```tsx
|
|
450
|
-
import { LegalScreen, PrivacyPolicyScreen, TermsOfServiceScreen } from '@umituz/react-native-settings';
|
|
451
|
-
|
|
452
|
-
const LegalStack = createStackNavigator();
|
|
453
|
-
|
|
454
|
-
function LegalNavigation() {
|
|
455
|
-
return (
|
|
456
|
-
<LegalStack.Navigator>
|
|
457
|
-
<LegalStack.Screen
|
|
458
|
-
name="LegalHub"
|
|
459
|
-
component={LegalHub}
|
|
460
|
-
options={{ title: 'Legal' }}
|
|
461
|
-
/>
|
|
462
|
-
<LegalStack.Screen
|
|
463
|
-
name="PrivacyPolicy"
|
|
464
|
-
component={PrivacyPolicyScreen}
|
|
465
|
-
options={{ title: 'Privacy Policy' }}
|
|
466
|
-
/>
|
|
467
|
-
<LegalStack.Screen
|
|
468
|
-
name="TermsOfService"
|
|
469
|
-
component={TermsOfServiceScreen}
|
|
470
|
-
options={{ title: 'Terms of Service' }}
|
|
471
|
-
/>
|
|
472
|
-
</LegalStack.Navigator>
|
|
473
|
-
);
|
|
474
|
-
}
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
## Architecture
|
|
478
|
-
|
|
479
|
-
The Legal domain follows a clean architecture pattern:
|
|
480
|
-
|
|
481
|
-
```
|
|
482
|
-
src/domains/legal/
|
|
483
|
-
├── domain/ # Domain layer
|
|
484
|
-
│ ├── entities/ # LegalConfig entity
|
|
485
|
-
│ └── services/ # UrlHandler, ContentValidation, StyleCache
|
|
486
|
-
├── presentation/ # Presentation layer
|
|
487
|
-
│ ├── screens/ # LegalScreen, PrivacyPolicyScreen, etc.
|
|
488
|
-
│ └── components/ # LegalDocumentsList, LegalItem, etc.
|
|
489
|
-
└── __tests__/ # Test files
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
## Best Practices
|
|
493
|
-
|
|
494
|
-
1. **Keep Content Updated**: Regularly update legal documents as regulations change
|
|
495
|
-
2. **Provide Offline Content**: Include basic content inline, with URL for full version
|
|
496
|
-
3. **Handle URL Errors**: Always use try-catch when opening external URLs
|
|
497
|
-
4. **Accessible Text**: Use proper text sizes and contrast for readability
|
|
498
|
-
5. **Version Your Documents**: Track last updated dates
|
|
499
|
-
6. **Localize Texts**: Translate legal documents for all supported languages
|
|
500
|
-
|
|
501
|
-
## Testing
|
|
502
|
-
|
|
503
|
-
```tsx
|
|
504
|
-
import { render, fireEvent } from '@testing-library/react-native';
|
|
505
|
-
import { LegalScreen } from '@umituz/react-native-settings';
|
|
506
|
-
|
|
507
|
-
describe('LegalScreen', () => {
|
|
508
|
-
it('renders legal documents list', () => {
|
|
509
|
-
const mockPrivacyPress = jest.fn();
|
|
510
|
-
const mockTermsPress = jest.fn();
|
|
511
|
-
|
|
512
|
-
const { getByText } = render(
|
|
513
|
-
<LegalScreen
|
|
514
|
-
privacyTitle="Privacy Policy"
|
|
515
|
-
termsTitle="Terms of Service"
|
|
516
|
-
onPrivacyPress={mockPrivacyPress}
|
|
517
|
-
onTermsPress={mockTermsPress}
|
|
518
|
-
/>
|
|
519
|
-
);
|
|
520
|
-
|
|
521
|
-
expect(getByText('Privacy Policy')).toBeTruthy();
|
|
522
|
-
expect(getByText('Terms of Service')).toBeTruthy();
|
|
523
|
-
});
|
|
524
|
-
|
|
525
|
-
it('handles document press', () => {
|
|
526
|
-
const mockPrivacyPress = jest.fn();
|
|
527
|
-
|
|
528
|
-
const { getByText } = render(
|
|
529
|
-
<LegalScreen
|
|
530
|
-
privacyTitle="Privacy Policy"
|
|
531
|
-
onPrivacyPress={mockPrivacyPress}
|
|
532
|
-
/>
|
|
533
|
-
);
|
|
534
|
-
|
|
535
|
-
fireEvent.press(getByText('Privacy Policy'));
|
|
536
|
-
expect(mockPrivacyPress).toHaveBeenCalled();
|
|
537
|
-
});
|
|
538
|
-
});
|
|
539
|
-
```
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Provides screens and components for displaying legal documents such as privacy policies, terms of service, and other legal information.
|
|
6
|
+
|
|
7
|
+
## File Paths
|
|
8
|
+
|
|
9
|
+
**Screens:**
|
|
10
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/presentation/screens/LegalScreen.tsx`
|
|
11
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/presentation/screens/PrivacyPolicyScreen.tsx`
|
|
12
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/presentation/screens/TermsOfServiceScreen.tsx`
|
|
13
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/presentation/screens/LegalContentScreen.tsx`
|
|
14
|
+
|
|
15
|
+
**Components:**
|
|
16
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/presentation/components/LegalScreenHeader.tsx`
|
|
17
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/presentation/components/LegalDocumentsList.tsx`
|
|
18
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/presentation/components/LegalLinks.tsx`
|
|
19
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/presentation/components/LegalSection.tsx`
|
|
20
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/presentation/components/LegalItem.tsx`
|
|
21
|
+
|
|
22
|
+
**Services:**
|
|
23
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/domain/services/UrlHandlerService.ts`
|
|
24
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/domain/services/ContentValidationService.ts`
|
|
25
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/domain/services/StyleCacheService.ts`
|
|
26
|
+
|
|
27
|
+
**Domain:**
|
|
28
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/domain/entities/LegalConfig.ts`
|
|
29
|
+
|
|
30
|
+
**Index:**
|
|
31
|
+
- `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/legal/index.ts`
|
|
32
|
+
|
|
33
|
+
## Strategy
|
|
34
|
+
|
|
35
|
+
1. **Content Validation**: Use ContentValidationService to ensure legal screens have proper content before rendering
|
|
36
|
+
2. **URL Handling**: Use UrlHandlerService for consistent external URL opening with error handling
|
|
37
|
+
3. **Style Caching**: Optimize performance with StyleCacheService to avoid recreating styles on every render
|
|
38
|
+
4. **Modular Components**: Compose legal screens from smaller components (LegalItem, LegalSection, etc.) for reusability
|
|
39
|
+
5. **Accessibility First**: Ensure all legal content is properly accessible with semantic markup and labels
|
|
40
|
+
|
|
41
|
+
## Restrictions (Forbidden)
|
|
42
|
+
|
|
43
|
+
### DO NOT
|
|
44
|
+
- ❌ DO NOT display legal screens without validating required content (title, content, or URL)
|
|
45
|
+
- ❌ DO NOT open external URLs without using UrlHandlerService
|
|
46
|
+
- ❌ DO NOT bypass ContentValidationService when rendering legal content
|
|
47
|
+
- ❌ DO NOT hardcode legal content directly in components - always pass as props
|
|
48
|
+
|
|
49
|
+
### NEVER
|
|
50
|
+
- ❌ NEVER use LegalContentScreen without providing both styleCacheKey and createStyles
|
|
51
|
+
- ❌ NEVER open URLs without proper error handling (try-catch)
|
|
52
|
+
- ❌ NEVER skip accessibility considerations for legal content
|
|
53
|
+
- ❌ NEVER use legal components without providing proper testIDs for testing
|
|
54
|
+
|
|
55
|
+
### AVOID
|
|
56
|
+
- ❌ AVOID inline style creation in render methods - use StyleCacheService
|
|
57
|
+
- ❌ AVOID mixing legal content with business logic
|
|
58
|
+
- ❌ AVOID creating custom legal screens when LegalContentScreen can be configured
|
|
59
|
+
- ❌ AVOID storing large legal documents in component state
|
|
60
|
+
|
|
61
|
+
## Rules
|
|
62
|
+
|
|
63
|
+
### ALWAYS
|
|
64
|
+
- ✅ ALWAYS validate screen content using ContentValidationService before rendering
|
|
65
|
+
- ✅ ALWAYS use UrlHandlerService for opening external URLs
|
|
66
|
+
- ✅ ALWAYS provide proper error handling for URL operations
|
|
67
|
+
- ✅ ALWAYS include testID props for E2E testing
|
|
68
|
+
- ✅ ALWAYS use StyleCacheService for style optimization in LegalContentScreen
|
|
69
|
+
|
|
70
|
+
### MUST
|
|
71
|
+
- ✅ MUST provide title prop to all legal screen components
|
|
72
|
+
- ✅ MUST provide styleCacheKey and createStyles to LegalContentScreen
|
|
73
|
+
- ✅ MUST handle URL opening errors gracefully with user feedback
|
|
74
|
+
- ✅ MUST ensure legal content is readable and accessible
|
|
75
|
+
- ✅ MUST provide localized legal content for all supported languages
|
|
76
|
+
|
|
77
|
+
### SHOULD
|
|
78
|
+
- ✅ SHOULD provide inline content with URL fallback for offline access
|
|
79
|
+
- ✅ SHOULD keep legal documents updated with version tracking
|
|
80
|
+
- ✅ SHOULD use proper typography and spacing for readability
|
|
81
|
+
- ✅ SHOULD implement proper navigation between legal documents
|
|
82
|
+
- ✅ SHOULD cache legal content for better performance
|
|
83
|
+
|
|
84
|
+
## AI Agent Guidelines
|
|
85
|
+
|
|
86
|
+
1. **Screen Selection**: Use LegalScreen for hub, PrivacyPolicyScreen/TermsOfServiceScreen for specific documents, LegalContentScreen for custom legal documents
|
|
87
|
+
2. **Validation**: Always use ContentValidationService to validate screen props before rendering
|
|
88
|
+
3. **URL Handling**: Always use UrlHandlerService for external URLs - never use Linking directly
|
|
89
|
+
4. **Performance**: Always use StyleCacheService in LegalContentScreen to optimize style creation
|
|
90
|
+
5. **Accessibility**: Always ensure legal content meets accessibility standards with proper semantic structure
|
|
540
91
|
|
|
541
92
|
## Related
|
|
542
93
|
|