diff --git a/ChangeLog.md b/ChangeLog.md index 812db2591..57f02860c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,8 @@ +2019-09-27 Version 4.2.0 + - Update Android Branch SDK to 4.1.0 + - Update iOS Branch SDK to 0.29.0 + - Expose Android reInit session for foreground links + 2019-07-25 Version 3.1.1 - Requires RN < 0.60 - Fix a runtime iOS issue in 3.1.0 diff --git a/android/build.gradle b/android/build.gradle index 438f0e376..eda1c7ea2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -22,5 +22,5 @@ android { dependencies { implementation 'com.facebook.react:react-native:+' // From node_modules - api 'io.branch.sdk.android:library:3.2.0' + api 'io.branch.sdk.android:library:4.1.0' } diff --git a/android/src/main/java/io/branch/rnbranch/RNBranchModule.java b/android/src/main/java/io/branch/rnbranch/RNBranchModule.java index e772bfa25..f5f7cb17f 100644 --- a/android/src/main/java/io/branch/rnbranch/RNBranchModule.java +++ b/android/src/main/java/io/branch/rnbranch/RNBranchModule.java @@ -85,6 +85,8 @@ public class RNBranchModule extends ReactContextBaseJavaModule { private AgingHash mUniversalObjectMap = new AgingHash<>(AGING_HASH_TTL); + private static Branch.BranchReferralInitListener referralInitListener = null; + public static void getAutoInstance(Context context) { RNBranchConfig config = new RNBranchConfig(context); String branchKey = config.getBranchKey(); @@ -106,6 +108,11 @@ else if (!useTest && liveKey != null) { } } + public static void reInitSession(Activity reactActivity) { + Branch branch = Branch.getInstance(); + branch.reInitSession(reactActivity, referralInitListener); + } + public static void initSession(final Uri uri, Activity reactActivity, Branch.BranchUniversalReferralInitListener anInitListener) { initListener = anInitListener; initSession(uri, reactActivity); @@ -115,7 +122,7 @@ public static void initSession(final Uri uri, Activity reactActivity) { Branch branch = setupBranch(reactActivity.getApplicationContext()); mActivity = reactActivity; - branch.initSession(new Branch.BranchReferralInitListener(){ + referralInitListener = new Branch.BranchReferralInitListener(){ private Activity mmActivity = null; @@ -208,7 +215,9 @@ private void generateLocalBroadcast(JSONObject referringParams, LocalBroadcastManager.getInstance(mmActivity).sendBroadcast(broadcastIntent); } - }.init(reactActivity), uri, reactActivity); + }.init(reactActivity); + + branch.initSession(referralInitListener, uri, reactActivity); } public static void setDebug() { @@ -247,13 +256,13 @@ public Map getConstants() { // Constants for use with userCompletedAction (deprecated) - constants.put(ADD_TO_CART_EVENT, BranchEvent.ADD_TO_CART); - constants.put(ADD_TO_WISHLIST_EVENT, BranchEvent.ADD_TO_WISH_LIST); - constants.put(PURCHASED_EVENT, BranchEvent.PURCHASED); - constants.put(PURCHASE_INITIATED_EVENT, BranchEvent.PURCHASE_STARTED); - constants.put(REGISTER_VIEW_EVENT, BranchEvent.VIEW); - constants.put(SHARE_COMPLETED_EVENT, BranchEvent.SHARE_COMPLETED); - constants.put(SHARE_INITIATED_EVENT, BranchEvent.SHARE_STARTED); + // constants.put(ADD_TO_CART_EVENT, BranchEvent.ADD_TO_CART); + // constants.put(ADD_TO_WISHLIST_EVENT, BranchEvent.ADD_TO_WISH_LIST); + // constants.put(PURCHASED_EVENT, BranchEvent.PURCHASED); + // constants.put(PURCHASE_INITIATED_EVENT, BranchEvent.PURCHASE_STARTED); + // constants.put(REGISTER_VIEW_EVENT, BranchEvent.VIEW); + // constants.put(SHARE_COMPLETED_EVENT, BranchEvent.SHARE_COMPLETED); + // constants.put(SHARE_INITIATED_EVENT, BranchEvent.SHARE_STARTED); // constants for use with BranchEvent diff --git a/examples/testbed_simple/ios/Podfile.lock b/examples/testbed_simple/ios/Podfile.lock index 4fcb43e70..cf4d3f73a 100644 --- a/examples/testbed_simple/ios/Podfile.lock +++ b/examples/testbed_simple/ios/Podfile.lock @@ -1,8 +1,8 @@ PODS: - boost-for-react-native (1.63.0) - - Branch (0.27.1): - - Branch/Core (= 0.27.1) - - Branch/Core (0.27.1) + - Branch (0.28.1): + - Branch/Core (= 0.28.1) + - Branch/Core (0.28.1) - DoubleConversion (1.1.6) - Folly (2018.10.22.00): - boost-for-react-native @@ -61,7 +61,7 @@ PODS: - React-jsi (= 0.60.3) - React-jsinspector (0.60.3) - react-native-branch (4.1.0): - - Branch (= 0.27.1) + - Branch (= 0.28.1) - React - React-RCTActionSheet (0.60.3): - React-Core (= 0.60.3) @@ -169,7 +169,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c - Branch: 1ace77c04b6e3efbf982bf4364f0662bfac156a0 + Branch: edf6cab0cecb437d6a6abba3a25d0a0fa6f277ec DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2 Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51 glog: 1f3da668190260b06b429bb211bfbee5cd790c28 @@ -181,7 +181,7 @@ SPEC CHECKSUMS: React-jsi: c2b6e57836bcae2677a036384111dc2c58e94369 React-jsiexecutor: d9023c5c199114d2b6f38ec861a4d923c73d0735 React-jsinspector: 817b64f3c8a807f09d78620f4f505868d89b26f3 - react-native-branch: 861e9210afb3a52317fe4cc6a04086a9250f71b8 + react-native-branch: 8e9dec04d5f52b3eab6970effcb01ed163351d3e React-RCTActionSheet: 9c42321fd5652515d706dd722c5a10b1970d7ec8 React-RCTAnimation: fabb087dde8964c9a835a7fabd0e7e5701787913 React-RCTBlob: 93f34281d9c9c9e216b25824309eed9fe22a5d41 diff --git a/ios/RNBranch.h b/ios/RNBranch.h index 777398940..4de31f8a4 100644 --- a/ios/RNBranch.h +++ b/ios/RNBranch.h @@ -28,7 +28,6 @@ extern NSString * _Nonnull const RNBranchLinkOpenedNotificationLinkPropertiesKey + (void)setDebug; + (void)delayInitToCheckForSearchAds; -+ (void)setAppleSearchAdsDebugMode; + (void)setRequestMetadataKey:(NSString * _Nonnull)key value:(NSObject * _Nonnull)value; @end diff --git a/ios/RNBranch.m b/ios/RNBranch.m index ade2da33f..bb02e1a98 100644 --- a/ios/RNBranch.m +++ b/ios/RNBranch.m @@ -29,7 +29,7 @@ static NSString * const RNBranchErrorDomain = @"RNBranchErrorDomain"; static NSInteger const RNBranchUniversalObjectNotFoundError = 1; -static NSString * const REQUIRED_BRANCH_SDK = @"0.27.1"; +static NSString * const REQUIRED_BRANCH_SDK = @"0.28.1"; #pragma mark - Private RNBranch declarations @@ -89,9 +89,6 @@ + (void)setupBranchInstance:(Branch *)instance if (config.delayInitToCheckForSearchAds) { [instance delayInitToCheckForSearchAds]; } - if (config.appleSearchAdsDebugMode) { - [instance setAppleSearchAdsDebugMode]; - } } - (NSDictionary *)constantsToExport { @@ -147,11 +144,6 @@ + (void)delayInitToCheckForSearchAds [self.branch delayInitToCheckForSearchAds]; } -+ (void)setAppleSearchAdsDebugMode -{ - [self.branch setAppleSearchAdsDebugMode]; -} - + (void)setRequestMetadataKey:(NSString *)key value:(NSObject *)value { [self.branch setRequestMetadataKey:key value:value]; diff --git a/package.json b/package.json index 2075b7214..9a6b7cdd0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-branch", - "version": "4.1.1", + "version": "4.2.0", "description": "Branch Metrics React Native SDK", "main": "src/index.js", "files": [ diff --git a/react-native-branch.podspec b/react-native-branch.podspec index a0631a18d..aac0484c2 100644 --- a/react-native-branch.podspec +++ b/react-native-branch.podspec @@ -21,6 +21,6 @@ Pod::Spec.new do |s| s.source = { spec['repository']['type'].to_sym => spec['repository']['url'].sub(/^[a-z]+\+/, '') } s.source_files = [ "ios/*.h", "ios/*.m"] s.header_dir = 'RNBranch' # also sets generated module name - s.dependency 'Branch', '0.27.1' + s.dependency 'Branch', '0.29.0' s.dependency 'React' # to ensure the correct build order end