Skip to content

Commit

Permalink
Merge pull request #11 from AppsFlyerSDK/v6-beta
Browse files Browse the repository at this point in the history
V6 beta
  • Loading branch information
af-fess authored Sep 14, 2020
2 parents 030d304 + a52aa5d commit a139c68
Show file tree
Hide file tree
Showing 23 changed files with 409 additions and 367 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Versions

## 6.0.3
- iOS SDK 6.0.3
- APIs renamed:
|Before v6 | v6 |
|---|---|
| trackAppLaunch | start|
| trackEvent | logEvent |
| trackLocation | logLocation|
| stopTracking | stop |
| validateAndTrackInAppPurchase | validateAndLogInAppPurchase |
| setDeviceTrackingDisabled | anonymizeUser|

----------

## 5.4.1

Release date: Aug 5, 2020
Expand Down
11 changes: 6 additions & 5 deletions Classes/AppDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ static int register_all_packages()

static void onConversionDataSuccess(cocos2d::ValueMap installData) {
CCLOG("%s", "AppDelegate.cpp got conversion data!");

for (auto &t : installData){
CCLOG("%s - %s", t.first.c_str(), t.second.asString().c_str());
}
Expand All @@ -86,14 +85,16 @@ static void onAppOpenAttributionFailure(cocos2d::ValueMap map) {

bool AppDelegate::applicationDidFinishLaunching() {

AppsFlyerX::stopTracking(false);
AppsFlyerX::stop(false);

AppsFlyerX::setIsDebug(true);
//AppsFlyerX::setMinTimeBetweenSessions(9);
AppsFlyerX::setAppsFlyerDevKey("H9xZweqPFhzBEtiDh2vDj");

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerX::setAppleAppID("942960987");
// AppsFlyerX::waitForATTUserAuthorizationWithTimeoutInterval(60);

#endif
// std::vector<std::string> partners;
// partners.push_back("facebook_int");
Expand All @@ -105,10 +106,10 @@ bool AppDelegate::applicationDidFinishLaunching() {
AppsFlyerX::setOnAppOpenAttribution(onAppOpenAttribution);
AppsFlyerX::setOnAppOpenAttributionFailure(onAppOpenAttributionFailure);

AppsFlyerX::trackEvent(AFEventPurchase, {{ "key1", cocos2d::Value("value1")},
AppsFlyerX::logEvent(AFEventPurchase, {{ "key1", cocos2d::Value("value1")},
{ "key2", cocos2d::Value("value2")}});
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerX::trackAppLaunch();
AppsFlyerX::start();
#endif

// initialize director
Expand Down Expand Up @@ -180,7 +181,7 @@ void AppDelegate::applicationWillEnterForeground() {
//CCLOG("%s", "~+~+~+~+~ applicationWillEnterForeground ~+~+~+~+~");

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerX::trackAppLaunch();
AppsFlyerX::start();
#endif

#if USE_AUDIO_ENGINE
Expand Down
4 changes: 2 additions & 2 deletions Classes/AppsFlyer/AppsFlyerX+AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import "AppsFlyerX+AppController.h"
#import <objc/runtime.h>
#import "AppsFlyerTracker.h"
#import "AppsFlyerLib.h"

@implementation AppController (AppsFlyerX)

Expand Down Expand Up @@ -46,7 +46,7 @@ + (void)load {
#pragma mark - Method Swizzling

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

if (isOriginalImpementationExist) {
[self x_application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
Expand Down
136 changes: 86 additions & 50 deletions Classes/AppsFlyer/AppsFlyerX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,21 @@ std::string AppsFlyerX::currencyCode() {
#endif
}

void AppsFlyerX::disableAppleAdSupportTracking(bool isDisableAppleAdSupportTracking) {
void AppsFlyerX::disableAdvertisingIdentifier(bool shouldDisable) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "disableAppleAdSupportTracking is not supported for Android.");
CCLOGWARN("%s", "disableAdvertiserIdentifier is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::disableAppleAdSupportTracking(isDisableAppleAdSupportTracking);
return AppsFlyerXApple::disableAdvertisingIdentifier(shouldDisable);
#endif
}

bool AppsFlyerX::isDisableAppleAdSupportTracking() {
bool AppsFlyerX::isDisabledAdvertisingIdentifier() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "isDisableAppleAdSupportTracking is not supported for Android.");
CCLOGWARN("%s", "isDisabledAdvertiserIdentifier is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::isDisableAppleAdSupportTracking();
return AppsFlyerXApple::isDisabledAdvertisingIdentifier();
#endif
}

Expand Down Expand Up @@ -175,38 +175,38 @@ std::string AppsFlyerX::appInviteOneLinkID() {
#endif
}

void AppsFlyerX::deviceTrackingDisabled(bool deviceTrackingDisabled) {
void AppsFlyerX::anonymizeUser(bool shouldAnonymize) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::deviceTrackingDisabled(deviceTrackingDisabled);
AppsFlyerXAndroid::anonymizeUser(shouldAnonymize);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::deviceTrackingDisabled(deviceTrackingDisabled);
return AppsFlyerXApple::anonymizeUser(shouldAnonymize);
#endif
}

bool AppsFlyerX::isDeviceTrackingDisabled() {
bool AppsFlyerX::isAnonymizedUser() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "isDeviceTrackingDisabled is not supported for Android.");
CCLOGWARN("%s", "isAnonymizedUser is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::isDeviceTrackingDisabled();
return AppsFlyerXApple::isAnonymizedUser();
#endif
}

void AppsFlyerX::disableIAdTracking(bool disableIAdTracking) {
void AppsFlyerX::disableCollectASA(bool shouldDisable) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "disableIAdTracking is not supported for Android.");
CCLOGWARN("%s", "disableCollectASA is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::disableIAdTracking(disableIAdTracking);
return AppsFlyerXApple::setDisableCollectASA(shouldDisable);
#endif
}

bool AppsFlyerX::isDisableIAdTracking() {
bool AppsFlyerX::isDisabledCollectASA() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "isDisableIAdTracking is not supported for Android.");
CCLOGWARN("%s", "isDisabledCollectASA is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::isDisableIAdTracking();
return AppsFlyerXApple::isDisabledCollectASA();
#endif
}

Expand Down Expand Up @@ -273,31 +273,23 @@ void AppsFlyerX::setUserEmails(std::vector<std::string> userEmails, EmailCryptTy
#endif
}

void AppsFlyerX::trackAppLaunch() {
void AppsFlyerX::start() {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::startTracking();
AppsFlyerXAndroid::start();
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::trackAppLaunch();
AppsFlyerXApple::start();
#endif
}

void AppsFlyerX::trackEvent(const std::string& eventName, const std::string& value) {
void AppsFlyerX::logEvent(const std::string& eventName, cocos2d::ValueMap values) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::trackEvent(eventName, value);
AppsFlyerXAndroid::logEvent(eventName, values);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::trackEvent(eventName, value);
AppsFlyerXApple::logEvent(eventName, values);
#endif
}

void AppsFlyerX::trackEvent(const std::string& eventName, cocos2d::ValueMap values) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::trackEvent(eventName, values);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
AppsFlyerXApple::trackEvent(eventName, values);
#endif
}

void AppsFlyerX::validateAndTrackInAppPurchase(const std::string& productIdentifier,
void AppsFlyerX::validateAndLogInAppPurchase(const std::string& productIdentifier,
const std::string& price,
const std::string& currency,
const std::string& tranactionId,
Expand All @@ -306,28 +298,28 @@ void AppsFlyerX::validateAndTrackInAppPurchase(const std::string& productIdentif
std::function<void(cocos2d::ValueMap)> failureBlock) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Not supported for Android
CCLOGWARN("%s", "validateAndTrackInAppPurchase is not supported for Android.");
CCLOGWARN("%s", "validateAndLogInAppPurchase is not supported for Android.");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)

AppsFlyerXApple::validateAndTrackInAppPurchase(productIdentifier, price, currency, tranactionId, params, [&](cocos2d::ValueMap result) {
AppsFlyerXApple::validateAndLogInAppPurchase(productIdentifier, price, currency, tranactionId, params, [&](cocos2d::ValueMap result) {
successBlock(result);
}, [&] (cocos2d::ValueMap error) {
successBlock(error);
});
#endif
}

void AppsFlyerX::validateAndTrackInAppPurchase(const std::string& publicKey,
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::validateAndTrackInAppPurchase(publicKey, signature, purchaseData, price, currency, additionalParameters);
AppsFlyerXAndroid::validateAndLogInAppPurchase(publicKey, signature, purchaseData, price, currency, additionalParameters);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// Not supported for iOS
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.");
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
}

Expand All @@ -340,7 +332,6 @@ std::string AppsFlyerX::getAppsFlyerUID() {
#endif
}

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

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


void AppsFlyerX::stopTracking(bool stopTracking) {
void AppsFlyerX::stop(bool shouldStop) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::stopTracking(stopTracking);
AppsFlyerXAndroid::stop(shouldStop);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::stopTracking(stopTracking);
return AppsFlyerXApple::stop(shouldStop);
#endif
}

void AppsFlyerX::sharingFilter(std::vector<std::string> partners){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::sharingFilter(partners);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::sharingFilter(partners);
#endif
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::sharingFilter(partners);
#endif
}

void AppsFlyerX::sharingFilterForAllPartners(){
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
AppsFlyerXAndroid::sharingFilterForAllPartners();
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
return AppsFlyerXApple::sharingFilterForAllPartners();
#endif
#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
}

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
}


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
}
Loading

0 comments on commit a139c68

Please sign in to comment.