-
Notifications
You must be signed in to change notification settings - Fork 11
/
AppsFlyerX.cpp
647 lines (564 loc) · 23.5 KB
/
AppsFlyerX.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
//
// AppsFlyerX.cpp
// AppsFlyerCocos2dX
//
// Created by Andrey Gagan
// Copyright © 2017 AppsFlyer. All rights reserved.
//
#include "AppsFlyerX.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include "AppsFlyerXAndroid.h"
#define COCOS2D_DEBUG 1
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "AppsFlyerXApple.h"
#endif
bool AppsFlyerX::manualStart = false;
void AppsFlyerX::setManualStart(bool isManualStart) {
manualStart = isManualStart;
}
//static void enableTCFDataCollection(bool shouldCollectConsentData);
void AppsFlyerX::enableTCFDataCollection(bool shouldCollectConsentData) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::enableTCFDataCollection(shouldCollectConsentData);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::enableTCFDataCollection(shouldCollectConsentData);
#endif
}
void AppsFlyerX::setConsentData(const AppsFlyerXConsent& consentData){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setConsentData(consentData);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::setConsentData(consentData);
#endif
}
void AppsFlyerX::setCustomerUserID(const std::string& customerUserID) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setCustomerUserID(customerUserID);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::setCustomerUserID(customerUserID);
#endif
}
std::string AppsFlyerX::customerUserID() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
return AppsFlyerXAndroid::customerUserID();
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::customerUserID();
#endif
}
void AppsFlyerX::setAdditionalData(cocos2d::ValueMap customData) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setAdditionalData(customData);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::setAdditionalData(customData);
#endif
}
cocos2d::ValueMap AppsFlyerX::customData() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "customData is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::customData();
#endif
}
void AppsFlyerX::setAppsFlyerDevKey(const std::string& appsFlyerDevKey) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setAppsFlyerDevKey(appsFlyerDevKey);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::setAppsFlyerDevKey(appsFlyerDevKey);
#endif
}
std::string AppsFlyerX::appsFlyerDevKey() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
return AppsFlyerXAndroid::appsFlyerDevKey();
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::appsFlyerDevKey();
#endif
}
void AppsFlyerX::setAppleAppID(const std::string& appleAppID) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "setAppleAppID is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::setAppleAppID(appleAppID);
#endif
}
std::string AppsFlyerX::appleAppID() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "appleAppID is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::appleAppID();
#endif
}
void AppsFlyerX::setCurrencyCode(const std::string& currencyCode) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setCurrencyCode(currencyCode);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setCurrencyCode(currencyCode);
#endif
}
std::string AppsFlyerX::currencyCode() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "currencyCode is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::currencyCode();
#endif
}
#ifndef AFSDK_NO_IDFA
void AppsFlyerX::disableAdvertisingIdentifier(bool shouldDisable) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setDisableAdvertisingIdentifiers(shouldDisable);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::disableAdvertisingIdentifier(shouldDisable);
#endif
}
#endif
#ifndef AFSDK_NO_IDFA
bool AppsFlyerX::isDisabledAdvertisingIdentifier() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "isDisabledAdvertiserIdentifier is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::isDisabledAdvertisingIdentifier();
#endif
}
#endif
void AppsFlyerX::didEnterBackground(){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::didEnterBackground();
#endif
}
void AppsFlyerX::setIsDebug(bool isDebug) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setIsDebug(isDebug);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::setIsDebug(isDebug);
#endif
}
bool AppsFlyerX::isDebug() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "isDebug is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::isDebug();
#endif
}
void AppsFlyerX::setShouldCollectDeviceName(bool isShouldCollectDeviceName) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "setShouldCollectDeviceName is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setShouldCollectDeviceName(isShouldCollectDeviceName);
#endif
}
bool AppsFlyerX::isShouldCollectDeviceName() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "isShouldCollectDeviceName is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::isShouldCollectDeviceName();
#endif
}
void AppsFlyerX::setAppInviteOneLink(const std::string& appInviteOneLinkID) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setAppInviteOneLink(appInviteOneLinkID);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setAppInviteOneLink(appInviteOneLinkID);
#endif
}
std::string AppsFlyerX::appInviteOneLinkID() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "appInviteOneLinkID is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::appInviteOneLinkID();
#endif
}
void AppsFlyerX::anonymizeUser(bool shouldAnonymize) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::anonymizeUser(shouldAnonymize);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::anonymizeUser(shouldAnonymize);
#endif
}
bool AppsFlyerX::isAnonymizedUser() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "isAnonymizedUser is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::isAnonymizedUser();
#endif
}
void AppsFlyerX::disableCollectASA(bool shouldDisable) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "disableCollectASA is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setDisableCollectASA(shouldDisable);
#endif
}
bool AppsFlyerX::isDisabledCollectASA() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "isDisabledCollectASA is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::isDisabledCollectASA();
#endif
}
void AppsFlyerX::setUseReceiptValidationSandbox(bool useReceiptValidationSandbox) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "setUseReceiptValidationSandbox is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setUseReceiptValidationSandbox(useReceiptValidationSandbox);
#endif
}
bool AppsFlyerX::isUseReceiptValidationSandbox() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "isUseReceiptValidationSandbox is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::isUseReceiptValidationSandbox();
#endif
}
void AppsFlyerX::setUseUninstallSandbox(bool setUseUninstallSandbox) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "setUseUninstallSandbox is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::setUseUninstallSandbox(setUseUninstallSandbox);
#endif
}
bool AppsFlyerX::isUseUninstallSandbox() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "isUseUninstallSandbox is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::isUseUninstallSandbox();
#endif
}
void AppsFlyerX::setUserEmails(std::vector<std::string> userEmails, EmailCryptTypeX type) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "setUserEmails is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::setUserEmails(userEmails, type);
#endif
}
void AppsFlyerX::start() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::start();
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::start();
#endif
}
void AppsFlyerX::logEvent(const std::string& eventName, cocos2d::ValueMap values) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::logEvent(eventName, values);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::logEvent(eventName, values);
#endif
}
void AppsFlyerX::validateAndLogInAppPurchase(const std::string& productIdentifier,
const std::string& price,
const std::string& currency,
const std::string& tranactionId,
cocos2d::ValueMap params,
std::function<void(cocos2d::ValueMap)> successBlock,
std::function<void(cocos2d::ValueMap)> failureBlock) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "validateAndLogInAppPurchase is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::validateAndLogInAppPurchase(productIdentifier, price, currency, tranactionId, params, [&](cocos2d::ValueMap result) {
successBlock(result);
}, [&] (cocos2d::ValueMap error) {
failureBlock(error);
});
#endif
}
void AppsFlyerX::validateAndLogInAppPurchase(const std::string& publicKey,
const std::string& signature,
const std::string& purchaseData,
const std::string& price,
const std::string& currency,
cocos2d::ValueMap additionalParameters){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::validateAndLogInAppPurchase(publicKey, signature, purchaseData, price, currency, additionalParameters);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// Not supported for iOS
CCLOGWARN("%s", "validateAndLogInAppPurchase(const std::string& publicKey, const std::string& signature, const std::string& purchaseData, const std::string& price, const std::string& currency, cocos2d::ValueMap additionalParameters) is not supported for Android.");
#endif
}
void AppsFlyerX::logAdRevenue(AFXAdRevenueData adRevenueData, cocos2d::ValueMap additionalParameters) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Android implementation
CCLOGWARN("Log AdRevenue Android");
AppsFlyerXAndroid::logAdRevenue(adRevenueData, additionalParameters);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::logAdRevenue(adRevenueData, additionalParameters);
#endif
}
void AppsFlyerX::validateAndLogInAppPurchase(AFSDKXPurchaseDetails &details, cocos2d::ValueMap params, std::function<void(AFSDKXValidateAndLogResult)> completionHandler) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Android implementation
AppsFlyerXAndroid::validateAndLogInAppPurchase(details, std::move(params), std::move(completionHandler));
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::validateAndLogInAppPurchase(details, params, completionHandler);
#endif
}
std::string AppsFlyerX::getAppsFlyerUID() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
return AppsFlyerXAndroid::getAppsFlyerUID();
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::getAppsFlyerUID();
#endif
}
void AppsFlyerX::handleOpenURL(const std::string& url, const std::string& sourceApplication) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "handleOpenURL is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::handleOpenURL(url, sourceApplication);
#endif
}
void AppsFlyerX::handleOpenURL(std::string url, std::string sourceApplication, void* annotation) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "handleOpenURL is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::handleOpenURL(url, sourceApplication, annotation);
#endif
}
void AppsFlyerX::handleOpenURL(std::string url, cocos2d::ValueMap options) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "handleOpenURL is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::handleOpenURL(url, options);
#endif
}
/*
- (BOOL) continueUserActivity:(NSUserActivity *) userActivity restorationHandler:(void (^)(NSArray *))restorationHandler NS_AVAILABLE_IOS(9_0);
- (void) didUpdateUserActivity:(NSUserActivity *)userActivity NS_AVAILABLE_IOS(9_0);
*/
void AppsFlyerX::handlePushNotification(cocos2d::ValueMap pushPayload) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "handlePushNotification is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::handlePushNotification(pushPayload);
#endif
}
void AppsFlyerX::registerUninstall(void* deviceToken, unsigned long length) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "registerUninstall(void* deviceToken, unsigned long length) is not supported for IOS.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::registerUninstall(deviceToken, length);
#endif
}
void AppsFlyerX::registerUninstall(const std::string& token) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::registerUninstall(token);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// Not supported for IOS
CCLOGWARN("%s", "handlePushNotification is not supported for IOS.");
#endif
}
// std::string AppsFlyerX::getSDKVersion() {
// #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// return AppsFlyerXAndroid::getSDKVersion();
// #elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// return AppsFlyerXApple::getSDKVersion();
// #endif
// }
void AppsFlyerX::setHost(const std::string& host) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setHost(host);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::setHost(host);
#endif
}
std::string AppsFlyerX::getHost() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
return AppsFlyerXAndroid::getHost();
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::getHost();
#endif
}
void AppsFlyerX::setMinTimeBetweenSessions(unsigned long minTimeBetweenSessions) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setMinTimeBetweenSessions(minTimeBetweenSessions);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::setMinTimeBetweenSessions(minTimeBetweenSessions);
#endif
}
// TODO: remove
unsigned long AppsFlyerX::getMinTimeBetweenSessions() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// FIXME: Android is not support this API
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::getMinTimeBetweenSessions();
#endif
}
// Delegates methods proxy
void AppsFlyerX::setOnConversionDataSuccess(void(*callback)(cocos2d::ValueMap installData)) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setOnConversionDataSuccess(callback);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setOnConversionDataReceived(callback);
#endif
}
void AppsFlyerX::setOnConversionDataFail(void(*callback)(cocos2d::ValueMap error)) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setOnConversionDataFail(callback);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setOnConversionDataRequestFailure(callback);
#endif
}
void AppsFlyerX::setOnAppOpenAttribution(void(*callback)(cocos2d::ValueMap attributionData)) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setOnAppOpenAttribution(callback);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setOnAppOpenAttribution(callback);
#endif
}
void AppsFlyerX::setOnAppOpenAttributionFailure(void(*callback)(cocos2d::ValueMap error)) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setOnAppOpenAttributionFailure(callback);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setOnAppOpenAttributionFailure(callback);
#endif
}
void AppsFlyerX::stop(bool shouldStop) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::stop(shouldStop);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::stop(shouldStop);
#endif
}
[[deprecated("This method is deprecated, please replace by setSharingFilterForPartners API")]]
void AppsFlyerX::sharingFilter(std::vector<std::string> partners){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::sharingFilter(partners);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::sharingFilter(partners);
#endif
}
[[deprecated("This method is deprecated, please replace by setSharingFilterForPartners API")]]
void AppsFlyerX::sharingFilterForAllPartners(){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::sharingFilterForAllPartners();
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::sharingFilterForAllPartners();
#endif
}
void AppsFlyerX::logLocation(double longitude, double latitude){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::logLocation(longitude, latitude);
#endif
}
void AppsFlyerX::disableSKAdNetwork(bool shouldDisable){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
//not supported for Android
CCLOGWARN("%s", "disableSKAdNetwork is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::disableSKAdNetwork(shouldDisable);
#endif
}
bool AppsFlyerX::isDisabledSKAdNetwork(){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
//not supported for Android
CCLOGWARN("%s", "isDisabledSKAdNetwork is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::isDisabledSKAdNetwork();
#endif
}
#ifndef AFSDK_NO_IDFA
void AppsFlyerX::waitForATTUserAuthorizationWithTimeoutInterval(double timeoutInterval){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
//not supported for Android
CCLOGWARN("%s", "waitForATTUserAuthorizationWithTimeoutInterval is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::waitForATTUserAuthorizationWithTimeoutInterval(timeoutInterval);
#endif
}
#endif
void AppsFlyerX::setPhoneNumber(const std::string& phoneNumber){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
//not supported for Android
CCLOGWARN("%s", "setPhoneNumber is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setPhoneNumber(phoneNumber);
#endif
}
void AppsFlyerX::setDidResolveDeepLink(void(*callback)(AppsFlyerXDeepLinkResult result)){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setOnDeepLinking(callback);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setDidResolveDeepLink(callback);
#endif
}
void AppsFlyerX::setPartnerData(std::string partnerId, cocos2d::ValueMap data) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setPartnerData(partnerId, data);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setPartnerData(partnerId, data);
#endif
}
void AppsFlyerX::setOneLinkCustomDomains(std::vector<std::string> domains) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setOneLinkCustomDomains(domains);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setOneLinkCustomDomains(domains);
#endif
}
void AppsFlyerX::setCurrentDeviceLanguage(const std::string& language) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
//not supported for Android
CCLOGWARN("%s", "setCurrentDeviceLanguage is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::setCurrentDeviceLanguage(language);
#endif
}
void AppsFlyerX::setSharingFilterForPartners(std::vector<std::string> partners) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setSharingFilterForPartners(partners);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::setSharingFilterForPartners(partners);
#endif
}
void AppsFlyerX::logInvite(const std::string& channel, cocos2d::ValueMap parameters){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::logInvite(channel, parameters);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::logInvite(channel, parameters);
#endif
}
void AppsFlyerX::generateUserInviteLink(cocos2d::ValueMap parameters,void(*onResponse)(std::string url), void(*onResponseError)(std::string url)){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::generateInviteUrl(parameters, onResponse, onResponseError);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
//not supported for iOS
CCLOGWARN("%s", "Please use generateUserInviteLink(cocos2d::ValueMap parameters, std::function<void(std::string url)> callback) for iOS");
#endif
}
void AppsFlyerX::generateUserInviteLink(cocos2d::ValueMap parameters, std::function<void(std::string url)> callback){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
//not supported for Android
CCLOGWARN("%s", "Please use generateUserInviteLink(cocos2d::ValueMap parameters,void(*onResponse)(std::string url), void(*onResponseError)(std::string url) for Android");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::generateUserInviteLink(parameters, callback);
#endif
}
void AppsFlyerX::setDisableNetworkData(bool disable){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::setDisableNetworkData(disable);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
//not supported for iOS
CCLOGWARN("%s", "setDisableNetworkData is not supported for iOS");
#endif
}