@umituz/react-native-settings 4.20.56 → 4.20.58
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 +146 -4
- package/package.json +1 -2
- package/src/__tests__/setup.ts +1 -4
- 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/appearance/presentation/components/README.md +493 -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 +455 -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,452 @@
|
|
|
1
|
+
# About Domain
|
|
2
|
+
|
|
3
|
+
The About domain provides components and utilities for displaying app information, user details, version info, and contact information in your React Native app.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **App Information Display**: Show app name, version, and build number
|
|
8
|
+
- **Contact Information**: Display developer, email, and website details
|
|
9
|
+
- **Customizable Actions**: Handle taps on email, website, and other links
|
|
10
|
+
- **Localized Texts**: Support for custom labels and messages
|
|
11
|
+
- **Loading & Error States**: Built-in loading and error handling
|
|
12
|
+
- **Fully Typed**: Complete TypeScript support
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
This domain is part of `@umituz/react-native-settings`. Install the package to use it:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @umituz/react-native-settings
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Components
|
|
23
|
+
|
|
24
|
+
### AboutScreen
|
|
25
|
+
|
|
26
|
+
The main screen component for displaying app information.
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { AboutScreen } from '@umituz/react-native-settings';
|
|
30
|
+
|
|
31
|
+
function MyAboutScreen() {
|
|
32
|
+
const config = {
|
|
33
|
+
appName: 'My App',
|
|
34
|
+
version: '1.0.0',
|
|
35
|
+
buildNumber: '100',
|
|
36
|
+
developer: 'Acme Inc',
|
|
37
|
+
contactEmail: 'support@acme.com',
|
|
38
|
+
websiteUrl: 'https://acme.com',
|
|
39
|
+
actions: {
|
|
40
|
+
onEmailPress: () => Linking.openURL('mailto:support@acme.com'),
|
|
41
|
+
onWebsitePress: () => Linking.openURL('https://acme.com'),
|
|
42
|
+
},
|
|
43
|
+
texts: {
|
|
44
|
+
versionPrefix: 'Version',
|
|
45
|
+
contact: 'Contact Us',
|
|
46
|
+
developer: 'Developer',
|
|
47
|
+
email: 'Email',
|
|
48
|
+
website: 'Website',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return <AboutScreen config={config} />;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Props
|
|
57
|
+
|
|
58
|
+
| Prop | Type | Default | Description |
|
|
59
|
+
|------|------|---------|-------------|
|
|
60
|
+
| `config` | `AboutConfig` | **Required** | Configuration object with app info |
|
|
61
|
+
| `containerStyle` | `ViewStyle` | `undefined` | Custom container style |
|
|
62
|
+
| `headerStyle` | `ViewStyle` | `undefined` | Custom header style |
|
|
63
|
+
| `titleStyle` | `TextStyle` | `undefined` | Custom title style |
|
|
64
|
+
| `versionStyle` | `TextStyle` | `undefined` | Custom version style |
|
|
65
|
+
| `showHeader` | `boolean` | `true` | Show app header with name and version |
|
|
66
|
+
| `headerComponent` | `ReactNode` | `undefined` | Custom header component |
|
|
67
|
+
| `footerComponent` | `ReactNode` | `undefined` | Custom footer component |
|
|
68
|
+
| `testID` | `string` | `undefined` | Test ID for E2E testing |
|
|
69
|
+
|
|
70
|
+
### AboutContent
|
|
71
|
+
|
|
72
|
+
Displays the list of about items organized in sections.
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
import { AboutContent } from '@umituz/react-native-settings';
|
|
76
|
+
|
|
77
|
+
function MyAboutContent() {
|
|
78
|
+
const appInfo = {
|
|
79
|
+
appName: 'My App',
|
|
80
|
+
version: '1.0.0',
|
|
81
|
+
developer: 'Acme Inc',
|
|
82
|
+
contactEmail: 'support@acme.com',
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const config = {
|
|
86
|
+
actions: {
|
|
87
|
+
onEmailPress: () => console.log('Email pressed'),
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return <AboutContent appInfo={appInfo} config={config} />;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### Props
|
|
96
|
+
|
|
97
|
+
| Prop | Type | Default | Description |
|
|
98
|
+
|------|------|---------|-------------|
|
|
99
|
+
| `appInfo` | `AppInfo` | **Required** | App information to display |
|
|
100
|
+
| `config` | `AboutConfig` | **Required** | Configuration for actions |
|
|
101
|
+
|
|
102
|
+
### AboutSection
|
|
103
|
+
|
|
104
|
+
Renders a section of related about items.
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
import { AboutSection } from '@umituz/react-native-settings';
|
|
108
|
+
|
|
109
|
+
function ContactSection() {
|
|
110
|
+
const items = [
|
|
111
|
+
{
|
|
112
|
+
title: 'Developer',
|
|
113
|
+
value: 'Acme Inc',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
title: 'Email',
|
|
117
|
+
value: 'support@acme.com',
|
|
118
|
+
onPress: () => Linking.openURL('mailto:support@acme.com'),
|
|
119
|
+
},
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
return <AboutSection title="Contact" items={items} />;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### AboutSettingItem
|
|
127
|
+
|
|
128
|
+
Individual setting item with title, value, and optional press handler.
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import { AboutSettingItem } from '@umituz/react-native-settings';
|
|
132
|
+
|
|
133
|
+
function EmailItem() {
|
|
134
|
+
return (
|
|
135
|
+
<AboutSettingItem
|
|
136
|
+
title="Email"
|
|
137
|
+
value="support@acme.com"
|
|
138
|
+
onPress={() => Linking.openURL('mailto:support@acme.com')}
|
|
139
|
+
showChevron={true}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### Props
|
|
146
|
+
|
|
147
|
+
| Prop | Type | Default | Description |
|
|
148
|
+
|------|------|---------|-------------|
|
|
149
|
+
| `title` | `string` | **Required** | Item title |
|
|
150
|
+
| `value` | `string` | `undefined` | Item value to display |
|
|
151
|
+
| `onPress` | `() => void` | `undefined` | Press handler |
|
|
152
|
+
| `showChevron` | `boolean` | `false` | Show navigation chevron |
|
|
153
|
+
| `testID` | `string` | `undefined` | Test ID for testing |
|
|
154
|
+
|
|
155
|
+
### AboutHeader
|
|
156
|
+
|
|
157
|
+
Header component displaying app name and version.
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
import { AboutHeader } from '@umituz/react-native-settings';
|
|
161
|
+
|
|
162
|
+
function MyAboutHeader() {
|
|
163
|
+
const appInfo = {
|
|
164
|
+
appName: 'My App',
|
|
165
|
+
version: '1.0.0',
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
return <AboutHeader appInfo={appInfo} />;
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Props
|
|
173
|
+
|
|
174
|
+
| Prop | Type | Default | Description |
|
|
175
|
+
|------|------|---------|-------------|
|
|
176
|
+
| `appInfo` | `AppInfo` | **Required** | App information |
|
|
177
|
+
| `containerStyle` | `ViewStyle` | `undefined` | Custom container style |
|
|
178
|
+
| `titleStyle` | `TextStyle` | `undefined` | Custom title style |
|
|
179
|
+
| `versionStyle` | `TextStyle` | `undefined` | Custom version style |
|
|
180
|
+
| `versionPrefix` | `string` | `'Version'` | Version label prefix |
|
|
181
|
+
|
|
182
|
+
## Hooks
|
|
183
|
+
|
|
184
|
+
### useAboutInfo
|
|
185
|
+
|
|
186
|
+
Hook for managing About information with reactive state management.
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
import { useAboutInfo } from '@umituz/react-native-settings';
|
|
190
|
+
|
|
191
|
+
function MyAboutComponent() {
|
|
192
|
+
const {
|
|
193
|
+
appInfo,
|
|
194
|
+
loading,
|
|
195
|
+
error,
|
|
196
|
+
initialize,
|
|
197
|
+
update,
|
|
198
|
+
updateAppInfo,
|
|
199
|
+
refresh,
|
|
200
|
+
reset,
|
|
201
|
+
} = useAboutInfo({
|
|
202
|
+
autoInit: true,
|
|
203
|
+
initialConfig: {
|
|
204
|
+
appName: 'My App',
|
|
205
|
+
version: '1.0.0',
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
if (loading) return <Text>Loading...</Text>;
|
|
210
|
+
if (error) return <Text>Error: {error}</Text>;
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<View>
|
|
214
|
+
<Text>{appInfo?.appName}</Text>
|
|
215
|
+
<Text>{appInfo?.version}</Text>
|
|
216
|
+
</View>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### Return Value
|
|
222
|
+
|
|
223
|
+
| Property | Type | Description |
|
|
224
|
+
|----------|------|-------------|
|
|
225
|
+
| `appInfo` | `AppInfo \| null` | Current app information |
|
|
226
|
+
| `loading` | `boolean` | Loading state |
|
|
227
|
+
| `error` | `string \| null` | Error message if any |
|
|
228
|
+
| `initialize` | `(config) => Promise<void>` | Initialize with config |
|
|
229
|
+
| `update` | `(config) => Promise<void>` | Update with new config |
|
|
230
|
+
| `updateAppInfo` | `(updates) => Promise<void>` | Partial update |
|
|
231
|
+
| `refresh` | `() => Promise<void>` | Refresh from storage |
|
|
232
|
+
| `reset` | `() => void` | Reset state |
|
|
233
|
+
|
|
234
|
+
## Types
|
|
235
|
+
|
|
236
|
+
### AppInfo
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
interface AppInfo {
|
|
240
|
+
appName: string;
|
|
241
|
+
version: string;
|
|
242
|
+
buildNumber?: string;
|
|
243
|
+
developer?: string;
|
|
244
|
+
contactEmail?: string;
|
|
245
|
+
websiteUrl?: string;
|
|
246
|
+
websiteDisplay?: string;
|
|
247
|
+
moreAppsUrl?: string;
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### AboutConfig
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
interface AboutConfig {
|
|
255
|
+
appName?: string;
|
|
256
|
+
version?: string;
|
|
257
|
+
buildNumber?: string;
|
|
258
|
+
developer?: string;
|
|
259
|
+
contactEmail?: string;
|
|
260
|
+
websiteUrl?: string;
|
|
261
|
+
websiteDisplay?: string;
|
|
262
|
+
moreAppsUrl?: string;
|
|
263
|
+
actions?: {
|
|
264
|
+
onEmailPress?: () => void;
|
|
265
|
+
onWebsitePress?: () => void;
|
|
266
|
+
onMoreAppsPress?: () => void;
|
|
267
|
+
};
|
|
268
|
+
texts?: {
|
|
269
|
+
versionPrefix?: string;
|
|
270
|
+
contact?: string;
|
|
271
|
+
developer?: string;
|
|
272
|
+
email?: string;
|
|
273
|
+
website?: string;
|
|
274
|
+
more?: string;
|
|
275
|
+
moreApps?: string;
|
|
276
|
+
loading?: string;
|
|
277
|
+
errorPrefix?: string;
|
|
278
|
+
noInfo?: string;
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Examples
|
|
284
|
+
|
|
285
|
+
### Basic Usage
|
|
286
|
+
|
|
287
|
+
```tsx
|
|
288
|
+
import React from 'react';
|
|
289
|
+
import { View } from 'react-native';
|
|
290
|
+
import { AboutScreen } from '@umituz/react-native-settings';
|
|
291
|
+
|
|
292
|
+
export default function App() {
|
|
293
|
+
return (
|
|
294
|
+
<View style={{ flex: 1 }}>
|
|
295
|
+
<AboutScreen
|
|
296
|
+
config={{
|
|
297
|
+
appName: 'My Awesome App',
|
|
298
|
+
version: '2.1.0',
|
|
299
|
+
buildNumber: '210',
|
|
300
|
+
developer: 'My Company',
|
|
301
|
+
contactEmail: 'hello@mycompany.com',
|
|
302
|
+
websiteUrl: 'https://mycompany.com',
|
|
303
|
+
actions: {
|
|
304
|
+
onEmailPress: () => {
|
|
305
|
+
// Handle email press
|
|
306
|
+
Linking.openURL('mailto:hello@mycompany.com');
|
|
307
|
+
},
|
|
308
|
+
onWebsitePress: () => {
|
|
309
|
+
// Handle website press
|
|
310
|
+
Linking.openURL('https://mycompany.com');
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
}}
|
|
314
|
+
/>
|
|
315
|
+
</View>
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Custom Styling
|
|
321
|
+
|
|
322
|
+
```tsx
|
|
323
|
+
import { AboutScreen } from '@umituz/react-native-settings';
|
|
324
|
+
|
|
325
|
+
function StyledAboutScreen() {
|
|
326
|
+
return (
|
|
327
|
+
<AboutScreen
|
|
328
|
+
config={{ /* ... */ }}
|
|
329
|
+
containerStyle={{ backgroundColor: '#f5f5f5' }}
|
|
330
|
+
headerStyle={{ paddingVertical: 24 }}
|
|
331
|
+
titleStyle={{ fontSize: 28, fontWeight: 'bold' }}
|
|
332
|
+
versionStyle={{ fontSize: 16, color: '#666' }}
|
|
333
|
+
/>
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Custom Header and Footer
|
|
339
|
+
|
|
340
|
+
```tsx
|
|
341
|
+
import { AboutScreen } from '@umituz/react-native-settings';
|
|
342
|
+
|
|
343
|
+
function CustomAboutScreen() {
|
|
344
|
+
return (
|
|
345
|
+
<AboutScreen
|
|
346
|
+
config={{ /* ... */ }}
|
|
347
|
+
showHeader={false}
|
|
348
|
+
headerComponent={
|
|
349
|
+
<View style={{ padding: 20, alignItems: 'center' }}>
|
|
350
|
+
<Image source={logo} style={{ width: 80, height: 80 }} />
|
|
351
|
+
<Text>My Custom Header</Text>
|
|
352
|
+
</View>
|
|
353
|
+
}
|
|
354
|
+
footerComponent={
|
|
355
|
+
<View style={{ padding: 20, alignItems: 'center' }}>
|
|
356
|
+
<Text>Made with ❤️</Text>
|
|
357
|
+
</View>
|
|
358
|
+
}
|
|
359
|
+
/>
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Using the Hook
|
|
365
|
+
|
|
366
|
+
```tsx
|
|
367
|
+
import { useAboutInfo } from '@umituz/react-native-settings';
|
|
368
|
+
|
|
369
|
+
function AboutManager() {
|
|
370
|
+
const { appInfo, updateAppInfo } = useAboutInfo({
|
|
371
|
+
autoInit: true,
|
|
372
|
+
initialConfig: {
|
|
373
|
+
appName: 'My App',
|
|
374
|
+
version: '1.0.0',
|
|
375
|
+
},
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
const handleUpdate = async () => {
|
|
379
|
+
await updateAppInfo({
|
|
380
|
+
version: '1.0.1',
|
|
381
|
+
developer: 'New Developer',
|
|
382
|
+
});
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
return (
|
|
386
|
+
<View>
|
|
387
|
+
<Text>App: {appInfo?.appName}</Text>
|
|
388
|
+
<Text>Version: {appInfo?.version}</Text>
|
|
389
|
+
<Button title="Update" onPress={handleUpdate} />
|
|
390
|
+
</View>
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## Architecture
|
|
396
|
+
|
|
397
|
+
The About domain follows a clean architecture pattern:
|
|
398
|
+
|
|
399
|
+
```
|
|
400
|
+
src/domains/about/
|
|
401
|
+
├── domain/ # Domain entities and interfaces
|
|
402
|
+
│ ├── entities/ # AppInfo entity
|
|
403
|
+
│ └── repositories/ # Repository interfaces
|
|
404
|
+
├── infrastructure/ # Implementation details
|
|
405
|
+
│ └── repositories/ # AboutRepository implementation
|
|
406
|
+
├── presentation/ # UI components
|
|
407
|
+
│ ├── screens/ # AboutScreen
|
|
408
|
+
│ ├── components/ # AboutContent, AboutHeader, etc.
|
|
409
|
+
│ └── hooks/ # useAboutInfo hook
|
|
410
|
+
└── utils/ # Utility functions and factories
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
## Best Practices
|
|
414
|
+
|
|
415
|
+
1. **Always provide a config**: The `AboutConfig` is required for proper initialization
|
|
416
|
+
2. **Handle actions**: Implement press handlers for email, website, and other interactive elements
|
|
417
|
+
3. **Provide localized texts**: Use the `texts` property to support multiple languages
|
|
418
|
+
4. **Use the hook for dynamic updates**: The `useAboutInfo` hook is ideal for scenarios where app info changes
|
|
419
|
+
5. **Test with testIDs**: All components support `testID` prop for E2E testing
|
|
420
|
+
|
|
421
|
+
## Testing
|
|
422
|
+
|
|
423
|
+
```tsx
|
|
424
|
+
import { render } from '@testing-library/react-native';
|
|
425
|
+
import { AboutScreen } from '@umituz/react-native-settings';
|
|
426
|
+
|
|
427
|
+
describe('AboutScreen', () => {
|
|
428
|
+
it('displays app name and version', () => {
|
|
429
|
+
const { getByText } = render(
|
|
430
|
+
<AboutScreen
|
|
431
|
+
config={{
|
|
432
|
+
appName: 'Test App',
|
|
433
|
+
version: '1.0.0',
|
|
434
|
+
}}
|
|
435
|
+
/>
|
|
436
|
+
);
|
|
437
|
+
|
|
438
|
+
expect(getByText('Test App')).toBeTruthy();
|
|
439
|
+
expect(getByText('Version 1.0.0')).toBeTruthy();
|
|
440
|
+
});
|
|
441
|
+
});
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
## Related
|
|
445
|
+
|
|
446
|
+
- **Settings**: Main settings management
|
|
447
|
+
- **Appearance**: Theme customization
|
|
448
|
+
- **Legal**: Privacy policy and terms
|
|
449
|
+
|
|
450
|
+
## License
|
|
451
|
+
|
|
452
|
+
MIT
|