Skip to content

Commit

Permalink
added sdk v5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wesfieldj committed Jan 23, 2020
1 parent 1fe59f6 commit 56e7e0a
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 70 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Versions

## 1.4.8
## 5.1.0

Android AppsFlyer SDK 5.1.0
iOS SDK AppsFlyer 5.1.0

## 5.0.0

Android AppsFlyer SDK 5.0.0
iOS SDK AppsFlyer 5.0.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

### <a id="plugin-build-for"> This plugin is built for

- iOS AppsFlyerSDK **v5.0.0**
- Android AppsFlyerSDK **v5.0.0**
- iOS AppsFlyerSDK **v5.1.0**
- Android AppsFlyerSDK **v5.1.0**


## <a id="installation"> 📲 Adding the SDK to your project
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ repositories {
dependencies {
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
implementation "com.android.installreferrer:installreferrer:1.0"
implementation "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '5.0.0')}"
implementation "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '5.1.0')}"
}
36 changes: 19 additions & 17 deletions examples/demo/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from 'react-native';
import appsFlyer from 'react-native-appsflyer';

this.onInstallConversionDataCanceller = appsFlyer.onInstallConversionData(
var onInstallConversionDataCanceller = appsFlyer.onInstallConversionData(
(res) => {
console.log(res);
if (JSON.parse(res.data.is_first_launch) == true) {
Expand All @@ -26,7 +26,7 @@ this.onInstallConversionDataCanceller = appsFlyer.onInstallConversionData(
);


this.onAppOpenAttributionCanceller = appsFlyer.onAppOpenAttribution((res) => {
var onAppOpenAttributionCanceller = appsFlyer.onAppOpenAttribution((res) => {
console.log(res);
});

Expand Down Expand Up @@ -68,28 +68,30 @@ class App extends React.Component {
}

componentWillUnmount() {
if(this.onInstallConversionDataCanceller){
this.onInstallConversionDataCanceller();
AppState.removeEventListener('change', this._handleAppStateChange);

// Optionaly remove listeners for deep link data if you no longer need them
if (onInstallConversionDataCanceller) {
onInstallConversionDataCanceller();
console.log('unregister onInstallConversionDataCanceller');
onInstallConversionDataCanceller = null;
}
if (onAppOpenAttributionCanceller) {
onAppOpenAttributionCanceller();
console.log('unregister onAppOpenAttributionCanceller');
onAppOpenAttributionCanceller = null;
}
AppState.removeEventListener('change', this._handleAppStateChange);
}

_handleAppStateChange = (nextAppState) => {
_handleAppStateChange = (nextAppState) => {
if (this.state.appState.match(/inactive|background/) && nextAppState === 'active') {

if (Platform.OS === 'ios') {
appsFlyer.trackAppLaunch();
}
}

if (this.state.appState.match(/active|foreground/) && nextAppState === 'background') {
if(this.onInstallConversionDataCanceller){
this.onInstallConversionDataCanceller();
if (Platform.OS === 'ios') {
appsFlyer.trackAppLaunch();
}
}

this.setState({appState: nextAppState});
}
};


TrackEventPressed() {
const eventName = "af_test_event";
Expand Down
5 changes: 0 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ appsFlyer.setGCMProjectNumber = (gcmProjectNumber, successC, errorC) => {
return RNAppsFlyer.setGCMProjectNumber(gcmProjectNumber, successC, errorC);
};

/**
* For Android only (GCM). iOS uses 'didRegisterForRemoteNotificationsWithDeviceToken' in AppDelegate.m
*
*/

/**
* @deprecated
*/
Expand Down
2 changes: 0 additions & 2 deletions ios/AppsFlyerCrossPromotionHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>


NS_ASSUME_NONNULL_BEGIN

Expand Down
84 changes: 43 additions & 41 deletions ios/AppsFlyerTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// AppsFlyerTracker.h
// AppsFlyerLib
//
// AppsFlyer iOS SDK 5.0.0 (925)
// Copyright (c) 2019 AppsFlyer Ltd. All rights reserved.
// AppsFlyer iOS SDK 5.1.0 (951)
// Copyright (c) 2012-2019 AppsFlyer Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AppsFlyerCrossPromotionHelper.h"
#import "AppsFlyerShareInviteHelper.h"

NS_ASSUME_NONNULL_BEGIN


// In app event names constants
Expand Down Expand Up @@ -184,7 +184,7 @@ typedef enum {
existed before this method ESP resolving call.
To keep default SDK dehavior - return nil;
*/
- (NSDictionary <NSString *, NSString *> *)allHTTPHeaderFieldsForResolveDeepLinkURL:(NSURL *)URL;
- (NSDictionary <NSString *, NSString *> * _Nullable)allHTTPHeaderFieldsForResolveDeepLinkURL:(NSURL *)URL;

@end

Expand Down Expand Up @@ -212,24 +212,24 @@ typedef enum {
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
*/
@property(nonatomic, strong, setter = setCustomerUserID:) NSString * customerUserID;
@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, setter = setAdditionalData:) NSDictionary * customData;
@property(nonatomic, strong, nullable, setter = setAdditionalData:) NSDictionary * customData;

/**
Use this property to set your AppsFlyer's dev key
*/
@property(nonatomic, strong, setter = setAppsFlyerDevKey:) NSString * appsFlyerDevKey;
@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, setter = setAppleAppID:) NSString * appleAppID;
@property(nonatomic, strong) NSString * appleAppID;

/**
In case of in app purchase events, you can set the currency code your user has purchased with.
Expand All @@ -247,7 +247,7 @@ typedef enum {
AppsFlyerTracker.shared().currencyCode = "USD"
</pre>
*/
@property(nonatomic, strong) NSString *currencyCode;
@property(nonatomic, strong, nullable) NSString *currencyCode;

/**
AppsFlyer SDK collect Apple's `advertisingIdentifier` if the `AdSupport.framework` included in the SDK.
Expand All @@ -259,17 +259,17 @@ typedef enum {
Prints SDK messages to the console log. This property should only be used in `DEBUG` mode.
The default value is `NO`
*/
@property(nonatomic, setter = setIsDebug:) BOOL isDebug;
@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, setter = setShouldCollectDeviceName:) BOOL shouldCollectDeviceName;
@property(nonatomic) BOOL shouldCollectDeviceName;

/**
Set your `OneLink ID` from OneLink configuration. Used in User Invites to generate a OneLink.
*/
@property(nonatomic, strong, setter = setAppInviteOneLink:) NSString * appInviteOneLinkID;
@property(nonatomic, strong, nullable, setter = setAppInviteOneLink:) NSString * appInviteOneLinkID;

/**
Opt-out tracking for specific user
Expand All @@ -289,17 +289,17 @@ typedef enum {
/**
In app purchase receipt validation Apple environment(production or sandbox). The default value is NO
*/
@property(nonatomic, setter = setUseReceiptValidationSandbox:) BOOL useReceiptValidationSandbox;
@property(nonatomic) BOOL useReceiptValidationSandbox;

/**
Set this flag to test uninstall on Apple environment(production or sandbox). The default value is NO
*/
@property(nonatomic, setter = setUseUninstallSandbox:) BOOL useUninstallSandbox;
@property(nonatomic) BOOL useUninstallSandbox;

/**
Advertising Id(exposed for RemoteDebug)
*/
@property(nonatomic, strong) NSString *advertiserId;
@property(nonatomic, strong, readonly) NSString *advertiserId;

/**
For advertisers who wrap OneLink within another Universal Link.
Expand All @@ -311,7 +311,7 @@ typedef enum {
[[AppsFlyerTracker sharedTracker] setResolveDeepLinkURLs:@[@"domain.com", @"subdomain.domain.com"]];
</pre>
*/
@property(nonatomic) NSArray<NSString *> *resolveDeepLinkURLs;
@property(nonatomic, nullable) NSArray<NSString *> *resolveDeepLinkURLs;

/**
For advertisers who use vanity OneLinks.
Expand All @@ -322,12 +322,12 @@ typedef enum {
[[AppsFlyerTracker sharedTracker] oneLinkCustomDomains:@[@"domain.com", @"subdomain.domain.com"]];
</pre>
*/
@property(nonatomic) NSArray<NSString *> *oneLinkCustomDomains;
@property(nonatomic, nullable) NSArray<NSString *> *oneLinkCustomDomains;

/*
* Set phone number for each `trackAppLaunch` event. `phoneNumber` will be sent as SHA256 string
*/
@property(nonatomic) NSString *phoneNumber;
@property(nonatomic, nullable) NSString *phoneNumber;

- (NSString *)phoneNumber UNAVAILABLE_ATTRIBUTE;

Expand Down Expand Up @@ -355,23 +355,23 @@ typedef enum {
@param facebookAppLinkUtilityClass requeries method call `[FBSDKAppLinkUtility class]` as param.
*/
- (void)enableFacebookDeferredApplinksWithClass:(Class)facebookAppLinkUtilityClass;
- (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 *)userEmails withCryptType:(EmailCryptType)type;
- (void)setUserEmails:(NSArray<NSString *> * _Nullable)userEmails withCryptType:(EmailCryptType)type;

/**
Track application launch(session).
Add the following method at the `applicationDidBecomeActive` in AppDelegate class
*/
- (void)trackAppLaunch;

- (void)trackAppLaunchWithCompletionHandler:(void (^)(NSDictionary<NSString *, id> *dictionary, NSError *error))completionHandler;
- (void)trackAppLaunchWithCompletionHandler:(void (^ _Nullable)(NSDictionary<NSString *, id> * _Nullable dictionary, NSError * _Nullable error))completionHandler;

/**
Use this method to track events in your app like purchases or user actions
Expand All @@ -384,7 +384,7 @@ typedef enum {
</pre>
*/
- (void)trackEvent:(NSString *)eventName withValue:(NSString *)value __attribute__((deprecated));
- (void)trackEvent:(NSString *)eventName withValue:(NSString * _Nullable)value __attribute__((deprecated));

/**
Use this method to track an events with mulitple values. See AppsFlyer's documentation for details.
Expand Down Expand Up @@ -412,11 +412,11 @@ typedef enum {
@param eventName Contains name of event that could be provided from predefined constants in `AppsFlyerTracker.h`
@param values Contains dictionary of values for handling by backend
*/
- (void)trackEvent:(NSString *)eventName withValues:(NSDictionary *)values;
- (void)trackEvent:(NSString *)eventName withValues:(NSDictionary * _Nullable)values;

- (void)trackEventWithEventName:(NSString *)eventName
eventValues:(NSDictionary<NSString * , id> * )eventValues
completionHandler:(void (^)(NSDictionary<NSString *, id> *dictionary, NSError *error))completionHandler
eventValues:(NSDictionary<NSString * , id> * _Nullable)eventValues
completionHandler:(void (^ _Nullable)(NSDictionary<NSString *, id> * _Nullable dictionary, NSError * _Nullable error))completionHandler
NS_SWIFT_NAME(trackEvent(name:values:completionHandler:));

/**
Expand All @@ -431,13 +431,13 @@ NS_SWIFT_NAME(trackEvent(name:values:completionHandler:));
@param successBlock The success callback
@param failedBlock The failure callback
*/
- (void)validateAndTrackInAppPurchase:(NSString *)productIdentifier
price:(NSString *)price
currency:(NSString *)currency
transactionId:(NSString *)tranactionId
additionalParameters:(NSDictionary *)params
success:(void (^)(NSDictionary *response))successBlock
failure:(void (^)(NSError *error, id reponse))failedBlock NS_AVAILABLE(10_7, 7_0);
- (void)validateAndTrackInAppPurchase:(NSString * _Nullable)productIdentifier
price:(NSString * _Nullable)price
currency:(NSString * _Nullable)currency
transactionId:(NSString * _Nullable)tranactionId
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);

/**
To Track location for geo-fencing. Does the same as code below.
Expand Down Expand Up @@ -466,7 +466,7 @@ NS_SWIFT_NAME(trackEvent(name:values:completionHandler:));
@param url The URL that was passed to your AppDelegate.
@param sourceApplication The sourceApplication that passed to your AppDelegate.
*/
- (void)handleOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication;
- (void)handleOpenURL:(NSURL * _Nullable)url sourceApplication:(NSString * _Nullable)sourceApplication API_UNAVAILABLE(macos);

/**
In case you want to track deep linking.
Expand All @@ -476,9 +476,9 @@ NS_SWIFT_NAME(trackEvent(name:values:completionHandler:));
@param sourceApplication The sourceApplication that passed to your AppDelegate.
@param annotation The annotation that passed to your app delegate.
*/
- (void)handleOpenURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
withAnnotation:(id)annotation;
- (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.
Expand All @@ -488,16 +488,16 @@ NS_SWIFT_NAME(trackEvent(name:values:completionHandler:));
@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 *)url options:(NSDictionary *)options;
- (void)handleOpenUrl:(NSURL * _Nullable)url options:(NSDictionary * _Nullable)options API_UNAVAILABLE(macos);

/**
Allow AppsFlyer to handle restoration from an NSUserActivity.
Use this method to track deep links with OneLink.
@param userActivity The NSUserActivity that caused the app to be opened.
*/
- (BOOL)continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray *))restorationHandler NS_AVAILABLE_IOS(9_0);
- (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.
Expand All @@ -508,15 +508,15 @@ NS_SWIFT_NAME(trackEvent(name:values:completionHandler:));
@param pushPayload The `userInfo` from received remote notification. One of root keys should be @"af".
*/
- (void)handlePushNotification:(NSDictionary *)pushPayload;
- (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 *)deviceToken;
- (void)registerUninstall:(NSData * _Nullable)deviceToken;

/**
Get SDK version.
Expand Down Expand Up @@ -575,3 +575,5 @@ NS_SWIFT_NAME(trackEvent(name:values:completionHandler:));
@property(atomic) BOOL isStopTracking;

@end

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion react-native-appsflyer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Pod::Spec.new do |s|
s.source_files = 'ios/**/*.{h,m}'
s.platform = :ios, "8.0"
s.static_framework = true
s.dependency 'AppsFlyerFramework', '~> 5.0.0'
s.dependency 'AppsFlyerFramework', '~> 5.1.0'
s.dependency 'React'
end

0 comments on commit 56e7e0a

Please sign in to comment.