apps-sdk 1.0.88 → 1.0.90
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
package/src/libraries/AdJust.js
CHANGED
|
@@ -8,10 +8,11 @@ import Networking from './Networking';
|
|
|
8
8
|
class AdJust {
|
|
9
9
|
sdkVersion = null;
|
|
10
10
|
attribution = {};
|
|
11
|
-
initialize() {
|
|
11
|
+
async initialize() {
|
|
12
12
|
const adjustEnvironment = config.ADJUST.ENVIRONMENT === 'SANDBOX' ? AdjustConfig.EnvironmentSandbox : AdjustConfig.EnvironmentProduction;
|
|
13
13
|
const adjustLogLevel = config.ADJUST.LOG_LEVEL === 'VERBOSE' ? AdjustConfig.LogLevelVerbose : AdjustConfig.LogLevelSuppress;
|
|
14
|
-
|
|
14
|
+
await storage.setTrackingPermissionFromStorage()
|
|
15
|
+
console.log("Initializing AdJust. Environment: " + adjustEnvironment + ", Log level: " + adjustLogLevel + ", config.TRACKING_ACTIVE: " + config.TRACKING_ACTIVE);
|
|
15
16
|
try {
|
|
16
17
|
const adjustConfig = new AdjustConfig(config.ADJUST.ADJUST_TOKEN, adjustEnvironment);
|
|
17
18
|
adjustConfig.setLogLevel(adjustLogLevel);
|
|
@@ -6,6 +6,7 @@ import AdJust from './AdJust';
|
|
|
6
6
|
import CryptoES from "crypto-es";
|
|
7
7
|
import semver from 'semver';
|
|
8
8
|
import Constants from 'expo-constants';
|
|
9
|
+
import { Platform } from 'react-native';
|
|
9
10
|
|
|
10
11
|
class Networking {
|
|
11
12
|
constructor() {
|
|
@@ -209,8 +210,8 @@ class Networking {
|
|
|
209
210
|
}
|
|
210
211
|
|
|
211
212
|
sendEvent = async (eventType, eventKeyword, eventData={}) => {
|
|
212
|
-
if (config.TRACKING_ACTIVE === false) {
|
|
213
|
-
console.log('Event not sent, tracking is denied: ', eventType, eventKeyword);
|
|
213
|
+
if (config.TRACKING_ACTIVE === false && Platform.OS === 'ios') {
|
|
214
|
+
console.log('Event not sent, tracking is denied (iOS): ', eventType, eventKeyword);
|
|
214
215
|
console.log('Tracking answered: ', config.TRACKING_ANSWERED);
|
|
215
216
|
if (!config.TRACKING_ANSWERED) {
|
|
216
217
|
this.addPendingEvent({eventType, eventKeyword, eventData});
|
package/src/libraries/Storage.js
CHANGED
|
@@ -89,7 +89,7 @@ class Storage {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
if (galleryPermission === 'granted') {
|
|
92
|
-
let fileUri = FileSystem.documentDirectory + fileName + '.
|
|
92
|
+
let fileUri = FileSystem.documentDirectory + fileName + '.png';
|
|
93
93
|
if (utils.isBase64Image(base64)) {
|
|
94
94
|
console.log('DOWNLOADIMAGE isBase64Image');
|
|
95
95
|
const data = await fetch(base64);
|
|
@@ -124,7 +124,7 @@ class Storage {
|
|
|
124
124
|
const directoryUri = CREATIONS_DIR + '/' + fileName;
|
|
125
125
|
console.log('handleDownloadImageToCreations directoryUri:', directoryUri);
|
|
126
126
|
await this.createDir(directoryUri);
|
|
127
|
-
const fileUri = directoryUri + '/image.
|
|
127
|
+
const fileUri = directoryUri + '/image.png';
|
|
128
128
|
console.log('handleDownloadImageToCreations fileUri:', fileUri);
|
|
129
129
|
const fileData = directoryUri + '/data.json';
|
|
130
130
|
console.log('handleDownloadImageToCreations fileData:', fileData);
|
|
@@ -143,7 +143,7 @@ class Storage {
|
|
|
143
143
|
const directoryUri = TMP_DIR + '/' + fileName;
|
|
144
144
|
console.log('handleDownloadImageToTMP directoryUri:', directoryUri);
|
|
145
145
|
await this.createDir(directoryUri);
|
|
146
|
-
const fileUri = directoryUri + '/image.
|
|
146
|
+
const fileUri = directoryUri + '/image.png';
|
|
147
147
|
console.log('handleDownloadImageToTMP fileUri:', fileUri);
|
|
148
148
|
console.log('handleDownloadImageToTMP base64Image:', base64Image.substring(0, 50) + '...');
|
|
149
149
|
const base64Data = base64Image.replace(/^data:image\/[a-z]+;base64,/, '');
|
|
@@ -195,10 +195,16 @@ class Storage {
|
|
|
195
195
|
|
|
196
196
|
for (const directory of directories) {
|
|
197
197
|
const directoryUri = `${CREATIONS_DIR}/${directory}`;
|
|
198
|
-
|
|
198
|
+
let imageUri = `${directoryUri}/image.png`;
|
|
199
199
|
const dataUri = `${directoryUri}/data.json`;
|
|
200
|
+
let imageData = null;
|
|
200
201
|
try {
|
|
201
|
-
|
|
202
|
+
try {
|
|
203
|
+
imageData = await FileSystem.readAsStringAsync(imageUri, { encoding: FileSystem.EncodingType.Base64 });
|
|
204
|
+
} catch (error) {
|
|
205
|
+
imageUri = `${directoryUri}/image.jpg`;
|
|
206
|
+
imageData = await FileSystem.readAsStringAsync(imageUri, { encoding: FileSystem.EncodingType.Base64 });
|
|
207
|
+
}
|
|
202
208
|
const jsonData = await FileSystem.readAsStringAsync(dataUri, { encoding: FileSystem.EncodingType.UTF8 });
|
|
203
209
|
config.DEBUG_MODE && console.debug('getCreations jsonData:', jsonData);
|
|
204
210
|
|
|
@@ -272,6 +278,17 @@ class Storage {
|
|
|
272
278
|
config.TRACKING_ACTIVE = value;
|
|
273
279
|
this.storeData('TRACKING_PERMISSION', value ? 'granted' : 'denied');
|
|
274
280
|
}
|
|
281
|
+
|
|
282
|
+
async setTrackingPermissionFromStorage() {
|
|
283
|
+
this.getData('TRACKING_PERMISSION').then(value => {
|
|
284
|
+
console.log('Setting tracking permission from storage:', (value === 'granted'));
|
|
285
|
+
if (value === 'granted') {
|
|
286
|
+
config.TRACKING_ACTIVE = true;
|
|
287
|
+
} else {
|
|
288
|
+
config.TRACKING_ACTIVE = false;
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
275
292
|
}
|
|
276
293
|
|
|
277
294
|
export default new Storage();
|
package/types/index.d.ts
CHANGED
|
@@ -97,6 +97,7 @@ declare module 'apps-sdk' {
|
|
|
97
97
|
handleDownloadImageToGallery(imageURI: string): Promise<string>;
|
|
98
98
|
handleRequestGalleryPermission(): Promise<string>;
|
|
99
99
|
setTrackingPermissionGranted(value: boolean): void;
|
|
100
|
+
setTrackingPermissionFromStorage(): Promise<void>;
|
|
100
101
|
removeAllKeys(): Promise<void>;
|
|
101
102
|
deleteTempFiles(): Promise<void>;
|
|
102
103
|
}
|
|
@@ -134,7 +135,7 @@ declare module 'apps-sdk' {
|
|
|
134
135
|
export class AdJust {
|
|
135
136
|
sdkVersion: string | null;
|
|
136
137
|
attribution: object;
|
|
137
|
-
initialize(): void
|
|
138
|
+
initialize(): Promise<void>;
|
|
138
139
|
updateAttributionInfo(): void;
|
|
139
140
|
getAttributionData(): Promise<any>;
|
|
140
141
|
sendAttributionData(attribution: any): Promise<void>;
|