@umituz/react-native-subscription 2.14.22 → 2.14.23
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.14.
|
|
3
|
+
"version": "2.14.23",
|
|
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",
|
|
@@ -117,7 +117,31 @@ export async function initializeSDK(
|
|
|
117
117
|
// Case 2: Already configured but different user or re-initializing
|
|
118
118
|
if (isPurchasesConfigured) {
|
|
119
119
|
try {
|
|
120
|
-
|
|
120
|
+
// Check if we're already logged in with this user ID
|
|
121
|
+
const currentAppUserId = await Purchases.getAppUserID();
|
|
122
|
+
|
|
123
|
+
if (__DEV__) {
|
|
124
|
+
console.log('[DEBUG RevenueCatInitializer] Current app user ID check', {
|
|
125
|
+
currentAppUserId,
|
|
126
|
+
requestedUserId: userId,
|
|
127
|
+
needsLogin: currentAppUserId !== userId,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Only call logIn if the user ID is different
|
|
132
|
+
let customerInfo;
|
|
133
|
+
if (currentAppUserId !== userId) {
|
|
134
|
+
if (__DEV__) {
|
|
135
|
+
console.log('[DEBUG RevenueCatInitializer] User ID changed, calling logIn');
|
|
136
|
+
}
|
|
137
|
+
const result = await Purchases.logIn(userId);
|
|
138
|
+
customerInfo = result.customerInfo;
|
|
139
|
+
} else {
|
|
140
|
+
if (__DEV__) {
|
|
141
|
+
console.log('[DEBUG RevenueCatInitializer] Already logged in with same user ID, skipping logIn');
|
|
142
|
+
}
|
|
143
|
+
customerInfo = await Purchases.getCustomerInfo();
|
|
144
|
+
}
|
|
121
145
|
|
|
122
146
|
deps.setInitialized(true);
|
|
123
147
|
deps.setCurrentUserId(userId);
|