Skip to content

Commit

Permalink
ios sdk v6.10.1, android sdk v6.10.2, deeplinking docs and platform e…
Browse files Browse the repository at this point in the history
…xtension
  • Loading branch information
amit-kremer93 committed Mar 28, 2023
1 parent 75f69e5 commit e43b31d
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 29 deletions.
4 changes: 2 additions & 2 deletions Docs/DeepLink.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ For more info please check out the [OneLink™ Deep Linking Guide](https://suppo

### <a id="deferred-deep-linking"> 1. Deferred Deep Linking (Get Conversion Data)

Check out the deferred deeplinkg guide from the AppFlyer knowledge base [here](https://support.appsflyer.com/hc/en-us/articles/207032096-Accessing-AppsFlyer-Attribution-Conversion-Data-from-the-SDK-Deferred-Deeplinking-#Introduction).
Check out the deferred deeplinkg guide from the AppFlyer knowledge base [here](https://dev.appsflyer.com/hc/docs/dl_work_flow).

Code Sample to handle the conversion data:

Expand Down Expand Up @@ -60,7 +60,7 @@ The `appsFlyer.onInstallConversionData` returns function to unregister this eve
### <a id="handle-deeplinking"> 2. Direct Deeplinking
When a deeplink is clicked on the device the AppsFlyer SDK will return the resolved link in the [onAppOpenAttribution](https://support.appsflyer.com/hc/en-us/articles/208874366-OneLink-Deep-Linking-Guide#deep-linking-data-the-onappopenattribution-method-) method.
When a deeplink is clicked on the device the AppsFlyer SDK will return the resolved link in the onAppOpenAttribution method.([Android](https://dev.appsflyer.com/hc/docs/dl_android_gcd_legacy) / [iOS](https://dev.appsflyer.com/hc/docs/dl_ios_gcd_legacy))
Code Sample to handle OnAppOpenAttribution:
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ repositories {
dependencies {
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
implementation "com.android.installreferrer:installreferrer:${safeExtGet('installReferrerVersion', '2.1')}"
api "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '6.9.4')}"
api "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '6.10.2')}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

public class RNAppsFlyerConstants {

final static String PLUGIN_VERSION = "6.10.2";
final static String NO_DEVKEY_FOUND = "No 'devKey' found or its empty";
final static String UNKNOWN_ERROR = "AF Unknown Error";
final static String SUCCESS = "Success";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import com.appsflyer.AppsFlyerConversionListener;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerProperties.EmailsCryptType;
import com.appsflyer.internal.platform_extension.Plugin;
import com.appsflyer.internal.platform_extension.PluginInfo;
import com.appsflyer.share.CrossPromotionHelper;
import com.appsflyer.share.LinkGenerator;
import com.appsflyer.share.ShareInviteHelper;
Expand Down Expand Up @@ -150,6 +152,10 @@ private String callSdkInternal(ReadableMap _options) {
isDeepLinking = options.optBoolean(afDeepLink, false);
isManualStartMode = options.optBoolean("manualStart", false);

boolean isExpoApp = this.isExpoApp();
PluginInfo pluginInfo = new PluginInfo(isExpoApp ? Plugin.EXPO : Plugin.REACT_NATIVE, PLUGIN_VERSION);
instance.setPluginInfo(pluginInfo);

instance.init(devKey, (isConversionData == true) ? registerConversionListener() : null, application.getApplicationContext());
if (isDeepLinking) {
instance.subscribeForDeepLink(registerDeepLinkListener());
Expand All @@ -161,6 +167,22 @@ private String callSdkInternal(ReadableMap _options) {
return null;
}

/**
* We try to load this class which is associated with Expo. If the class is loaded we return true
* so we handle this app as an Expo app. If not its just a React Native app.
* @return true if its an Expo app, false is its React Native app
*/
private boolean isExpoApp() {
try {
Class.forName("expo.modules.devmenu.react.DevMenuAwareReactActivity");
return true;
} catch (ClassNotFoundException e) {
return false;
} catch (Exception e) {
return false;
}
}

private DeepLinkListener registerDeepLinkListener() {
return new DeepLinkListener() {
@Override
Expand Down
1 change: 0 additions & 1 deletion ios/AppsFlyerAttribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#ifndef AppsFlyerAttribution_h
#define AppsFlyerAttribution_h
#endif /* AppsFlyerAttribution_h */
#import "AppsFlyerLib.h"

@interface AppsFlyerAttribution : NSObject
@property BOOL RNAFBridgeReady;
Expand Down
1 change: 1 addition & 0 deletions ios/AppsFlyerAttribution.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#import <Foundation/Foundation.h>
#import "AppsFlyerAttribution.h"
#import <AppsFlyerLib/AppsFlyerLib.h>

@interface AppsFlyerAttribution ()
@property NSUserActivity * userActivity;
Expand Down
53 changes: 41 additions & 12 deletions ios/AppsFlyerLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
// AppsFlyerLib.h
// AppsFlyerLib
//
// AppsFlyer iOS SDK 6.5.4 (62)
// Copyright (c) 2012-2020 AppsFlyer Ltd. All rights reserved.
// AppsFlyer iOS SDK 6.10.1.106 (106)
// Copyright (c) 2012-2023 AppsFlyer Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "AppsFlyerCrossPromotionHelper.h"
#import "AppsFlyerShareInviteHelper.h"
#import "AppsFlyerDeepLinkResult.h"
#import "AppsFlyerDeepLink.h"
#import <AppsFlyerLib/AppsFlyerCrossPromotionHelper.h>
#import <AppsFlyerLib/AppsFlyerShareInviteHelper.h>
#import <AppsFlyerLib/AppsFlyerDeepLinkResult.h>
#import <AppsFlyerLib/AppsFlyerDeepLink.h>

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -131,18 +131,33 @@ NS_ASSUME_NONNULL_BEGIN
#define AFEventParamAdRevenueAdSize @"af_adrev_ad_size"
#define AFEventParamAdRevenueMediatedNetworkName @"af_adrev_mediated_network_name"


/// Mail hashing type
typedef enum {
/// None
EmailCryptTypeNone = 0,
/// SHA1
EmailCryptTypeSHA1 = 1,
/// MD5
EmailCryptTypeMD5 = 2,
/// SHA256
EmailCryptTypeSHA256 = 3
} EmailCryptType;

typedef NS_CLOSED_ENUM(NSInteger, AFSDKPlugin) {
AFSDKPluginIOSNative,
AFSDKPluginUnity,
AFSDKPluginFlutter,
AFSDKPluginReactNative,
AFSDKPluginAdobeAir,
AFSDKPluginAdobeMobile,
AFSDKPluginCocos2dx,
AFSDKPluginCordova,
AFSDKPluginMparticle,
AFSDKPluginNativeScript,
AFSDKPluginExpo,
AFSDKPluginUnreal,
AFSDKPluginXamarin,
AFSDKPluginCapacitor,
} NS_SWIFT_NAME(AppsFlyerPlugin);


NS_SWIFT_NAME(DeepLinkDelegate)
@protocol AppsFlyerDeepLinkDelegate <NSObject>

Expand Down Expand Up @@ -212,6 +227,9 @@ NS_SWIFT_NAME(DeepLinkDelegate)
*/
+ (AppsFlyerLib *)shared;


- (void)setUpInteroperabilityObject:(id)object;

/**
In case you use your own user ID in your app, you can set this property to that ID.
Enables you to cross-reference your own unique ID with AppsFlyer’s unique ID and the other devices’ IDs
Expand Down Expand Up @@ -294,10 +312,13 @@ NS_SWIFT_NAME(waitForATTUserAuthorization(timeoutInterval:));
@property(atomic) BOOL anonymizeUser;

/**
Opt-out for Apple Search Ads attributions
Deprecated. This API has no effect, since the SDK is no longer fetching Apple Search Ads data from the iAd Framework. iAd Framework has been deprecated by Apple. For more information, see here: https://developer.apple.com/documentation/iad/iad_changelog
*/
@property(atomic) BOOL disableCollectASA;
@property(atomic) BOOL disableCollectASA DEPRECATED_MSG_ATTRIBUTE("Deprecated. This API has no effect, since the SDK is no longer fetching Apple Search Ads data from the iAd Framework.");

/**
Disable Apple Ads Attribution API +[AAAtribution attributionTokenWithError:]
*/
@property(nonatomic) BOOL disableAppleAdsAttribution;

/**
Expand Down Expand Up @@ -368,6 +389,14 @@ NS_SWIFT_NAME(waitForATTUserAuthorization(timeoutInterval:));
*/
@property(nonatomic, nullable) NSString *currentDeviceLanguage;

/**
Internal API. Please don't use.
*/
- (void)setPluginInfoWith:(AFSDKPlugin)plugin
pluginVersion:(NSString *)version
additionalParams:(NSDictionary * _Nullable)additionalParams
NS_SWIFT_NAME(setPluginInfo(plugin:version:additionalParams:));

/**
Enable the collection of Facebook Deferred AppLinks
Requires Facebook SDK and Facebook app on target/client device.
Expand Down
2 changes: 1 addition & 1 deletion ios/AppsFlyerShareInviteHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

#import <Foundation/Foundation.h>
#import "AppsFlyerLinkGenerator.h"
#import <AppsFlyerLib/AppsFlyerLinkGenerator.h>

/**
AppsFlyerShareInviteHelper
Expand Down
11 changes: 6 additions & 5 deletions ios/RNAppsFlyer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@

#import "AppsFlyerAttribution.h"
#import <objc/message.h>
//#if __has_include(<AppsFlyerLib/AppsFlyerLib.h>) // from Pod
//#import <AppsFlyerLib/AppsFlyerLib.h>
//#else
//#import "AppsFlyerLib.h"
//#endif
#if __has_include(<AppsFlyerLib/AppsFlyerLib.h>) // from Pod
#import <AppsFlyerLib/AppsFlyerLib.h>
#else
#import "AppsFlyerLib.h"
#endif


@interface RNAppsFlyer: RCTEventEmitter <RCTBridgeModule, AppsFlyerLibDelegate, AppsFlyerDeepLinkDelegate>
@property (readwrite, nonatomic) BOOL isManualStart;
@end


static NSString *const kAppsFlyerPluginVersion = @"6.10.2";
static NSString *const NO_DEVKEY_FOUND = @"No 'devKey' found or its empty";
static NSString *const NO_APPID_FOUND = @"No 'appId' found or its empty";
static NSString *const NO_EVENT_NAME_FOUND = @"No 'eventName' found or its empty";
Expand Down
16 changes: 10 additions & 6 deletions ios/RNAppsFlyer.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import "RNAppsFlyer.h"
#import "AppsFlyerAttribution.h"

@implementation RNAppsFlyer
@synthesize bridge = _bridge;
Expand Down Expand Up @@ -94,6 +95,11 @@ -(NSError *) callSdkInternal:(NSDictionary*)initSdkOptions {
[[AppsFlyerLib shared] waitForATTUserAuthorizationWithTimeoutInterval:timeoutInterval];
}
#endif
BOOL isExpoApp = [self isExpoApp];
[[AppsFlyerLib shared] setPluginInfoWith:isExpoApp ? AFSDKPluginExpo : AFSDKPluginReactNative
pluginVersion:kAppsFlyerPluginVersion
additionalParams:nil];

[AppsFlyerLib shared].appleAppID = appId;
[AppsFlyerLib shared].appsFlyerDevKey = devKey;
[AppsFlyerLib shared].isDebug = isDebug;
Expand Down Expand Up @@ -191,12 +197,6 @@ -(NSError *) callSdkInternal:(NSDictionary*)initSdkOptions {
int _t = [emailsCryptTypeId intValue];

switch (_t) {
case EmailCryptTypeSHA1:
emailsCryptType = EmailCryptTypeSHA1;
break;
case EmailCryptTypeMD5:
emailsCryptType = EmailCryptTypeMD5;
break;
case EmailCryptTypeSHA256:
emailsCryptType = EmailCryptTypeSHA256;
break;
Expand Down Expand Up @@ -424,6 +424,10 @@ -(void) reportOnSuccess:(NSString *)data type:(NSString*) type {
}
}

- (BOOL)isExpoApp {
return NSClassFromString(@"EXAppDelegateWrapper") != nil;
}

RCT_EXPORT_METHOD(anonymizeUser: (BOOL *)b callback:(RCTResponseSenderBlock)callback) {
[AppsFlyerLib shared].anonymizeUser = b;
callback(@[SUCCESS]);
Expand Down
3 changes: 2 additions & 1 deletion react-native-appsflyer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Pod::Spec.new do |s|
Pod::UI.puts "#{s.name}: Using default AppsFlyerFramework. You may require App Tracking Transparency. Not allowed for Kids apps."
Pod::UI.puts "#{s.name}: You may set variable `$RNAppsFlyerStrictMode=true` in Podfile to use strict mode for kids apps."
end
s.dependency 'AppsFlyerFramework', '6.9.1'
# s.dependency 'AppsFlyerFramework', '6.9.1'
s.dependency 'appsflyer-apple-sdk-qa', '6.10.1.106'
end
end

0 comments on commit e43b31d

Please sign in to comment.