Skip to content

Commit d14f824

Browse files
authored
Merge pull request #562 from BranchMetrics/SDK-929_update-native-sdks-3.x
[SDK-929] Update native sdks (3.x)
2 parents ba462e5 + 1ba47d7 commit d14f824

File tree

15 files changed

+51
-275
lines changed

15 files changed

+51
-275
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@ android/build
4949
.idea
5050

5151
Pods
52+
53+
# Because of bundler 1.x/2.x issues
54+
Gemfile.lock

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ cache: yarn
1010

1111
install:
1212
# Set up RVM, RubyGems, Bundler
13-
- rvm install 2.4.3
14-
- rvm use 2.4.3 --default
13+
- rvm install 2.6
14+
- rvm use 2.6 --default
1515
- gem update --system
1616
- gem install bundler
1717
- bundle check || bundle install

Gemfile.lock

Lines changed: 0 additions & 259 deletions
This file was deleted.

android/build.gradle

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
apply plugin: 'com.android.library'
2+
import groovy.json.JsonSlurper
3+
4+
def getNpmVersion() {
5+
def packageJsonFile = file('../package.json')
6+
def packageJson = new JsonSlurper().parseText(packageJsonFile.text)
7+
return packageJson.version
8+
}
29

310
repositories {
411
mavenCentral()
@@ -17,10 +24,12 @@ android {
1724
targetSdkVersion safeExtGet('targetSdkVersion', 26)
1825
versionCode 1
1926
versionName "1.0"
27+
28+
buildConfigField("String", "RNBRANCH_VERSION", "\"${getNpmVersion()}\"")
2029
}
2130
}
2231

2332
dependencies {
2433
implementation 'com.facebook.react:react-native:+' // From node_modules
25-
api 'io.branch.sdk.android:library:4.3.2'
34+
api 'io.branch.sdk.android:library:5.0.0'
2635
}

android/src/main/java/io/branch/rnbranch/RNBranchModule.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public class RNBranchModule extends ReactContextBaseJavaModule {
7373
private static final String IDENT_FIELD_NAME = "ident";
7474
public static final String UNIVERSAL_OBJECT_NOT_FOUND_ERROR_CODE = "RNBranch::Error::BUONotFound";
7575
private static final long AGING_HASH_TTL = 3600000;
76+
private static final String PLUGIN_NAME = "ReactNative";
7677

7778
private static JSONObject initSessionResult = null;
7879
private BroadcastReceiver mInitSessionEventReceiver = null;
@@ -92,6 +93,8 @@ public static void getAutoInstance(Context context) {
9293
String testKey = config.getTestKey();
9394
boolean useTest = config.getUseTestInstance();
9495

96+
Branch.registerPlugin(PLUGIN_NAME, io.branch.rnbranch.BuildConfig.RNBRANCH_VERSION);
97+
9598
if (branchKey != null) {
9699
Branch.getAutoInstance(context, branchKey);
97100
}

examples/browser_example/android/app/src/main/java/com/browser_example/MainApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import io.branch.rnbranch.RNBranchPackage;
99
import com.reactnativecommunity.webview.RNCWebViewPackage;
1010

11-
import io.branch.referral.Branch;
11+
import io.branch.rnbranch.RNBranchModule;
1212
import com.facebook.react.ReactNativeHost;
1313
import com.facebook.react.ReactPackage;
1414
import com.facebook.react.shell.MainReactPackage;
@@ -49,7 +49,7 @@ public ReactNativeHost getReactNativeHost() {
4949
public void onCreate() {
5050
super.onCreate();
5151
SoLoader.init(this, /* native exopackage */ false);
52-
Branch.getAutoInstance(this);
52+
RNBranchModule.getAutoInstance(this);
5353
}
5454

5555
@Override

examples/testbed_native_android/android/app/src/main/java/io/branch/testbed_native_android/MainApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import android.support.multidex.MultiDex;
55
import android.support.multidex.MultiDexApplication;
66

7-
import io.branch.referral.Branch;
7+
import io.branch.rnbranch.RNBranchModule;
88

99
/**
1010
* Created by jdee on 3/30/17.
@@ -14,7 +14,7 @@ public class MainApplication extends MultiDexApplication {
1414
@Override
1515
public void onCreate() {
1616
super.onCreate();
17-
Branch.getAutoInstance(this);
17+
RNBranchModule.getAutoInstance(this);
1818
}
1919

2020
@Override

examples/testbed_simple/android/app/src/main/java/com/testbed_simple/MainApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.facebook.react.ReactApplication;
88
import io.branch.rnbranch.RNBranchPackage;
99

10-
import io.branch.referral.Branch;
10+
import io.branch.rnbranch.RNBranchModule;
1111
import com.facebook.react.ReactNativeHost;
1212
import com.facebook.react.ReactPackage;
1313
import com.facebook.react.shell.MainReactPackage;
@@ -47,7 +47,7 @@ public ReactNativeHost getReactNativeHost() {
4747
public void onCreate() {
4848
super.onCreate();
4949
SoLoader.init(this, /* native exopackage */ false);
50-
Branch.getAutoInstance(this);
50+
RNBranchModule.getAutoInstance(this);
5151
}
5252

5353
@Override

fastlane/lib/actions/version_bump.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def run(params)
1414
UI.message "Bumping to version #{version}."
1515

1616
update_package_json version
17+
update_rnbranch_xcodeproj version
1718
update_pods_in_tests_and_examples(
1819
repo_update: params[:repo_update],
1920
verbose: params[:verbose],

0 commit comments

Comments
 (0)