ios branch.io integration

This commit is contained in:
Leo Schweizer
2018-07-18 14:04:12 +02:00
parent d1151f6491
commit d3b433632c
34 changed files with 3707 additions and 32 deletions
@@ -301,6 +301,14 @@
7FED45CC1A25F5910022505F /* leaderboard1.json in Resources */ = {isa = PBXBuildFile; fileRef = 7FED45C61A25F5900022505F /* leaderboard1.json */; };
9E95C3D61C723AB30016632B /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E95C3D51C723AB30016632B /* Constants.swift */; };
9ECBDDAE1C9C4F0300F76AEB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9ECBDDAD1C9C4F0300F76AEB /* LaunchScreen.storyboard */; };
B3150BA920FF42D9006D742A /* SAPTracker.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = B3150B2920FE3280006D742A /* SAPTracker.entitlements */; };
B3150BAB20FF4518006D742A /* Branch.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3150BAA20FF4518006D742A /* Branch.framework */; };
B3150BAC20FF4518006D742A /* Branch.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B3150BAA20FF4518006D742A /* Branch.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B3150BAF20FF452C006D742A /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3150BAE20FF452C006D742A /* AdSupport.framework */; };
B3150BB120FF4532006D742A /* SafariServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3150BB020FF4532006D742A /* SafariServices.framework */; };
B3150BB320FF453D006D742A /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3150BB220FF453D006D742A /* MobileCoreServices.framework */; };
B3150BB520FF4548006D742A /* CoreSpotlight.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3150BB420FF4548006D742A /* CoreSpotlight.framework */; };
B3150BB720FF454D006D742A /* iAd.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3150BB620FF454D006D742A /* iAd.framework */; };
C8150BA51DCC6FDB0087C9C2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C8150BA71DCC6FDB0087C9C2 /* InfoPlist.strings */; };
C8289F3A1F386D8300A76953 /* SignUpRequestManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8289F391F386D8300A76953 /* SignUpRequestManager.swift */; };
C843D47F1EBC54A300250F01 /* CompetitorCheckIn+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = C843D4791EBC54A300250F01 /* CompetitorCheckIn+CoreDataProperties.swift */; };
@@ -420,6 +428,20 @@
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
B3150BAD20FF4518006D742A /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
B3150BAC20FF4518006D742A /* Branch.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
64FDEBD220D12C390086C2F4 /* AFImageDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFImageDownloader.h; sourceTree = "<group>"; };
64FDEBD320D12C390086C2F4 /* AFAutoPurgingImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFAutoPurgingImageCache.h; sourceTree = "<group>"; };
@@ -720,6 +742,13 @@
7FED45C61A25F5900022505F /* leaderboard1.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = leaderboard1.json; sourceTree = "<group>"; };
9E95C3D51C723AB30016632B /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
9ECBDDAD1C9C4F0300F76AEB /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
B3150B2920FE3280006D742A /* SAPTracker.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SAPTracker.entitlements; sourceTree = "<group>"; };
B3150BAA20FF4518006D742A /* Branch.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Branch.framework; path = SAPTracker/Libraries/Branch.framework; sourceTree = "<group>"; };
B3150BAE20FF452C006D742A /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; };
B3150BB020FF4532006D742A /* SafariServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SafariServices.framework; path = System/Library/Frameworks/SafariServices.framework; sourceTree = SDKROOT; };
B3150BB220FF453D006D742A /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
B3150BB420FF4548006D742A /* CoreSpotlight.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreSpotlight.framework; path = System/Library/Frameworks/CoreSpotlight.framework; sourceTree = SDKROOT; };
B3150BB620FF454D006D742A /* iAd.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = iAd.framework; path = System/Library/Frameworks/iAd.framework; sourceTree = SDKROOT; };
C8150BA61DCC6FDB0087C9C2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/InfoPlist.strings; sourceTree = "<group>"; };
C8150BA81DCC6FDD0087C9C2 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/InfoPlist.strings; sourceTree = "<group>"; };
C8289F391F386D8300A76953 /* SignUpRequestManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignUpRequestManager.swift; sourceTree = "<group>"; };
@@ -863,7 +892,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B3150BB720FF454D006D742A /* iAd.framework in Frameworks */,
B3150BB520FF4548006D742A /* CoreSpotlight.framework in Frameworks */,
B3150BB320FF453D006D742A /* MobileCoreServices.framework in Frameworks */,
B3150BB120FF4532006D742A /* SafariServices.framework in Frameworks */,
B3150BAF20FF452C006D742A /* AdSupport.framework in Frameworks */,
7FC5232D19F6AEE800BBFDCC /* AVFoundation.framework in Frameworks */,
B3150BAB20FF4518006D742A /* Branch.framework in Frameworks */,
7F83F17619F1574700C53328 /* CoreLocation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -883,6 +918,11 @@
7AC6457280AEA3EC18F5E846 /* Frameworks */ = {
isa = PBXGroup;
children = (
B3150BB620FF454D006D742A /* iAd.framework */,
B3150BB420FF4548006D742A /* CoreSpotlight.framework */,
B3150BB220FF453D006D742A /* MobileCoreServices.framework */,
B3150BB020FF4532006D742A /* SafariServices.framework */,
B3150BAE20FF452C006D742A /* AdSupport.framework */,
7FC5232C19F6AEE800BBFDCC /* AVFoundation.framework */,
7F83F17519F1574700C53328 /* CoreLocation.framework */,
);
@@ -1212,6 +1252,7 @@
7F83F14719F154F000C53328 = {
isa = PBXGroup;
children = (
B3150BAA20FF4518006D742A /* Branch.framework */,
7AC6457280AEA3EC18F5E846 /* Frameworks */,
7F83F15119F154F000C53328 /* Products */,
7F83F15219F154F000C53328 /* SAPTracker */,
@@ -1231,6 +1272,7 @@
7F83F15219F154F000C53328 /* SAPTracker */ = {
isa = PBXGroup;
children = (
B3150B2920FE3280006D742A /* SAPTracker.entitlements */,
7F83F15519F154F000C53328 /* AppDelegate.swift */,
C8739DC71D2A653F00A89F3C /* Classes */,
C8F71EA31D8691F700826DE4 /* Libraries */,
@@ -1641,6 +1683,7 @@
7F83F14D19F154F000C53328 /* Frameworks */,
7F83F14E19F154F000C53328 /* Resources */,
7FF3E4BE1A1DFCF20012F1FB /* ShellScript */,
B3150BAD20FF4518006D742A /* Embed Frameworks */,
);
buildRules = (
);
@@ -1680,8 +1723,14 @@
TargetAttributes = {
7F83F14F19F154F000C53328 = {
CreatedOnToolsVersion = 6.0.1;
DevelopmentTeam = F9U235EA4J;
LastSwiftMigration = 0820;
ProvisioningStyle = Manual;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.SafariKeychain = {
enabled = 1;
};
};
};
7F83F16419F154F000C53328 = {
CreatedOnToolsVersion = 6.0.1;
@@ -1716,6 +1765,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B3150BA920FF42D9006D742A /* SAPTracker.entitlements in Resources */,
C8603D511C52892A002B2F28 /* Acknowledgements.markdown in Resources */,
7F14A1EC1A13B9A6001C1ECB /* SZ.png in Resources */,
7F14A1C91A13B9A6001C1ECB /* PE.png in Resources */,
@@ -2283,15 +2333,20 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_ENTITLEMENTS = SAPTracker/SAPTracker.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = F9U235EA4J;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/SAPTracker/Libraries",
);
INFOPLIST_FILE = SAPTracker/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = "";
PRODUCT_BUNDLE_IDENTIFIER = com.sap.sailing.ios.SAPTracker.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -2306,15 +2361,20 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_ENTITLEMENTS = SAPTracker/SAPTracker.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = F9U235EA4J;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/SAPTracker/Libraries",
);
INFOPLIST_FILE = SAPTracker/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "";
PRODUCT_BUNDLE_IDENTIFIER = com.sap.sailing.ios.SAPTracker.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -8,6 +8,7 @@
import UIKit
import CoreData
import Branch
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -38,14 +39,29 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
setup()
Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in
guard let data = params as? [String: AnyObject] else { return }
if let checkinUrl = data["checkinUrl"] as? String {
Preferences.newCheckInURL = checkinUrl.removingPercentEncoding
}
}
return true
}
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
Preferences.newCheckInURL = urlStringForDeeplink(url: url)
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
Branch.getInstance().application(app, open: url, options: options)
return true
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
Branch.getInstance().continue(userActivity)
return true
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
Branch.getInstance().handlePushNotification(userInfo)
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
@@ -107,22 +123,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
SVProgressHUD.setDefaultMaskType(.clear)
}
// MARK: - Helper
fileprivate func urlStringForDeeplink(url: URL) -> String {
var urlString = url.absoluteString
let appPrefix : String = "comsapsailingtracker://"
// FIXME: - Two prefixes are not allowed
// Deeplink needs another structure (if possible) because of allowed characters in URL
// https:// -> http//
urlString = urlString.hasPrefix(appPrefix) ? urlString.substring(from: appPrefix.endIndex) : urlString
let httpPrefix : String = "http//"
urlString = urlString.hasPrefix(httpPrefix) ? "http://" + urlString.substring(from: httpPrefix.endIndex) : urlString
let httpsPrefix : String = "https//"
urlString = urlString.hasPrefix(httpsPrefix) ? "https://" + urlString.substring(from: httpsPrefix.endIndex) : urlString
return urlString
}
}
@@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.sap.sailing.ios.SAPTracker</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@@ -48,6 +48,10 @@
</dict>
<key>NSLocationAlwaysUsageDescription</key>
<string></string>
<key>branch_app_domain</key>
<string>d-labs.app.link</string>
<key>branch_key</key>
<string>key_live_hcw9UuPC67XuavXlixn9ZhepFBkRkS8m</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
@@ -0,0 +1,25 @@
//
// BNCAvailability.h
// Branch-SDK
//
// Created by Edward on 10/26/16.
// Copyright © 2016 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_10_0
#warning Warning: Compiling with pre-iOS 10 / Xcode 7 support.
typedef NSString * UIActivityType;
typedef NSString * UIApplicationOpenURLOptionsKey;
#endif
#ifndef NS_STRING_ENUM
#define NS_STRING_ENUM
#endif
@@ -0,0 +1,22 @@
//
// BNCCallbacks.h
// Branch-TestBed
//
// Created by Ahmed Nawar on 6/18/16.
// Copyright © 2016 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
@class BranchUniversalObject, BranchLinkProperties;
typedef void (^callbackWithParams) (NSDictionary * _Nullable params, NSError * _Nullable error);
typedef void (^callbackWithUrl) (NSString * _Nullable url, NSError * _Nullable error);
typedef void (^callbackWithStatus) (BOOL changed, NSError * _Nullable error);
typedef void (^callbackWithList) (NSArray * _Nullable list, NSError * _Nullable error);
typedef void (^callbackWithUrlAndSpotlightIdentifier) (NSString * _Nullable url, NSString * _Nullable spotlightIdentifier, NSError * _Nullable error);
typedef void (^callbackWithBranchUniversalObject) (BranchUniversalObject * _Nullable universalObject, BranchLinkProperties * _Nullable linkProperties, NSError * _Nullable error);
@@ -0,0 +1,273 @@
//
// BNCCommerceEvent.h
// Branch-SDK
//
// Created by Edward Smith on 12/14/16.
// Copyright (c) 2016 Branch Metrics. All rights reserved.
//
#import "BNCServerRequest.h"
#import "BNCAvailability.h"
#pragma mark BNCProductCategory
typedef NSString*const BNCProductCategory NS_STRING_ENUM;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryAnimalSupplies;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryApparel;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryArtsEntertainment;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryBabyToddler;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryBusinessIndustrial;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryCamerasOptics;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryElectronics;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryFoodBeverageTobacco;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryFurniture;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryHardware;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryHealthBeauty;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryHomeGarden;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryLuggageBags;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryMature;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryMedia;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryOfficeSupplies;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryReligious;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategorySoftware;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategorySportingGoods;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryToysGames;
FOUNDATION_EXPORT BNCProductCategory _Nonnull BNCProductCategoryVehiclesParts;
NSArray<BNCProductCategory>*_Nonnull BNCProductCategoryAllCategories(void);
#pragma mark - BNCCurrency
typedef NSString*const BNCCurrency NS_STRING_ENUM;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyAED;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyAFN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyALL;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyAMD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyANG;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyAOA;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyARS;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyAUD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyAWG;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyAZN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBAM;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBBD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBDT;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBGN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBHD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBIF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBMD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBND;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBOB;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBOV;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBRL;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBSD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBTN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBWP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBYN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBYR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyBZD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCAD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCDF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCHE;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCHF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCHW;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCLF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCLP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCNY;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCOP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCOU;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCRC;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCUC;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCUP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCVE;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyCZK;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyDJF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyDKK;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyDOP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyDZD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyEGP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyERN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyETB;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyEUR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyFJD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyFKP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyGBP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyGEL;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyGHS;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyGIP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyGMD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyGNF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyGTQ;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyGYD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyHKD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyHNL;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyHRK;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyHTG;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyHUF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyIDR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyILS;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyINR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyIQD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyIRR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyISK;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyJMD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyJOD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyJPY;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyKES;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyKGS;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyKHR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyKMF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyKPW;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyKRW;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyKWD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyKYD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyKZT;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyLAK;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyLBP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyLKR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyLRD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyLSL;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyLYD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMAD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMDL;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMGA;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMKD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMMK;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMNT;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMOP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMRO;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMUR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMVR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMWK;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMXN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMXV;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMYR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyMZN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyNAD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyNGN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyNIO;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyNOK;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyNPR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyNZD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyOMR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyPAB;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyPEN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyPGK;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyPHP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyPKR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyPLN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyPYG;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyQAR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyRON;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyRSD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyRUB;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyRWF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySAR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySBD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySCR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySDG;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySEK;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySGD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySHP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySLL;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySOS;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySRD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySSP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySTD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySYP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencySZL;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyTHB;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyTJS;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyTMT;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyTND;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyTOP;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyTRY;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyTTD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyTWD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyTZS;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyUAH;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyUGX;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyUSD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyUSN;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyUYI;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyUYU;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyUZS;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyVEF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyVND;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyVUV;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyWST;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXAF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXAG;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXAU;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXBA;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXBB;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXBC;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXBD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXCD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXDR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXFU;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXOF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXPD;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXPF;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXPT;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXSU;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXTS;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXUA;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyXXX;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyYER;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyZAR;
FOUNDATION_EXPORT BNCCurrency _Nonnull BNCCurrencyZMW;
NSArray<BNCCurrency>*_Nonnull BNCCurrencyAllCurrencies(void);
#pragma mark - BNCProduct
@interface BNCProduct : NSObject
@property (nonatomic, strong) NSString*_Nullable sku;
@property (nonatomic, strong) NSString*_Nullable name;
@property (nonatomic, strong) NSDecimalNumber*_Nullable price;
@property (nonatomic, strong) NSNumber*_Nullable quantity;
@property (nonatomic, strong) NSString*_Nullable brand;
@property (nonatomic, strong) BNCProductCategory _Nullable category;
@property (nonatomic, strong) NSString*_Nullable variant;
@end
#pragma mark - BNCCommerceEvent
//__attribute__((deprecated(("Please use BranchEvent to track commerce events."))))
@interface BNCCommerceEvent : NSObject
@property (nonatomic, strong) NSDecimalNumber*_Nullable revenue;
@property (nonatomic, strong) BNCCurrency _Nullable currency;
@property (nonatomic, strong) NSString*_Nullable transactionID;
@property (nonatomic, strong) NSDecimalNumber*_Nullable shipping;
@property (nonatomic, strong) NSDecimalNumber*_Nullable tax;
@property (nonatomic, strong) NSString*_Nullable coupon;
@property (nonatomic, strong) NSString*_Nullable affiliation;
@property (nonatomic, strong) NSArray<BNCProduct*>*_Nullable products;
@end
@interface BranchCommerceEventRequest : BNCServerRequest <NSCoding>
- (instancetype _Nonnull) initWithCommerceEvent:(BNCCommerceEvent*_Nonnull)commerceEvent
metadata:(NSDictionary*_Nullable)dictionary
completion:
(void (^_Nullable)(NSDictionary*_Nullable response, NSError*_Nullable error))callBack;
@end
@@ -0,0 +1,20 @@
//
// BNCConfig.h
// Branch-SDK
//
// Created by Qinwei Gong on 10/6/14.
// Copyright (c) 2014 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
FOUNDATION_EXPORT NSString*_Nonnull const BNC_SDK_VERSION;
FOUNDATION_EXPORT NSString*_Nonnull const BNC_API_BASE_URL;
FOUNDATION_EXPORT BOOL const BNC_API_PINNED;
FOUNDATION_EXPORT NSString*_Nonnull const BNC_API_VERSION;
FOUNDATION_EXPORT NSString*_Nonnull const BNC_LINK_URL;
@@ -0,0 +1,90 @@
/**
@file BNCDebug.h
@package Branch-SDK
@brief Debugging Support.
@author Edward Smith
@date October 2016
@copyright Copyright © 2016 Branch. All rights reserved.
*/
/**
@discusion
# BNCDebug
## Useful run time debugging environmental variables
Set DYLD_IMAGE_SUFFIX to _debug to load debug versions of dynamic libraries.
Set NSDebugEnabled to YES to enable obj-c debug checks.
Set NSZombieEnabled to YES to enable zombies to help catch the referencing of released objects.
Set NSAutoreleaseFreedObjectCheckEnabled to YES to catch autorelease problems.
Set MallocStackLoggingNoCompact to YES to track and save all memory allocations. Memory intensive.
Check NSDebug.h for more debug switches.
Also check Apple Technical Note TN2124, TN2239, and question QA1887 for more info.
Useful exception breakpoints to set:
objc_exception_throw
NSInternalInconsistencyException
May be helpful for iPhone Simulator: GTM_DISABLE_IPHONE_LAUNCH_DAEMONS 1
Useful lldb macros (Works after Xcode 5.0):
command script import lldb.macosx.heap
Search the heap for all references to the pointer 0x0000000116e13920:
ptr_refs -m 0x0000000116e13920
*/
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
///@functiongroup Debugging Functions
///@return Returns true if the app is currently attached to a debugger.
extern BOOL BNCDebuggerIsAttached(void);
///@param object An obj-c instance, class, or meta-class.
///@return Returns an NSString with a dump of the methods and member variables of the instance,
/// class, or meta-class.
extern NSString* _Nonnull BNCDebugStringFromObject(id _Nullable object);
///@return Returns the names of all loaded classes as an array of NSStrings.
extern NSArray<NSString*> * _Nonnull BNCDebugArrayOfReqisteredClasses(void);
///@return Returns an NSString indicating the name of the enclosing method.
#define BNCSStringForCurrentMethod() \
NSStringFromSelector(_cmd)
///@return Returns an NSString indicating the name of the enclosing function.
#define BNCSStringForCurrentFunction() \
[NSString stringWithFormat:@"%s", __FUNCTION__]
/// Stops execution at the current execution point.
/// If attached to a debugger, current app will halt and wait for the debugger.
/// If not attached to a debugger then the current app will probably quit executing.
#define BNCDebugBreakpoint() \
do { raise(SIGINT); } while (0)
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,46 @@
/**
@file BNCError.h
@package Branch-SDK
@brief Branch errors.
@author Qinwei Gong
@date November 2014
@copyright Copyright © 2014 Branch. All rights reserved.
*/
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
FOUNDATION_EXPORT NSString *_Nonnull const BNCErrorDomain;
typedef NS_ENUM(NSInteger, BNCErrorCode) {
BNCInitError = 1000,
BNCDuplicateResourceError = 1001,
BNCRedeemCreditsError = 1002,
BNCBadRequestError = 1003,
BNCServerProblemError = 1004,
BNCNilLogError = 1005, // Not used at the moment.
BNCVersionError = 1006, // Not used at the moment.
BNCNetworkServiceInterfaceError = 1007,
BNCInvalidNetworkPublicKeyError = 1008,
BNCContentIdentifierError = 1009,
BNCSpotlightNotAvailableError = 1010,
BNCSpotlightTitleError = 1011,
BNCRedeemZeroCreditsError = 1012,
BNCSpotlightIdentifierError = 1013,
BNCSpotlightPublicIndexError = 1014,
BNCTrackingDisabledError = 1015,
BNCHighestError,
};
@interface NSError (Branch)
+ (NSError*_Nonnull) branchErrorWithCode:(BNCErrorCode)errorCode;
+ (NSError*_Nonnull) branchErrorWithCode:(BNCErrorCode)errorCode error:(NSError*_Nullable)error;
+ (NSError*_Nonnull) branchErrorWithCode:(BNCErrorCode)errorCode localizedMessage:(NSString*_Nullable)message;
@end
void BNCForceNSErrorCategoryToLoad(void)
__attribute__((constructor));
@@ -0,0 +1,15 @@
//
// BNCLinkCache.h
// Branch-SDK
//
// Created by Qinwei Gong on 1/23/15.
// Copyright (c) 2015 Branch Metrics. All rights reserved.
//
#import "BNCLinkData.h"
@interface BNCLinkCache : NSObject
- (void)setObject:(NSString *)anObject forKey:(BNCLinkData *)aKey;
- (NSString *)objectForKey:(BNCLinkData *)aKey;
- (void) clear;
@end
@@ -0,0 +1,35 @@
//
// BNCLinkData.h
// Branch-SDK
//
// Created by Qinwei Gong on 1/22/15.
// Copyright (c) 2015 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
typedef NS_ENUM(NSUInteger, BranchLinkType) {
BranchLinkTypeUnlimitedUse = 0,
BranchLinkTypeOneTimeUse = 1
};
@interface BNCLinkData : NSObject
@property (strong, nonatomic) NSMutableDictionary *data;
- (void)setupTags:(NSArray *)tags;
- (void)setupAlias:(NSString *)alias;
- (void)setupType:(BranchLinkType)type;
- (void)setupChannel:(NSString *)channel;
- (void)setupFeature:(NSString *)feature;
- (void)setupStage:(NSString *)stage;
- (void)setupCampaign:(NSString *)campaign;
- (void)setupParams:(NSDictionary *)params;
- (void)setupMatchDuration:(NSUInteger)duration;
- (void)setupIgnoreUAString:(NSString *)ignoreUAString;
@end
@@ -0,0 +1,240 @@
/**
@file BNCLog.h
@package Branch-SDK
@brief Simple logging functions.
@author Edward Smith
@date October 2016
@copyright Copyright © 2016 Branch. All rights reserved.
*/
#import "BNCDebug.h"
#ifdef __cplusplus
extern "C" {
#endif
///@functiongroup Branch Logging Functions
#pragma mark Log Initialization
/// Log facility initialization. Usually there is no need to call this directly.
extern void BNCLogInitialize(void) __attribute__((constructor));
#pragma mark Log Message Severity
/// Log message severity
typedef NS_ENUM(NSInteger, BNCLogLevel) {
BNCLogLevelAll = 0,
BNCLogLevelDebugSDK = BNCLogLevelAll,
BNCLogLevelBreakPoint,
BNCLogLevelDebug,
BNCLogLevelWarning,
BNCLogLevelError,
BNCLogLevelAssert,
BNCLogLevelLog,
BNCLogLevelNone,
BNCLogLevelMax
};
/*!
* @return Returns the current log severity display level.
*/
extern BNCLogLevel BNCLogDisplayLevel(void);
/*!
* @param level Sets the current display level for log messages.
*/
extern void BNCLogSetDisplayLevel(BNCLogLevel level);
/*!
* @param level The log level to convert to a string.
* @return Returns the string indicating the log level.
*/
extern NSString *_Nonnull BNCLogStringFromLogLevel(BNCLogLevel level);
/*!
* @param string A string indicating the log level.
* @return Returns The log level corresponding to the string.
*/
extern BNCLogLevel BNCLogLevelFromString(NSString*_Null_unspecified string);
#pragma mark - Programmatic Breakpoints
///@return Returns 'YES' if programmatic breakpoints are enabled.
extern BOOL BNCLogBreakPointsAreEnabled(void);
///@param enabled Sets programmatic breakpoints enabled or disabled.
extern void BNCLogSetBreakPointsEnabled(BOOL enabled);
#pragma mark - Client Initialization Function
typedef void (*BNCLogClientInitializeFunctionPtr)(void);
///@param clientInitializationFunction The client function that should be called before logging starts.
extern BNCLogClientInitializeFunctionPtr _Null_unspecified
BNCLogSetClientInitializeFunction(BNCLogClientInitializeFunctionPtr _Nullable clientInitializationFunction);
#pragma mark - Optional Log Output Handlers
///@brief Pre-defined log message handlers --
typedef void (*BNCLogOutputFunctionPtr)(NSDate*_Nonnull timestamp, BNCLogLevel level, NSString*_Nullable message);
extern void BNCLogFunctionOutputToStdOut(NSDate*_Nonnull timestamp, BNCLogLevel level, NSString *_Nullable message);
extern void BNCLogFunctionOutputToStdErr(NSDate*_Nonnull timestamp, BNCLogLevel level, NSString *_Nullable message);
///@param functionPtr A pointer to the logging function. Setting the parameter to NULL will flush
/// and close the currently set log function and future log messages will be
/// ignored until a non-NULL logging function is set.
extern void BNCLogSetOutputFunction(BNCLogOutputFunctionPtr _Nullable functionPtr);
///@return Returns the current logging function.
extern BNCLogOutputFunctionPtr _Nullable BNCLogOutputFunction(void);
/// If a predefined log handler is being used, the function closes the output file.
extern void BNCLogCloseLogFile(void);
///@param URL Sets the log output function to a function that writes messages to the file at URL.
extern void BNCLogSetOutputToURL(NSURL *_Nullable URL);
///@param URL Sets the log output function to a function that writes messages to the file at URL.
///@param maxRecords Wraps the file at `maxRecords` records.
extern void BNCLogSetOutputToURLRecordWrap(NSURL *_Nullable URL, long maxRecords);
///@param URL Sets the log output function to a function that writes messages to the file at URL.
///@param maxBytes Wraps the file at `maxBytes` bytes. Must be an even number of bytes.
extern void BNCLogSetOutputToURLByteWrap(NSURL *_Nullable URL, long maxBytes);
typedef void (*BNCLogFlushFunctionPtr)(void);
///@param flushFunction The logging functions use `flushFunction` to flush the outstanding log
/// messages to the output function. For instance, this function may call
/// `fsync` to assure that the log messages are written to disk.
extern void BNCLogSetFlushFunction(BNCLogFlushFunctionPtr _Nullable flushFunction);
///@return Returns the current flush function.
extern BNCLogFlushFunctionPtr _Nullable BNCLogFlushFunction(void);
#pragma mark - BNCLogWriteMessage
/// The main logging function used in the variadic logging defines.
extern void BNCLogWriteMessageFormat(
BNCLogLevel logLevel,
const char *_Nullable sourceFileName,
int32_t sourceLineNumber,
NSString* _Nullable messageFormat,
...
) NS_FORMAT_FUNCTION(4,5);
/// Swift-friendly wrapper for BNCLogWriteMessageFormat
extern void BNCLogWriteMessage(
BNCLogLevel logLevel,
NSString *_Nonnull sourceFileName,
int32_t sourceLineNumber,
NSString *_Nonnull message
);
/// This function synchronizes all outstanding log messages and writes them to the logging function
/// set by BNCLogSetOutputFunction.
extern void BNCLogFlushMessages(void);
#pragma mark - Logging
///@info Logging
///@param format Log an info message with the specified formatting.
#define BNCLogDebugSDK(...) \
do { BNCLogWriteMessageFormat(BNCLogLevelDebugSDK, __FILE__, __LINE__, __VA_ARGS__); } while (0)
///@param format Log a debug message with the specified formatting.
#define BNCLogDebug(...) \
do { BNCLogWriteMessageFormat(BNCLogLevelDebug, __FILE__, __LINE__, __VA_ARGS__); } while (0)
///@param format Log a warning message with the specified formatting.
#define BNCLogWarning(...) \
do { BNCLogWriteMessageFormat(BNCLogLevelWarning, __FILE__, __LINE__, __VA_ARGS__); } while (0)
///@param format Log an error message with the specified formatting.
#define BNCLogError(...) \
do { BNCLogWriteMessageFormat(BNCLogLevelError, __FILE__, __LINE__, __VA_ARGS__); } while (0)
///@param format Log a message with the specified formatting.
#define BNCLog(...) \
do { BNCLogWriteMessageFormat(BNCLogLevelLog, __FILE__, __LINE__, __VA_ARGS__); } while (0)
///Cause a programmatic breakpoint if breakpoints are enabled.
#define BNCLogBreakPoint() \
do { \
if (BNCLogBreakPointsAreEnabled()) { \
BNCLogWriteMessageFormat(BNCLogLevelBreakPoint, __FILE__, __LINE__, @"Programmatic breakpoint."); \
if (BNCDebuggerIsAttached()) { \
BNCLogFlushMessages(); \
BNCDebugBreakpoint(); \
} \
} \
} while (0)
///Log a message and cause a programmatic breakpoint if breakpoints are enabled.
#define BNCBreakPointWithMessage(...) \
do { \
if (BNCLogBreakPointsAreEnabled() { \
BNCLogWriteMessageFormat(BNCLogLevelBreakPoint, __FILE__, __LINE__, __VA_ARGS__); \
if (BNCDebuggerIsAttached()) { \
BNCLogFlushMessages(); \
BNCDebugBreakpoint(); \
} \
} \
} while (0)
///Check if an asserting is true. If programmatic breakpoints are enabled then break.
#define BNCLogAssert(condition) \
do { \
if (!(condition)) { \
BNCLogWriteMessageFormat(BNCLogLevelAssert, __FILE__, __LINE__, @"(%s) !!!", #condition); \
if (BNCLogBreakPointsAreEnabled() && BNCDebuggerIsAttached()) { \
BNCLogFlushMessages(); \
BNCDebugBreakpoint(); \
} \
} \
} while (0)
///Check if an asserting is true logging a message if the assertion fails.
///If programmatic breakpoints are enabled then break.
#define BNCLogAssertWithMessage(condition, message, ...) \
do { \
if (!(condition)) { \
NSString *m = [NSString stringWithFormat:message, __VA_ARGS__]; \
BNCLogWriteMessageFormat(BNCLogLevelAssert, __FILE__, __LINE__, @"(%s) !!! %@", #condition, m); \
if (BNCLogBreakPointsAreEnabled() && BNCDebuggerIsAttached()) { \
BNCLogFlushMessages(); \
BNCDebugBreakpoint(); \
} \
} \
} while (0)
///Assert that the current thread is the main thread.
#define BNCLogAssertIsMainThread() \
BNCLogAssert([NSThread isMainThread])
///Write the name of the current method to the log.
#define BNCLogMethodName() \
BNCLogDebug(@"Method '%@'.", NSStringFromSelector(_cmd))
///Write the name of the current function to the log.
#define BNCLogFunctionName() \
BNCLogDebug(@"Function '%s'.", __FUNCTION__)
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,118 @@
//
// BNCNetworkServiceProtocol.h
// Branch-SDK
//
// Created by Edward Smith on 5/30/17.
// Copyright © 2017 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#pragma mark BNCNetworkOperationProtocol
///-----------------------------------------------------------------------------------
/// @name The `BNCNetworkServiceProtocol` and `BNCNetworkOperationProtocol` protocols.
///-----------------------------------------------------------------------------------
/**
The protocols `BNCNetworkServiceProtocol` and `BNCNetworkOperationProtocol` describe the methods
needed to create a drop in replacement for the standard Branch SDK networking.
See `Branch-SDK/Network/BNCNetworkService.h` and `Branch-SDK/Network/BNCNetworkService.m` for a
concrete example of how to implement the BNCNetworkServiceProtocol and BNCNetworkOperationProtocol
protocols.
Usage
-----
1. Create your own network service class that follows the `BNCNetworkServiceProtocol`.
The `new` and `networkOperationWithURLRequest:completion:` methods are required. The
others are optional.
2. Create your own network operation class that follows the `BNCNetworkOperationProtocol`.
The `start` method is required, as are all the getters for request, response, error, and date
data items.
3. In your app delegate, set your network class by calling `[Branch setNetworkServiceClass:]` with
your network class as a parameter. This method must be called before initializing the Branch
shared object.
*/
@protocol BNCNetworkOperationProtocol <NSObject>
/// The initial NSMutableURLRequest.
@required
@property (readonly, copy) NSURLRequest *request;
/// The response from the server.
@required
@property (readonly, copy) NSHTTPURLResponse *response;
/// The data from the server.
@required
@property (readonly, strong) NSData *responseData;
/// Any errors that occurred during the request.
@required
@property (readonly, copy) NSError *error;
/// The original start date of the operation. This should be set by the network service provider
/// when the operation is started.
@required
@property (readonly, copy) NSDate *startDate;
/// The timeout date for the operation. This is calculated and set by the underlying network service
/// provider by taking the original start date and adding the timeout interval of the URL request.
/// It should be set once (and not recalculated for each retry) by the network service.
@required
@property (readonly, copy) NSDate *timeoutDate;
/// A dictionary for the Branch SDK to store operation user info.
@required
@property (strong) NSDictionary *userInfo;
/// Starts the network operation.
@required
- (void) start;
/// Cancels a queued or in progress network operation.
@optional
- (void) cancel;
@end
#pragma mark - BNCNetworkServiceProtocol
/**
The `BNCNetworkServiceProtocol` defines a network service that handles a queue of network
operations.
*/
@protocol BNCNetworkServiceProtocol <NSObject>
/// Creates and returns a new network service.
@required
+ (id<BNCNetworkServiceProtocol>) new;
/// Cancel all current and queued network operations.
@optional
- (void) cancelAllOperations;
/// Create and return a new network operation object. The network operation is not started until
/// `[operation start]` is called.
@required
- (id<BNCNetworkOperationProtocol>) networkOperationWithURLRequest:(NSMutableURLRequest*)request
completion:(void (^)(id<BNCNetworkOperationProtocol>operation))completion;
/// A dictionary for the Branch SDK to store operation user info.
@required
@property (strong) NSDictionary *userInfo;
/// Pins the session to the array of public keys.
@optional
- (NSError*) pinSessionToPublicSecKeyRefs:(NSArray/**<SecKeyRef>*/*)publicKeys;
@end
@@ -0,0 +1,98 @@
//
// BNCPreferenceHelper.h
// Branch-SDK
//
// Created by Alex Austin on 6/6/14.
// Copyright (c) 2014 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#define FILE_NAME [[NSString stringWithUTF8String:__FILE__] lastPathComponent]
#define LINE_NUM __LINE__
NSURL* /* _Nonnull */ BNCURLForBranchDirectory(void);
@interface BNCPreferenceHelper : NSObject
@property (strong, nonatomic) NSString *lastRunBranchKey;
@property (strong, nonatomic) NSDate *lastStrongMatchDate;
@property (strong, nonatomic) NSString *appVersion;
@property (strong, nonatomic) NSString *deviceFingerprintID;
@property (strong, nonatomic) NSString *sessionID;
@property (strong, nonatomic) NSString *identityID;
@property (strong, nonatomic) NSString *linkClickIdentifier;
@property (strong, nonatomic) NSString *spotlightIdentifier;
@property (strong, atomic) NSString *universalLinkUrl;
@property (strong, nonatomic) NSString *userUrl;
@property (strong, nonatomic) NSString *userIdentity;
@property (strong, nonatomic) NSString *sessionParams;
@property (strong, nonatomic) NSString *installParams;
@property (assign, nonatomic) BOOL isDebug;
@property (assign, nonatomic) BOOL shouldWaitForInit;
@property (assign, nonatomic) BOOL checkedFacebookAppLinks;
@property (assign, nonatomic) BOOL checkedAppleSearchAdAttribution;
@property (assign, nonatomic) NSInteger retryCount;
@property (assign, nonatomic) NSTimeInterval retryInterval;
@property (assign, nonatomic) NSTimeInterval timeout;
@property (strong, atomic) NSString *externalIntentURI;
@property (strong, nonatomic) NSMutableDictionary *savedAnalyticsData;
@property (assign, nonatomic) NSInteger installRequestDelay;
@property (strong, nonatomic) NSDictionary *appleSearchAdDetails;
@property (assign, nonatomic) BOOL appleSearchAdNeedsSend;
@property (strong, nonatomic) NSString *lastSystemBuildVersion;
@property (strong, nonatomic) NSString *browserUserAgentString;
@property (strong, atomic) NSString *referringURL;
@property (strong, atomic) NSString *branchAPIURL;
@property (assign, atomic) BOOL limitFacebookTracking;
@property (strong, atomic) NSDate *previousAppBuildDate;
@property (strong, atomic) NSArray<NSString*> *URLBlackList;
@property (assign, atomic) NSInteger URLBlackListVersion;
@property (assign, atomic) BOOL blacklistURLOpen;
@property (assign, atomic) BOOL trackingDisabled;
- (void) clearTrackingInformation;
+ (BNCPreferenceHelper *)preferenceHelper;
- (NSString *)getAPIBaseURL;
- (NSString *)getAPIURL:(NSString *)endpoint;
- (NSString *)getEndpointFromURL:(NSString *)url;
- (void)clearUserCreditsAndCounts;
- (void)clearUserCredits;
- (id)getBranchUniversalLinkDomains;
- (void)setCreditCount:(NSInteger)count;
- (void)setCreditCount:(NSInteger)count forBucket:(NSString *)bucket;
- (void)removeCreditCountForBucket:(NSString *)bucket;
- (NSDictionary *)getCreditDictionary;
- (NSInteger)getCreditCount;
- (NSInteger)getCreditCountForBucket:(NSString *)bucket;
- (void)updateBranchViewCount:(NSString *)branchViewID;
- (NSInteger)getBranchViewCount:(NSString *)branchViewID;
- (void)setRequestMetadataKey:(NSString *)key value:(NSObject *)value;
- (NSMutableDictionary *)requestMetadataDictionary;
- (void)addInstrumentationDictionaryKey:(NSString *)key value:(NSString *)value;
- (NSMutableDictionary *)instrumentationDictionary;
- (void)clearInstrumentationDictionary;
- (void)saveBranchAnalyticsData:(NSDictionary *)analyticsData;
- (void)clearBranchAnalyticsData;
- (NSMutableDictionary *)getBranchAnalyticsData;
- (NSDictionary *)getContentAnalyticsManifest;
- (void)saveContentAnalyticsManifest:(NSDictionary *)cdManifest;
- (NSMutableString*) sanitizedMutableBaseURL:(NSString*)baseUrl;
- (void) synchronize; // Flushes preference queue to persistence.
@end
@@ -0,0 +1,37 @@
//
// BNCServerInterface.h
// Branch-SDK
//
// Created by Alex Austin on 6/4/14.
// Copyright (c) 2014 Branch Metrics. All rights reserved.
//
#import "BNCServerResponse.h"
#import "BNCPreferenceHelper.h"
#import "BNCNetworkServiceProtocol.h"
typedef void (^BNCServerCallback)(BNCServerResponse *response, NSError *error);
@interface BNCServerInterface : NSObject
- (void)getRequest:(NSDictionary *)params
url:(NSString *)url
key:(NSString *)key
callback:(BNCServerCallback)callback;
- (BNCServerResponse *)postRequestSynchronous:(NSDictionary *)post
url:(NSString *)url
key:(NSString *)key;
- (void)postRequest:(NSDictionary *)post
url:(NSString *)url
key:(NSString *)key
callback:(BNCServerCallback)callback;
- (void)genericHTTPRequest:(NSURLRequest *)request
retryNumber:(NSInteger)retryNumber
callback:(BNCServerCallback)callback
retryHandler:(NSURLRequest *(^)(NSInteger))retryHandler;
@property (strong, nonatomic) BNCPreferenceHelper *preferenceHelper;
@end
@@ -0,0 +1,16 @@
//
// BNCServerRequest.h
// Branch-SDK
//
// Created by Alex Austin on 6/5/14.
// Copyright (c) 2014 Branch Metrics. All rights reserved.
//
#import "BNCServerInterface.h"
@interface BNCServerRequest : NSObject <NSCoding>
- (void)makeRequest:(BNCServerInterface *)serverInterface key:(NSString *)key callback:(BNCServerCallback)callback;
- (void)processResponse:(BNCServerResponse *)response error:(NSError *)error;
- (void)safeSetValue:(NSObject *)value forKey:(NSString *)key onDict:(NSMutableDictionary *)dict;
@end
@@ -0,0 +1,34 @@
//
// BNCServerRequestQueue.h
// Branch-SDK
//
// Created by Qinwei Gong on 9/6/14.
// Copyright (c) 2014 Branch Metrics. All rights reserved.
//
#import "BNCServerRequest.h"
@class BranchOpenRequest;
@interface BNCServerRequestQueue : NSObject
- (void)enqueue:(BNCServerRequest *)request;
- (BNCServerRequest *)dequeue;
- (BNCServerRequest *)peek;
- (BNCServerRequest *)peekAt:(NSUInteger)index;
- (void)insert:(BNCServerRequest *)request at:(NSUInteger)index;
- (BNCServerRequest *)removeAt:(NSUInteger)index;
- (void)remove:(BNCServerRequest *)request;
- (void)persistEventually;
- (void)persistImmediately;
- (void)clearQueue;
- (BOOL)containsInstallOrOpen;
- (BOOL)removeInstallOrOpen;
- (BOOL)containsClose;
- (BranchOpenRequest *)moveInstallOrOpenToFront:(NSInteger)networkCount;
+ (id)getInstance;
@property (readonly, assign, atomic) NSInteger queueDepth;
@property (readonly, assign, atomic) BOOL isDirty;
@end
@@ -0,0 +1,18 @@
//
// BNCServerResponse.h
// Branch-SDK
//
// Created by Qinwei Gong on 10/10/14.
// Copyright (c) 2014 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
@interface BNCServerResponse : NSObject
@property (nonatomic, strong) NSNumber *statusCode;
@property (nonatomic, strong) id data;
@end
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,42 @@
//
// BranchActivityItemProvider.h
// Branch-TestBed
//
// Created by Scott Hasbrouck on 1/28/15.
// Copyright (c) 2015 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
@import UIKit;
#else
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
/**
The `BranchActivityItemProviderDelegate` allows you to customize the link parameters based on the channel chosen by the user.
This is useful in the case that you want to add specific items only for Facebook or Twitter for instance.
Every item is optional, and if not provided, will fallback to the item provided with the constructor.
*/
@protocol BranchActivityItemProviderDelegate <NSObject>
@optional
- (NSDictionary *)activityItemParamsForChannel:(NSString *)channel;
- (NSArray *)activityItemTagsForChannel:(NSString *)channel;
- (NSString *)activityItemFeatureForChannel:(NSString *)channel;
- (NSString *)activityItemStageForChannel:(NSString *)channel;
- (NSString *)activityItemCampaignForChannel:(NSString *)channel;
- (NSString *)activityItemAliasForChannel:(NSString *)channel;
- (NSString *)activityItemOverrideChannelForChannel:(NSString *)channel;
@end
@interface BranchActivityItemProvider : UIActivityItemProvider
- (id)initWithParams:(NSDictionary *)params andTags:(NSArray *)tags andFeature:(NSString *)feature andStage:(NSString *)stage andAlias:(NSString *)alias __attribute__((deprecated(("Use the delegate method instead"))));;
- (id)initWithParams:(NSDictionary *)params tags:(NSArray *)tags feature:(NSString *)feature stage:(NSString *)stage campaign:(NSString *)campaign alias:(NSString *)alias delegate:(id <BranchActivityItemProviderDelegate>)delegate;
+ (NSString *)humanReadableChannelWithActivityType:(NSString *)activityString;
@end
@@ -0,0 +1,144 @@
//
// BranchConstants.h
// Branch-TestBed
//
// Created by Graham Mueller on 6/10/15.
// Copyright (c) 2015 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
extern NSString * const BRANCH_REQUEST_KEY_BRANCH_IDENTITY;
extern NSString * const BRANCH_REQUEST_KEY_DEVELOPER_IDENTITY;
extern NSString * const BRANCH_REQUEST_KEY_DEVICE_FINGERPRINT_ID;
extern NSString * const BRANCH_REQUEST_KEY_SESSION_ID;
extern NSString * const BRANCH_REQUEST_KEY_ACTION;
extern NSString * const BRANCH_REQUEST_KEY_STATE;
extern NSString * const BRANCH_REQUEST_KEY_BUCKET;
extern NSString * const BRANCH_REQUEST_KEY_AMOUNT;
extern NSString * const BRANCH_REQUEST_KEY_LENGTH;
extern NSString * const BRANCH_REQUEST_KEY_DIRECTION;
extern NSString * const BRANCH_REQUEST_KEY_STARTING_TRANSACTION_ID;
extern NSString * const BRANCH_REQUEST_KEY_REFERRAL_USAGE_TYPE;
extern NSString * const BRANCH_REQUEST_KEY_REFERRAL_REWARD_LOCATION;
extern NSString * const BRANCH_REQUEST_KEY_REFERRAL_TYPE;
extern NSString * const BRANCH_REQUEST_KEY_REFERRAL_CREATION_SOURCE;
extern NSString * const BRANCH_REQUEST_KEY_REFERRAL_PREFIX;
extern NSString * const BRANCH_REQUEST_KEY_REFERRAL_EXPIRATION;
extern NSString * const BRANCH_REQUEST_KEY_URL_SOURCE;
extern NSString * const BRANCH_REQUEST_KEY_URL_TAGS;
extern NSString * const BRANCH_REQUEST_KEY_URL_LINK_TYPE;
extern NSString * const BRANCH_REQUEST_KEY_URL_ALIAS;
extern NSString * const BRANCH_REQUEST_KEY_URL_CHANNEL;
extern NSString * const BRANCH_REQUEST_KEY_URL_FEATURE;
extern NSString * const BRANCH_REQUEST_KEY_URL_STAGE;
extern NSString * const BRANCH_REQUEST_KEY_URL_CAMPAIGN;
extern NSString * const BRANCH_REQUEST_KEY_URL_DURATION;
extern NSString * const BRANCH_REQUEST_KEY_URL_DATA;
extern NSString * const BRANCH_REQUEST_KEY_URL_IGNORE_UA_STRING;
extern NSString * const BRANCH_REQUEST_KEY_HARDWARE_ID;
extern NSString * const BRANCH_REQUEST_KEY_HARDWARE_ID_TYPE;
extern NSString * const BRANCH_REQUEST_KEY_IS_HARDWARE_ID_REAL;
extern NSString * const BRANCH_REQUEST_KEY_IOS_VENDOR_ID;
extern NSString * const BRANCH_REQUEST_KEY_AD_TRACKING_ENABLED;
extern NSString * const BRANCH_REQUEST_KEY_DEBUG;
extern NSString * const BRANCH_REQUEST_KEY_BUNDLE_ID;
extern NSString * const BRANCH_REQUEST_KEY_TEAM_ID;
extern NSString * const BRANCH_REQUEST_KEY_APP_VERSION;
extern NSString * const BRANCH_REQUEST_KEY_OS;
extern NSString * const BRANCH_REQUEST_KEY_OS_VERSION;
extern NSString * const BRANCH_REQUEST_KEY_URI_SCHEME;
extern NSString * const BRANCH_REQUEST_KEY_CHECKED_FACEBOOK_APPLINKS;
extern NSString * const BRANCH_REQUEST_KEY_CHECKED_APPLE_AD_ATTRIBUTION;
extern NSString * const BRANCH_REQUEST_KEY_LINK_IDENTIFIER;
extern NSString * const BRANCH_REQUEST_KEY_SPOTLIGHT_IDENTIFIER;
extern NSString * const BRANCH_REQUEST_KEY_UNIVERSAL_LINK_URL;
extern NSString * const BRANCH_REQUEST_KEY_BRAND;
extern NSString * const BRANCH_REQUEST_KEY_MODEL;
extern NSString * const BRANCH_REQUEST_KEY_SCREEN_WIDTH;
extern NSString * const BRANCH_REQUEST_KEY_SCREEN_HEIGHT;
extern NSString * const BRANCH_REQUEST_KEY_IS_SIMULATOR;
extern NSString * const BRANCH_REQUEST_KEY_LOG;
extern NSString * const BRANCH_REQUEST_KEY_EXTERNAL_INTENT_URI;
extern NSString * const BRANCH_REQUEST_KEY_INSTRUMENTATION;
extern NSString * const BRANCH_REQUEST_ENDPOINT_SET_IDENTITY;
extern NSString * const BRANCH_REQUEST_ENDPOINT_APP_LINK_SETTINGS;
extern NSString * const BRANCH_REQUEST_ENDPOINT_LOGOUT;
extern NSString * const BRANCH_REQUEST_ENDPOINT_USER_COMPLETED_ACTION;
extern NSString * const BRANCH_REQUEST_ENDPOINT_LOAD_REWARDS;
extern NSString * const BRANCH_REQUEST_ENDPOINT_REDEEM_REWARDS;
extern NSString * const BRANCH_REQUEST_ENDPOINT_CREDIT_HISTORY;
extern NSString * const BRANCH_REQUEST_ENDPOINT_GET_SHORT_URL;
extern NSString * const BRANCH_REQUEST_ENDPOINT_CLOSE;
extern NSString * const BRANCH_REQUEST_ENDPOINT_OPEN;
extern NSString * const BRANCH_REQUEST_ENDPOINT_INSTALL;
extern NSString * const BRANCH_REQUEST_ENDPOINT_REGISTER_VIEW;
extern NSString * const BRANCH_RESPONSE_KEY_BRANCH_IDENTITY;
extern NSString * const BRANCH_RESPONSE_KEY_SESSION_ID;
extern NSString * const BRANCH_RESPONSE_KEY_USER_URL;
extern NSString * const BRANCH_RESPONSE_KEY_INSTALL_PARAMS;
extern NSString * const BRANCH_RESPONSE_KEY_REFERRER;
extern NSString * const BRANCH_RESPONSE_KEY_REFERREE;
extern NSString * const BRANCH_RESPONSE_KEY_URL;
extern NSString * const BRANCH_RESPONSE_KEY_SPOTLIGHT_IDENTIFIER;
extern NSString * const BRANCH_RESPONSE_KEY_DEVELOPER_IDENTITY;
extern NSString * const BRANCH_RESPONSE_KEY_DEVICE_FINGERPRINT_ID;
extern NSString * const BRANCH_RESPONSE_KEY_SESSION_DATA;
extern NSString * const BRANCH_RESPONSE_KEY_CLICKED_BRANCH_LINK;
extern NSString * const BRANCH_RESPONSE_KEY_BRANCH_VIEW_DATA;
extern NSString * const BRANCH_RESPONSE_KEY_BRANCH_REFERRING_LINK;
extern NSString * const BRANCH_LINK_DATA_KEY_OG_TITLE;
extern NSString * const BRANCH_LINK_DATA_KEY_OG_DESCRIPTION;
extern NSString * const BRANCH_LINK_DATA_KEY_OG_IMAGE_URL;
extern NSString * const BRANCH_LINK_DATA_KEY_TITLE;
extern NSString * const BRANCH_LINK_DATA_KEY_DESCRIPTION;
extern NSString * const BRANCH_LINK_DATA_KEY_PUBLICLY_INDEXABLE;
extern NSString * const BRANCH_LINK_DATA_KEY_LOCALLY_INDEXABLE;
extern NSString * const BRANCH_LINK_DATA_KEY_TYPE;
extern NSString * const BRANCH_LINK_DATA_KEY_THUMBNAIL_URL;
extern NSString * const BRANCH_LINK_DATA_KEY_KEYWORDS;
extern NSString * const BRANCH_LINK_DATA_KEY_CANONICAL_IDENTIFIER;
extern NSString * const BRANCH_LINK_DATA_KEY_CANONICAL_URL;
extern NSString * const BRANCH_LINK_DATA_KEY_CONTENT_EXPIRATION_DATE;
extern NSString * const BRANCH_LINK_DATA_KEY_CONTENT_TYPE;
extern NSString * const BRANCH_LINK_DATA_KEY_EMAIL_SUBJECT;
extern NSString * const BRANCH_LINK_DATA_KEY_EMAIL_HTML_HEADER;
extern NSString * const BRANCH_LINK_DATA_KEY_EMAIL_HTML_FOOTER;
extern NSString * const BRANCH_LINK_DATA_KEY_EMAIL_HTML_LINK_TEXT;
extern NSString * const BRANCH_SPOTLIGHT_PREFIX;
extern NSString * const BRANCH_MANIFEST_VERSION_KEY;
extern NSString * const BRANCH_HASH_MODE_KEY;
extern NSString * const BRANCH_MANIFEST_KEY;
extern NSString * const BRANCH_PATH_KEY;
extern NSString * const BRANCH_FILTERED_KEYS;
extern NSString * const BRANCH_MAX_TEXT_LEN_KEY;
extern NSString * const BRANCH_MAX_VIEW_HISTORY_LENGTH;
extern NSString * const BRANCH_MAX_PACKET_SIZE_KEY;
extern NSString * const BRANCH_CONTENT_DISCOVER_KEY;
extern NSString * const BRANCH_BUNDLE_IDENTIFIER;
extern NSString * const BRANCH_TIME_STAMP_KEY;
extern NSString * const BRANCH_TIME_STAMP_CLOSE_KEY;
extern NSString * const BRANCH_NAV_PATH_KEY;
extern NSString * const BRANCH_REFERRAL_LINK_KEY;
extern NSString * const BRANCH_CONTENT_LINK_KEY;
extern NSString * const BRANCH_CONTENT_META_DATA_KEY;
extern NSString * const BRANCH_VIEW_KEY;
extern NSString * const BRANCH_CONTENT_DATA_KEY;
extern NSString * const BRANCH_CONTENT_KEYS_KEY;
extern NSString * const BRANCH_PACKAGE_NAME_KEY;
extern NSString * const BRANCH_ENTITIES_KEY;
extern NSString * const BRANCH_REQUEST_KEY_SEARCH_AD;
extern NSString * const BRANCH_CRASHLYTICS_SDK_VERSION_KEY;
extern NSString * const BRANCH_CRASHLYTICS_FINGERPRINT_ID_KEY;
extern NSString * const BRANCH_CRASHLYTICS_LOW_MEMORY_KEY;
@@ -0,0 +1,39 @@
//
// BranchDeepLinkingController.h
// Branch-TestBed
//
// Created by Graham Mueller on 6/18/15.
// Copyright (c) 2015 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
@import UIKit;
#else
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
@protocol BranchDeepLinkingControllerCompletionDelegate <NSObject>
- (void)deepLinkingControllerCompleted
__attribute__((deprecated(("This API is deprecated. Instead, use deepLinkingControllerCompletedFrom: viewController"))));;
- (void)deepLinkingControllerCompletedFrom:(UIViewController*) viewController;
@end
typedef NS_ENUM(NSInteger, BNCViewControllerPresentationOption) {
BNCViewControllerOptionShow,
BNCViewControllerOptionPush,
BNCViewControllerOptionPresent
};
#pragma mark - BranchDeepLinkingController Protocol
@protocol BranchDeepLinkingController <NSObject>
- (void)configureControlWithData:(NSDictionary *)data;
@property (weak, nonatomic) id <BranchDeepLinkingControllerCompletionDelegate> deepLinkingCompletionDelegate;
@end
@@ -0,0 +1,45 @@
//
// BranchDelegate.h
// Branch-SDK
//
// Created by Edward Smith on 6/30/17.
// Copyright © 2017 Branch Metrics. All rights reserved.
//
// TODO: Add documentation
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
@class Branch, BranchUniversalObject, BranchLinkProperties, BranchLink;
#pragma mark BranchDelegate Protocol
@protocol BranchDelegate <NSObject>
@optional
- (void) branch:(Branch*_Nonnull)branch willStartSessionWithURL:(NSURL*_Nullable)url;
@optional
- (void) branch:(Branch*_Nonnull)branch
didStartSessionWithURL:(NSURL*_Nullable)url
branchLink:(BranchLink*_Nullable)branchLink;
@optional
- (void) branch:(Branch*_Nonnull)branch
failedToStartSessionWithURL:(NSURL*_Nullable)url
error:(NSError*_Nullable)error;
@end
#pragma mark - Branch Notifications
FOUNDATION_EXPORT NSString*_Nonnull const BranchWillStartSessionNotification;
FOUNDATION_EXPORT NSString*_Nonnull const BranchDidStartSessionNotification;
FOUNDATION_EXPORT NSString*_Nonnull const BranchErrorKey;
FOUNDATION_EXPORT NSString*_Nonnull const BranchURLKey;
FOUNDATION_EXPORT NSString*_Nonnull const BranchUniversalObjectKey;
FOUNDATION_EXPORT NSString*_Nonnull const BranchLinkPropertiesKey;
@@ -0,0 +1,87 @@
//
// BranchEvent.h
// Branch-SDK
//
// Created by Edward Smith on 7/24/17.
// Copyright © 2017 Branch Metrics. All rights reserved.
//
#import "Branch.h"
#import "BNCCommerceEvent.h"
#import "BranchUniversalObject.h"
///@group Branch Event Logging
typedef NSString*const BranchStandardEvent NS_STRING_ENUM;
///@name Commerce Events
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventAddToCart;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventAddToWishlist;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventViewCart;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventInitiatePurchase;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventAddPaymentInfo;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventPurchase;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventSpendCredits;
///@name Content Events
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventSearch;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventViewItem;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventViewItems;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventRate;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventShare;
///@name User Lifecycle Events
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventCompleteRegistration;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventCompleteTutorial;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventAchieveLevel;
FOUNDATION_EXPORT BranchStandardEvent _Nonnull BranchStandardEventUnlockAchievement;
#pragma mark - BranchEvent
@interface BranchEvent : NSObject
- (instancetype _Nonnull) initWithName:(NSString*_Nonnull)name NS_DESIGNATED_INITIALIZER;
+ (instancetype _Nonnull) standardEvent:(BranchStandardEvent _Nonnull)standardEvent;
+ (instancetype _Nonnull) standardEvent:(BranchStandardEvent _Nonnull)standardEvent
withContentItem:(BranchUniversalObject* _Nonnull)contentItem;
+ (instancetype _Nonnull) customEventWithName:(NSString*_Nonnull)name;
+ (instancetype _Nonnull) customEventWithName:(NSString*_Nonnull)name
contentItem:(BranchUniversalObject*_Nonnull)contentItem;
- (instancetype _Nonnull) init __attribute((unavailable));
+ (instancetype _Nonnull) new __attribute((unavailable));
@property (nonatomic, strong) NSString*_Nullable transactionID;
@property (nonatomic, strong) BNCCurrency _Nullable currency;
@property (nonatomic, strong) NSDecimalNumber*_Nullable revenue;
@property (nonatomic, strong) NSDecimalNumber*_Nullable shipping;
@property (nonatomic, strong) NSDecimalNumber*_Nullable tax;
@property (nonatomic, strong) NSString*_Nullable coupon;
@property (nonatomic, strong) NSString*_Nullable affiliation;
@property (nonatomic, strong) NSString*_Nullable eventDescription;
@property (nonatomic, strong) NSString*_Nullable searchQuery;
@property (nonatomic, copy) NSMutableArray<BranchUniversalObject*>*_Nonnull contentItems;
@property (nonatomic, copy) NSMutableDictionary<NSString*, NSString*> *_Nonnull customData;
- (void) logEvent; //!< Logs the event on the Branch server.
- (NSDictionary*_Nonnull) dictionary; //!< Returns a dictionary representation of the event.
- (NSString* _Nonnull) description; //!< Returns a string description of the event.
@end
#pragma mark - BranchEventRequest
@interface BranchEventRequest : BNCServerRequest <NSCoding>
- (instancetype _Nonnull) initWithServerURL:(NSURL*_Nonnull)serverURL
eventDictionary:(NSDictionary*_Nullable)eventDictionary
completion:(void (^_Nullable)(NSDictionary*_Nullable response, NSError*_Nullable error))completion;
@property (strong) NSDictionary*_Nullable eventDictionary;
@property (strong) NSURL*_Nullable serverURL;
@property (copy) void (^_Nullable completion)(NSDictionary*_Nullable response, NSError*_Nullable error);
@end
@@ -0,0 +1,31 @@
//
// BranchLinkProperties.h
// Branch-TestBed
//
// Created by Derrick Staten on 10/16/15.
// Copyright © 2015 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
@interface BranchLinkProperties : NSObject
@property (nonatomic, strong) NSArray *tags;
@property (nonatomic, strong) NSString *feature;
@property (nonatomic, strong) NSString *alias;
@property (nonatomic, strong) NSString *channel;
@property (nonatomic, strong) NSString *stage;
@property (nonatomic, strong) NSString *campaign;
@property (nonatomic) NSUInteger matchDuration;
@property (nonatomic, strong) NSDictionary *controlParams;
- (void)addControlParam:(NSString *)controlParam withValue:(NSString *)value;
+ (BranchLinkProperties *)getBranchLinkPropertiesFromDictionary:(NSDictionary *)dictionary;
- (NSString *)description;
@end
@@ -0,0 +1,118 @@
//
// BranchShareLink.h
// Branch-SDK
//
// Created by Edward Smith on 3/13/17.
// Copyright © 2017 Branch Metrics. All rights reserved.
//
#import "BranchUniversalObject.h"
@class BranchShareLink;
@protocol BranchShareLinkDelegate <NSObject>
@optional
/**
This delegate method is called during the course of user interaction while sharing a
Branch link. The linkProperties, such as channel, or the share text parameters can be
altered as appropriate for the particular user-chosen activityType.
This delegate method will be called multiple times during a share interaction and might be
called on a background thread.
@param shareLink The calling BranchShareLink that is currently sharing.
*/
- (void) branchShareLinkWillShare:(BranchShareLink*_Nonnull)shareLink;
/**
This delegate method is called when sharing has completed.
@param shareLink The Branch share action sheet that has just completed.
@param completed This parameter is YES if sharing completed successfully and the user did not cancel.
@param error This parameter contains any errors that occurred will attempting to share.
*/
- (void) branchShareLink:(BranchShareLink*_Nonnull)shareLink
didComplete:(BOOL)completed
withError:(NSError*_Nullable)error;
@end
#pragma mark - BranchShareLink
/**
The `BranchShareLink` class facilitates sharing Branch links using a `UIActivityViewController`
user experience.
The `BranchShareLink` is a new class that is similar to but has more functionality than the old
`[BranchUniversalObject showShareSheetWithLinkProperties:...]` methods.
The `BranchShareLink` is initialized with the `BranchUniversalObject` and `BranchLinkProperties`
objects that will be used to generate the Branch link.
After the `BranchShareLink` object is created, set any configuration properties on the activity
sheet object, and then call `showFromViewController:anchor:` to show the activity sheet.
A delegate on the BranchShareLink can further configure the share experience. For instance the link
parameters can be changed depending on the activity that the user selects.
*/
@interface BranchShareLink : NSObject
/**
Creates a BranchShareLink object.
@param universalObject The Branch Universal Object the will be shared.
@param linkProperties The link properties that the link will have.
*/
- (instancetype _Nonnull) initWithUniversalObject:(BranchUniversalObject*_Nonnull)universalObject
linkProperties:(BranchLinkProperties*_Nonnull)linkProperties
NS_DESIGNATED_INITIALIZER;
- (instancetype _Nonnull) init NS_UNAVAILABLE;
+ (instancetype _Nonnull) new NS_UNAVAILABLE;
///Returns an array of activity item providers, one for the Branch Universal Object,
///one for the share text (if provided), and one for the shareObject (if provided).
- (NSArray<UIActivityItemProvider*>*_Nonnull) activityItems;
/**
Presents a UIActivityViewController that shares the Branch link.
@param viewController The parent view controller from which to present the the activity sheet.
@param anchorViewOrButtonItem The anchor point for the activity sheet. Used for iPad form factors.
*/
- (void) presentActivityViewControllerFromViewController:(UIViewController*_Nullable)viewController
anchor:(id _Nullable)anchorViewOrButtonItem;
///The title for the share sheet.
@property (nonatomic, strong) NSString*_Nullable title;
///Share text for the item.
///This text can be changed later when the `branchShareSheetWillShare:` delegate method is called.
@property (nonatomic, strong) NSString*_Nullable shareText;
///An additional, user defined, non-typed, object to be shared.
///This object can be changed later when the `branchShareSheetWillShare:` delegate method is called.
@property (nonatomic, strong) id _Nullable shareObject;
///Sets an email subject line for the share activity. If the Branch link property already has an
///email subject, that attribute takes precedence over this field.
@property (nonatomic, strong) NSString*_Nullable emailSubject;
///The resulting Branch URL that was shared.
@property (nonatomic, strong, readonly) NSURL*_Nullable shareURL;
///The activity type that the user chose.
@property (nonatomic, strong, readonly) NSString*_Nullable activityType;
///Extra server parameters that should be included with the link data.
@property (nonatomic, strong) NSMutableDictionary*_Nullable serverParameters;
///The Branch Universal Object that will be shared.
@property (nonatomic, strong, readonly) BranchUniversalObject*_Nonnull universalObject;
///The link properties for the created URL.
@property (nonatomic, strong, readonly) BranchLinkProperties*_Nonnull linkProperties;
///The delegate. See 'BranchShareLinkDelegate' above for a description.
@property (nonatomic, weak) id<BranchShareLinkDelegate>_Nullable delegate;
@end
@@ -0,0 +1,255 @@
//
// BranchUniversalObject.h
// Branch-SDK
//
// Created by Derrick Staten on 10/16/15.
// Copyright © 2015 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import UIKit;
@import CoreSpotlight;
#else
#import <UIKit/UIKit.h>
#import <CoreSpotlight/CoreSpotlight.h>
#endif
#import "BNCCommerceEvent.h"
@class BranchLinkProperties;
#pragma mark BranchContentIndexMode
typedef NS_ENUM(NSInteger, BranchContentIndexMode) {
BranchContentIndexModePublic,
BranchContentIndexModePrivate
};
#pragma mark - BranchContentSchema
typedef NSString * const BranchContentSchema NS_STRING_ENUM;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaCommerceAuction;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaCommerceBusiness;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaCommerceOther;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaCommerceProduct;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaCommerceRestaurant;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaCommerceService;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaCommerceTravelFlight;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaCommerceTravelHotel;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaCommerceTravelOther;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaGameState;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaMediaImage;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaMediaMixed;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaMediaMusic;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaMediaOther;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaMediaVideo;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaOther;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaTextArticle;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaTextBlog;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaTextOther;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaTextRecipe;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaTextReview;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaTextSearchResults;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaTextStory;
FOUNDATION_EXPORT BranchContentSchema _Nonnull BranchContentSchemaTextTechnicalDoc;
#pragma mark - BranchCondition
typedef NSString * const BranchCondition NS_STRING_ENUM;
FOUNDATION_EXPORT BranchCondition _Nonnull BranchConditionOther;
FOUNDATION_EXPORT BranchCondition _Nonnull BranchConditionNew;
FOUNDATION_EXPORT BranchCondition _Nonnull BranchConditionExcellent;
FOUNDATION_EXPORT BranchCondition _Nonnull BranchConditionGood;
FOUNDATION_EXPORT BranchCondition _Nonnull BranchConditionFair;
FOUNDATION_EXPORT BranchCondition _Nonnull BranchConditionPoor;
FOUNDATION_EXPORT BranchCondition _Nonnull BranchConditionUsed;
FOUNDATION_EXPORT BranchCondition _Nonnull BranchConditionRefurbished;
#pragma mark - BranchContentMetadata
@interface BranchContentMetadata : NSObject
@property (nonatomic, strong, nullable) BranchContentSchema contentSchema;
@property (nonatomic, assign) double quantity;
@property (nonatomic, strong, nullable) NSDecimalNumber *price;
@property (nonatomic, strong, nullable) BNCCurrency currency;
@property (nonatomic, strong, nullable) NSString *sku;
@property (nonatomic, strong, nullable) NSString *productName;
@property (nonatomic, strong, nullable) NSString *productBrand;
@property (nonatomic, strong, nullable) BNCProductCategory productCategory;
@property (nonatomic, strong, nullable) NSString *productVariant;
@property (nonatomic, strong, nullable) BranchCondition condition;
@property (nonatomic, assign) double ratingAverage;
@property (nonatomic, assign) NSInteger ratingCount;
@property (nonatomic, assign) double ratingMax;
@property (nonatomic, assign) double rating;
@property (nonatomic, strong, nullable) NSString *addressStreet;
@property (nonatomic, strong, nullable) NSString *addressCity;
@property (nonatomic, strong, nullable) NSString *addressRegion;
@property (nonatomic, strong, nullable) NSString *addressCountry;
@property (nonatomic, strong, nullable) NSString *addressPostalCode;
@property (nonatomic, assign) double latitude;
@property (nonatomic, assign) double longitude;
@property (nonatomic, copy, nonnull) NSMutableArray<NSString*> *imageCaptions;
@property (nonatomic, copy, nonnull) NSMutableDictionary<NSString*, NSString*> *customMetadata;
- (NSDictionary*_Nonnull) dictionary;
+ (BranchContentMetadata*_Nonnull) contentMetadataWithDictionary:(NSDictionary*_Nullable)dictionary;
@end
#pragma mark - BranchUniversalObject
@interface BranchUniversalObject : NSObject
- (nonnull instancetype)initWithCanonicalIdentifier:(nonnull NSString *)canonicalIdentifier;
- (nonnull instancetype)initWithTitle:(nonnull NSString *)title;
@property (nonatomic, strong, nullable) NSString *canonicalIdentifier;
@property (nonatomic, strong, nullable) NSString *canonicalUrl;
@property (nonatomic, strong, nullable) NSString *title;
@property (nonatomic, strong, nullable) NSString *contentDescription;
@property (nonatomic, strong, nullable) NSString *imageUrl;
@property (nonatomic, strong, nullable) NSArray<NSString*> *keywords;
@property (nonatomic, strong, nullable) NSDate *creationDate;
@property (nonatomic, strong, nullable) NSDate *expirationDate;
@property (nonatomic, assign) BOOL locallyIndex; //!< Index on Spotlight.
@property (nonatomic, assign) BOOL publiclyIndex; //!< Index on Google, Branch, etc.
@property (nonatomic, strong, nonnull) BranchContentMetadata *contentMetadata;
///@name Deprecated Properties
@property (nonatomic, strong, nullable)
__attribute__((deprecated(("Use `BranchUniversalObject.contentMetadata.customMetadata` instead."))))
NSDictionary *metadata;
- (void)addMetadataKey:(nonnull NSString *)key value:(nonnull NSString *)value
__attribute__((deprecated(("Use `BranchUniversalObject.contentMetadata.customMetadata` instead."))));
@property (nonatomic, strong, nullable)
__attribute__((deprecated(("Use `BranchUniversalObject.contentMetadata.contentSchema` instead."))))
NSString *type;
@property (nonatomic, assign)
__attribute__((deprecated(("Use `BranchUniversalObject.locallyIndex and BranchUniversalObject.publiclyIndex` instead."))))
BranchContentIndexMode contentIndexMode;
@property (nonatomic, strong, nullable)
__attribute__((deprecated(("Not used due to iOS 10.0 Spotlight changes."))))
NSString *spotlightIdentifier;
@property (nonatomic, assign)
__attribute__((deprecated(("Use `BranchUniversalObject.contentMetadata.price` instead."))))
CGFloat price;
@property (nonatomic, strong, nullable)
__attribute__((deprecated(("Use `BranchUniversalObject.contentMetadata.currency` instead."))))
NSString *currency;
@property (nonatomic, assign)
__attribute__((deprecated(("Use `BranchUniversalObject.locallyIndex` instead."))))
BOOL automaticallyListOnSpotlight;
/// @name Log a User Content View Event
- (void)registerView;
- (void)registerViewWithCallback:(void (^_Nullable)(NSDictionary * _Nullable params, NSError * _Nullable error))callback;
/// @name User Event Tracking
- (void)userCompletedAction:(nonnull NSString *)action;
// __attribute__((deprecated(("Use `[BranchEvent logEvent...]` instead."))));
- (void)userCompletedAction:(nonnull NSString *)action withState:(nullable NSDictionary *)state;
// __attribute__((deprecated(("Use `[BranchEvent logEvent...]` instead."))));
/// @name Short Links
/// Returns a Branch short URL to the content item with the passed link properties.
- (nullable NSString *)getShortUrlWithLinkProperties:(nonnull BranchLinkProperties *)linkProperties;
/// Returns a Branch short URL to the content item with the passed link properties.
/// Ignores the first access of the item (usually due to a robot indexing the item) for statistics.
- (nullable NSString *)getShortUrlWithLinkPropertiesAndIgnoreFirstClick:(nonnull BranchLinkProperties *)linkProperties;
/// Returns a Branch short URL to the content item with the passed link properties with a callback.
- (void)getShortUrlWithLinkProperties:(nonnull BranchLinkProperties *)linkProperties
andCallback:(void (^_Nullable)(NSString * _Nullable url, NSError * _Nullable error))callback;
/// Returns a Branch long URL to the content item
- (nullable NSString *)getLongUrlWithChannel:(nullable NSString *)channel
andTags:(nullable NSArray *)tags
andFeature:(nullable NSString *)feature
andStage:(nullable NSString *)stage
andAlias:(nullable NSString *)alias;
/// @name Share Sheet Handling
- (nullable UIActivityItemProvider *)getBranchActivityItemWithLinkProperties:(nonnull BranchLinkProperties *)linkProperties;
- (void)showShareSheetWithShareText:(nullable NSString *)shareText
completion:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed))completion;
- (void)showShareSheetWithLinkProperties:(nullable BranchLinkProperties *)linkProperties
andShareText:(nullable NSString *)shareText
fromViewController:(nullable UIViewController *)viewController
completion:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed))completion;
/// Returns with activityError as well
- (void)showShareSheetWithLinkProperties:(nullable BranchLinkProperties *)linkProperties
andShareText:(nullable NSString *)shareText
fromViewController:(nullable UIViewController *)viewController
completionWithError:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed, NSError*_Nullable error))completion;
// iPad
- (void)showShareSheetWithLinkProperties:(nullable BranchLinkProperties *)linkProperties
andShareText:(nullable NSString *)shareText
fromViewController:(nullable UIViewController *)viewController
anchor:(nullable UIBarButtonItem *)anchor
completion:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed))completion;
// Returns with activityError as well
- (void)showShareSheetWithLinkProperties:(nullable BranchLinkProperties *)linkProperties
andShareText:(nullable NSString *)shareText
fromViewController:(nullable UIViewController *)viewController
anchor:(nullable UIBarButtonItem *)anchor
completionWithError:(void (^ _Nullable)(NSString * _Nullable activityType, BOOL completed, NSError*_Nullable error))completion;
/// @name List items on Spotlight
- (void)listOnSpotlight;
- (void)listOnSpotlightWithCallback:(void (^_Nullable)(NSString * _Nullable url, NSError * _Nullable error))callback;
- (void)listOnSpotlightWithIdentifierCallback:(void (^_Nullable)(NSString * _Nullable url,
NSString * _Nullable spotlightIdentifier,
NSError * _Nullable error))spotlightCallback
__attribute__((deprecated((
"iOS 10 has changed how Spotlight indexing works and weve updated the SDK to reflect this. "
"Please see https://dev.branch.io/features/spotlight-indexing/overview/ for instructions on migration."))));
- (void)listOnSpotlightWithLinkProperties:(BranchLinkProperties*_Nullable)linkproperties
callback:(void (^_Nullable)(NSString * _Nullable url,
NSError * _Nullable error))completion;
- (void)removeFromSpotlightWithCallback:(void (^_Nullable)(NSError * _Nullable error))completion;
- (NSDictionary*_Nonnull)getDictionaryWithCompleteLinkProperties:(BranchLinkProperties*_Nonnull)linkProperties;
- (NSDictionary*_Nonnull)getParamsForServerRequestWithAddedLinkProperties:(BranchLinkProperties*_Nonnull)linkProperties;
/// Convenience method for initSession methods that return BranchUniversalObject, but can be used safely by anyone.
- (NSMutableDictionary*_Nonnull) dictionary;
+ (BranchUniversalObject*_Nonnull) objectWithDictionary:(NSDictionary*_Null_unspecified)dictionary;
- (NSString*_Nonnull) description;
@end
@@ -0,0 +1,52 @@
//
// BranchView.h
// Branch-TestBed
//
// Created by Sojan P.R. on 3/4/16.
// Copyright © 2016 Branch Metrics. All rights reserved.
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
@interface BranchView : NSObject
//-------- properties-------------------//
/**
Unique ID for this Branch view
*/
@property (strong, nonatomic) NSString *branchViewID;
/**
User or Branch action associated with the Branch view
*/
@property (strong, nonatomic) NSString *branchViewAction;
/**
Number of times this Branch view can be used
*/
@property (nonatomic) NSInteger numOfUse;
/**
Web url to for showing html content for the Branch View
*/
@property (strong, nonatomic) NSString *webUrl;
/**
Html content for loading the web view
*/
@property (strong, nonatomic) NSString *webHtml;
//---------- Methods---------------//
/**
Initialises Branch View with the given dictionary
*/
- (id)initWithBranchView:(NSDictionary *)branchViewDict andActionName:(NSString *)actionName;
/**
Check Branch view for usage limit
*/
- (BOOL)isAvailable;
/**
update the usage count for this Branch view
*/
- (void)updateUsageCount;
@end
@@ -0,0 +1,36 @@
//
// BNCViewHandler.h
// Branch-TestBed
//
// Created by Sojan P.R. on 3/3/16.
// Copyright © 2016 Branch Metrics. All rights reserved.
//
#import "BranchView.h"
@protocol BranchViewControllerDelegate <NSObject>
- (void)branchViewVisible:(NSString *)actionName withID:(NSString *)branchViewID;
- (void)branchViewAccepted:(NSString *)actionName withID:(NSString *)branchViewID;
- (void)branchViewCancelled:(NSString *)actionName withID:(NSString *)branchViewID;
- (void)branchViewErrorCode:(NSInteger)errorCode message:(NSString *)errorMsg actionName:(NSString *)actionName withID:(NSString *)branchViewID;
@end
@interface BranchViewHandler : NSObject
//---- Properties---------------//
/**
Callback for Branch View events
*/
@property (nonatomic, assign) id <BranchViewControllerDelegate> branchViewCallback;
//-- Methods--------------------//
/**
Gets the global instance for BranchViewHandler.
*/
+ (BranchViewHandler *)getInstance;
/**
Shows a Branch view for the given action if available
*/
- (BOOL)showBranchView:(NSString *)actionName withBranchViewDictionary:(NSDictionary*)branchViewDict andWithDelegate:(id)callback;
@end
@@ -0,0 +1,21 @@
//
// UIViewController+Branch.h
// Branch-SDK
//
// Created by Edward Smith on 11/16/17.
// Copyright © 2017 Branch. All rights reserved.
//
#if __has_feature(modules)
@import UIKit;
#else
#import <UIKit/UIKit.h>
#endif
@interface UIViewController (Branch)
+ (UIWindow*_Nullable) bnc_currentWindow;
+ (UIViewController*_Nullable) bnc_currentViewController;
- (UIViewController*_Nonnull) bnc_currentViewController;
@end
void BNCForceUIViewControllerCategoryToLoad(void) __attribute__((constructor));
@@ -0,0 +1,6 @@
framework module Branch {
umbrella header "Branch.h"
export *
module * { export * }
}
@@ -0,0 +1,13 @@
<?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>com.apple.developer.associated-domains</key>
<array>
<string>applinks:d-labs.app.link</string>
<string>applinks:d-labs-alternate.app.link</string>
<string>applinks:d-labs.test-app.link</string>
<string>applinks:d-labs-alternate.test-app.link</string>
</array>
</dict>
</plist>