[A] appsflyer, SDK facade init method

This commit is contained in:
2024-08-07 00:28:22 +08:00
parent d2f1da88f1
commit 90d63db9e6
160 changed files with 9440 additions and 283 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 62d43a96569c549cc8c607773bfd3a4c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: abbe912b9f917460995af0e66da301d0
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 6f38effdeaf92485b91158b901ad3755
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 5ccc58bdfe5e4493b8735a4304b66213
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d8325c12a80ff4323b82e2833a8fc287
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,22 @@
//
// AFUnityUtils.h
//
// Created by Andrii H. and Dmitry O. on 16 Oct 2023
//
#if __has_include(<AppsFlyerLib/AppsFlyerLib.h>)
#import <AppsFlyerLib/AppsFlyerLib.h>
#else
#import "AppsFlyerLib.h"
#endif
static NSString* stringFromChar(const char *str);
static NSDictionary* dictionaryFromJson(const char *jsonString);
static const char* stringFromdictionary(NSDictionary* dictionary);
static NSArray<NSString*> *NSArrayFromCArray(int length, const char **arr);
static char* getCString(const char* string);
static AppsFlyerLinkGenerator* generatorFromDictionary(NSDictionary* dictionary, AppsFlyerLinkGenerator* generator);
static EmailCryptType emailCryptTypeFromInt(int emailCryptTypeInt);
static NSString* stringFromDeepLinkResultStatus(AFSDKDeepLinkResultStatus deepLinkResult);
static NSString* stringFromDeepLinkResultError(AppsFlyerDeepLinkResult *result);

View File

@@ -0,0 +1,27 @@
fileFormatVersion: 2
guid: 4b0609ff467554f2088aee1c52bf54a2
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,145 @@
//
// AFUnityUtils.mm
// Unity-iPhone
//
// Created by Jonathan Wesfield on 24/07/2019.
//
#import "AFUnityUtils.h"
static NSString* stringFromChar(const char *str) {
return str ? [NSString stringWithUTF8String:str] : nil;
}
static NSDictionary* dictionaryFromJson(const char *jsonString) {
if(jsonString){
NSData *jsonData = [[NSData alloc] initWithBytes:jsonString length:strlen(jsonString)];
NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil];
return dictionary;
}
return nil;
}
static const char* stringFromdictionary(NSDictionary* dictionary) {
if(dictionary){
NSError * err;
NSData * jsonData = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:&err];
NSString * myString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
return [myString UTF8String];
}
return nil;
}
static NSDictionary* dictionaryFromNSError(NSError* error) {
if(error){
NSInteger code = [error code];
NSString *localizedDescription = [error localizedDescription];
NSDictionary *errorDictionary = @{
@"code" : @(code) ?: @(-1),
@"localizedDescription" : localizedDescription,
};
return errorDictionary;
}
return nil;
}
static NSArray<NSString*> *NSArrayFromCArray(int length, const char **arr) {
NSMutableArray<NSString *> *res = [[NSMutableArray alloc] init];
for(int i = 0; i < length; i++) {
if (arr[i]) {
[res addObject:[NSString stringWithUTF8String:arr[i]]];
}
}
return res;
}
static char* getCString(const char* string){
if (string == NULL){
return NULL;
}
char* res = (char*)malloc(strlen(string) + 1);
strcpy(res, string);
return res;
}
static AppsFlyerLinkGenerator* generatorFromDictionary(NSDictionary* dictionary, AppsFlyerLinkGenerator* generator) {
NSArray* generatorKeys = @[@"channel", @"customerID", @"campaign", @"referrerName", @"referrerImageUrl", @"deeplinkPath", @"baseDeeplink", @"brandDomain"];
NSMutableDictionary* mutableDictionary = [dictionary mutableCopy];
[generator setChannel:[dictionary objectForKey: @"channel"]];
[generator setReferrerCustomerId:[dictionary objectForKey: @"customerID"]];
[generator setCampaign:[dictionary objectForKey: @"campaign"]];
[generator setReferrerName:[dictionary objectForKey: @"referrerName"]];
[generator setReferrerImageURL:[dictionary objectForKey: @"referrerImageUrl"]];
[generator setDeeplinkPath:[dictionary objectForKey: @"deeplinkPath"]];
[generator setBaseDeeplink:[dictionary objectForKey: @"baseDeeplink"]];
[generator setBrandDomain:[dictionary objectForKey: @"brandDomain"]];
[mutableDictionary removeObjectsForKeys:generatorKeys];
[generator addParameters:mutableDictionary];
return generator;
}
static EmailCryptType emailCryptTypeFromInt(int emailCryptTypeInt){
EmailCryptType emailCryptType;
switch (emailCryptTypeInt){
case 1:
emailCryptType = EmailCryptTypeSHA256;
break;
default:
emailCryptType = EmailCryptTypeNone;
break;
}
return emailCryptType;
}
static NSString* stringFromDeepLinkResultStatus(AFSDKDeepLinkResultStatus deepLinkResult){
NSString* result;
switch (deepLinkResult){
case AFSDKDeepLinkResultStatusFound:
result = @"FOUND";
break;
case AFSDKDeepLinkResultStatusFailure:
result = @"ERROR";
break;
case AFSDKDeepLinkResultStatusNotFound:
result = @"NOT_FOUND";
break;
default:
result = @"ERROR";
break;
}
return result;
}
static NSString* stringFromDeepLinkResultError(AppsFlyerDeepLinkResult *result){
NSString* res;
if (result && result.error){
if ([[result.error userInfo][NSUnderlyingErrorKey] code] == -1001) {
res = @"TIMEOUT";
} else if ([[result.error userInfo][NSUnderlyingErrorKey] code] == -1009) {
res = @"NETWORK";
}
}
res = @"UNKNOWN";
return res;
}

View File

@@ -0,0 +1,37 @@
fileFormatVersion: 2
guid: 18a03931864e84d86bedcc99c440e060
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,133 @@
//
// AppsFlyer+AppController.m
// Unity-iPhone
//
// Created by Jonathan Wesfield on 24/07/2019.
//
#import <objc/runtime.h>
#import "UnityAppController.h"
#import "AppsFlyeriOSWrapper.h"
#if __has_include(<AppsFlyerLib/AppsFlyerLib.h>)
#import <AppsFlyerLib/AppsFlyerLib.h>
#else
#import "AppsFlyerLib.h"
#endif
@implementation UnityAppController (AppsFlyerSwizzledAppController)
static BOOL didEnteredBackGround __unused;
static IMP __original_applicationDidBecomeActive_Imp __unused;
static IMP __original_applicationDidEnterBackground_Imp __unused;
static IMP __original_didReceiveRemoteNotification_Imp __unused;
static IMP __original_continueUserActivity_Imp __unused;
static IMP __original_openUrl_Imp __unused;
+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Method method1 = class_getInstanceMethod([self class], @selector(applicationDidBecomeActive:));
__original_applicationDidBecomeActive_Imp = method_setImplementation(method1, (IMP)__swizzled_applicationDidBecomeActive);
Method method2 = class_getInstanceMethod([self class], @selector(applicationDidEnterBackground:));
__original_applicationDidEnterBackground_Imp = method_setImplementation(method2, (IMP)__swizzled_applicationDidEnterBackground);
Method method3 = class_getInstanceMethod([self class], @selector(didReceiveRemoteNotification:));
__original_didReceiveRemoteNotification_Imp = method_setImplementation(method3, (IMP)__swizzled_didReceiveRemoteNotification);
Method method4 = class_getInstanceMethod([self class], @selector(application:openURL:options:));
__original_openUrl_Imp = method_setImplementation(method4, (IMP)__swizzled_openURL);
if (_AppsFlyerdelegate == nil) {
_AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init];
}
[self swizzleContinueUserActivity:[self class]];
});
}
+(void)swizzleContinueUserActivity:(Class)class {
SEL originalSelector = @selector(application:continueUserActivity:restorationHandler:);
Method defaultMethod = class_getInstanceMethod(class, originalSelector);
Method swizzledMethod = class_getInstanceMethod(class, @selector(__swizzled_continueUserActivity));
BOOL isMethodExists = !class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod));
if (isMethodExists) {
__original_continueUserActivity_Imp = method_setImplementation(defaultMethod, (IMP)__swizzled_continueUserActivity);
} else {
class_replaceMethod(class, originalSelector, (IMP)__swizzled_continueUserActivity, method_getTypeEncoding(swizzledMethod));
}
}
BOOL __swizzled_continueUserActivity(id self, SEL _cmd, UIApplication* application, NSUserActivity* userActivity, void (^restorationHandler)(NSArray*)) {
NSLog(@"swizzled continueUserActivity");
[[AppsFlyerAttribution shared] continueUserActivity:userActivity restorationHandler:restorationHandler];
if(__original_continueUserActivity_Imp){
return ((BOOL(*)(id, SEL, UIApplication*, NSUserActivity*, void (^)(NSArray*)))__original_continueUserActivity_Imp)(self, _cmd, application, userActivity, NULL);
}
return YES;
}
void __swizzled_applicationDidBecomeActive(id self, SEL _cmd, UIApplication* launchOptions) {
NSLog(@"swizzled applicationDidBecomeActive");
[[AppsFlyerLib shared] setDelegate:_AppsFlyerdelegate];
if(didEnteredBackGround && AppsFlyeriOSWarpper.didCallStart == YES){
[[AppsFlyerLib shared] start];
}
if(__original_applicationDidBecomeActive_Imp){
((void(*)(id,SEL, UIApplication*))__original_applicationDidBecomeActive_Imp)(self, _cmd, launchOptions);
}
}
void __swizzled_applicationDidEnterBackground(id self, SEL _cmd, UIApplication* application) {
NSLog(@"swizzled applicationDidEnterBackground");
didEnteredBackGround = YES;
if(__original_applicationDidEnterBackground_Imp){
((void(*)(id,SEL, UIApplication*))__original_applicationDidEnterBackground_Imp)(self, _cmd, application);
}
}
BOOL __swizzled_didReceiveRemoteNotification(id self, SEL _cmd, UIApplication* application, NSDictionary* userInfo,void (^UIBackgroundFetchResult)(void) ) {
NSLog(@"swizzled didReceiveRemoteNotification");
[[AppsFlyerLib shared] handlePushNotification:userInfo];
if(__original_didReceiveRemoteNotification_Imp){
return ((BOOL(*)(id, SEL, UIApplication*, NSDictionary*, int(UIBackgroundFetchResult)))__original_didReceiveRemoteNotification_Imp)(self, _cmd, application, userInfo, nil);
}
return YES;
}
BOOL __swizzled_openURL(id self, SEL _cmd, UIApplication* application, NSURL* url, NSDictionary * options) {
NSLog(@"swizzled openURL");
[[AppsFlyerAttribution shared] handleOpenUrl:url options:options];
if(__original_openUrl_Imp){
return ((BOOL(*)(id, SEL, UIApplication*, NSURL*, NSDictionary*))__original_openUrl_Imp)(self, _cmd, application, url, options);
}
return NO;
}
@end

View File

@@ -0,0 +1,37 @@
fileFormatVersion: 2
guid: 6ae9e1f7daef2427588fab2fbf8d35d5
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,103 @@
//
// AppsFlyerAppController.mm
// Unity-iPhone
//
// Created by Jonathan Wesfield on 30/07/2019.
//
#import <Foundation/Foundation.h>
#import "UnityAppController.h"
#import "AppDelegateListener.h"
#import "AppsFlyeriOSWrapper.h"
#if __has_include(<AppsFlyerLib/AppsFlyerLib.h>)
#import <AppsFlyerLib/AppsFlyerLib.h>
#else
#import "AppsFlyerLib.h"
#endif
#import <objc/message.h>
/**
Note if you would like to use method swizzeling see AppsFlyer+AppController.m
If you are using swizzeling then comment out the method that is being swizzeled in AppsFlyerAppController.mm
Only use swizzeling if there are conflicts with other plugins that needs to be resolved.
*/
@interface AppsFlyerAppController : UnityAppController <AppDelegateListener>
{
BOOL didEnteredBackGround;
}
@end
@implementation AppsFlyerAppController
- (instancetype)init
{
self = [super init];
if (self) {
id swizzleFlag = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"AppsFlyerShouldSwizzle"];
BOOL shouldSwizzle = swizzleFlag ? [swizzleFlag boolValue] : NO;
if(!shouldSwizzle){
UnityRegisterAppDelegateListener(self);
}
}
return self;
}
- (void)didFinishLaunching:(NSNotification*)notification {
NSLog(@"got didFinishLaunching = %@",notification.userInfo);
if (_AppsFlyerdelegate == nil) {
_AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init];
}
[[AppsFlyerLib shared] setDelegate:_AppsFlyerdelegate];
if (notification.userInfo[@"url"]) {
[self onOpenURL:notification];
}
}
-(void)didBecomeActive:(NSNotification*)notification {
NSLog(@"got didBecomeActive(out) = %@", notification.userInfo);
if (didEnteredBackGround == YES && AppsFlyeriOSWarpper.didCallStart == YES) {
[[AppsFlyerLib shared] start];
didEnteredBackGround = NO;
}
}
- (void)didEnterBackground:(NSNotification*)notification {
NSLog(@"got didEnterBackground = %@", notification.userInfo);
didEnteredBackGround = YES;
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
[[AppsFlyerAttribution shared] continueUserActivity:userActivity restorationHandler:restorationHandler];
return YES;
}
- (void)onOpenURL:(NSNotification*)notification {
NSLog(@"got onOpenURL = %@", notification.userInfo);
NSURL *url = notification.userInfo[@"url"];
NSString *sourceApplication = notification.userInfo[@"sourceApplication"];
if (sourceApplication == nil) {
sourceApplication = @"";
}
if (url != nil) {
[[AppsFlyerAttribution shared] handleOpenUrl:url sourceApplication:sourceApplication annotation:nil];
}
}
- (void)didReceiveRemoteNotification:(NSNotification*)notification {
NSLog(@"got didReceiveRemoteNotification = %@", notification.userInfo);
[[AppsFlyerLib shared] handlePushNotification:notification.userInfo];
}
@end

View File

@@ -0,0 +1,37 @@
fileFormatVersion: 2
guid: 2d1497a1493b24fecaa58bd3a7b707f9
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
//
// AppsFlyerAttribution.h
// UnityFramework
//
// Created by Margot Guetta on 11/04/2021.
//
#ifndef AppsFlyerAttribution_h
#define AppsFlyerAttribution_h
#endif /* AppsFlyerAttribution_h */
#if __has_include(<AppsFlyerLib/AppsFlyerLib.h>)
#import <AppsFlyerLib/AppsFlyerLib.h>
#else
#import "AppsFlyerLib.h"
#endif
@interface AppsFlyerAttribution : NSObject
@property NSUserActivity*_Nullable userActivity;
@property (nonatomic, copy) void (^ _Nullable restorationHandler)(NSArray *_Nullable );
@property NSURL * _Nullable url;
@property NSDictionary * _Nullable options;
@property NSString* _Nullable sourceApplication;
@property id _Nullable annotation;
@property BOOL isBridgeReady;
+ (AppsFlyerAttribution *_Nullable)shared;
- (void) continueUserActivity: (NSUserActivity*_Nullable) userActivity restorationHandler: (void (^_Nullable)(NSArray * _Nullable))restorationHandler;
- (void) handleOpenUrl:(NSURL*_Nullable)url options:(NSDictionary*_Nullable) options;
- (void) handleOpenUrl: (NSURL *_Nonnull)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation;
@end
static NSString * _Nullable const AF_BRIDGE_SET = @"bridge is set";

View File

@@ -0,0 +1,27 @@
fileFormatVersion: 2
guid: 8544dc3b3c7bb40d397b2de568df1058
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,86 @@
//
// NSObject+AppsFlyerAttribution.m
// UnityFramework
//
// Created by Margot Guetta on 11/04/2021.
//
#import <Foundation/Foundation.h>
#import "AppsFlyerAttribution.h"
@implementation AppsFlyerAttribution
+ (id)shared {
static AppsFlyerAttribution *shared = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
shared = [[self alloc] init];
});
return shared;
}
- (id)init {
if (self = [super init]) {
self.options = nil;
self.restorationHandler = nil;
self.url = nil;
self.userActivity = nil;
self.annotation = nil;
self.sourceApplication = nil;
self.isBridgeReady = NO;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receiveBridgeReadyNotification:)
name:AF_BRIDGE_SET
object:nil];
}
return self;
}
- (void) continueUserActivity: (NSUserActivity*_Nullable) userActivity restorationHandler: (void (^_Nullable)(NSArray * _Nullable))restorationHandler{
if(self.isBridgeReady == YES){
[[AppsFlyerLib shared] continueUserActivity:userActivity restorationHandler:restorationHandler];
}else{
[AppsFlyerAttribution shared].userActivity = userActivity;
[AppsFlyerAttribution shared].restorationHandler = restorationHandler;
}
}
- (void) handleOpenUrl:(NSURL *)url options:(NSDictionary *)options{
if(self.isBridgeReady == YES){
[[AppsFlyerLib shared] handleOpenUrl:url options:options];
}else{
[AppsFlyerAttribution shared].url = url;
[AppsFlyerAttribution shared].options = options;
}
}
- (void) handleOpenUrl:(NSURL *)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation{
if(self.isBridgeReady == YES){
[[AppsFlyerLib shared] handleOpenURL:url sourceApplication:sourceApplication withAnnotation:annotation];
}else{
[AppsFlyerAttribution shared].url = url;
[AppsFlyerAttribution shared].sourceApplication = sourceApplication;
[AppsFlyerAttribution shared].annotation = annotation;
}
}
- (void) receiveBridgeReadyNotification:(NSNotification *) notification
{
NSLog (@"AppsFlyer Debug: handle deep link");
if(self.url && self.sourceApplication){
[[AppsFlyerLib shared] handleOpenURL:self.url sourceApplication:self.sourceApplication withAnnotation:self.annotation];
self.url = nil;
self.sourceApplication = nil;
self.annotation = nil;
}else if(self.options && self.url){
[[AppsFlyerLib shared] handleOpenUrl:self.url options:self.options];
self.options = nil;
self.url = nil;
}else if(self.userActivity){
[[AppsFlyerLib shared] continueUserActivity:self.userActivity restorationHandler:nil];
self.userActivity = nil;
self.restorationHandler = nil;
}
}
@end

View File

@@ -0,0 +1,37 @@
fileFormatVersion: 2
guid: 1060e47d7b9e2453ba575f0b455b2bf8
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c6eb16011ddb043229e75516454c1620
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>AppsFlyerLib.framework/AppsFlyerLib</string>
<key>LibraryIdentifier</key>
<string>tvos-arm64</string>
<key>LibraryPath</key>
<string>AppsFlyerLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>AppsFlyerLib.framework/Versions/A/AppsFlyerLib</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-maccatalyst</string>
<key>LibraryPath</key>
<string>AppsFlyerLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>AppsFlyerLib.framework/AppsFlyerLib</string>
<key>LibraryIdentifier</key>
<string>tvos-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>AppsFlyerLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>AppsFlyerLib.framework/AppsFlyerLib</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>AppsFlyerLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>AppsFlyerLib.framework/AppsFlyerLib</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>AppsFlyerLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>AppsFlyerLib.framework/Versions/A/AppsFlyerLib</string>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>AppsFlyerLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 33f5655c37fc243b6ba1e8c4cdb845f6
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d0617eb39fb8c4be19e44c5eadba954f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6eab9019c228043ef870491ffa94472c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9ffeeb46152314a1a8d7f7d419e35e69
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2137c062a092346a580ae32be7e89d2c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 39935b444e291432d9ab7dc0b12738f2
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1053f3338b36541a5b5e0a2bf33f9a14
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7c375e0f706da4d4c922eea21f386e3c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 50f6709a681894a409338666e50329a6
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
//
// AFSDKPurchaseDetails.h
// AppsFlyerLib
//
// Created by Moris Gateno on 13/03/2024.
//
@interface AFSDKPurchaseDetails : NSObject
- (nonnull instancetype)init NS_UNAVAILABLE;
+ (nonnull instancetype)new NS_UNAVAILABLE;
@property (strong, nullable, nonatomic) NSString *productId;
@property (strong, nullable, nonatomic) NSString *price;
@property (strong, nullable, nonatomic) NSString *currency;
@property (strong, nullable, nonatomic) NSString *transactionId;
- (instancetype _Nonnull )initWithProductId:(NSString *_Nullable)productId
price:(NSString *_Nullable)price
currency:(NSString *_Nullable)currency
transactionId:(NSString *_Nullable)transactionId;
@end

View File

@@ -0,0 +1,35 @@
//
// AFSDKValidateAndLogResult.h
// AppsFlyerLib
//
// Created by Moris Gateno on 13/03/2024.
//
typedef NS_CLOSED_ENUM(NSUInteger, AFSDKValidateAndLogStatus) {
AFSDKValidateAndLogStatusSuccess,
AFSDKValidateAndLogStatusFailure,
AFSDKValidateAndLogStatusError
} NS_SWIFT_NAME(ValidateAndLogStatus);
NS_SWIFT_NAME(ValidateAndLogResult)
@interface AFSDKValidateAndLogResult : NSObject
- (nonnull instancetype)init NS_UNAVAILABLE;
+ (nonnull instancetype)new NS_UNAVAILABLE;
- (instancetype _Nonnull )initWithStatus:(AFSDKValidateAndLogStatus)status
result:(NSDictionary *_Nullable)result
errorData:(NSDictionary *_Nullable)errorData
error:(NSError *_Nullable)error;
@property(readonly) AFSDKValidateAndLogStatus status;
// Success case
@property(readonly, nullable) NSDictionary *result;
// Server 200 with validation failure
@property(readonly, nullable) NSDictionary *errorData;
// for the error case
@property(readonly, nullable) NSError *error;
@end

View File

@@ -0,0 +1,26 @@
//
// AppsFlyerConsent.h
// AppsFlyerLib
//
// Created by Veronica Belyakov on 14/01/2024.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface AppsFlyerConsent : NSObject <NSCoding>
@property (nonatomic, readonly, assign) BOOL isUserSubjectToGDPR;
@property (nonatomic, readonly, assign) BOOL hasConsentForDataUsage;
@property (nonatomic, readonly, assign) BOOL hasConsentForAdsPersonalization;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)initForGDPRUserWithHasConsentForDataUsage:(BOOL)hasConsentForDataUsage
hasConsentForAdsPersonalization:(BOOL)hasConsentForAdsPersonalization NS_DESIGNATED_INITIALIZER;
- (instancetype)initNonGDPRUser NS_DESIGNATED_INITIALIZER;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,49 @@
//
// CrossPromotionHelper.h
// AppsFlyerLib
//
// Created by Gil Meroz on 27/01/2017.
//
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
AppsFlyer allows you to log and attribute installs originating
from cross promotion campaigns of your existing apps.
Afterwards, you can optimize on your cross-promotion traffic to get even better results.
*/
@interface AppsFlyerCrossPromotionHelper : NSObject
/**
To log an impression use the following API call.
Make sure to use the promoted App ID as it appears within the AppsFlyer dashboard.
@param appID Promoted App ID
@param campaign A campaign name
@param parameters Additional params like `@{@"af_sub1": @"val", @"custom_param": @"val2" }`
*/
+ (void)logCrossPromoteImpression:(nonnull NSString *)appID
campaign:(nullable NSString *)campaign
parameters:(nullable NSDictionary *)parameters;
/**
iOS allows you to utilize the StoreKit component to open
the App Store while remaining in the context of your app.
More details at https://support.appsflyer.com/hc/en-us/articles/115004481946-Cross-Promotion-Tracking#tracking-cross-promotion-impressions
@param appID Promoted App ID
@param campaign A campaign name
@param parameters Additional params like `@{@"af_sub1": @"val", @"custom_param": @"val2" }`
@param openStoreBlock Contains promoted `clickURL`
*/
+ (void)logAndOpenStore:(nonnull NSString *)appID
campaign:(nullable NSString *)campaign
parameters:(nullable NSDictionary *)parameters
openStore:(void (^)(NSURLSession *urlSession, NSURL *clickURL))openStoreBlock;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,36 @@
//
// AFSDKDeeplink.h
// AppsFlyerLib
//
// Created by Andrii Hahan on 20.08.2020.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
NS_SWIFT_NAME(DeepLink)
@interface AppsFlyerDeepLink : NSObject
- (nonnull instancetype)init NS_UNAVAILABLE;
+ (nonnull instancetype)new NS_UNAVAILABLE;
@property (readonly, nonnull) NSDictionary<NSString *, id> *clickEvent;
@property (readonly, nullable) NSString *deeplinkValue;
@property (readonly, nullable) NSString *matchType;
@property (readonly, nullable) NSString *clickHTTPReferrer;
@property (readonly, nullable) NSString *mediaSource;
@property (readonly, nullable) NSString *campaign;
@property (readonly, nullable) NSString *campaignId;
@property (readonly, nullable) NSString *afSub1;
@property (readonly, nullable) NSString *afSub2;
@property (readonly, nullable) NSString *afSub3;
@property (readonly, nullable) NSString *afSub4;
@property (readonly, nullable) NSString *afSub5;
@property (readonly) BOOL isDeferred;
- (NSString *)toString;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,29 @@
//
// AFSDKDeeplinkResult.h
// AppsFlyerLib
//
// Created by Andrii Hahan on 20.08.2020.
//
#import <Foundation/Foundation.h>
@class AppsFlyerDeepLink;
typedef NS_CLOSED_ENUM(NSUInteger, AFSDKDeepLinkResultStatus) {
AFSDKDeepLinkResultStatusNotFound,
AFSDKDeepLinkResultStatusFound,
AFSDKDeepLinkResultStatusFailure,
} NS_SWIFT_NAME(DeepLinkResultStatus);
NS_SWIFT_NAME(DeepLinkResult)
@interface AppsFlyerDeepLinkResult : NSObject
- (nonnull instancetype)init NS_UNAVAILABLE;
+ (nonnull instancetype)new NS_UNAVAILABLE;
@property(readonly) AFSDKDeepLinkResultStatus status;
@property(readonly, nullable) AppsFlyerDeepLink *deepLink;
@property(readonly, nullable) NSError *error;
@end

View File

@@ -0,0 +1,742 @@
//
// AppsFlyerLib.h
// AppsFlyerLib
//
// AppsFlyer iOS SDK 6.14.4 (186)
// Copyright (c) 2012-2023 AppsFlyer Ltd. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AppsFlyerLib/AppsFlyerCrossPromotionHelper.h>
#import <AppsFlyerLib/AppsFlyerShareInviteHelper.h>
#import <AppsFlyerLib/AppsFlyerDeepLinkResult.h>
#import <AppsFlyerLib/AppsFlyerDeepLink.h>
#import <AppsFlyerLib/AppsFlyerConsent.h>
#import <AppsFlyerLib/AFSDKPurchaseDetails.h>
#import <AppsFlyerLib/AFSDKValidateAndLogResult.h>
NS_ASSUME_NONNULL_BEGIN
// In app event names constants
#define AFEventLevelAchieved @"af_level_achieved"
#define AFEventAddPaymentInfo @"af_add_payment_info"
#define AFEventAddToCart @"af_add_to_cart"
#define AFEventAddToWishlist @"af_add_to_wishlist"
#define AFEventCompleteRegistration @"af_complete_registration"
#define AFEventTutorial_completion @"af_tutorial_completion"
#define AFEventInitiatedCheckout @"af_initiated_checkout"
#define AFEventPurchase @"af_purchase"
#define AFEventRate @"af_rate"
#define AFEventSearch @"af_search"
#define AFEventSpentCredits @"af_spent_credits"
#define AFEventAchievementUnlocked @"af_achievement_unlocked"
#define AFEventContentView @"af_content_view"
#define AFEventListView @"af_list_view"
#define AFEventTravelBooking @"af_travel_booking"
#define AFEventShare @"af_share"
#define AFEventInvite @"af_invite"
#define AFEventLogin @"af_login"
#define AFEventReEngage @"af_re_engage"
#define AFEventUpdate @"af_update"
#define AFEventOpenedFromPushNotification @"af_opened_from_push_notification"
#define AFEventLocation @"af_location_coordinates"
#define AFEventCustomerSegment @"af_customer_segment"
#define AFEventSubscribe @"af_subscribe"
#define AFEventStartTrial @"af_start_trial"
#define AFEventAdClick @"af_ad_click"
#define AFEventAdView @"af_ad_view"
// In app event parameter names
#define AFEventParamContent @"af_content"
#define AFEventParamAchievementId @"af_achievement_id"
#define AFEventParamLevel @"af_level"
#define AFEventParamScore @"af_score"
#define AFEventParamSuccess @"af_success"
#define AFEventParamPrice @"af_price"
#define AFEventParamContentType @"af_content_type"
#define AFEventParamContentId @"af_content_id"
#define AFEventParamContentList @"af_content_list"
#define AFEventParamCurrency @"af_currency"
#define AFEventParamQuantity @"af_quantity"
#define AFEventParamRegistrationMethod @"af_registration_method"
#define AFEventParamPaymentInfoAvailable @"af_payment_info_available"
#define AFEventParamMaxRatingValue @"af_max_rating_value"
#define AFEventParamRatingValue @"af_rating_value"
#define AFEventParamSearchString @"af_search_string"
#define AFEventParamDateA @"af_date_a"
#define AFEventParamDateB @"af_date_b"
#define AFEventParamDestinationA @"af_destination_a"
#define AFEventParamDestinationB @"af_destination_b"
#define AFEventParamDescription @"af_description"
#define AFEventParamClass @"af_class"
#define AFEventParamEventStart @"af_event_start"
#define AFEventParamEventEnd @"af_event_end"
#define AFEventParamLat @"af_lat"
#define AFEventParamLong @"af_long"
#define AFEventParamCustomerUserId @"af_customer_user_id"
#define AFEventParamValidated @"af_validated"
#define AFEventParamRevenue @"af_revenue"
#define AFEventProjectedParamRevenue @"af_projected_revenue"
#define AFEventParamReceiptId @"af_receipt_id"
#define AFEventParamTutorialId @"af_tutorial_id"
#define AFEventParamVirtualCurrencyName @"af_virtual_currency_name"
#define AFEventParamDeepLink @"af_deep_link"
#define AFEventParamOldVersion @"af_old_version"
#define AFEventParamNewVersion @"af_new_version"
#define AFEventParamReviewText @"af_review_text"
#define AFEventParamCouponCode @"af_coupon_code"
#define AFEventParamOrderId @"af_order_id"
#define AFEventParam1 @"af_param_1"
#define AFEventParam2 @"af_param_2"
#define AFEventParam3 @"af_param_3"
#define AFEventParam4 @"af_param_4"
#define AFEventParam5 @"af_param_5"
#define AFEventParam6 @"af_param_6"
#define AFEventParam7 @"af_param_7"
#define AFEventParam8 @"af_param_8"
#define AFEventParam9 @"af_param_9"
#define AFEventParam10 @"af_param_10"
#define AFEventParamTouch @"af_touch_obj"
#define AFEventParamDepartingDepartureDate @"af_departing_departure_date"
#define AFEventParamReturningDepartureDate @"af_returning_departure_date"
#define AFEventParamDestinationList @"af_destination_list" //array of string
#define AFEventParamCity @"af_city"
#define AFEventParamRegion @"af_region"
#define AFEventParamCountry @"af_country"
#define AFEventParamDepartingArrivalDate @"af_departing_arrival_date"
#define AFEventParamReturningArrivalDate @"af_returning_arrival_date"
#define AFEventParamSuggestedDestinations @"af_suggested_destinations" //array of string
#define AFEventParamTravelStart @"af_travel_start"
#define AFEventParamTravelEnd @"af_travel_end"
#define AFEventParamNumAdults @"af_num_adults"
#define AFEventParamNumChildren @"af_num_children"
#define AFEventParamNumInfants @"af_num_infants"
#define AFEventParamSuggestedHotels @"af_suggested_hotels" //array of string
#define AFEventParamUserScore @"af_user_score"
#define AFEventParamHotelScore @"af_hotel_score"
#define AFEventParamPurchaseCurrency @"af_purchase_currency"
#define AFEventParamPreferredStarRatings @"af_preferred_star_ratings" //array of int (basically a tuple (min,max) but we'll use array of int and instruct the developer to use two values)
#define AFEventParamPreferredPriceRange @"af_preferred_price_range" //array of int (basically a tuple (min,max) but we'll use array of int and instruct the developer to use two values)
#define AFEventParamPreferredNeighborhoods @"af_preferred_neighborhoods" //array of string
#define AFEventParamPreferredNumStops @"af_preferred_num_stops"
#define AFEventParamAdRevenueAdType @"af_adrev_ad_type"
#define AFEventParamAdRevenueNetworkName @"af_adrev_network_name"
#define AFEventParamAdRevenuePlacementId @"af_adrev_placement_id"
#define AFEventParamAdRevenueAdSize @"af_adrev_ad_size"
#define AFEventParamAdRevenueMediatedNetworkName @"af_adrev_mediated_network_name"
/// Mail hashing type
typedef enum {
/// None
EmailCryptTypeNone = 0,
/// SHA256
EmailCryptTypeSHA256 = 3
} EmailCryptType;
typedef NS_CLOSED_ENUM(NSInteger, AFSDKPlugin) {
AFSDKPluginIOSNative,
AFSDKPluginUnity,
AFSDKPluginFlutter,
AFSDKPluginReactNative,
AFSDKPluginAdobeAir,
AFSDKPluginAdobeMobile,
AFSDKPluginCocos2dx,
AFSDKPluginCordova,
AFSDKPluginMparticle,
AFSDKPluginNativeScript,
AFSDKPluginExpo,
AFSDKPluginUnreal,
AFSDKPluginXamarin,
AFSDKPluginCapacitor,
AFSDKPluginSegment,
AFSDKPluginAdobeSwiftAEP
} NS_SWIFT_NAME(Plugin);
NS_SWIFT_NAME(DeepLinkDelegate)
@protocol AppsFlyerDeepLinkDelegate <NSObject>
@optional
- (void)didResolveDeepLink:(AppsFlyerDeepLinkResult *_Nonnull)result;
@end
/**
Conform and subscribe to this protocol to allow getting data about conversion and
install attribution
*/
@protocol AppsFlyerLibDelegate <NSObject>
/**
`conversionInfo` contains information about install.
Organic/non-organic, etc.
@param conversionInfo May contain <code>null</code> values for some keys. Please handle this case.
*/
- (void)onConversionDataSuccess:(NSDictionary *)conversionInfo;
/**
Any errors that occurred during the conversion request.
*/
- (void)onConversionDataFail:(NSError *)error;
@optional
/**
`attributionData` contains information about OneLink, deeplink.
*/
- (void)onAppOpenAttribution:(NSDictionary *)attributionData;
/**
Any errors that occurred during the attribution request.
*/
- (void)onAppOpenAttributionFailure:(NSError *)error;
/**
@abstract Sets the HTTP header fields of the ESP resolving to the given
dictionary.
@discussion This method replaces all header fields that may have
existed before this method ESP resolving call.
To keep default SDK behavior - return nil;
*/
- (NSDictionary <NSString *, NSString *> * _Nullable)allHTTPHeaderFieldsForResolveDeepLinkURL:(NSURL *)URL;
@end
/**
You can log installs, app updates, sessions and additional in-app events
(including in-app purchases, game levels, etc.)
to evaluate ROI and user engagement.
The iOS SDK is compatible with all iOS/tvOS devices with iOS version 7 and above.
@see [SDK Integration Validator](https://support.appsflyer.com/hc/en-us/articles/207032066-AppsFlyer-SDK-Integration-iOS)
for more information.
*/
@interface AppsFlyerLib : NSObject
/**
Gets the singleton instance of the AppsFlyerLib class, creating it if
necessary.
@return The singleton instance of AppsFlyerLib.
*/
+ (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 AppsFlyers unique ID and the other devices IDs
*/
@property(nonatomic, strong, nullable) NSString * customerUserID;
/**
In case you use custom data and you want to receive it in the raw reports.
@see [Setting additional custom data](https://support.appsflyer.com/hc/en-us/articles/207032066-AppsFlyer-SDK-Integration-iOS#setting-additional-custom-data) for more information.
*/
@property(nonatomic, strong, nullable, setter = setAdditionalData:) NSDictionary * customData;
/**
Use this property to set your AppsFlyer's dev key
*/
@property(nonatomic, strong) NSString * appsFlyerDevKey;
/**
Use this property to set your app's Apple ID(taken from the app's page on iTunes Connect)
*/
@property(nonatomic, strong) NSString * appleAppID;
#ifndef AFSDK_NO_IDFA
/**
AppsFlyer SDK collect Apple's `advertisingIdentifier` if the `AdSupport.framework` included in the SDK.
You can disable this behavior by setting the following property to YES
*/
@property(nonatomic) BOOL disableAdvertisingIdentifier;
@property(nonatomic, strong, readonly) NSString *advertisingIdentifier;
/**
Waits for request user authorization to access app-related data
*/
- (void)waitForATTUserAuthorizationWithTimeoutInterval:(NSTimeInterval)timeoutInterval
NS_SWIFT_NAME(waitForATTUserAuthorization(timeoutInterval:));
#endif
@property(nonatomic) BOOL disableSKAdNetwork;
/**
In case of in app purchase events, you can set the currency code your user has purchased with.
The currency code is a 3 letter code according to ISO standards
Objective-C:
<pre>
[[AppsFlyerLib shared] setCurrencyCode:@"USD"];
</pre>
Swift:
<pre>
AppsFlyerLib.shared().currencyCode = "USD"
</pre>
*/
@property(nonatomic, strong, nullable) NSString *currencyCode;
/**
Prints SDK messages to the console log. This property should only be used in `DEBUG` mode.
The default value is `NO`
*/
@property(nonatomic) BOOL isDebug;
/**
Set this flag to `YES`, to collect the current device name(e.g. "My iPhone"). Default value is `NO`
*/
@property(nonatomic) BOOL shouldCollectDeviceName;
/**
Set your `OneLink ID` from OneLink configuration. Used in User Invites to generate a OneLink.
*/
@property(nonatomic, strong, nullable, setter = setAppInviteOneLink:) NSString * appInviteOneLinkID;
/**
Opt-out logging for specific user
*/
@property(atomic) BOOL anonymizeUser;
/**
Opt-out for Apple Search Ads attributions
*/
@property(atomic) BOOL disableCollectASA;
/**
Disable Apple Ads Attribution API +[AAAtribution attributionTokenWithError:]
*/
@property(nonatomic) BOOL disableAppleAdsAttribution;
/**
AppsFlyer delegate. See `AppsFlyerLibDelegate`
*/
@property(weak, nonatomic) id<AppsFlyerLibDelegate> delegate;
@property(weak, nonatomic) id<AppsFlyerDeepLinkDelegate> deepLinkDelegate;
/**
In app purchase receipt validation Apple environment(production or sandbox). The default value is NO
*/
@property(nonatomic) BOOL useReceiptValidationSandbox;
/**
Set this flag to test uninstall on Apple environment(production or sandbox). The default value is NO
*/
@property(nonatomic) BOOL useUninstallSandbox;
/**
For advertisers who wrap OneLink within another Universal Link.
An advertiser will be able to deeplink from a OneLink wrapped within another Universal Link and also log this retargeting conversion.
Objective-C:
<pre>
[[AppsFlyerLib shared] setResolveDeepLinkURLs:@[@"domain.com", @"subdomain.domain.com"]];
</pre>
*/
@property(nonatomic, nullable, copy) NSArray<NSString *> *resolveDeepLinkURLs;
/**
For advertisers who use vanity OneLinks.
Objective-C:
<pre>
[[AppsFlyerLib shared] oneLinkCustomDomains:@[@"domain.com", @"subdomain.domain.com"]];
</pre>
*/
@property(nonatomic, nullable, copy) NSArray<NSString *> *oneLinkCustomDomains;
/*
* Set phone number for each `start` event. `phoneNumber` will be sent as SHA256 string
*/
@property(nonatomic, nullable, copy) NSString *phoneNumber;
- (NSString *)phoneNumber UNAVAILABLE_ATTRIBUTE;
/**
To disable app's vendor identifier(IDFV), set disableIDFVCollection to true
*/
@property(nonatomic) BOOL disableIDFVCollection;
/**
Set the language of the device. The data will be displayed in Raw Data Reports
Objective-C:
<pre>
[[AppsFlyerLib shared] setCurrentDeviceLanguage:@"EN"]
</pre>
Swift:
<pre>
AppsFlyerLib.shared().currentDeviceLanguage("EN")
</pre>
*/
@property(nonatomic, nullable, copy) 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.
This API must be invoked prior to initializing the AppsFlyer SDK in order to function properly.
Objective-C:
<pre>
[[AppsFlyerLib shared] enableFacebookDeferredApplinksWithClass:[FBSDKAppLinkUtility class]]
</pre>
Swift:
<pre>
AppsFlyerLib.shared().enableFacebookDeferredApplinks(with: FBSDKAppLinkUtility.self)
</pre>
@param facebookAppLinkUtilityClass requeries method call `[FBSDKAppLinkUtility class]` as param.
*/
- (void)enableFacebookDeferredApplinksWithClass:(Class _Nullable)facebookAppLinkUtilityClass;
/**
Use this to send the user's emails
@param userEmails The list of strings that hold mails
@param type Hash algoritm
*/
- (void)setUserEmails:(NSArray<NSString *> * _Nullable)userEmails withCryptType:(EmailCryptType)type;
/**
Start SDK session
Add the following method at the `applicationDidBecomeActive` in AppDelegate class
*/
- (void)start;
- (void)startWithCompletionHandler:(void (^ _Nullable)(NSDictionary<NSString *, id> * _Nullable dictionary, NSError * _Nullable error))completionHandler;
/**
Use this method to log an events with multiple values. See AppsFlyer's documentation for details.
Objective-C:
<pre>
[[AppsFlyerLib shared] logEvent:AFEventPurchase
withValues: @{AFEventParamRevenue : @200,
AFEventParamCurrency : @"USD",
AFEventParamQuantity : @2,
AFEventParamContentId: @"092",
AFEventParamReceiptId: @"9277"}];
</pre>
Swift:
<pre>
AppsFlyerLib.shared().logEvent(AFEventPurchase,
withValues: [AFEventParamRevenue : "1200",
AFEventParamContent : "shoes",
AFEventParamContentId: "123"])
</pre>
@param eventName Contains name of event that could be provided from predefined constants in `AppsFlyerLib.h`
@param values Contains dictionary of values for handling by backend
*/
- (void)logEvent:(NSString *)eventName withValues:(NSDictionary * _Nullable)values;
- (void)logEventWithEventName:(NSString *)eventName
eventValues:(NSDictionary<NSString * , id> * _Nullable)eventValues
completionHandler:(void (^ _Nullable)(NSDictionary<NSString *, id> * _Nullable dictionary, NSError * _Nullable error))completionHandler
NS_SWIFT_NAME(logEvent(name:values:completionHandler:));
/**
To log and validate in app purchases you can call this method from the completeTransaction: method on
your `SKPaymentTransactionObserver`.
@param productIdentifier The product identifier
@param price The product price
@param currency The product currency
@param transactionId The purchase transaction Id
@param params The additional param, which you want to receive it in the raw reports
@param successBlock The success callback
@param failedBlock The failure callback
*/
- (void)validateAndLogInAppPurchase:(NSString * _Nullable)productIdentifier
price:(NSString * _Nullable)price
currency:(NSString * _Nullable)currency
transactionId:(NSString * _Nullable)transactionId
additionalParameters:(NSDictionary * _Nullable)params
success:(void (^ _Nullable)(NSDictionary * response))successBlock
failure:(void (^ _Nullable)(NSError * _Nullable error, id _Nullable reponse))failedBlock NS_AVAILABLE(10_7, 7_0);
typedef void (^AFSDKValidateAndLogCompletion)(AFSDKValidateAndLogResult * _Nullable result);
/**
To log and validate in app purchases you can call this method from the completeTransaction: method on
your `SKPaymentTransactionObserver`.
@param details The product details
@param extraEventValues The additional param, which you want to receive it in the raw reports
@param completionHandler The callback
*/
- (void)validateAndLogInAppPurchase:(AFSDKPurchaseDetails *)details
extraEventValues:(NSDictionary * _Nullable)extraEventValues
completionHandler:(AFSDKValidateAndLogCompletion)completionHandler NS_AVAILABLE(10_7, 7_0);
/**
To log location for geo-fencing. Does the same as code below.
<pre>
AppsFlyerLib.shared().logEvent(AFEventLocation, withValues: [AFEventParamLong:longitude, AFEventParamLat:latitude])
</pre>
@param longitude The location longitude
@param latitude The location latitude
*/
- (void)logLocation:(double)longitude latitude:(double)latitude NS_SWIFT_NAME(logLocation(longitude:latitude:));
/**
This method returns AppsFlyer's internal id(unique for your app)
@return Internal AppsFlyer Id
*/
- (NSString *)getAppsFlyerUID;
/**
In case you want to log deep linking. Does the same as `-handleOpenURL:sourceApplication:withAnnotation`.
@warning Preferred to use `-handleOpenURL:sourceApplication:withAnnotation`.
@param url The URL that was passed to your AppDelegate.
@param sourceApplication The sourceApplication that passed to your AppDelegate.
*/
- (void)handleOpenURL:(NSURL * _Nullable)url sourceApplication:(NSString * _Nullable)sourceApplication API_UNAVAILABLE(macos);
/**
In case you want to log deep linking.
Call this method from inside your AppDelegate `-application:openURL:sourceApplication:annotation:`
@param url The URL that was passed to your AppDelegate.
@param sourceApplication The sourceApplication that passed to your AppDelegate.
@param annotation The annotation that passed to your app delegate.
*/
- (void)handleOpenURL:(NSURL * _Nullable)url
sourceApplication:(NSString * _Nullable)sourceApplication
withAnnotation:(id _Nullable)annotation API_UNAVAILABLE(macos);
/**
Call this method from inside of your AppDelegate `-application:openURL:options:` method.
This method is functionally the same as calling the AppsFlyer method
`-handleOpenURL:sourceApplication:withAnnotation`.
@param url The URL that was passed to your app delegate
@param options The options dictionary that was passed to your AppDelegate.
*/
- (void)handleOpenUrl:(NSURL * _Nullable)url options:(NSDictionary * _Nullable)options API_UNAVAILABLE(macos);
/**
Allow AppsFlyer to handle restoration from an NSUserActivity.
Use this method to log deep links with OneLink.
@param userActivity The NSUserActivity that caused the app to be opened.
*/
- (BOOL)continueUserActivity:(NSUserActivity * _Nullable)userActivity
restorationHandler:(void (^ _Nullable)(NSArray * _Nullable))restorationHandler NS_AVAILABLE_IOS(9_0) API_UNAVAILABLE(macos);
/**
Enable AppsFlyer to handle a push notification.
@see [Learn more here](https://support.appsflyer.com/hc/en-us/articles/207364076-Measuring-Push-Notification-Re-Engagement-Campaigns)
@warning To make it work - set data, related to AppsFlyer under key @"af".
@param pushPayload The `userInfo` from received remote notification. One of root keys should be @"af".
*/
- (void)handlePushNotification:(NSDictionary * _Nullable)pushPayload;
/**
Register uninstall - you should register for remote notification and provide AppsFlyer the push device token.
@param deviceToken The `deviceToken` from `-application:didRegisterForRemoteNotificationsWithDeviceToken:`
*/
- (void)registerUninstall:(NSData * _Nullable)deviceToken;
/**
Get SDK version.
@return The AppsFlyer SDK version info.
*/
- (NSString *)getSDKVersion;
/**
This is for internal use.
*/
- (void)remoteDebuggingCallWithData:(NSString *)data;
/**
This is for internal use.
*/
- (void)remoteDebuggingCallV2WithData:(NSString *)dataAsString;
/**
Used to force the trigger `onAppOpenAttribution` delegate.
Notice, re-engagement, session and launch won't be counted.
Only for OneLink/UniversalLink/Deeplink resolving.
@param URL The param to resolve into -[AppsFlyerLibDelegate onAppOpenAttribution:]
*/
- (void)performOnAppAttributionWithURL:(NSURL * _Nullable)URL;
/**
@brief This property accepts a string value representing the host name for all endpoints.
Can be used to Zero rate your applications data usage. Contact your CSM for more information.
@warning To use `default` SDK endpoint set value to `nil`.
Objective-C:
<pre>
[[AppsFlyerLib shared] setHost:@"example.com"];
</pre>
Swift:
<pre>
AppsFlyerLib.shared().host = "example.com"
</pre>
*/
@property(nonatomic, strong, readonly) NSString *host;
/**
* This function set the host name and prefix host name for all the endpoints
**/
- (void)setHost:(NSString *)host withHostPrefix:(NSString *)hostPrefix;
/**
* This property accepts a string value representing the prefix host name for all endpoints.
* for example "test" prefix with default host name will have the address "host.appsflyer.com"
*/
@property(nonatomic, strong, readonly) NSString *hostPrefix;
/**
This property is responsible for timeout between sessions in seconds.
Default value is 5 seconds.
*/
@property(atomic) NSUInteger minTimeBetweenSessions;
/**
API to shut down all SDK activities.
@warning This will disable all requests from AppsFlyer SDK.
*/
@property(atomic) BOOL isStopped;
/**
API to set manually Facebook deferred app link
*/
@property(nonatomic, nullable, copy) NSURL *facebookDeferredAppLink;
/**
Block an events from being shared with ad networks and other 3rd party integrations
Must only include letters/digits or underscore, maximum length: 45
*/
@property(nonatomic, nullable, copy) NSArray<NSString *> *sharingFilter DEPRECATED_MSG_ATTRIBUTE("starting SDK version 6.4.0, please use `setSharingFilterForPartners:`");
@property(nonatomic) NSUInteger deepLinkTimeout;
/**
Block an events from being shared with any partner
This method overwrite -[AppsFlyerLib setSharingFilter:]
*/
- (void)setSharingFilterForAllPartners DEPRECATED_MSG_ATTRIBUTE("starting SDK version 6.4.0, please use `setSharingFilterForPartners:`");
/**
Block an events from being shared with ad networks and other 3rd party integrations
Must only include letters/digits or underscore, maximum length: 45
The sharing filter is cleared in case if `nil` or empty array passed as a parameter.
"all" keyword sets sharing filter for ALL partners, it is case insencitive and has highest priority
if passed along with another values. For example, if ["all", "examplePartner1_int", "examplePartner2_int" ] passed,
the sharing filter will be set for ALL partners.
*/
- (void)setSharingFilterForPartners:(NSArray<NSString *> * _Nullable)sharingFilter;
/**
Sets or updates the user consent data related to GDPR and DMA regulations for advertising and data usage
purposes within the application. This method must be invoked with the user's current consent status each
time the app starts or whenever there is a change in the user's consent preferences.
Note that this method does not persist the consent data across app sessions; it only applies for the
duration of the current app session. If you wish to stop providing the consent data, you should
cease calling this method.
@param consent an instance of AppsFlyerConsent that encapsulates the user's consent information.
*/
- (void)setConsentData:(AppsFlyerConsent *)consent;
/**
Enable the SDK to collect and send TCF data
@param shouldCollectConsentData indicates if the TCF data collection is enabled.
*/
- (void)enableTCFDataCollection:(BOOL)shouldCollectConsentData;
/**
Validate if URL contains certain string and append quiery
parameters to deeplink URL. In case if URL does not contain user-defined string,
parameters are not appended to the url.
@param containsString string to check in URL.
@param parameters NSDictionary, which containins parameters to append to the deeplink url after it passed validation.
*/
- (void)appendParametersToDeepLinkingURLWithString:(NSString *)containsString
parameters:(NSDictionary<NSString *, NSString*> *)parameters
NS_SWIFT_NAME(appendParametersToDeeplinkURL(contains:parameters:));
/**
Adds array of keys, which are used to compose key path
to resolve deeplink from push notification payload `userInfo`.
@param deepLinkPath an array of strings which contains keys to search for deeplink in payload.
*/
- (void)addPushNotificationDeepLinkPath:(NSArray<NSString *> *)deepLinkPath;
/**
* Allows sending custom data for partner integration purposes.
*
* @param partnerId ID of the partner (usually has "_int" suffix)
* @param partnerInfo customer data, depends on the integration nature with specific partner
*/
- (void)setPartnerDataWithPartnerId:(NSString * _Nullable)partnerId partnerInfo:(NSDictionary<NSString *, id> * _Nullable)partnerInfo
NS_SWIFT_NAME(setPartnerData(partnerId:partnerInfo:));
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,52 @@
//
// LinkGenerator.h
// AppsFlyerLib
//
// Created by Gil Meroz on 27/01/2017.
//
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
Payload container for the `generateInviteUrlWithLinkGenerator:completionHandler:` from `AppsFlyerShareInviteHelper`
*/
@interface AppsFlyerLinkGenerator : NSObject
/// Instance initialization is not allowed. Use generated instance
/// from `-[AppsFlyerShareInviteHelper generateInviteUrlWithLinkGenerator:completionHandler]`
- (instancetype)init NS_UNAVAILABLE;
/// Instance initialization is not allowed. Use generated instance
/// from `-[AppsFlyerShareInviteHelper generateInviteUrlWithLinkGenerator:completionHandler]`
+ (instancetype)new NS_UNAVAILABLE;
@property(nonatomic, nullable, copy) NSString *brandDomain;
/// The channel through which the invite was sent (e.g. Facebook/Gmail/etc.). Usage: Recommended
- (void)setChannel :(nonnull NSString *)channel;
/// ReferrerCustomerId setter
- (void)setReferrerCustomerId:(nonnull NSString *)referrerCustomerId;
/// A campaign name. Usage: Optional
- (void)setCampaign :(nonnull NSString *)campaign;
/// ReferrerUID setter
- (void)setReferrerUID :(nonnull NSString *)referrerUID;
/// Referrer name
- (void)setReferrerName :(nonnull NSString *)referrerName;
/// The URL to referrer user avatar. Usage: Optional
- (void)setReferrerImageURL :(nonnull NSString *)referrerImageURL;
/// AppleAppID
- (void)setAppleAppID :(nonnull NSString *)appleAppID;
/// Deeplink path
- (void)setDeeplinkPath :(nonnull NSString *)deeplinkPath;
/// Base deeplink path
- (void)setBaseDeeplink :(nonnull NSString *)baseDeeplink;
/// A single key value custom parameter. Usage: Optional
- (void)addParameterValue :(nonnull NSString *)value forKey:(NSString *)key;
/// Multiple key value custom parameters. Usage: Optional
- (void)addParameters :(nonnull NSDictionary *)parameters;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,35 @@
//
// ShareInviteHelper.h
// AppsFlyerLib
//
// Created by Gil Meroz on 27/01/2017.
//
//
#import <Foundation/Foundation.h>
#import <AppsFlyerLib/AppsFlyerLinkGenerator.h>
/**
AppsFlyerShareInviteHelper
*/
@interface AppsFlyerShareInviteHelper : NSObject
NS_ASSUME_NONNULL_BEGIN
/**
* The AppsFlyerShareInviteHelper class builds the invite URL according to various setter methods
* which allow passing on additional information on the click.
* This information is available through `onConversionDataReceived:` when the user accepts the invite and installs the app.
* In addition, campaign and channel parameters are visible within the AppsFlyer Dashboard.
*/
+ (void)generateInviteUrlWithLinkGenerator:(AppsFlyerLinkGenerator *(^)(AppsFlyerLinkGenerator *generator))generatorCreator completionHandler:(void (^)(NSURL *_Nullable url))completionHandler;
/**
* It is recommended to generate an in-app event after the invite is sent to log the invites from the senders' perspective.
* This enables you to find the users that tend most to invite friends, and the media sources that get you these users.
*/
+ (void)logInvite:(nullable NSString *)channel parameters:(nullable NSDictionary *)parameters;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,6 @@
framework module AppsFlyerLib {
umbrella header "AppsFlyerLib.h"
export *
module * { export * }
}

View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeDeviceID</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<true/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<true/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising</string>
</array>
</dict>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeProductInteraction</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
</array>
</dict>
</array>
<key>NSPrivacyTrackingDomains</key>
<array>
<string>att-attr.whappsflyer.com</string>
<string>att-attr.appsflyer-cn.com</string>
<string>att-attr.hevents.appsflyer-cn.com</string>
<string>att-launches.whappsflyer.com</string>
<string>att-launches.appsflyer-cn.com</string>
<string>att-launches.hevents.appsflyer-cn.com</string>
<string>att-conversions.hevents.appsflyer-cn.com</string>
<string>att-conversions.appsflyer-cn.com</string>
<string>att-conversions.whappsflyer.com</string>
<string>att-dlsdk.hevents.appsflyer-cn.com</string>
<string>att-dlsdk.appsflyer-cn.com</string>
<string>att-dlsdk.whappsflyer.com</string>
<string>att-dlsdk.appsflyersdk.com</string>
<string>att-conversions.appsflyersdk.com</string>
<string>att-launches.appsflyersdk.com</string>
<string>att-attr.appsflyersdk.com</string>
</array>
<key>NSPrivacyTracking</key>
<true/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
</dict>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
</dict>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,50 @@
//
// AppsFlyeriOSWarpper.h
// Unity-iPhone
//
// Created by Jonathan Wesfield on 24/07/2019.
//
#import "AFUnityUtils.mm"
#import "UnityAppController.h"
#import "AppsFlyerAttribution.h"
#if __has_include(<AppsFlyerLib/AppsFlyerLib.h>)
#import <AppsFlyerLib/AppsFlyerLib.h>
#else
#import "AppsFlyerLib.h"
#endif
@interface AppsFlyeriOSWarpper : NSObject <AppsFlyerLibDelegate, AppsFlyerDeepLinkDelegate>
+ (BOOL) didCallStart;
+ (void) setDidCallStart:(BOOL)val;
@end
static AppsFlyeriOSWarpper *_AppsFlyerdelegate;
static const int kPushNotificationSize = 32;
static NSString* ConversionDataCallbackObject = @"AppsFlyerObject";
static const char* VALIDATE_CALLBACK = "didFinishValidateReceipt";
static const char* VALIDATE_ERROR_CALLBACK = "didFinishValidateReceiptWithError";
static const char* GCD_CALLBACK = "onConversionDataSuccess";
static const char* GCD_ERROR_CALLBACK = "onConversionDataFail";
static const char* OAOA_CALLBACK = "onAppOpenAttribution";
static const char* OAOA_ERROR_CALLBACK = "onAppOpenAttributionFailure";
static const char* GENERATE_LINK_CALLBACK = "onInviteLinkGenerated";
static const char* OPEN_STORE_LINK_CALLBACK = "onOpenStoreLinkGenerated";
static const char* START_REQUEST_CALLBACK = "requestResponseReceived";
static const char* IN_APP_RESPONSE_CALLBACK = "inAppResponseReceived";
static const char* ON_DEEPLINKING = "onDeepLinking";
static const char* VALIDATE_AND_LOG_V2_CALLBACK = "onValidateAndLogComplete";
static const char* VALIDATE_AND_LOG_V2_ERROR_CALLBACK = "onValidateAndLogFailure";
static NSString* validateObjectName = @"";
static NSString* openStoreObjectName = @"";
static NSString* generateInviteObjectName = @"";
static NSString* validateAndLogObjectName = @"";
static NSString* startRequestObjectName = @"";
static NSString* inAppRequestObjectName = @"";
static NSString* onDeeplinkingObjectName = @"";

View File

@@ -0,0 +1,27 @@
fileFormatVersion: 2
guid: 147104b04b5794eaa92b4195cc328e13
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,370 @@
//
// AppsFlyeriOSWarpper.mm
// Unity-iPhone
//
// Created by Jonathan Wesfield on 24/07/2019.
//
#import "AppsFlyeriOSWrapper.h"
static void unityCallBack(NSString* objectName, const char* method, const char* msg) {
if(objectName){
UnitySendMessage([objectName UTF8String], method, msg);
}
}
extern "C" {
const void _startSDK(bool shouldCallback, const char* objectName) {
[[AppsFlyerLib shared] setPluginInfoWith: AFSDKPluginUnity
pluginVersion:@"6.14.5"
additionalParams:nil];
startRequestObjectName = stringFromChar(objectName);
AppsFlyeriOSWarpper.didCallStart = YES;
[AppsFlyerAttribution shared].isBridgeReady = YES;
[[NSNotificationCenter defaultCenter] postNotificationName:AF_BRIDGE_SET object: [AppsFlyerAttribution shared]];
[[AppsFlyerLib shared] startWithCompletionHandler:^(NSDictionary<NSString *,id> *dictionary, NSError *error) {
if(shouldCallback){
if (error) {
NSDictionary *callbackDictionary = @{@"statusCode":[NSNumber numberWithLong:[error code]]};
unityCallBack(startRequestObjectName, START_REQUEST_CALLBACK, stringFromdictionary(callbackDictionary));
return;
}
if (dictionary) {
unityCallBack(startRequestObjectName, START_REQUEST_CALLBACK, stringFromdictionary(dictionary));
return;
}
}
}];
}
const void _setCustomerUserID (const char* customerUserID) {
[[AppsFlyerLib shared] setCustomerUserID:stringFromChar(customerUserID)];
}
const void _setAdditionalData (const char* customData) {
[[AppsFlyerLib shared] setAdditionalData:dictionaryFromJson(customData)];
}
const void _setAppsFlyerDevKey (const char* appsFlyerDevKey) {
[AppsFlyerLib shared].appsFlyerDevKey = stringFromChar(appsFlyerDevKey);
}
const void _setAppleAppID (const char* appleAppID) {
[AppsFlyerLib shared].appleAppID = stringFromChar(appleAppID);
}
const void _setCurrencyCode (const char* currencyCode) {
[[AppsFlyerLib shared] setCurrencyCode:stringFromChar(currencyCode)];
}
const void _setDisableCollectAppleAdSupport (bool disableAdvertisingIdentifier) {
[AppsFlyerLib shared].disableAdvertisingIdentifier = disableAdvertisingIdentifier;
}
const void _setIsDebug (bool isDebug) {
[AppsFlyerLib shared].isDebug = isDebug;
}
const void _setShouldCollectDeviceName (bool shouldCollectDeviceName) {
[AppsFlyerLib shared].shouldCollectDeviceName = shouldCollectDeviceName;
}
const void _setAppInviteOneLinkID (const char* appInviteOneLinkID) {
[[AppsFlyerLib shared] setAppInviteOneLink:stringFromChar(appInviteOneLinkID)];
}
const void _setDeepLinkTimeout (long deepLinkTimeout) {
[AppsFlyerLib shared].deepLinkTimeout = deepLinkTimeout;
}
const void _anonymizeUser (bool anonymizeUser) {
[AppsFlyerLib shared].anonymizeUser = anonymizeUser;
}
const void _enableTCFDataCollection (bool shouldCollectTcfData) {
[[AppsFlyerLib shared] enableTCFDataCollection:shouldCollectTcfData];
}
const void _setConsentData(bool isUserSubjectToGDPR, bool hasConsentForDataUsage, bool hasConsentForAdsPersonalization) {
AppsFlyerConsent *consentData = nil;
if (isUserSubjectToGDPR) {
consentData = [[AppsFlyerConsent alloc] initForGDPRUserWithHasConsentForDataUsage:hasConsentForDataUsage hasConsentForAdsPersonalization:hasConsentForAdsPersonalization];
} else {
consentData = [[AppsFlyerConsent alloc] initNonGDPRUser];
}
[[AppsFlyerLib shared] setConsentData:consentData];
}
const void _setDisableCollectIAd (bool disableCollectASA) {
[AppsFlyerLib shared].disableCollectASA = disableCollectASA;
}
const void _setUseReceiptValidationSandbox (bool useReceiptValidationSandbox) {
[AppsFlyerLib shared].useReceiptValidationSandbox = useReceiptValidationSandbox;
}
const void _setUseUninstallSandbox (bool useUninstallSandbox) {
[AppsFlyerLib shared].useUninstallSandbox = useUninstallSandbox;
}
const void _setResolveDeepLinkURLs (int length, const char **resolveDeepLinkURLs) {
if(length > 0 && resolveDeepLinkURLs) {
[[AppsFlyerLib shared] setResolveDeepLinkURLs:NSArrayFromCArray(length, resolveDeepLinkURLs)];
}
}
const void _setOneLinkCustomDomains (int length, const char **oneLinkCustomDomains) {
if(length > 0 && oneLinkCustomDomains) {
[[AppsFlyerLib shared] setOneLinkCustomDomains:NSArrayFromCArray(length, oneLinkCustomDomains)];
}
}
const void _afSendEvent (const char* eventName, const char* eventValues, bool shouldCallback, const char* objectName) {
inAppRequestObjectName = stringFromChar(objectName);
[[AppsFlyerLib shared] logEventWithEventName:stringFromChar(eventName) eventValues:dictionaryFromJson(eventValues) completionHandler:^(NSDictionary<NSString *,id> *dictionary, NSError *error) {
if(shouldCallback){
if (error) {
NSDictionary *callbackDictionary = @{@"statusCode":[NSNumber numberWithLong:[error code]]};
unityCallBack(inAppRequestObjectName, IN_APP_RESPONSE_CALLBACK, stringFromdictionary(callbackDictionary));
return;
}
if (dictionary) {
unityCallBack(inAppRequestObjectName, IN_APP_RESPONSE_CALLBACK, stringFromdictionary(dictionary));
return;
}
}
}];
}
const void _recordLocation (double longitude, double latitude) {
[[AppsFlyerLib shared] logLocation:longitude latitude:latitude];
}
const char* _getAppsFlyerId () {
return getCString([[[AppsFlyerLib shared] getAppsFlyerUID] UTF8String]);
}
const void _registerUninstall (unsigned char* deviceToken) {
if(deviceToken){
NSData* tokenData = [NSData dataWithBytes:(const void *)deviceToken length:sizeof(unsigned char)*kPushNotificationSize];
[[AppsFlyerLib shared] registerUninstall:tokenData];
}
}
const void _handlePushNotification (const char* pushPayload) {
[[AppsFlyerLib shared] handlePushNotification:dictionaryFromJson(pushPayload)];
}
const char* _getSDKVersion () {
return getCString([[[AppsFlyerLib shared] getSDKVersion] UTF8String]);
}
const void _setHost (const char* host, const char* hostPrefix) {
[[AppsFlyerLib shared] setHost:stringFromChar(host) withHostPrefix:stringFromChar(hostPrefix)];
}
const void _setMinTimeBetweenSessions (int minTimeBetweenSessions) {
[AppsFlyerLib shared].minTimeBetweenSessions = minTimeBetweenSessions;
}
const void _stopSDK (bool isStopped) {
[AppsFlyerLib shared].isStopped = isStopped;
}
const BOOL _isSDKStopped () {
return [AppsFlyerLib shared].isStopped;
}
const void _handleOpenUrl(const char *url, const char *sourceApplication, const char *annotation) {
[[AppsFlyerLib shared] handleOpenURL:[NSURL URLWithString:stringFromChar(url)] sourceApplication:stringFromChar(sourceApplication) withAnnotation:stringFromChar(annotation)]; }
const void _recordCrossPromoteImpression (const char* appID, const char* campaign, const char* parameters) {
[AppsFlyerCrossPromotionHelper logCrossPromoteImpression:stringFromChar(appID) campaign:stringFromChar(campaign) parameters:dictionaryFromJson(parameters)]; }
const void _attributeAndOpenStore (const char* appID, const char* campaign, const char* parameters, const char* objectName) {
openStoreObjectName = stringFromChar(objectName);
[AppsFlyerCrossPromotionHelper
logAndOpenStore:stringFromChar(appID)
campaign:stringFromChar(campaign)
parameters:dictionaryFromJson(parameters)
openStore:^(NSURLSession * _Nonnull urlSession, NSURL * _Nonnull clickURL) {
unityCallBack(openStoreObjectName, OPEN_STORE_LINK_CALLBACK, [clickURL.absoluteString UTF8String]);
}];
}
const void _generateUserInviteLink (const char* parameters, const char* objectName) {
generateInviteObjectName = stringFromChar(objectName);
[AppsFlyerShareInviteHelper generateInviteUrlWithLinkGenerator:^AppsFlyerLinkGenerator * _Nonnull(AppsFlyerLinkGenerator * _Nonnull generator) {
return generatorFromDictionary(dictionaryFromJson(parameters), generator);
} completionHandler:^(NSURL * _Nullable url) {
unityCallBack(generateInviteObjectName, GENERATE_LINK_CALLBACK, [url.absoluteString UTF8String]);
}];
}
const void _recordInvite (const char* channel, const char* parameters) {
[AppsFlyerShareInviteHelper logInvite:stringFromChar(channel) parameters:dictionaryFromJson(parameters)];
}
const void _setUserEmails (int emailCryptTypeInt , int length, const char **userEmails) {
if(length > 0 && userEmails) {
[[AppsFlyerLib shared] setUserEmails:NSArrayFromCArray(length, userEmails) withCryptType:emailCryptTypeFromInt(emailCryptTypeInt)];
}
}
const void _setPhoneNumber (const char* phoneNumber) {
[[AppsFlyerLib shared] setPhoneNumber:stringFromChar(phoneNumber)];
}
const void _setSharingFilterForAllPartners () {
[[AppsFlyerLib shared] setSharingFilterForAllPartners];
}
const void _setSharingFilter (int length, const char **partners) {
if(length > 0 && partners) {
[[AppsFlyerLib shared] setSharingFilter:NSArrayFromCArray(length, partners)];
}
}
const void _setSharingFilterForPartners (int length, const char **partners) {
if(length > 0 && partners) {
[[AppsFlyerLib shared] setSharingFilterForPartners:NSArrayFromCArray(length, partners)];
} else {
[[AppsFlyerLib shared] setSharingFilterForPartners:nil];
}
}
const void _validateAndSendInAppPurchase (const char* productIdentifier, const char* price, const char* currency, const char* transactionId, const char* additionalParameters, const char* objectName) {
validateObjectName = stringFromChar(objectName);
[[AppsFlyerLib shared]
validateAndLogInAppPurchase:stringFromChar(productIdentifier)
price:stringFromChar(price)
currency:stringFromChar(currency)
transactionId:stringFromChar(transactionId)
additionalParameters:dictionaryFromJson(additionalParameters)
success:^(NSDictionary *result){
unityCallBack(validateObjectName, VALIDATE_CALLBACK, stringFromdictionary(result));
} failure:^(NSError *error, id response) {
if(response && [response isKindOfClass:[NSDictionary class]]) {
NSDictionary* value = (NSDictionary*)response;
unityCallBack(validateObjectName, VALIDATE_ERROR_CALLBACK, stringFromdictionary(value));
} else {
unityCallBack(validateObjectName, VALIDATE_ERROR_CALLBACK, error ? [[error localizedDescription] UTF8String] : "error");
}
}];
}
const void _validateAndSendInAppPurchaseV2 (const char* product, const char* price, const char* currency, const char* transactionId, const char* extraEventValues, const char* objectName) {
validateAndLogObjectName = stringFromChar(objectName);
AFSDKPurchaseDetails *details = [[AFSDKPurchaseDetails alloc] initWithProductId:stringFromChar(product) price:stringFromChar(price) currency:stringFromChar(currency) transactionId:stringFromChar(transactionId)];
[[AppsFlyerLib shared]
validateAndLogInAppPurchase:details
extraEventValues:dictionaryFromJson(extraEventValues)
completionHandler:^(AFSDKValidateAndLogResult * _Nullable result) {
if (result.status == AFSDKValidateAndLogStatusSuccess) {
unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_CALLBACK, stringFromdictionary(result.result));
} else if (result.status == AFSDKValidateAndLogStatusFailure) {
unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_CALLBACK, stringFromdictionary(result.errorData));
} else {
unityCallBack(validateAndLogObjectName, VALIDATE_AND_LOG_V2_ERROR_CALLBACK, stringFromdictionary(dictionaryFromNSError(result.error)));
}
}];
}
const void _getConversionData(const char* objectName) {
if (_AppsFlyerdelegate == nil) {
_AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init];
}
ConversionDataCallbackObject = stringFromChar(objectName);
[[AppsFlyerLib shared] setDelegate:_AppsFlyerdelegate];
}
const void _waitForATTUserAuthorizationWithTimeoutInterval (int timeoutInterval) {
[[AppsFlyerLib shared] waitForATTUserAuthorizationWithTimeoutInterval:timeoutInterval];
}
const void _disableSKAdNetwork (bool isDisabled) {
[AppsFlyerLib shared].disableSKAdNetwork = isDisabled;
}
const void _addPushNotificationDeepLinkPath (int length, const char **paths) {
if(length > 0 && paths) {
[[AppsFlyerLib shared] addPushNotificationDeepLinkPath:NSArrayFromCArray(length, paths)];
}
}
const void _subscribeForDeepLink (const char* objectName) {
onDeeplinkingObjectName = stringFromChar(objectName);
if (_AppsFlyerdelegate == nil) {
_AppsFlyerdelegate = [[AppsFlyeriOSWarpper alloc] init];
}
[[AppsFlyerLib shared] setDeepLinkDelegate:_AppsFlyerdelegate];
}
const void _setCurrentDeviceLanguage(const char* language) {
[[AppsFlyerLib shared] setCurrentDeviceLanguage:stringFromChar(language)];
}
const void _setPartnerData(const char* partnerId, const char* partnerInfo) {
[[AppsFlyerLib shared] setPartnerDataWithPartnerId: stringFromChar(partnerId) partnerInfo:dictionaryFromJson(partnerInfo)];
}
const void _disableIDFVCollection(bool isDisabled) {
[AppsFlyerLib shared].disableIDFVCollection = isDisabled;
}
}
@implementation AppsFlyeriOSWarpper
static BOOL didCallStart;
+ (BOOL) didCallStart
{ @synchronized(self) { return didCallStart; } }
+ (void) setDidCallStart:(BOOL)val
{ @synchronized(self) { didCallStart = val; } }
- (void)onConversionDataSuccess:(NSDictionary *)installData {
unityCallBack(ConversionDataCallbackObject, GCD_CALLBACK, stringFromdictionary(installData));
}
- (void)onConversionDataFail:(NSError *)error {
unityCallBack(ConversionDataCallbackObject, GCD_ERROR_CALLBACK, [[error localizedDescription] UTF8String]);
}
- (void)onAppOpenAttribution:(NSDictionary *)attributionData {
unityCallBack(ConversionDataCallbackObject, OAOA_CALLBACK, stringFromdictionary(attributionData));
}
- (void)onAppOpenAttributionFailure:(NSError *)error {
unityCallBack(ConversionDataCallbackObject, OAOA_ERROR_CALLBACK, [[error localizedDescription] UTF8String]);
}
- (void)didResolveDeepLink:(AppsFlyerDeepLinkResult *)result{
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setValue:stringFromDeepLinkResultError(result) forKey:@"error"];
[dict setValue:stringFromDeepLinkResultStatus(result.status) forKey:@"status"];
if(result && result.deepLink){
[dict setValue:result.deepLink.description forKey:@"deepLink"];
[dict setValue:@(result.deepLink.isDeferred) forKey:@"is_deferred"];
}
unityCallBack(onDeeplinkingObjectName, ON_DEEPLINKING, stringFromdictionary(dict));
}
@end

View File

@@ -0,0 +1,37 @@
fileFormatVersion: 2
guid: 2bff3788f3d8747fe9679bd3818e1d76
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant: