Skip to content

Commit

Permalink
Merge pull request #562 from BranchMetrics/SDK-929_update-native-sdks…
Browse files Browse the repository at this point in the history
…-3.x

[SDK-929] Update native sdks (3.x)
  • Loading branch information
jdee authored Mar 31, 2020
2 parents ba462e5 + 1ba47d7 commit d14f824
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 275 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ android/build
.idea

Pods

# Because of bundler 1.x/2.x issues
Gemfile.lock
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ cache: yarn

install:
# Set up RVM, RubyGems, Bundler
- rvm install 2.4.3
- rvm use 2.4.3 --default
- rvm install 2.6
- rvm use 2.6 --default
- gem update --system
- gem install bundler
- bundle check || bundle install
Expand Down
259 changes: 0 additions & 259 deletions Gemfile.lock

This file was deleted.

11 changes: 10 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
apply plugin: 'com.android.library'
import groovy.json.JsonSlurper

def getNpmVersion() {
def packageJsonFile = file('../package.json')
def packageJson = new JsonSlurper().parseText(packageJsonFile.text)
return packageJson.version
}

repositories {
mavenCentral()
Expand All @@ -17,10 +24,12 @@ android {
targetSdkVersion safeExtGet('targetSdkVersion', 26)
versionCode 1
versionName "1.0"

buildConfigField("String", "RNBRANCH_VERSION", "\"${getNpmVersion()}\"")
}
}

dependencies {
implementation 'com.facebook.react:react-native:+' // From node_modules
api 'io.branch.sdk.android:library:4.3.2'
api 'io.branch.sdk.android:library:5.0.0'
}
3 changes: 3 additions & 0 deletions android/src/main/java/io/branch/rnbranch/RNBranchModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public class RNBranchModule extends ReactContextBaseJavaModule {
private static final String IDENT_FIELD_NAME = "ident";
public static final String UNIVERSAL_OBJECT_NOT_FOUND_ERROR_CODE = "RNBranch::Error::BUONotFound";
private static final long AGING_HASH_TTL = 3600000;
private static final String PLUGIN_NAME = "ReactNative";

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

Branch.registerPlugin(PLUGIN_NAME, io.branch.rnbranch.BuildConfig.RNBRANCH_VERSION);

if (branchKey != null) {
Branch.getAutoInstance(context, branchKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import io.branch.rnbranch.RNBranchPackage;
import com.reactnativecommunity.webview.RNCWebViewPackage;

import io.branch.referral.Branch;
import io.branch.rnbranch.RNBranchModule;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
Expand Down Expand Up @@ -49,7 +49,7 @@ public ReactNativeHost getReactNativeHost() {
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
Branch.getAutoInstance(this);
RNBranchModule.getAutoInstance(this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;

import io.branch.referral.Branch;
import io.branch.rnbranch.RNBranchModule;

/**
* Created by jdee on 3/30/17.
Expand All @@ -14,7 +14,7 @@ public class MainApplication extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
Branch.getAutoInstance(this);
RNBranchModule.getAutoInstance(this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.facebook.react.ReactApplication;
import io.branch.rnbranch.RNBranchPackage;

import io.branch.referral.Branch;
import io.branch.rnbranch.RNBranchModule;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
Expand Down Expand Up @@ -47,7 +47,7 @@ public ReactNativeHost getReactNativeHost() {
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
Branch.getAutoInstance(this);
RNBranchModule.getAutoInstance(this);
}

@Override
Expand Down
1 change: 1 addition & 0 deletions fastlane/lib/actions/version_bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def run(params)
UI.message "Bumping to version #{version}."

update_package_json version
update_rnbranch_xcodeproj version
update_pods_in_tests_and_examples(
repo_update: params[:repo_update],
verbose: params[:verbose],
Expand Down
Loading

0 comments on commit d14f824

Please sign in to comment.