@umituz/react-native-settings 4.23.121 → 4.23.122
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": "4.23.
|
|
3
|
+
"version": "4.23.122",
|
|
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",
|
|
@@ -22,7 +22,31 @@ declare const __DEV__: boolean;
|
|
|
22
22
|
*/
|
|
23
23
|
export const useAuthHandlers = (appInfo: AppInfo, translations?: SettingsTranslations["errors"]) => {
|
|
24
24
|
const { signOut } = useAuth();
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
const passwordPrompt = useCallback(async (): Promise<string | null> => {
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
Alert.prompt(
|
|
29
|
+
"Password Required",
|
|
30
|
+
"Please enter your password to delete your account",
|
|
31
|
+
[
|
|
32
|
+
{
|
|
33
|
+
text: "Cancel",
|
|
34
|
+
style: "cancel",
|
|
35
|
+
onPress: () => resolve(null),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
text: "Confirm",
|
|
39
|
+
onPress: (password) => resolve(password || null),
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
"secure-text"
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
47
|
+
const { deleteAccount } = useAccountManagement({
|
|
48
|
+
onPasswordRequired: passwordPrompt,
|
|
49
|
+
});
|
|
26
50
|
const { showAuthModal } = useAuthModalStore();
|
|
27
51
|
|
|
28
52
|
const handleRatePress = useCallback(async () => {
|
|
@@ -68,12 +92,25 @@ export const useAuthHandlers = (appInfo: AppInfo, translations?: SettingsTransla
|
|
|
68
92
|
try {
|
|
69
93
|
await deleteAccount();
|
|
70
94
|
} catch (error) {
|
|
95
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
96
|
+
|
|
71
97
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
72
98
|
console.error("[useAuthHandlers] Delete account failed:", error);
|
|
73
99
|
}
|
|
100
|
+
|
|
101
|
+
// More specific error messages
|
|
102
|
+
if (errorMessage.includes("Password required") || errorMessage.includes("password")) {
|
|
103
|
+
Alert.alert(
|
|
104
|
+
"Password Required",
|
|
105
|
+
"Please enter your password when prompted to confirm account deletion.",
|
|
106
|
+
[{ text: "OK" }]
|
|
107
|
+
);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
74
111
|
AlertService.createErrorAlert(
|
|
75
|
-
translations?.common || "",
|
|
76
|
-
translations?.deleteAccountError || ""
|
|
112
|
+
translations?.common || "Error",
|
|
113
|
+
errorMessage || translations?.deleteAccountError || "Failed to delete account"
|
|
77
114
|
);
|
|
78
115
|
}
|
|
79
116
|
}, [deleteAccount, translations]);
|