@umituz/react-native-settings 5.2.1 → 5.2.5
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/package.json +1 -1
- package/src/presentation/hooks/useSettingsScreenConfig.ts +10 -22
- package/src/presentation/navigation/SettingsStackNavigator.tsx +1 -0
- package/src/presentation/utils/accountConfigUtils.ts +2 -2
- package/src/presentation/utils/screenFactory.ts +1 -1
- package/src/presentation/utils/usePasswordPromptNavigation.ts +25 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.5",
|
|
4
4
|
"description": "Complete settings hub for React Native apps - consolidated package with settings, localization, about, legal, appearance, feedback, FAQs, rating, and gamification",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -104,16 +104,6 @@ export const useSettingsScreenConfig = (
|
|
|
104
104
|
translations,
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
-
// Add subscription title and description from translations if available
|
|
108
|
-
if (config.subscription && typeof config.subscription === 'object' && translations?.features?.subscription) {
|
|
109
|
-
config.subscription = {
|
|
110
|
-
...config.subscription,
|
|
111
|
-
title: translations.features.subscription.title,
|
|
112
|
-
description: translations.features.subscription.description,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Add subscription title and description from translations if available
|
|
117
107
|
if (config.subscription && typeof config.subscription === 'object') {
|
|
118
108
|
config.subscription = {
|
|
119
109
|
...config.subscription,
|
|
@@ -123,25 +113,23 @@ export const useSettingsScreenConfig = (
|
|
|
123
113
|
};
|
|
124
114
|
}
|
|
125
115
|
|
|
126
|
-
// Add gamification title and description
|
|
127
116
|
if (config.gamification) {
|
|
128
117
|
const existingConfig = typeof config.gamification === 'object' ? config.gamification : { enabled: true };
|
|
129
118
|
config.gamification = {
|
|
130
|
-
...
|
|
119
|
+
...existingConfig,
|
|
131
120
|
enabled: true,
|
|
132
|
-
title: translations?.features?.gamification?.title ||
|
|
133
|
-
description: translations?.features?.gamification?.description ||
|
|
121
|
+
title: translations?.features?.gamification?.title || existingConfig.title || "Your Progress",
|
|
122
|
+
description: translations?.features?.gamification?.description || existingConfig.description,
|
|
134
123
|
};
|
|
135
124
|
}
|
|
136
125
|
|
|
137
|
-
// Add videoTutorial title and description
|
|
138
126
|
if (config.videoTutorial) {
|
|
139
127
|
const existingConfig = typeof config.videoTutorial === 'object' ? config.videoTutorial : { enabled: true };
|
|
140
128
|
config.videoTutorial = {
|
|
141
|
-
...
|
|
129
|
+
...existingConfig,
|
|
142
130
|
enabled: true,
|
|
143
|
-
title: translations?.features?.videoTutorial?.title ||
|
|
144
|
-
description: translations?.features?.videoTutorial?.description ||
|
|
131
|
+
title: translations?.features?.videoTutorial?.title || existingConfig.title || "Video Tutorials",
|
|
132
|
+
description: translations?.features?.videoTutorial?.description || existingConfig.description,
|
|
145
133
|
};
|
|
146
134
|
}
|
|
147
135
|
|
|
@@ -154,11 +142,11 @@ export const useSettingsScreenConfig = (
|
|
|
154
142
|
}), [userProfileData, handleSignIn]);
|
|
155
143
|
|
|
156
144
|
const accountConfig = useMemo(() => createAccountConfig({
|
|
157
|
-
displayName: userProfileData?.displayName || user?.displayName
|
|
158
|
-
userId: userProfileData?.userId ?? user?.uid
|
|
159
|
-
photoURL: user?.photoURL
|
|
145
|
+
displayName: userProfileData?.displayName || user?.displayName,
|
|
146
|
+
userId: userProfileData?.userId ?? user?.uid,
|
|
147
|
+
photoURL: user?.photoURL,
|
|
160
148
|
isAnonymous: user?.isAnonymous,
|
|
161
|
-
avatarUrl: userProfileData?.avatarUrl
|
|
149
|
+
avatarUrl: userProfileData?.avatarUrl,
|
|
162
150
|
onSignIn: handleSignIn,
|
|
163
151
|
onLogout: handleSignOut,
|
|
164
152
|
onDeleteAccount: handleDeleteAccount,
|
|
@@ -69,9 +69,9 @@ export function createAccountConfig(params: CreateAccountConfigParams): AccountS
|
|
|
69
69
|
return {
|
|
70
70
|
profile: {
|
|
71
71
|
displayName: displayName || "",
|
|
72
|
-
userId
|
|
72
|
+
userId,
|
|
73
73
|
isAnonymous: anonymous,
|
|
74
|
-
avatarUrl: avatarUrl ?? photoURL
|
|
74
|
+
avatarUrl: avatarUrl ?? photoURL,
|
|
75
75
|
},
|
|
76
76
|
isAnonymous: anonymous,
|
|
77
77
|
editProfileText: translations?.editProfile || "",
|
|
@@ -55,7 +55,7 @@ export function createScreenWithProps<P>(
|
|
|
55
55
|
export function convertAdditionalScreen(screen: AdditionalScreen): StackScreen {
|
|
56
56
|
const stackScreen: Partial<StackScreen> = { name: screen.name };
|
|
57
57
|
if (screen.component) stackScreen.component = screen.component;
|
|
58
|
-
if (screen.children) stackScreen.children = screen.children;
|
|
58
|
+
if (screen.children) stackScreen.children = screen.children as any;
|
|
59
59
|
if (screen.options) stackScreen.options = screen.options;
|
|
60
60
|
return stackScreen as StackScreen;
|
|
61
61
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Password Prompt Navigation Hook
|
|
3
3
|
* Navigation-based password prompt that maintains Promise interface
|
|
4
|
+
* Uses AppNavigation for global navigation access
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
|
-
import { useCallback, useRef } from 'react';
|
|
7
|
+
import { useCallback, useRef, useEffect } from 'react';
|
|
7
8
|
import { AppNavigation } from '@umituz/react-native-design-system';
|
|
8
9
|
|
|
9
10
|
export interface UsePasswordPromptNavigationOptions {
|
|
@@ -23,8 +24,21 @@ export const usePasswordPromptNavigation = (
|
|
|
23
24
|
const { title, message, confirmText, cancelText } = options;
|
|
24
25
|
const resolveRef = useRef<((value: string | null) => void) | null>(null);
|
|
25
26
|
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
return () => {
|
|
29
|
+
if (resolveRef.current) {
|
|
30
|
+
resolveRef.current(null);
|
|
31
|
+
resolveRef.current = null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
|
|
26
36
|
const showPasswordPrompt = useCallback((): Promise<string | null> => {
|
|
27
|
-
return new Promise<string | null>((resolve) => {
|
|
37
|
+
return new Promise<string | null>((resolve, reject) => {
|
|
38
|
+
if (resolveRef.current) {
|
|
39
|
+
resolveRef.current(null);
|
|
40
|
+
}
|
|
41
|
+
|
|
28
42
|
resolveRef.current = resolve;
|
|
29
43
|
|
|
30
44
|
const params = {
|
|
@@ -40,10 +54,15 @@ export const usePasswordPromptNavigation = (
|
|
|
40
54
|
cancelText,
|
|
41
55
|
};
|
|
42
56
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
try {
|
|
58
|
+
AppNavigation.navigate('PasswordPrompt', params);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (resolveRef.current) {
|
|
61
|
+
resolveRef.current(null);
|
|
62
|
+
resolveRef.current = null;
|
|
63
|
+
}
|
|
64
|
+
reject(error);
|
|
65
|
+
}
|
|
47
66
|
});
|
|
48
67
|
}, [title, message, confirmText, cancelText]);
|
|
49
68
|
|