apps-sdk 2.0.8 → 2.0.9
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/index.js +3 -2
- package/package.json +1 -1
- package/src/libraries/Adapty.js +22 -8
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency, Voice, MixPanel, Adapty, HomeActions, Facebook, Legal} from "./src/libraries";
|
|
1
|
+
import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency, Voice, MixPanel, Adapty, HomeActions, Facebook, Firebase, Legal} from "./src/libraries";
|
|
2
2
|
// import PayWall from "./src/components/PayWall"; // DEPRECATED: Use SDK.adaptyOnboarding or SDK.adapty.showPaywall() instead
|
|
3
3
|
import AdaptyOnboarding from "./src/components/AdaptyOnboarding";
|
|
4
4
|
|
|
@@ -63,5 +63,6 @@ export default {
|
|
|
63
63
|
adapty: Adapty,
|
|
64
64
|
homeActions: HomeActions,
|
|
65
65
|
facebook: Facebook,
|
|
66
|
+
firebase: Firebase,
|
|
66
67
|
legal: Legal,
|
|
67
|
-
}
|
|
68
|
+
}
|
package/package.json
CHANGED
package/src/libraries/Adapty.js
CHANGED
|
@@ -4,6 +4,11 @@ import {Session} from "./index";
|
|
|
4
4
|
import {createPaywallView, createOnboardingView} from "react-native-adapty/dist/ui";
|
|
5
5
|
|
|
6
6
|
class Adapty {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.currentPaywallView = null;
|
|
9
|
+
this.currentOnboardingView = null;
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
async initialize(apiKey = null) {
|
|
8
13
|
try {
|
|
9
14
|
const isActivated = await this.isActivated();
|
|
@@ -64,6 +69,8 @@ class Adapty {
|
|
|
64
69
|
return;
|
|
65
70
|
}
|
|
66
71
|
|
|
72
|
+
this.currentPaywallView = paywallView;
|
|
73
|
+
|
|
67
74
|
paywallView.setEventHandlers({
|
|
68
75
|
onCloseButtonPress: eventHandlers.onCloseButtonPress || (() => { return true; }),
|
|
69
76
|
onAndroidSystemBack: eventHandlers.onAndroidSystemBack || (() => { paywallView.dismiss(); return true; }),
|
|
@@ -115,12 +122,12 @@ class Adapty {
|
|
|
115
122
|
}
|
|
116
123
|
|
|
117
124
|
async closePaywall() {
|
|
118
|
-
const paywallView = await adapty.getCurrentPaywallView();
|
|
119
125
|
try {
|
|
120
|
-
if (
|
|
121
|
-
|
|
126
|
+
if (this.currentPaywallView) {
|
|
127
|
+
await this.currentPaywallView.dismiss();
|
|
128
|
+
this.currentPaywallView = null;
|
|
122
129
|
} else {
|
|
123
|
-
console.warn('Error closing paywall: paywall view
|
|
130
|
+
console.warn('Error closing paywall: no paywall view reference stored');
|
|
124
131
|
}
|
|
125
132
|
} catch (error) {
|
|
126
133
|
console.error('Error closing paywall:', error);
|
|
@@ -142,6 +149,8 @@ class Adapty {
|
|
|
142
149
|
async showPaywallPreloaded(paywallView, eventHandlers = {}) {
|
|
143
150
|
try {
|
|
144
151
|
if (paywallView) {
|
|
152
|
+
this.currentPaywallView = paywallView;
|
|
153
|
+
|
|
145
154
|
paywallView.setEventHandlers({
|
|
146
155
|
onCloseButtonPress: eventHandlers.onCloseButtonPress || (() => { return true; }),
|
|
147
156
|
onAndroidSystemBack: eventHandlers.onAndroidSystemBack || (() => { paywallView.dismiss(); return true; }),
|
|
@@ -231,6 +240,9 @@ class Adapty {
|
|
|
231
240
|
config.DEBUG_MODE && console.log('Getting onboarding for placement:', placementID, 'and language:', lang, 'onboarding:', onboarding);
|
|
232
241
|
if (onboarding) {
|
|
233
242
|
const onboardingView = await this.createOnboardingView(onboarding);
|
|
243
|
+
|
|
244
|
+
this.currentOnboardingView = onboardingView;
|
|
245
|
+
|
|
234
246
|
onboardingView.setEventHandlers({
|
|
235
247
|
onAnalytics: eventHandlers.onAnalytics || (() => { }),
|
|
236
248
|
onClose: eventHandlers.onClose || (async (actionId, meta) => { await onboardingView.dismiss(); return true; }),
|
|
@@ -256,12 +268,12 @@ class Adapty {
|
|
|
256
268
|
|
|
257
269
|
|
|
258
270
|
async closeOnboarding() {
|
|
259
|
-
const onboardingView = await adapty.getCurrentOnboardingView();
|
|
260
271
|
try {
|
|
261
|
-
if (
|
|
262
|
-
|
|
272
|
+
if (this.currentOnboardingView) {
|
|
273
|
+
await this.currentOnboardingView.dismiss();
|
|
274
|
+
this.currentOnboardingView = null;
|
|
263
275
|
} else {
|
|
264
|
-
console.warn('Error closing onboarding: onboarding view
|
|
276
|
+
console.warn('Error closing onboarding: no onboarding view reference stored');
|
|
265
277
|
}
|
|
266
278
|
} catch (error) {
|
|
267
279
|
console.error('Error closing onboarding:', error);
|
|
@@ -271,6 +283,8 @@ class Adapty {
|
|
|
271
283
|
async showOnboardingPreloaded(onboardingView, eventHandlers = {}) {
|
|
272
284
|
try {
|
|
273
285
|
if (onboardingView) {
|
|
286
|
+
this.currentOnboardingView = onboardingView;
|
|
287
|
+
|
|
274
288
|
onboardingView.setEventHandlers({
|
|
275
289
|
onAnalytics: eventHandlers.onAnalytics || (() => { }),
|
|
276
290
|
onClose: eventHandlers.onClose || (async (actionId, meta) => { await onboardingView.dismiss(); return true; }),
|