@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,350 +1,95 @@
|
|
|
1
1
|
# useAboutInfo Hook
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Custom hook for managing app information display in the About screen and components. Retrieves and formats app metadata including version, build number, developer information, and contact details for comprehensive about sections.
|
|
6
|
+
|
|
7
|
+
## File Paths
|
|
8
|
+
|
|
9
|
+
- **useAboutInfo**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/about/presentation/hooks/useAboutInfo.ts`
|
|
10
|
+
- **About Components**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/about/presentation/components/`
|
|
11
|
+
- **About Screen**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/about/presentation/screens/AboutScreen.tsx`
|
|
12
|
+
|
|
13
|
+
## Strategy
|
|
14
|
+
|
|
15
|
+
1. **Data Aggregation**: Centralizes app information from multiple sources including app config, custom props, and external repositories to provide a single, consistent interface for accessing app metadata.
|
|
16
|
+
|
|
17
|
+
2. **Performance Optimization**: Uses memoization (useMemo) to cache formatted strings and computed values, preventing unnecessary recalculations and re-renders.
|
|
18
|
+
|
|
19
|
+
3. **Flexible Configuration**: Supports both automatic data retrieval from Expo constants and manual injection of custom app info, making it suitable for various app configurations and testing scenarios.
|
|
20
|
+
|
|
21
|
+
4. **User-Friendly Formatting**: Provides pre-formatted strings for common display patterns (version strings, developer info) reducing boilerplate in components.
|
|
22
|
+
|
|
23
|
+
5. **Loading State Management**: Handles asynchronous data fetching with proper loading states, ensuring smooth user experience during data retrieval.
|
|
24
|
+
|
|
25
|
+
## Restrictions
|
|
26
|
+
|
|
27
|
+
### ❌ DO NOT
|
|
28
|
+
|
|
29
|
+
- Fetch app info on every render - use memoization
|
|
30
|
+
- Assume all app info fields are available - handle optional fields
|
|
31
|
+
- Mix data fetching logic with formatting logic
|
|
32
|
+
- Create multiple instances of the hook for the same data
|
|
33
|
+
- Hardcode app-specific values in the hook
|
|
34
|
+
|
|
35
|
+
### ❌ NEVER
|
|
36
|
+
|
|
37
|
+
- Mutate the returned appInfo object
|
|
38
|
+
- Use the hook outside of React components or custom hooks
|
|
39
|
+
- Store sensitive information (API keys, secrets) in app info
|
|
40
|
+
- Bypass loading states when data is being fetched
|
|
41
|
+
- Return undefined or null for required fields
|
|
42
|
+
|
|
43
|
+
### ❌ AVOID
|
|
44
|
+
|
|
45
|
+
- Making unnecessary network requests for static app info
|
|
46
|
+
- Complex formatting logic in components - use the hook's formatted values
|
|
47
|
+
- Storing large data objects in app info
|
|
48
|
+
- Frequent refetching of app metadata
|
|
49
|
+
- Overly complex validation logic in the hook
|
|
50
|
+
|
|
51
|
+
## Rules
|
|
52
|
+
|
|
53
|
+
### ✅ ALWAYS
|
|
54
|
+
|
|
55
|
+
- Use useMemo for expensive calculations and formatting
|
|
56
|
+
- Provide loading states when fetching data asynchronously
|
|
57
|
+
- Validate app info before displaying to users
|
|
58
|
+
- Handle missing or undefined optional fields gracefully
|
|
59
|
+
- Return consistent object structure regardless of data source
|
|
60
|
+
|
|
61
|
+
### ✅ MUST
|
|
62
|
+
|
|
63
|
+
- Return appInfo with all standard fields (name, version, buildNumber)
|
|
64
|
+
- Provide versionString in a user-friendly format
|
|
65
|
+
- Include developer information when available
|
|
66
|
+
- Handle errors gracefully with appropriate error states
|
|
67
|
+
- Cache results to prevent performance issues
|
|
68
|
+
|
|
69
|
+
### ✅ SHOULD
|
|
70
|
+
|
|
71
|
+
- Support custom app info injection for testing
|
|
72
|
+
- Format version strings to include build numbers in development
|
|
73
|
+
- Provide contact information (email, website) when available
|
|
74
|
+
- Include "More Apps" URL when applicable
|
|
75
|
+
- Use TypeScript interfaces for type safety
|
|
76
|
+
- Document all available app info fields
|
|
77
|
+
|
|
78
|
+
## AI Agent Guidelines
|
|
79
|
+
|
|
80
|
+
1. **Data Source Priority**: Use app config (expo-constants) as the primary data source. Fall back to custom props or static values only when app config is unavailable or for testing purposes.
|
|
81
|
+
|
|
82
|
+
2. **Formatting Standards**: Always use the provided formatted values (versionString, developerInfo) instead of manually formatting app info in components. This ensures consistency across the app.
|
|
83
|
+
|
|
84
|
+
3. **Loading States**: Display appropriate loading indicators while fetching app info. Show skeleton screens or spinners rather than partially loaded information.
|
|
85
|
+
|
|
86
|
+
4. **Error Handling**: Implement graceful error handling when app info fails to load. Provide fallback values or default information to ensure the about screen remains functional.
|
|
87
|
+
|
|
88
|
+
5. **Optional Fields**: Always check if optional fields (contactEmail, websiteUrl, moreAppsUrl) exist before displaying them. Use conditional rendering to avoid showing empty or null values.
|
|
89
|
+
|
|
90
|
+
## Reference
|
|
91
|
+
|
|
92
|
+
- **Hook Implementation**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/about/presentation/hooks/useAboutInfo.ts`
|
|
93
|
+
- **About Screen**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/about/presentation/screens/AboutScreen.tsx`
|
|
94
|
+
- **App Config**: Check `app.config.js` or `app.json` for app metadata
|
|
95
|
+
- **About Components**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/about/presentation/components/`
|