apps-sdk 1.1.6 → 1.1.8
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/app.json +2 -1
- package/package.json +2 -1
- package/src/components/PayWall.js +1 -1
- package/src/libraries/Adapty.js +44 -0
- package/src/libraries/QuickActions.js +26 -0
- package/types/index.d.ts +2 -0
package/app.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apps-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "Apps SDK",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"expo-localization": "~16.0.1",
|
|
26
26
|
"expo-media-library": "~17.0.6",
|
|
27
27
|
"expo-notifications": "~0.29.14",
|
|
28
|
+
"expo-quick-actions": "^4.0.2",
|
|
28
29
|
"expo-sharing": "~13.0.1",
|
|
29
30
|
"expo-speech": "~13.0.1",
|
|
30
31
|
"expo-store-review": "~8.0.1",
|
|
@@ -273,7 +273,7 @@ class PayWall extends React.Component {
|
|
|
273
273
|
<View style={styles.bottomNavigationView}>
|
|
274
274
|
{this.state.htmlContent ? (
|
|
275
275
|
<WebView
|
|
276
|
-
style={{ flex: 1 }}
|
|
276
|
+
style={{ flex: 1, backgroundColor: '#121212' }}
|
|
277
277
|
originWhitelist={['*']}
|
|
278
278
|
source={{ html: this.state.htmlContent }}
|
|
279
279
|
javaScriptEnabled
|
package/src/libraries/Adapty.js
CHANGED
|
@@ -81,6 +81,50 @@ class Adapty {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
async preloadPaywall(placementID, lang) {
|
|
85
|
+
try {
|
|
86
|
+
const paywall = await this.getPaywallForPlacement(placementID, lang);
|
|
87
|
+
if (paywall) {
|
|
88
|
+
const paywallView = await this.createPaywallView(paywall);
|
|
89
|
+
if (paywallView) {
|
|
90
|
+
return paywallView;
|
|
91
|
+
} else {
|
|
92
|
+
console.warn('Error preloading paywall: paywall view not created for placement', placementID, 'and language', lang);
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
console.warn('Error preloading paywall: paywall not found for placement', placementID, 'and language', lang);
|
|
97
|
+
}
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.error('Error preloading paywall:', error);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async showPaywallPreloaded(paywallView, eventHandlers = {}) {
|
|
104
|
+
try {
|
|
105
|
+
if (paywallView) {
|
|
106
|
+
paywallView.registerEventHandlers({
|
|
107
|
+
onCloseButtonPress: eventHandlers.onCloseButtonPress || (() => { return true; }),
|
|
108
|
+
onAndroidSystemBack: eventHandlers.onAndroidSystemBack || (() => { paywallView.dismiss(); return true; }),
|
|
109
|
+
onPurchaseCompleted: eventHandlers.onPurchaseCompleted || (() => { paywallView.dismiss(); return true; }),
|
|
110
|
+
onPurchaseStarted: eventHandlers.onPurchaseStarted || (() => { }),
|
|
111
|
+
onPurchaseFailed: eventHandlers.onPurchaseFailed || (() => { paywallView.dismiss(); return true; }),
|
|
112
|
+
onRestoreCompleted: eventHandlers.onRestoreCompleted || (() => { paywallView.dismiss(); return true; }),
|
|
113
|
+
onRestoreFailed: eventHandlers.onRestoreFailed || (() => { paywallView.dismiss(); return true; }),
|
|
114
|
+
onProductSelected: eventHandlers.onProductSelected || (() => { }),
|
|
115
|
+
onRenderingFailed: eventHandlers.onRenderingFailed || (() => { return true; }),
|
|
116
|
+
onLoadingProductsFailed: eventHandlers.onLoadingProductsFailed || (() => { paywallView.dismiss(); return true; }),
|
|
117
|
+
onUrlPress: eventHandlers.onUrlPress || (() => { return true; }),
|
|
118
|
+
});
|
|
119
|
+
await paywallView.present();
|
|
120
|
+
} else {
|
|
121
|
+
console.warn('Error showing preloaded paywall: paywall view is null');
|
|
122
|
+
}
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error('Error showing preloaded paywall:', error);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
84
128
|
async getProfile() {
|
|
85
129
|
try {
|
|
86
130
|
return await adapty.getProfile();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as config from '../../config';
|
|
2
|
+
import * as QuickActions from "expo-quick-actions";
|
|
3
|
+
import {useQuickActionCallback} from "expo-quick-actions/hooks";
|
|
4
|
+
|
|
5
|
+
class HmeActions {
|
|
6
|
+
constructor() {
|
|
7
|
+
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async setItems(items) {
|
|
11
|
+
await QuickActions.setItems(items);
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async itemCallback(itemCallbackFunction) {
|
|
16
|
+
console.log("itemCallback", itemCallback);
|
|
17
|
+
useQuickActionCallback(action => {
|
|
18
|
+
if (action) {
|
|
19
|
+
console.log("action", action);
|
|
20
|
+
itemCallbackFunction(action);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default new HmeActions();
|
package/types/index.d.ts
CHANGED
|
@@ -213,6 +213,8 @@ declare module 'apps-sdk' {
|
|
|
213
213
|
isActivated(): Promise<boolean>;
|
|
214
214
|
createPaywallView(paywall: any): Promise<any>;
|
|
215
215
|
showPaywall(placementID: any, lang: any, eventHandlers?: PaywallEventHandlers): Promise<void>;
|
|
216
|
+
preloadPaywall(placementID: any, lang: any): Promise<any>
|
|
217
|
+
showPaywallPreloaded(paywallView: any, eventHandlers?: PaywallEventHandlers): Promise<void>;
|
|
216
218
|
getProfile(): Promise<any>;
|
|
217
219
|
}
|
|
218
220
|
|