Skip to content

Commit 7f75db3

Browse files
authored
Merge pull request #28 from AppsFlyerSDK/dev/RD-69094/6.4.0
Dev/rd 69094/6.4.0
2 parents dcf9917 + 06ce182 commit 7f75db3

File tree

12 files changed

+100
-9
lines changed

12 files changed

+100
-9
lines changed

Classes/AppsFlyer/AppsFlyerX.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ void AppsFlyerX::stop(bool shouldStop) {
462462
#endif
463463
}
464464

465+
[[deprecated("This method is deprecated, please replace by setSharingFilterForPartners API")]]
465466
void AppsFlyerX::sharingFilter(std::vector<std::string> partners){
466467
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
467468
AppsFlyerXAndroid::sharingFilter(partners);
@@ -470,6 +471,7 @@ void AppsFlyerX::sharingFilter(std::vector<std::string> partners){
470471
#endif
471472
}
472473

474+
[[deprecated("This method is deprecated, please replace by setSharingFilterForPartners API")]]
473475
void AppsFlyerX::sharingFilterForAllPartners(){
474476
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
475477
AppsFlyerXAndroid::sharingFilterForAllPartners();
@@ -558,3 +560,12 @@ void AppsFlyerX::setCurrentDeviceLanguage(const std::string& language) {
558560
return AppsFlyerXApple::setCurrentDeviceLanguage(language);
559561
#endif
560562
}
563+
564+
void AppsFlyerX::setSharingFilterForPartners(std::vector<std::string> partners) {
565+
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
566+
AppsFlyerXAndroid::setSharingFilterForPartners(partners);
567+
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
568+
AppsFlyerXApple::setSharingFilterForPartners(partners);
569+
#endif
570+
}
571+

Classes/AppsFlyer/AppsFlyerX.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "AppsFlyerXMacro.h"
1717
#include "AppsFlyerXDeepLinkResult.h"
1818

19+
1920
class AppsFlyerX {
2021
public:
2122

@@ -123,8 +124,9 @@ class AppsFlyerX {
123124
static void setOnAppOpenAttribution(void(*callback)(cocos2d::ValueMap attributionData));
124125
static void setOnAppOpenAttributionFailure(void(*callback)(cocos2d::ValueMap error));
125126

126-
//Sharing Data filter
127+
//deprecated
127128
static void sharingFilter(std::vector<std::string> partners);
129+
//deprecated
128130
static void sharingFilterForAllPartners();
129131

130132
static void waitForATTUserAuthorizationWithTimeoutInterval(double timeoutInterval);
@@ -142,6 +144,8 @@ class AppsFlyerX {
142144
static void setOneLinkCustomDomains(std::vector<std::string> domains);
143145

144146
static void setCurrentDeviceLanguage(const std::string& language);
147+
148+
static void setSharingFilterForPartners(std::vector<std::string> partners);
145149
};
146150
#endif /* A;ppsFlyerX_h */
147151

Classes/AppsFlyer/AppsFlyerXAndroid.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,4 +1066,46 @@ void subscribeForDeepLink() {
10661066
CCLOGERROR("%s", "'AppsFlyerLib' is not loaded");
10671067
}
10681068
}
1069+
1070+
void AppsFlyerXAndroid::setSharingFilterForPartners(std::vector<std::string> partners) {
1071+
cocos2d::JniMethodInfo jniGetInstance = getAppsFlyerInstance();
1072+
1073+
jobject afInstance = (jobject) jniGetInstance.env->CallStaticObjectMethod(
1074+
jniGetInstance.classID, jniGetInstance.methodID);
1075+
1076+
if (NULL != afInstance) {
1077+
//CCLOG("%s", "com/appsflyer/AppsFlyerLib is loaded");
1078+
1079+
jclass cls = jniGetInstance.env->GetObjectClass(afInstance);
1080+
1081+
1082+
cocos2d::JniMethodInfo jniGetContext;
1083+
1084+
if (!cocos2d::JniHelper::getStaticMethodInfo(jniGetContext,
1085+
"org/cocos2dx/lib/Cocos2dxActivity",
1086+
"getContext",
1087+
"()Landroid/content/Context;")) {
1088+
return;
1089+
}
1090+
1091+
1092+
jobjectArray result;
1093+
result = (jobjectArray)jniGetInstance.env->NewObjectArray(partners.size(),jniGetInstance.env->FindClass("java/lang/String"),jniGetInstance.env->NewStringUTF(""));
1094+
for(int i=0; i<partners.size(); i++) {
1095+
jniGetInstance.env->SetObjectArrayElement(result,i,jniGetInstance.env->NewStringUTF(partners[i].c_str()));
1096+
}
1097+
1098+
jmethodID methodId = jniGetInstance.env->GetMethodID(cls, "setSharingFilterForPartners",
1099+
"([Ljava/lang/String;)V");
1100+
1101+
1102+
jniGetInstance.env->CallVoidMethod(afInstance, methodId, result);
1103+
1104+
jniGetInstance.env->DeleteLocalRef(result);
1105+
jniGetInstance.env->DeleteLocalRef(afInstance);
1106+
jniGetInstance.env->DeleteLocalRef(jniGetInstance.classID);
1107+
} else {
1108+
CCLOGERROR("%s", "'AppsFlyerLib' is not loaded");
1109+
}
1110+
}
10691111
#endif

Classes/AppsFlyer/AppsFlyerXAndroid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ class AppsFlyerXAndroid {
129129
static void setOneLinkCustomDomains(std::vector<std::string> domains);
130130

131131
static void setDisableAdvertisingIdentifiers(bool disable);
132+
133+
static void setSharingFilterForPartners(std::vector<std::string> partners);
132134
};
133135

134136

Classes/AppsFlyer/AppsFlyerXApple.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ class AppsFlyerXApple {
144144
static void setOneLinkCustomDomains(std::vector<std::string> domains);
145145

146146
static void setCurrentDeviceLanguage(const std::string& language);
147+
148+
static void setSharingFilterForPartners(std::vector<std::string> partners);
147149
};
148150

149151
#endif /* AppsFlyerXApple_h */

Classes/AppsFlyer/AppsFlyerXApple.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,11 @@ - (void)didUpdateUserActivity:(NSUserActivity *)userActivity NS_AVAILABLE_IOS(9_
374374
void AppsFlyerXApple::setCurrentDeviceLanguage(const std::string& language) {
375375
[AppsFlyerLib shared].currentDeviceLanguage = [NSString stringWithUTF8String:language.c_str()];
376376
}
377+
378+
void AppsFlyerXApple::setSharingFilterForPartners(std::vector<std::string> partners) {
379+
NSMutableArray *sharingFilter = [NSMutableArray new];
380+
for (auto partner : partners) {
381+
[sharingFilter addObject:[NSString stringWithUTF8String:partner.c_str()]];
382+
}
383+
[[AppsFlyerLib shared] setSharingFilterForPartners: sharingFilter];
384+
}

Classes/AppsFlyer/libAppsFlyer/AppsFlyerLib.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AppsFlyerLib.h
33
// AppsFlyerLib
44
//
5-
// AppsFlyer iOS SDK 6.3.5 (24)
5+
// AppsFlyer iOS SDK 6.4.0 (29)
66
// Copyright (c) 2012-2020 AppsFlyer Ltd. All rights reserved.
77
//
88

@@ -610,15 +610,26 @@ NS_SWIFT_NAME(logEvent(name:values:completionHandler:));
610610
Block an events from being shared with ad networks and other 3rd party integrations
611611
Must only include letters/digits or underscore, maximum length: 45
612612
*/
613-
@property(nonatomic, nullable) NSArray<NSString *> *sharingFilter;
613+
@property(nonatomic, nullable) NSArray<NSString *> *sharingFilter DEPRECATED_MSG_ATTRIBUTE("starting SDK version 6.4.0, please use `setSharingFilterForAllPartners:`");
614614

615615
@property(nonatomic) NSUInteger deepLinkTimeout;
616616

617617
/**
618618
Block an events from being shared with any partner
619619
This method overwrite -[AppsFlyerLib setSharingFilter:]
620620
*/
621-
-(void)setSharingFilterForAllPartners;
621+
- (void)setSharingFilterForAllPartners DEPRECATED_MSG_ATTRIBUTE("starting SDK version 6.4.0, please use `setSharingFilterForAllPartners:`");
622+
623+
/**
624+
Block an events from being shared with ad networks and other 3rd party integrations
625+
Must only include letters/digits or underscore, maximum length: 45
626+
627+
The sharing filter is cleared in case if `nil` or empty array passed as a parameter.
628+
"all" keyword sets sharing filter for ALL partners, it is case insencitive and has highest priority
629+
if passed along with another values. For example, if ["all", "examplePartner1_int", "examplePartner2_int" ] passed,
630+
the sharing filter will be set for ALL partners.
631+
*/
632+
- (void)setSharingFilterForPartners:(NSArray<NSString *> * _Nullable)sharingFilter;
622633

623634
/**
624635
Validate if URL contains certain string and append quiery
61 KB
Binary file not shown.

Classes/Strict/AppsFlyer/libAppsFlyer/AppsFlyerLib.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AppsFlyerLib.h
33
// AppsFlyerLib
44
//
5-
// AppsFlyer iOS SDK 6.3.5 (24)
5+
// AppsFlyer iOS SDK 6.4.0 (29)
66
// Copyright (c) 2012-2020 AppsFlyer Ltd. All rights reserved.
77
//
88

@@ -610,15 +610,26 @@ NS_SWIFT_NAME(logEvent(name:values:completionHandler:));
610610
Block an events from being shared with ad networks and other 3rd party integrations
611611
Must only include letters/digits or underscore, maximum length: 45
612612
*/
613-
@property(nonatomic, nullable) NSArray<NSString *> *sharingFilter;
613+
@property(nonatomic, nullable) NSArray<NSString *> *sharingFilter DEPRECATED_MSG_ATTRIBUTE("starting SDK version 6.4.0, please use `setSharingFilterForAllPartners:`");
614614

615615
@property(nonatomic) NSUInteger deepLinkTimeout;
616616

617617
/**
618618
Block an events from being shared with any partner
619619
This method overwrite -[AppsFlyerLib setSharingFilter:]
620620
*/
621-
-(void)setSharingFilterForAllPartners;
621+
- (void)setSharingFilterForAllPartners DEPRECATED_MSG_ATTRIBUTE("starting SDK version 6.4.0, please use `setSharingFilterForAllPartners:`");
622+
623+
/**
624+
Block an events from being shared with ad networks and other 3rd party integrations
625+
Must only include letters/digits or underscore, maximum length: 45
626+
627+
The sharing filter is cleared in case if `nil` or empty array passed as a parameter.
628+
"all" keyword sets sharing filter for ALL partners, it is case insencitive and has highest priority
629+
if passed along with another values. For example, if ["all", "examplePartner1_int", "examplePartner2_int" ] passed,
630+
the sharing filter will be set for ALL partners.
631+
*/
632+
- (void)setSharingFilterForPartners:(NSArray<NSString *> * _Nullable)sharingFilter;
622633

623634
/**
624635
Validate if URL contains certain string and append quiery
30.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)