@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,350 @@
|
|
|
1
|
+
# useAboutInfo Hook
|
|
2
|
+
|
|
3
|
+
Custom hook for managing app information display in the About screen and components.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **App Info**: Retrieves app name, version, build number
|
|
8
|
+
- **Developer Info**: Gets developer contact details
|
|
9
|
+
- **Formatted Data**: Provides formatted strings for display
|
|
10
|
+
- **Cached**: Memoized for performance
|
|
11
|
+
- **Customizable**: Supports custom app info injection
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
This hook is part of `@umituz/react-native-settings`.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Basic Usage
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { useAboutInfo } from '@umituz/react-native-settings';
|
|
23
|
+
|
|
24
|
+
function AboutScreen() {
|
|
25
|
+
const { appInfo, developerInfo, versionString, isLoading } = useAboutInfo();
|
|
26
|
+
|
|
27
|
+
if (isLoading) return <LoadingSpinner />;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<View>
|
|
31
|
+
<Text>{appInfo.name}</Text>
|
|
32
|
+
<Text>{versionString}</Text>
|
|
33
|
+
<Text>{developerInfo.name}</Text>
|
|
34
|
+
</View>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### With Custom App Info
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
function AboutScreen() {
|
|
43
|
+
const customAppInfo = {
|
|
44
|
+
name: 'My App',
|
|
45
|
+
version: '2.0.0',
|
|
46
|
+
buildNumber: '200',
|
|
47
|
+
developer: 'My Company',
|
|
48
|
+
contactEmail: 'support@example.com',
|
|
49
|
+
websiteUrl: 'https://example.com',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const { appInfo, versionString } = useAboutInfo(customAppInfo);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View>
|
|
56
|
+
<Text>{appInfo.name}</Text>
|
|
57
|
+
<Text>Version {versionString}</Text>
|
|
58
|
+
</View>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Return Value
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
interface UseAboutInfoResult {
|
|
67
|
+
appInfo: {
|
|
68
|
+
name: string; // App name
|
|
69
|
+
version: string; // App version
|
|
70
|
+
buildNumber: string; // Build number
|
|
71
|
+
developer: string; // Developer name
|
|
72
|
+
contactEmail?: string; // Contact email
|
|
73
|
+
websiteUrl?: string; // Website URL
|
|
74
|
+
websiteDisplay?: string; // Website display text
|
|
75
|
+
moreAppsUrl?: string; // More apps URL
|
|
76
|
+
};
|
|
77
|
+
versionString: string; // Formatted version (e.g., "Version 1.0.0 (100)")
|
|
78
|
+
developerInfo: {
|
|
79
|
+
name: string; // Developer name
|
|
80
|
+
email?: string; // Developer email
|
|
81
|
+
website?: string; // Developer website
|
|
82
|
+
};
|
|
83
|
+
isLoading: boolean; // Loading state
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Examples
|
|
88
|
+
|
|
89
|
+
### Display App Information
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
function AboutContent() {
|
|
93
|
+
const { appInfo, versionString, isLoading } = useAboutInfo();
|
|
94
|
+
|
|
95
|
+
if (isLoading) {
|
|
96
|
+
return <ActivityIndicator />;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<View style={styles.container}>
|
|
101
|
+
<Text style={styles.appName}>{appInfo.name}</Text>
|
|
102
|
+
<Text style={styles.version}>{versionString}</Text>
|
|
103
|
+
|
|
104
|
+
{appInfo.developer && (
|
|
105
|
+
<Text style={styles.developer}>
|
|
106
|
+
Made by {appInfo.developer}
|
|
107
|
+
</Text>
|
|
108
|
+
)}
|
|
109
|
+
</View>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Contact Actions
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
function AboutActions() {
|
|
118
|
+
const { appInfo } = useAboutInfo();
|
|
119
|
+
|
|
120
|
+
const handleEmailPress = useCallback(() => {
|
|
121
|
+
if (appInfo.contactEmail) {
|
|
122
|
+
Linking.openURL(`mailto:${appInfo.contactEmail}`);
|
|
123
|
+
}
|
|
124
|
+
}, [appInfo.contactEmail]);
|
|
125
|
+
|
|
126
|
+
const handleWebsitePress = useCallback(() => {
|
|
127
|
+
if (appInfo.websiteUrl) {
|
|
128
|
+
Linking.openURL(appInfo.websiteUrl);
|
|
129
|
+
}
|
|
130
|
+
}, [appInfo.websiteUrl]);
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<View>
|
|
134
|
+
<Button
|
|
135
|
+
title="Contact Support"
|
|
136
|
+
onPress={handleEmailPress}
|
|
137
|
+
disabled={!appInfo.contactEmail}
|
|
138
|
+
/>
|
|
139
|
+
<Button
|
|
140
|
+
title="Visit Website"
|
|
141
|
+
onPress={handleWebsitePress}
|
|
142
|
+
disabled={!appInfo.websiteUrl}
|
|
143
|
+
/>
|
|
144
|
+
</View>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### More Apps Link
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
function MoreAppsButton() {
|
|
153
|
+
const { appInfo } = useAboutInfo();
|
|
154
|
+
|
|
155
|
+
if (!appInfo.moreAppsUrl) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<TouchableOpacity
|
|
161
|
+
onPress={() => Linking.openURL(appInfo.moreAppsUrl)}
|
|
162
|
+
style={styles.button}
|
|
163
|
+
>
|
|
164
|
+
<Text style={styles.buttonText}>
|
|
165
|
+
More Apps by {appInfo.developer}
|
|
166
|
+
</Text>
|
|
167
|
+
</TouchableOpacity>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Custom Version Display
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
function VersionDisplay() {
|
|
176
|
+
const { appInfo } = useAboutInfo();
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<View style={styles.versionContainer}>
|
|
180
|
+
<View style={styles.versionBadge}>
|
|
181
|
+
<Text style={styles.versionText}>
|
|
182
|
+
v{appInfo.version}
|
|
183
|
+
</Text>
|
|
184
|
+
</View>
|
|
185
|
+
|
|
186
|
+
{__DEV__ && (
|
|
187
|
+
<Text style={styles.buildText}>
|
|
188
|
+
Build {appInfo.buildNumber}
|
|
189
|
+
</Text>
|
|
190
|
+
)}
|
|
191
|
+
</View>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### With Loading State
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
function AboutScreen() {
|
|
200
|
+
const { appInfo, versionString, isLoading } = useAboutInfo();
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
<ScrollView>
|
|
204
|
+
{isLoading ? (
|
|
205
|
+
<View style={styles.loading}>
|
|
206
|
+
<ActivityIndicator size="large" />
|
|
207
|
+
<Text>Loading app info...</Text>
|
|
208
|
+
</View>
|
|
209
|
+
) : (
|
|
210
|
+
<>
|
|
211
|
+
<AboutHeader appInfo={appInfo} />
|
|
212
|
+
<AboutVersion versionString={versionString} />
|
|
213
|
+
<AboutDeveloper developerInfo={appInfo.developer} />
|
|
214
|
+
</>
|
|
215
|
+
)}
|
|
216
|
+
</ScrollView>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### With Error Handling
|
|
222
|
+
|
|
223
|
+
```tsx
|
|
224
|
+
function AboutScreen() {
|
|
225
|
+
const { appInfo, versionString, isLoading, error } = useAboutInfo();
|
|
226
|
+
|
|
227
|
+
if (error) {
|
|
228
|
+
return (
|
|
229
|
+
<View style={styles.error}>
|
|
230
|
+
<Text>Failed to load app information</Text>
|
|
231
|
+
<Button title="Retry" onPress={refetch} />
|
|
232
|
+
</View>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (isLoading) {
|
|
237
|
+
return <LoadingSpinner />;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return <AboutContent appInfo={appInfo} versionString={versionString} />;
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Data Sources
|
|
245
|
+
|
|
246
|
+
### From App Config
|
|
247
|
+
|
|
248
|
+
```tsx
|
|
249
|
+
import Constants from 'expo-constants';
|
|
250
|
+
|
|
251
|
+
function useAboutInfo() {
|
|
252
|
+
const appInfo = useMemo(() => ({
|
|
253
|
+
name: Constants.expoConfig.name,
|
|
254
|
+
version: Constants.expoConfig.version,
|
|
255
|
+
buildNumber: Constants.expoConfig.ios?.buildNumber ||
|
|
256
|
+
Constants.expoConfig.android?.versionCode,
|
|
257
|
+
}), []);
|
|
258
|
+
|
|
259
|
+
return { appInfo };
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### From Custom Props
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
function useAboutInfo(customAppInfo?: AppInfo) {
|
|
267
|
+
const defaultAppInfo = {
|
|
268
|
+
name: 'My App',
|
|
269
|
+
version: '1.0.0',
|
|
270
|
+
buildNumber: '1',
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const appInfo = useMemo(() => ({
|
|
274
|
+
...defaultAppInfo,
|
|
275
|
+
...customAppInfo,
|
|
276
|
+
}), [customAppInfo]);
|
|
277
|
+
|
|
278
|
+
return { appInfo };
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### From Repository
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
function useAboutInfo() {
|
|
286
|
+
const { data, isLoading } = useQuery(['appInfo'], fetchAppInfo);
|
|
287
|
+
|
|
288
|
+
const appInfo = useMemo(() => ({
|
|
289
|
+
name: data?.name,
|
|
290
|
+
version: data?.version,
|
|
291
|
+
buildNumber: data?.buildNumber,
|
|
292
|
+
developer: data?.developer,
|
|
293
|
+
}), [data]);
|
|
294
|
+
|
|
295
|
+
return { appInfo, isLoading };
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Formatting Helpers
|
|
300
|
+
|
|
301
|
+
### Version String
|
|
302
|
+
|
|
303
|
+
```tsx
|
|
304
|
+
const versionString = useMemo(() => {
|
|
305
|
+
if (appInfo.buildNumber) {
|
|
306
|
+
return `Version ${appInfo.version} (${appInfo.buildNumber})`;
|
|
307
|
+
}
|
|
308
|
+
return `Version ${appInfo.version}`;
|
|
309
|
+
}, [appInfo.version, appInfo.buildNumber]);
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Developer String
|
|
313
|
+
|
|
314
|
+
```tsx
|
|
315
|
+
const developerString = useMemo(() => {
|
|
316
|
+
if (appInfo.contactEmail && appInfo.websiteUrl) {
|
|
317
|
+
return `${appInfo.developer}\n${appInfo.contactEmail}\n${appInfo.websiteUrl}`;
|
|
318
|
+
}
|
|
319
|
+
return appInfo.developer || '';
|
|
320
|
+
}, [appInfo.developer, appInfo.contactEmail, appInfo.websiteUrl]);
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Copyright String
|
|
324
|
+
|
|
325
|
+
```tsx
|
|
326
|
+
const copyrightString = useMemo(() => {
|
|
327
|
+
const year = new Date().getFullYear();
|
|
328
|
+
return `© ${year} ${appInfo.developer}. All rights reserved.`;
|
|
329
|
+
}, [appInfo.developer]);
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Best Practices
|
|
333
|
+
|
|
334
|
+
1. **Memoization**: Use useMemo for expensive calculations
|
|
335
|
+
2. **Loading States**: Show loading indicator while fetching
|
|
336
|
+
3. **Error Handling**: Handle errors gracefully
|
|
337
|
+
4. **Caching**: Cache app info to avoid repeated fetches
|
|
338
|
+
5. **Validation**: Validate app info before displaying
|
|
339
|
+
6. **Accessibility**: Ensure all info is accessible
|
|
340
|
+
7. **Type Safety**: Use TypeScript for type checking
|
|
341
|
+
|
|
342
|
+
## Related
|
|
343
|
+
|
|
344
|
+
- **AboutScreen**: About screen component
|
|
345
|
+
- **AboutContent**: About content component
|
|
346
|
+
- **AppInfo Type**: App info type definition
|
|
347
|
+
|
|
348
|
+
## License
|
|
349
|
+
|
|
350
|
+
MIT
|