@umituz/react-native-settings 4.23.122 → 4.23.123
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.123",
|
|
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",
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auth Handlers Hook
|
|
3
3
|
* Centralized authentication-related handlers for settings screen
|
|
4
|
-
*
|
|
4
|
+
* Uses auth package for all auth operations - no duplication
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { useCallback } from "react";
|
|
8
8
|
import { Linking, Alert } from "react-native";
|
|
9
9
|
import {
|
|
10
10
|
useAuth,
|
|
11
|
-
useAccountManagement,
|
|
12
11
|
useAuthModalStore,
|
|
12
|
+
useAccountManagement,
|
|
13
13
|
} from "@umituz/react-native-auth";
|
|
14
14
|
import { AlertService } from "@umituz/react-native-design-system";
|
|
15
15
|
import type { AppInfo } from "../navigation/types";
|
|
@@ -22,32 +22,13 @@ declare const __DEV__: boolean;
|
|
|
22
22
|
*/
|
|
23
23
|
export const useAuthHandlers = (appInfo: AppInfo, translations?: SettingsTranslations["errors"]) => {
|
|
24
24
|
const { signOut } = useAuth();
|
|
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
|
-
});
|
|
50
25
|
const { showAuthModal } = useAuthModalStore();
|
|
26
|
+
const { deleteAccount: deleteAccountFromAuth } = useAccountManagement({
|
|
27
|
+
passwordPromptTitle: translations?.deleteAccountTitle || "Confirm Account Deletion",
|
|
28
|
+
passwordPromptMessage: translations?.deleteAccountMessage || "Please enter your password to permanently delete your account. This action cannot be undone.",
|
|
29
|
+
passwordPromptCancel: translations?.cancel || "Cancel",
|
|
30
|
+
passwordPromptConfirm: translations?.delete || "Delete",
|
|
31
|
+
});
|
|
51
32
|
|
|
52
33
|
const handleRatePress = useCallback(async () => {
|
|
53
34
|
const url = appInfo.appStoreUrl;
|
|
@@ -90,7 +71,8 @@ export const useAuthHandlers = (appInfo: AppInfo, translations?: SettingsTransla
|
|
|
90
71
|
|
|
91
72
|
const handleDeleteAccount = useCallback(async () => {
|
|
92
73
|
try {
|
|
93
|
-
await
|
|
74
|
+
await deleteAccountFromAuth();
|
|
75
|
+
// Account deleted successfully - auth package handles everything
|
|
94
76
|
} catch (error) {
|
|
95
77
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
96
78
|
|
|
@@ -98,22 +80,12 @@ export const useAuthHandlers = (appInfo: AppInfo, translations?: SettingsTransla
|
|
|
98
80
|
console.error("[useAuthHandlers] Delete account failed:", error);
|
|
99
81
|
}
|
|
100
82
|
|
|
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
|
-
|
|
111
83
|
AlertService.createErrorAlert(
|
|
112
84
|
translations?.common || "Error",
|
|
113
85
|
errorMessage || translations?.deleteAccountError || "Failed to delete account"
|
|
114
86
|
);
|
|
115
87
|
}
|
|
116
|
-
}, [
|
|
88
|
+
}, [deleteAccountFromAuth, translations]);
|
|
117
89
|
|
|
118
90
|
const handleSignIn = useCallback(() => {
|
|
119
91
|
showAuthModal(undefined, "login");
|