@umituz/react-native-settings 4.20.56 → 4.20.57
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/README.md +145 -3
- package/package.json +1 -2
- package/src/application/README.md +322 -0
- package/src/domains/about/README.md +452 -0
- package/src/domains/about/presentation/hooks/README.md +350 -0
- package/src/domains/appearance/README.md +596 -0
- package/src/domains/appearance/hooks/README.md +366 -0
- package/src/domains/appearance/infrastructure/services/README.md +455 -0
- package/src/domains/cloud-sync/README.md +451 -0
- package/src/domains/cloud-sync/presentation/components/README.md +493 -0
- package/src/domains/dev/README.md +477 -0
- package/src/domains/disclaimer/README.md +421 -0
- package/src/domains/disclaimer/presentation/components/README.md +394 -0
- package/src/domains/faqs/README.md +586 -0
- package/src/domains/feedback/README.md +565 -0
- package/src/domains/feedback/presentation/hooks/README.md +428 -0
- package/src/domains/legal/README.md +549 -0
- package/src/domains/rating/README.md +452 -0
- package/src/domains/rating/presentation/components/README.md +475 -0
- package/src/domains/video-tutorials/README.md +482 -0
- package/src/domains/video-tutorials/presentation/components/README.md +433 -0
- package/src/infrastructure/README.md +509 -0
- package/src/infrastructure/repositories/README.md +475 -0
- package/src/infrastructure/services/README.md +510 -0
- package/src/presentation/components/README.md +482 -0
- package/src/presentation/components/SettingsErrorBoundary/README.md +461 -0
- package/src/presentation/components/SettingsFooter/README.md +446 -0
- package/src/presentation/components/SettingsItemCard/README.md +457 -0
- package/src/presentation/components/SettingsSection/README.md +421 -0
- package/src/presentation/hooks/README.md +413 -0
- package/src/presentation/hooks/mutations/README.md +430 -0
- package/src/presentation/hooks/queries/README.md +441 -0
- package/src/presentation/navigation/README.md +532 -0
- package/src/presentation/navigation/components/README.md +330 -0
- package/src/presentation/navigation/hooks/README.md +399 -0
- package/src/presentation/navigation/utils/README.md +442 -0
- package/src/presentation/screens/README.md +525 -0
- package/src/presentation/screens/components/SettingsContent/README.md +404 -0
- package/src/presentation/screens/components/SettingsHeader/README.md +322 -0
- package/src/presentation/screens/components/sections/CustomSettingsList/README.md +388 -0
- package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +232 -0
- package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +325 -0
- package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +480 -0
- package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +391 -0
- package/src/presentation/screens/hooks/README.md +383 -0
- package/src/presentation/screens/types/README.md +439 -0
- package/src/presentation/screens/utils/README.md +288 -0
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
# Legal Domain
|
|
2
|
+
|
|
3
|
+
The Legal domain provides screens and components for displaying legal documents such as privacy policies, terms of service, and other legal information in your React Native app.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Privacy Policy Screen**: Dedicated screen for privacy policy content
|
|
8
|
+
- **Terms of Service Screen**: Display terms and conditions
|
|
9
|
+
- **Generic Legal Content**: Reusable screen for any legal document
|
|
10
|
+
- **URL Handling**: Open external legal documents in browser
|
|
11
|
+
- **Content Validation**: Built-in validation for legal content
|
|
12
|
+
- **Style Caching**: Optimized rendering with cached styles
|
|
13
|
+
- **Accessible**: Full accessibility support
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
This domain is part of `@umituz/react-native-settings`. Install the package to use it:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @umituz/react-native-settings
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Components
|
|
24
|
+
|
|
25
|
+
### LegalScreen
|
|
26
|
+
|
|
27
|
+
Main screen displaying a list of legal documents (Privacy Policy, Terms of Service, EULA).
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { LegalScreen } from '@umituz/react-native-settings';
|
|
31
|
+
import { useNavigation } from '@react-navigation/native';
|
|
32
|
+
|
|
33
|
+
function MyLegalScreen() {
|
|
34
|
+
const navigation = useNavigation();
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<LegalScreen
|
|
38
|
+
title="Legal"
|
|
39
|
+
description="Important legal information"
|
|
40
|
+
documentsHeader="Documents"
|
|
41
|
+
privacyTitle="Privacy Policy"
|
|
42
|
+
privacyDescription="Learn how we handle your data"
|
|
43
|
+
termsTitle="Terms of Service"
|
|
44
|
+
termsDescription="Rules and guidelines for using our app"
|
|
45
|
+
onPrivacyPress={() => navigation.navigate('PrivacyPolicy')}
|
|
46
|
+
onTermsPress={() => navigation.navigate('TermsOfService')}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### Props
|
|
53
|
+
|
|
54
|
+
| Prop | Type | Default | Description |
|
|
55
|
+
|------|------|---------|-------------|
|
|
56
|
+
| `title` | `string` | `undefined` | Screen title |
|
|
57
|
+
| `description` | `string` | `undefined` | Screen description |
|
|
58
|
+
| `documentsHeader` | `string` | `undefined` | Section header for documents |
|
|
59
|
+
| `privacyTitle` | `string` | `undefined` | Privacy policy title |
|
|
60
|
+
| `privacyDescription` | `string` | `undefined` | Privacy policy description |
|
|
61
|
+
| `termsTitle` | `string` | `undefined` | Terms of service title |
|
|
62
|
+
| `termsDescription` | `string` | `undefined` | Terms of service description |
|
|
63
|
+
| `eulaTitle` | `string` | `undefined` | EULA title |
|
|
64
|
+
| `eulaDescription` | `string` | `undefined` | EULA description |
|
|
65
|
+
| `onPrivacyPress` | `() => void` | `undefined` | Privacy press handler |
|
|
66
|
+
| `onTermsPress` | `() => void` | `undefined` | Terms press handler |
|
|
67
|
+
| `onEulaPress` | `() => void` | `undefined` | EULA press handler |
|
|
68
|
+
| `eulaUrl` | `string` | `undefined` | External EULA URL |
|
|
69
|
+
| `testID` | `string` | `'legal-screen'` | Test ID for testing |
|
|
70
|
+
|
|
71
|
+
### PrivacyPolicyScreen
|
|
72
|
+
|
|
73
|
+
Dedicated screen for displaying privacy policy content.
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { PrivacyPolicyScreen } from '@umituz/react-native-settings';
|
|
77
|
+
|
|
78
|
+
function MyPrivacyPolicyScreen() {
|
|
79
|
+
return (
|
|
80
|
+
<PrivacyPolicyScreen
|
|
81
|
+
content="Your privacy policy content here..."
|
|
82
|
+
title="Privacy Policy"
|
|
83
|
+
viewOnlineText="View our full privacy policy online"
|
|
84
|
+
openText="Open in Browser"
|
|
85
|
+
url="https://yourapp.com/privacy"
|
|
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
|
+
```
|
|
540
|
+
|
|
541
|
+
## Related
|
|
542
|
+
|
|
543
|
+
- **Settings**: Main settings management
|
|
544
|
+
- **Disclaimer**: Disclaimer notices and modals
|
|
545
|
+
- **Storage**: Persistent legal content storage
|
|
546
|
+
|
|
547
|
+
## License
|
|
548
|
+
|
|
549
|
+
MIT
|