@umituz/react-native-subscription 2.37.58 → 2.37.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.37.
|
|
3
|
+
"version": "2.37.59",
|
|
4
4
|
"description": "Complete subscription management with RevenueCat, paywall UI, and credits system for React Native apps",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -68,6 +68,10 @@ export function configureServices(config: SubscriptionInitConfig, apiKey: string
|
|
|
68
68
|
const u = auth.currentUser;
|
|
69
69
|
return !!(u && !u.isAnonymous);
|
|
70
70
|
},
|
|
71
|
+
hasFirebaseUser: () => {
|
|
72
|
+
const auth = getFirebaseAuth();
|
|
73
|
+
return !!(auth?.currentUser);
|
|
74
|
+
},
|
|
71
75
|
showAuthModal,
|
|
72
76
|
});
|
|
73
77
|
|
|
@@ -54,10 +54,10 @@ export const useAuthAwarePurchase = (
|
|
|
54
54
|
const authProvider = authPurchaseStateManager.getProvider();
|
|
55
55
|
if (!authProvider) return;
|
|
56
56
|
|
|
57
|
-
const
|
|
57
|
+
const hasUser = authProvider.hasFirebaseUser();
|
|
58
58
|
const hasSavedPurchase = !!authPurchaseStateManager.getSavedPurchase();
|
|
59
59
|
|
|
60
|
-
if (
|
|
60
|
+
if (hasUser && hasSavedPurchase && !isExecutingSavedRef.current) {
|
|
61
61
|
isExecutingSavedRef.current = true;
|
|
62
62
|
executeSavedPurchase().finally(() => {
|
|
63
63
|
isExecutingSavedRef.current = false;
|
|
@@ -73,9 +73,7 @@ export const useAuthAwarePurchase = (
|
|
|
73
73
|
return false;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (!isAuth) {
|
|
76
|
+
if (!authProvider.hasFirebaseUser()) {
|
|
79
77
|
authPurchaseStateManager.savePurchase(pkg, source || params?.source || "settings");
|
|
80
78
|
authProvider.showAuthModal();
|
|
81
79
|
return false;
|
|
@@ -95,7 +93,7 @@ export const useAuthAwarePurchase = (
|
|
|
95
93
|
return false;
|
|
96
94
|
}
|
|
97
95
|
|
|
98
|
-
if (!authProvider.
|
|
96
|
+
if (!authProvider.hasFirebaseUser()) {
|
|
99
97
|
authProvider.showAuthModal();
|
|
100
98
|
return false;
|
|
101
99
|
}
|