Skip to content

Commit

Permalink
Merge pull request #506 from BranchMetrics/staging
Browse files Browse the repository at this point in the history
SDK-509 update react native
  • Loading branch information
echo-branch authored Sep 28, 2019
2 parents 409ea48 + 90383f7 commit 2a7a206
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 28 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
27 changes: 18 additions & 9 deletions android/src/main/java/io/branch/rnbranch/RNBranchModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public class RNBranchModule extends ReactContextBaseJavaModule {

private AgingHash<String, BranchUniversalObject> 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();
Expand All @@ -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);
Expand All @@ -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;

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -247,13 +256,13 @@ public Map<String, Object> 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

Expand Down
12 changes: 6 additions & 6 deletions examples/testbed_simple/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -169,7 +169,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
Branch: 1ace77c04b6e3efbf982bf4364f0662bfac156a0
Branch: edf6cab0cecb437d6a6abba3a25d0a0fa6f277ec
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion ios/RNBranch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 1 addition & 9 deletions ios/RNBranch.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -89,9 +89,6 @@ + (void)setupBranchInstance:(Branch *)instance
if (config.delayInitToCheckForSearchAds) {
[instance delayInitToCheckForSearchAds];
}
if (config.appleSearchAdsDebugMode) {
[instance setAppleSearchAdsDebugMode];
}
}

- (NSDictionary<NSString *, NSString *> *)constantsToExport {
Expand Down Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion react-native-branch.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2a7a206

Please sign in to comment.