apps-sdk 1.0.198 → 1.0.199

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": "apps-sdk",
3
- "version": "1.0.198",
3
+ "version": "1.0.199",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -6,19 +6,24 @@ import {createPaywallView} from "react-native-adapty/dist/ui";
6
6
  class Adapty {
7
7
  async initialize(apiKey = null) {
8
8
  try {
9
- config.DEBUG_MODE && console.log('Initializing Adapty with apiKey: ' + apiKey || config.ADAPTY.APP_KEY);
10
- await adapty.activate(apiKey || config.ADAPTY.APP_KEY, {
11
- customerUserId: Session.getUserID(),
12
- logLevel: config.ADAPTY.LOG_LEVEL,
13
- mediaCache: {
14
- memoryStorageTotalCostLimit: 100 * 1024 * 1024, // 100MB
15
- memoryStorageCountLimit: 2147483647, // 2^31 - 1
16
- diskStorageSizeLimit: 100 * 1024 * 1024, // 100MB
17
- },
18
- });
9
+ const isActivated = await this.isActivated();
10
+ if (!isActivated) {
11
+ config.DEBUG_MODE && console.log('Initializing Adapty with apiKey: ' + apiKey || config.ADAPTY.APP_KEY);
12
+ await adapty.activate(apiKey || config.ADAPTY.APP_KEY, {
13
+ customerUserId: Session.getUserID(),
14
+ logLevel: config.ADAPTY.LOG_LEVEL,
15
+ mediaCache: {
16
+ memoryStorageTotalCostLimit: 100 * 1024 * 1024, // 100MB
17
+ memoryStorageCountLimit: 2147483647, // 2^31 - 1
18
+ diskStorageSizeLimit: 100 * 1024 * 1024, // 100MB
19
+ },
20
+ });
21
+ } else {
22
+ config.DEBUG_MODE && console.log('Adapty is already activated');
23
+ }
19
24
  const profile = await adapty.getProfile();
20
25
  } catch (error) {
21
- console.error('Error initializing Adapty:', error);
26
+ console.warn('Error initializing Adapty:', error);
22
27
  }
23
28
  }
24
29