Skip to content

Commit a139c68

Browse files
authored
Merge pull request #11 from AppsFlyerSDK/v6-beta
V6 beta
2 parents 030d304 + a52aa5d commit a139c68

23 files changed

+409
-367
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Versions
22

3+
## 6.0.3
4+
- iOS SDK 6.0.3
5+
- APIs renamed:
6+
|Before v6 | v6 |
7+
|---|---|
8+
| trackAppLaunch | start|
9+
| trackEvent | logEvent |
10+
| trackLocation | logLocation|
11+
| stopTracking | stop |
12+
| validateAndTrackInAppPurchase | validateAndLogInAppPurchase |
13+
| setDeviceTrackingDisabled | anonymizeUser|
14+
15+
----------
16+
317
## 5.4.1
418

519
Release date: Aug 5, 2020

Classes/AppDelegate.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ static int register_all_packages()
6060

6161
static void onConversionDataSuccess(cocos2d::ValueMap installData) {
6262
CCLOG("%s", "AppDelegate.cpp got conversion data!");
63-
6463
for (auto &t : installData){
6564
CCLOG("%s - %s", t.first.c_str(), t.second.asString().c_str());
6665
}
@@ -86,14 +85,16 @@ static void onAppOpenAttributionFailure(cocos2d::ValueMap map) {
8685

8786
bool AppDelegate::applicationDidFinishLaunching() {
8887

89-
AppsFlyerX::stopTracking(false);
88+
AppsFlyerX::stop(false);
9089

9190
AppsFlyerX::setIsDebug(true);
9291
//AppsFlyerX::setMinTimeBetweenSessions(9);
9392
AppsFlyerX::setAppsFlyerDevKey("H9xZweqPFhzBEtiDh2vDj");
9493

9594
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
9695
AppsFlyerX::setAppleAppID("942960987");
96+
// AppsFlyerX::waitForATTUserAuthorizationWithTimeoutInterval(60);
97+
9798
#endif
9899
// std::vector<std::string> partners;
99100
// partners.push_back("facebook_int");
@@ -105,10 +106,10 @@ bool AppDelegate::applicationDidFinishLaunching() {
105106
AppsFlyerX::setOnAppOpenAttribution(onAppOpenAttribution);
106107
AppsFlyerX::setOnAppOpenAttributionFailure(onAppOpenAttributionFailure);
107108

108-
AppsFlyerX::trackEvent(AFEventPurchase, {{ "key1", cocos2d::Value("value1")},
109+
AppsFlyerX::logEvent(AFEventPurchase, {{ "key1", cocos2d::Value("value1")},
109110
{ "key2", cocos2d::Value("value2")}});
110111
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
111-
AppsFlyerX::trackAppLaunch();
112+
AppsFlyerX::start();
112113
#endif
113114

114115
// initialize director
@@ -180,7 +181,7 @@ void AppDelegate::applicationWillEnterForeground() {
180181
//CCLOG("%s", "~+~+~+~+~ applicationWillEnterForeground ~+~+~+~+~");
181182

182183
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
183-
AppsFlyerX::trackAppLaunch();
184+
AppsFlyerX::start();
184185
#endif
185186

186187
#if USE_AUDIO_ENGINE

Classes/AppsFlyer/AppsFlyerX+AppController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#import "AppsFlyerX+AppController.h"
99
#import <objc/runtime.h>
10-
#import "AppsFlyerTracker.h"
10+
#import "AppsFlyerLib.h"
1111

1212
@implementation AppController (AppsFlyerX)
1313

@@ -46,7 +46,7 @@ + (void)load {
4646
#pragma mark - Method Swizzling
4747

4848
- (BOOL)x_application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler {
49-
[[AppsFlyerTracker sharedTracker] continueUserActivity:userActivity restorationHandler:restorationHandler];
49+
[[AppsFlyerLib shared] continueUserActivity:userActivity restorationHandler:restorationHandler];
5050

5151
if (isOriginalImpementationExist) {
5252
[self x_application:application continueUserActivity:userActivity restorationHandler:restorationHandler];

Classes/AppsFlyer/AppsFlyerX.cpp

Lines changed: 86 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,21 @@ std::string AppsFlyerX::currencyCode() {
9999
#endif
100100
}
101101

102-
void AppsFlyerX::disableAppleAdSupportTracking(bool isDisableAppleAdSupportTracking) {
102+
void AppsFlyerX::disableAdvertisingIdentifier(bool shouldDisable) {
103103
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
104104
// Not supported for Android
105-
CCLOGWARN("%s", "disableAppleAdSupportTracking is not supported for Android.");
105+
CCLOGWARN("%s", "disableAdvertiserIdentifier is not supported for Android.");
106106
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
107-
return AppsFlyerXApple::disableAppleAdSupportTracking(isDisableAppleAdSupportTracking);
107+
return AppsFlyerXApple::disableAdvertisingIdentifier(shouldDisable);
108108
#endif
109109
}
110110

111-
bool AppsFlyerX::isDisableAppleAdSupportTracking() {
111+
bool AppsFlyerX::isDisabledAdvertisingIdentifier() {
112112
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
113113
// Not supported for Android
114-
CCLOGWARN("%s", "isDisableAppleAdSupportTracking is not supported for Android.");
114+
CCLOGWARN("%s", "isDisabledAdvertiserIdentifier is not supported for Android.");
115115
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
116-
return AppsFlyerXApple::isDisableAppleAdSupportTracking();
116+
return AppsFlyerXApple::isDisabledAdvertisingIdentifier();
117117
#endif
118118
}
119119

@@ -175,38 +175,38 @@ std::string AppsFlyerX::appInviteOneLinkID() {
175175
#endif
176176
}
177177

178-
void AppsFlyerX::deviceTrackingDisabled(bool deviceTrackingDisabled) {
178+
void AppsFlyerX::anonymizeUser(bool shouldAnonymize) {
179179
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
180-
AppsFlyerXAndroid::deviceTrackingDisabled(deviceTrackingDisabled);
180+
AppsFlyerXAndroid::anonymizeUser(shouldAnonymize);
181181
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
182-
return AppsFlyerXApple::deviceTrackingDisabled(deviceTrackingDisabled);
182+
return AppsFlyerXApple::anonymizeUser(shouldAnonymize);
183183
#endif
184184
}
185185

186-
bool AppsFlyerX::isDeviceTrackingDisabled() {
186+
bool AppsFlyerX::isAnonymizedUser() {
187187
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
188188
// Not supported for Android
189-
CCLOGWARN("%s", "isDeviceTrackingDisabled is not supported for Android.");
189+
CCLOGWARN("%s", "isAnonymizedUser is not supported for Android.");
190190
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
191-
return AppsFlyerXApple::isDeviceTrackingDisabled();
191+
return AppsFlyerXApple::isAnonymizedUser();
192192
#endif
193193
}
194194

195-
void AppsFlyerX::disableIAdTracking(bool disableIAdTracking) {
195+
void AppsFlyerX::disableCollectASA(bool shouldDisable) {
196196
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
197197
// Not supported for Android
198-
CCLOGWARN("%s", "disableIAdTracking is not supported for Android.");
198+
CCLOGWARN("%s", "disableCollectASA is not supported for Android.");
199199
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
200-
return AppsFlyerXApple::disableIAdTracking(disableIAdTracking);
200+
return AppsFlyerXApple::setDisableCollectASA(shouldDisable);
201201
#endif
202202
}
203203

204-
bool AppsFlyerX::isDisableIAdTracking() {
204+
bool AppsFlyerX::isDisabledCollectASA() {
205205
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
206206
// Not supported for Android
207-
CCLOGWARN("%s", "isDisableIAdTracking is not supported for Android.");
207+
CCLOGWARN("%s", "isDisabledCollectASA is not supported for Android.");
208208
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
209-
return AppsFlyerXApple::isDisableIAdTracking();
209+
return AppsFlyerXApple::isDisabledCollectASA();
210210
#endif
211211
}
212212

@@ -273,31 +273,23 @@ void AppsFlyerX::setUserEmails(std::vector<std::string> userEmails, EmailCryptTy
273273
#endif
274274
}
275275

276-
void AppsFlyerX::trackAppLaunch() {
276+
void AppsFlyerX::start() {
277277
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
278-
AppsFlyerXAndroid::startTracking();
278+
AppsFlyerXAndroid::start();
279279
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
280-
AppsFlyerXApple::trackAppLaunch();
280+
AppsFlyerXApple::start();
281281
#endif
282282
}
283283

284-
void AppsFlyerX::trackEvent(const std::string& eventName, const std::string& value) {
284+
void AppsFlyerX::logEvent(const std::string& eventName, cocos2d::ValueMap values) {
285285
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
286-
AppsFlyerXAndroid::trackEvent(eventName, value);
286+
AppsFlyerXAndroid::logEvent(eventName, values);
287287
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
288-
AppsFlyerXApple::trackEvent(eventName, value);
288+
AppsFlyerXApple::logEvent(eventName, values);
289289
#endif
290290
}
291291

292-
void AppsFlyerX::trackEvent(const std::string& eventName, cocos2d::ValueMap values) {
293-
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
294-
AppsFlyerXAndroid::trackEvent(eventName, values);
295-
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
296-
AppsFlyerXApple::trackEvent(eventName, values);
297-
#endif
298-
}
299-
300-
void AppsFlyerX::validateAndTrackInAppPurchase(const std::string& productIdentifier,
292+
void AppsFlyerX::validateAndLogInAppPurchase(const std::string& productIdentifier,
301293
const std::string& price,
302294
const std::string& currency,
303295
const std::string& tranactionId,
@@ -306,28 +298,28 @@ void AppsFlyerX::validateAndTrackInAppPurchase(const std::string& productIdentif
306298
std::function<void(cocos2d::ValueMap)> failureBlock) {
307299
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
308300
// Not supported for Android
309-
CCLOGWARN("%s", "validateAndTrackInAppPurchase is not supported for Android.");
301+
CCLOGWARN("%s", "validateAndLogInAppPurchase is not supported for Android.");
310302
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
311303

312-
AppsFlyerXApple::validateAndTrackInAppPurchase(productIdentifier, price, currency, tranactionId, params, [&](cocos2d::ValueMap result) {
304+
AppsFlyerXApple::validateAndLogInAppPurchase(productIdentifier, price, currency, tranactionId, params, [&](cocos2d::ValueMap result) {
313305
successBlock(result);
314306
}, [&] (cocos2d::ValueMap error) {
315307
successBlock(error);
316308
});
317309
#endif
318310
}
319311

320-
void AppsFlyerX::validateAndTrackInAppPurchase(const std::string& publicKey,
312+
void AppsFlyerX::validateAndLogInAppPurchase(const std::string& publicKey,
321313
const std::string& signature,
322314
const std::string& purchaseData,
323315
const std::string& price,
324316
const std::string& currency,
325317
cocos2d::ValueMap additionalParameters){
326318
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
327-
AppsFlyerXAndroid::validateAndTrackInAppPurchase(publicKey, signature, purchaseData, price, currency, additionalParameters);
319+
AppsFlyerXAndroid::validateAndLogInAppPurchase(publicKey, signature, purchaseData, price, currency, additionalParameters);
328320
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
329321
// Not supported for iOS
330-
CCLOGWARN("%s", "validateAndTrackInAppPurchase(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.");
322+
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.");
331323
#endif
332324
}
333325

@@ -340,7 +332,6 @@ std::string AppsFlyerX::getAppsFlyerUID() {
340332
#endif
341333
}
342334

343-
// - (void) loadConversionDataWithDelegate:(id<AppsFlyerTrackerDelegate>) delegate __attribute__((deprecated));
344335

345336
void AppsFlyerX::handleOpenURL(const std::string& url, const std::string& sourceApplication) {
346337
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
@@ -476,26 +467,71 @@ void AppsFlyerX::setOnAppOpenAttributionFailure(void(*callback)(cocos2d::ValueMa
476467
}
477468

478469

479-
void AppsFlyerX::stopTracking(bool stopTracking) {
470+
void AppsFlyerX::stop(bool shouldStop) {
480471
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
481-
AppsFlyerXAndroid::stopTracking(stopTracking);
472+
AppsFlyerXAndroid::stop(shouldStop);
482473
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
483-
return AppsFlyerXApple::stopTracking(stopTracking);
474+
return AppsFlyerXApple::stop(shouldStop);
484475
#endif
485476
}
486477

487478
void AppsFlyerX::sharingFilter(std::vector<std::string> partners){
488-
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
479+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
489480
AppsFlyerXAndroid::sharingFilter(partners);
490-
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
491-
return AppsFlyerXApple::sharingFilter(partners);
492-
#endif
481+
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
482+
return AppsFlyerXApple::sharingFilter(partners);
483+
#endif
493484
}
494485

495486
void AppsFlyerX::sharingFilterForAllPartners(){
496-
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
487+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
497488
AppsFlyerXAndroid::sharingFilterForAllPartners();
498-
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
499-
return AppsFlyerXApple::sharingFilterForAllPartners();
500-
#endif
489+
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
490+
return AppsFlyerXApple::sharingFilterForAllPartners();
491+
#endif
492+
}
493+
494+
void AppsFlyerX::logLocation(double longitude, double latitude){
495+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
496+
497+
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
498+
return AppsFlyerXApple::logLocation(longitude, latitude);
499+
#endif
500+
}
501+
502+
void AppsFlyerX::disableSKAdNetwork(bool shouldDisable){
503+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
504+
//not supported for Android
505+
CCLOGWARN("%s", "disableSKAdNetwork is not supported for Android.");
506+
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
507+
return AppsFlyerXApple::disableSKAdNetwork(shouldDisable);
508+
#endif
509+
}
510+
511+
bool AppsFlyerX::isDisabledSKAdNetwork(){
512+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
513+
//not supported for Android
514+
CCLOGWARN("%s", "isDisabledSKAdNetwork is not supported for Android.");
515+
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
516+
return AppsFlyerXApple::isDisabledSKAdNetwork();
517+
#endif
518+
}
519+
520+
void AppsFlyerX::waitForATTUserAuthorizationWithTimeoutInterval(double timeoutInterval){
521+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
522+
//not supported for Android
523+
CCLOGWARN("%s", "waitForATTUserAuthorizationWithTimeoutInterval is not supported for Android.");
524+
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
525+
return AppsFlyerXApple::waitForATTUserAuthorizationWithTimeoutInterval(timeoutInterval);
526+
#endif
527+
}
528+
529+
530+
void AppsFlyerX::setPhoneNumber(const std::string& phoneNumber){
531+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
532+
//not supported for Android
533+
CCLOGWARN("%s", "setPhoneNumber is not supported for Android.");
534+
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
535+
return AppsFlyerXApple::setPhoneNumber(phoneNumber);
536+
#endif
501537
}

0 commit comments

Comments
 (0)