@umituz/react-native-subscription 2.37.56 → 2.37.58
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.58",
|
|
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",
|
|
@@ -11,6 +11,7 @@ export async function startBackgroundInitialization(config: SubscriptionInitConf
|
|
|
11
11
|
let retryTimer: ReturnType<typeof setTimeout> | null = null;
|
|
12
12
|
let lastUserId: string | undefined = undefined;
|
|
13
13
|
let lastInitSucceeded = false;
|
|
14
|
+
let isInitializing = false; // true while attemptInitWithRetry is awaited
|
|
14
15
|
|
|
15
16
|
const initializeInBackground = async (revenueCatUserId?: string): Promise<void> => {
|
|
16
17
|
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
@@ -65,7 +66,7 @@ export async function startBackgroundInitialization(config: SubscriptionInitConf
|
|
|
65
66
|
retryTimer = null;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
if (lastUserId === revenueCatUserId && lastInitSucceeded) {
|
|
69
|
+
if (lastUserId === revenueCatUserId && (lastInitSucceeded || isInitializing)) {
|
|
69
70
|
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
70
71
|
console.log('[BackgroundInitializer] UserId unchanged and init succeeded, skipping');
|
|
71
72
|
}
|
|
@@ -83,7 +84,12 @@ export async function startBackgroundInitialization(config: SubscriptionInitConf
|
|
|
83
84
|
lastInitSucceeded = false;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
isInitializing = true;
|
|
88
|
+
try {
|
|
89
|
+
await attemptInitWithRetry(revenueCatUserId);
|
|
90
|
+
} finally {
|
|
91
|
+
isInitializing = false;
|
|
92
|
+
}
|
|
87
93
|
}, AUTH_STATE_DEBOUNCE_MS);
|
|
88
94
|
};
|
|
89
95
|
|
|
@@ -24,7 +24,7 @@ export function getOrCreateService(
|
|
|
24
24
|
return currentInstance;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const { getRevenueCatService } = require("../services/
|
|
27
|
+
const { getRevenueCatService } = require("../services/revenueCatServiceInstance");
|
|
28
28
|
const serviceInstance = getRevenueCatService();
|
|
29
29
|
|
|
30
30
|
if (!serviceInstance) {
|