@umituz/react-native-settings 5.2.0 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-settings",
3
- "version": "5.2.0",
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",
@@ -74,9 +74,9 @@
74
74
  "@types/react": "~19.1.10",
75
75
  "@typescript-eslint/eslint-plugin": "^7.18.0",
76
76
  "@typescript-eslint/parser": "^7.18.0",
77
- "@umituz/react-native-auth": "^4.1.1",
77
+ "@umituz/react-native-auth": "^4.2.0",
78
78
  "@umituz/react-native-design-system": "latest",
79
- "@umituz/react-native-firebase": "latest",
79
+ "@umituz/react-native-firebase": "^2.4.1",
80
80
  "@umituz/react-native-sentry": "latest",
81
81
  "eslint": "^8.57.0",
82
82
  "eslint-plugin-react": "^7.37.5",
@@ -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
- ...(existingConfig as any),
119
+ ...existingConfig,
131
120
  enabled: true,
132
- title: translations?.features?.gamification?.title || (existingConfig as any).title || "Your Progress",
133
- description: translations?.features?.gamification?.description || (existingConfig as any).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
- ...(existingConfig as any),
129
+ ...existingConfig,
142
130
  enabled: true,
143
- title: translations?.features?.videoTutorial?.title || (existingConfig as any).title || "Video Tutorials",
144
- description: translations?.features?.videoTutorial?.description || (existingConfig as any).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 || undefined,
158
- userId: userProfileData?.userId ?? user?.uid ?? undefined,
159
- photoURL: user?.photoURL ?? undefined,
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 ?? undefined,
149
+ avatarUrl: userProfileData?.avatarUrl,
162
150
  onSignIn: handleSignIn,
163
151
  onLogout: handleSignOut,
164
152
  onDeleteAccount: handleDeleteAccount,
@@ -53,6 +53,7 @@ export const SettingsStackNavigator: React.FC<SettingsStackNavigatorProps> = (pr
53
53
  });
54
54
 
55
55
  const navigatorConfig: StackNavigatorConfig<SettingsStackParamList> = {
56
+ id: "SettingsStack",
56
57
  initialRouteName: "SettingsMain",
57
58
  screenOptions,
58
59
  screens,
@@ -69,9 +69,9 @@ export function createAccountConfig(params: CreateAccountConfigParams): AccountS
69
69
  return {
70
70
  profile: {
71
71
  displayName: displayName || "",
72
- userId: userId ?? undefined,
72
+ userId,
73
73
  isAnonymous: anonymous,
74
- avatarUrl: avatarUrl ?? photoURL ?? undefined,
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
  }
@@ -11,7 +11,7 @@ import {
11
11
  useAuthModalStore,
12
12
  useAccountManagement,
13
13
  } from "@umituz/react-native-auth";
14
- import { AlertService, useAppNavigation } from "@umituz/react-native-design-system";
14
+ import { AlertService } from "@umituz/react-native-design-system";
15
15
  import type { AppInfo } from "../navigation/types";
16
16
  import type { SettingsTranslations } from "../screens/types";
17
17
  import { usePasswordPromptNavigation } from "./usePasswordPromptNavigation";
@@ -24,10 +24,8 @@ declare const __DEV__: boolean;
24
24
  export const useAuthHandlers = (appInfo: AppInfo, translations?: SettingsTranslations["account"] & SettingsTranslations["errors"]) => {
25
25
  const { signOut } = useAuth();
26
26
  const { showAuthModal } = useAuthModalStore();
27
- const navigation = useAppNavigation();
28
27
 
29
28
  const { showPasswordPrompt } = usePasswordPromptNavigation({
30
- navigation,
31
29
  title: translations?.deleteAccountTitle || "Confirm Account Deletion",
32
30
  message: translations?.deleteAccountMessage || "Please enter your password to permanently delete your account. This action cannot be undone.",
33
31
  cancelText: translations?.cancel || "Cancel",
@@ -1,13 +1,13 @@
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 type { useAppNavigation } from '@umituz/react-native-design-system';
7
+ import { useCallback, useRef, useEffect } from 'react';
8
+ import { AppNavigation } from '@umituz/react-native-design-system';
8
9
 
9
10
  export interface UsePasswordPromptNavigationOptions {
10
- navigation: ReturnType<typeof useAppNavigation>;
11
11
  title?: string;
12
12
  message?: string;
13
13
  confirmText?: string;
@@ -21,14 +21,27 @@ export interface UsePasswordPromptNavigationReturn {
21
21
  export const usePasswordPromptNavigation = (
22
22
  options: UsePasswordPromptNavigationOptions
23
23
  ): UsePasswordPromptNavigationReturn => {
24
- const { navigation, title, message, confirmText, cancelText } = options;
24
+ const { title, message, confirmText, cancelText } = options;
25
25
  const resolveRef = useRef<((value: string | null) => void) | null>(null);
26
26
 
27
+ useEffect(() => {
28
+ return () => {
29
+ if (resolveRef.current) {
30
+ resolveRef.current(null);
31
+ resolveRef.current = null;
32
+ }
33
+ };
34
+ }, []);
35
+
27
36
  const showPasswordPrompt = useCallback((): Promise<string | null> => {
28
- return new Promise<string | null>((resolve) => {
37
+ return new Promise<string | null>((resolve, reject) => {
38
+ if (resolveRef.current) {
39
+ resolveRef.current(null);
40
+ }
41
+
29
42
  resolveRef.current = resolve;
30
43
 
31
- navigation.navigate('PasswordPrompt', {
44
+ const params = {
32
45
  onComplete: (password: string | null) => {
33
46
  if (resolveRef.current) {
34
47
  resolveRef.current(password);
@@ -39,9 +52,19 @@ export const usePasswordPromptNavigation = (
39
52
  message,
40
53
  confirmText,
41
54
  cancelText,
42
- });
55
+ };
56
+
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
+ }
43
66
  });
44
- }, [navigation, title, message, confirmText, cancelText]);
67
+ }, [title, message, confirmText, cancelText]);
45
68
 
46
69
  return {
47
70
  showPasswordPrompt,