diff --git a/.gitignore b/.gitignore index e0b116ff4..e787f347f 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,6 @@ android/build .idea Pods + +# Because of bundler 1.x/2.x issues +Gemfile.lock diff --git a/.travis.yml b/.travis.yml index cdc570770..0dea2873a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 70d5d3c64..000000000 --- a/Gemfile.lock +++ /dev/null @@ -1,259 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - CFPropertyList (3.0.2) - activesupport (4.2.11.1) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) - algoliasearch (1.27.1) - httpclient (~> 2.8, >= 2.8.3) - json (>= 1.5.1) - atomos (0.1.3) - babosa (1.0.3) - backports (3.16.1) - claide (1.0.3) - cocoapods (1.8.4) - activesupport (>= 4.0.2, < 5) - claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.8.4) - cocoapods-deintegrate (>= 1.0.3, < 2.0) - cocoapods-downloader (>= 1.2.2, < 2.0) - cocoapods-plugins (>= 1.0.0, < 2.0) - cocoapods-search (>= 1.0.0, < 2.0) - cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.4.0, < 2.0) - cocoapods-try (>= 1.1.0, < 2.0) - colored2 (~> 3.1) - escape (~> 0.0.4) - fourflusher (>= 2.3.0, < 3.0) - gh_inspector (~> 1.0) - molinillo (~> 0.6.6) - nap (~> 1.0) - ruby-macho (~> 1.4) - xcodeproj (>= 1.11.1, < 2.0) - cocoapods-core (1.8.4) - activesupport (>= 4.0.2, < 6) - algoliasearch (~> 1.0) - concurrent-ruby (~> 1.1) - fuzzy_match (~> 2.0.4) - nap (~> 1.0) - cocoapods-deintegrate (1.0.4) - cocoapods-downloader (1.3.0) - cocoapods-plugins (1.0.0) - nap - cocoapods-search (1.0.0) - cocoapods-stats (1.1.0) - cocoapods-trunk (1.4.1) - nap (>= 0.8, < 2.0) - netrc (~> 0.11) - cocoapods-try (1.1.0) - colored (1.2) - colored2 (3.1.2) - commander-fastlane (4.4.6) - highline (~> 1.7.2) - concurrent-ruby (1.1.6) - connection_pool (2.2.2) - declarative (0.0.10) - declarative-option (0.1.0) - digest-crc (0.4.1) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) - dotenv (2.7.5) - emoji_regex (1.0.1) - escape (0.0.4) - ethon (0.12.0) - ffi (>= 1.3.0) - excon (0.72.0) - faraday (0.17.3) - multipart-post (>= 1.2, < 3) - faraday-cookie_jar (0.0.6) - faraday (>= 0.7.4) - http-cookie (~> 1.0.0) - faraday_middleware (0.13.1) - faraday (>= 0.7.4, < 1.0) - fastimage (2.1.7) - fastlane (2.142.0) - CFPropertyList (>= 2.3, < 4.0.0) - addressable (>= 2.3, < 3.0.0) - babosa (>= 1.0.2, < 2.0.0) - bundler (>= 1.12.0, < 3.0.0) - colored - commander-fastlane (>= 4.4.6, < 5.0.0) - dotenv (>= 2.1.1, < 3.0.0) - emoji_regex (>= 0.1, < 2.0) - excon (>= 0.71.0, < 1.0.0) - faraday (~> 0.17) - faraday-cookie_jar (~> 0.0.6) - faraday_middleware (~> 0.13.1) - fastimage (>= 2.1.0, < 3.0.0) - gh_inspector (>= 1.1.2, < 2.0.0) - google-api-client (>= 0.29.2, < 0.37.0) - google-cloud-storage (>= 1.15.0, < 2.0.0) - highline (>= 1.7.2, < 2.0.0) - json (< 3.0.0) - jwt (~> 2.1.0) - mini_magick (>= 4.9.4, < 5.0.0) - multi_xml (~> 0.5) - multipart-post (~> 2.0.0) - plist (>= 3.1.0, < 4.0.0) - public_suffix (~> 2.0.0) - rubyzip (>= 1.3.0, < 2.0.0) - security (= 0.1.3) - simctl (~> 1.6.3) - slack-notifier (>= 2.0.0, < 3.0.0) - terminal-notifier (>= 2.0.0, < 3.0.0) - terminal-table (>= 1.4.5, < 2.0.0) - tty-screen (>= 0.6.3, < 1.0.0) - tty-spinner (>= 0.8.0, < 1.0.0) - word_wrap (~> 1.0.0) - xcodeproj (>= 1.13.0, < 2.0.0) - xcpretty (~> 0.3.0) - xcpretty-travis-formatter (>= 0.0.3) - fastlane-plugin-patch (0.5.0) - pattern_patch (>= 0.5.1) - fastlane-plugin-yarn (1.2) - ffi (1.12.2) - fourflusher (2.3.1) - fuzzy_match (2.0.4) - gh (0.14.0) - addressable - backports - faraday (~> 0.8) - multi_json (~> 1.0) - net-http-persistent (>= 2.7) - net-http-pipeline - gh_inspector (1.1.3) - google-api-client (0.36.4) - addressable (~> 2.5, >= 2.5.1) - googleauth (~> 0.9) - httpclient (>= 2.8.1, < 3.0) - mini_mime (~> 1.0) - representable (~> 3.0) - retriable (>= 2.0, < 4.0) - signet (~> 0.12) - google-cloud-core (1.5.0) - google-cloud-env (~> 1.0) - google-cloud-errors (~> 1.0) - google-cloud-env (1.3.0) - faraday (~> 0.11) - google-cloud-errors (1.0.0) - google-cloud-storage (1.25.1) - addressable (~> 2.5) - digest-crc (~> 0.4) - google-api-client (~> 0.33) - google-cloud-core (~> 1.2) - googleauth (~> 0.9) - mini_mime (~> 1.0) - googleauth (0.11.0) - faraday (>= 0.17.3, < 2.0) - jwt (>= 1.4, < 3.0) - memoist (~> 0.16) - multi_json (~> 1.11) - os (>= 0.9, < 2.0) - signet (~> 0.12) - highline (1.7.10) - http-cookie (1.0.3) - domain_name (~> 0.5) - httpclient (2.8.3) - i18n (0.9.5) - concurrent-ruby (~> 1.0) - json (2.3.0) - jwt (2.1.0) - launchy (2.4.3) - addressable (~> 2.3) - memoist (0.16.2) - mini_magick (4.10.1) - mini_mime (1.0.2) - minitest (5.14.0) - molinillo (0.6.6) - multi_json (1.14.1) - multi_xml (0.6.0) - multipart-post (2.0.0) - nanaimo (0.2.6) - nap (1.1.0) - naturally (2.2.0) - net-http-persistent (3.1.0) - connection_pool (~> 2.2) - net-http-pipeline (1.0.1) - netrc (0.11.0) - os (1.0.1) - pattern_patch (1.0.0) - activesupport (>= 4.0.2, < 6) - plist (3.5.0) - public_suffix (2.0.5) - pusher-client (0.6.2) - json - websocket (~> 1.0) - representable (3.0.4) - declarative (< 0.1.0) - declarative-option (< 0.2.0) - uber (< 0.2.0) - retriable (3.1.2) - rouge (2.0.7) - ruby-macho (1.4.0) - rubyzip (1.3.0) - security (0.1.3) - signet (0.13.0) - addressable (~> 2.3) - faraday (>= 0.17.3, < 2.0) - jwt (>= 1.5, < 3.0) - multi_json (~> 1.10) - simctl (1.6.8) - CFPropertyList - naturally - slack-notifier (2.3.2) - terminal-notifier (2.0.0) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) - thread_safe (0.3.6) - travis (1.8.10) - backports - faraday (~> 0.9) - faraday_middleware (~> 0.9, >= 0.9.1) - gh (~> 0.13) - highline (~> 1.6) - launchy (~> 2.1) - pusher-client (~> 0.4) - typhoeus (~> 0.6, >= 0.6.8) - tty-cursor (0.7.1) - tty-screen (0.7.1) - tty-spinner (0.9.3) - tty-cursor (~> 0.7) - typhoeus (0.8.0) - ethon (>= 0.8.0) - tzinfo (1.2.6) - thread_safe (~> 0.1) - uber (0.1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.6) - unicode-display_width (1.6.1) - websocket (1.2.8) - word_wrap (1.0.0) - xcodeproj (1.15.0) - CFPropertyList (>= 2.3.3, < 4.0) - atomos (~> 0.1.3) - claide (>= 1.0.2, < 2.0) - colored2 (~> 3.1) - nanaimo (~> 0.2.6) - xcpretty (0.3.0) - rouge (~> 2.0.7) - xcpretty-travis-formatter (1.0.0) - xcpretty (~> 0.2, >= 0.0.7) - -PLATFORMS - ruby - -DEPENDENCIES - cocoapods (>= 1.7.1, < 2.0.0) - fastlane (~> 2.69) - fastlane-plugin-patch - fastlane-plugin-yarn - travis - -BUNDLED WITH - 1.17.3 diff --git a/android/build.gradle b/android/build.gradle index 66db0c658..3964535fe 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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() @@ -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' } diff --git a/android/src/main/java/io/branch/rnbranch/RNBranchModule.java b/android/src/main/java/io/branch/rnbranch/RNBranchModule.java index 89ccbcaa9..a0ba1d2da 100644 --- a/android/src/main/java/io/branch/rnbranch/RNBranchModule.java +++ b/android/src/main/java/io/branch/rnbranch/RNBranchModule.java @@ -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; @@ -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); } diff --git a/examples/browser_example/android/app/src/main/java/com/browser_example/MainApplication.java b/examples/browser_example/android/app/src/main/java/com/browser_example/MainApplication.java index 5e36f483a..b63c77f37 100644 --- a/examples/browser_example/android/app/src/main/java/com/browser_example/MainApplication.java +++ b/examples/browser_example/android/app/src/main/java/com/browser_example/MainApplication.java @@ -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; @@ -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 diff --git a/examples/testbed_native_android/android/app/src/main/java/io/branch/testbed_native_android/MainApplication.java b/examples/testbed_native_android/android/app/src/main/java/io/branch/testbed_native_android/MainApplication.java index b853422d6..5b386d551 100644 --- a/examples/testbed_native_android/android/app/src/main/java/io/branch/testbed_native_android/MainApplication.java +++ b/examples/testbed_native_android/android/app/src/main/java/io/branch/testbed_native_android/MainApplication.java @@ -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. @@ -14,7 +14,7 @@ public class MainApplication extends MultiDexApplication { @Override public void onCreate() { super.onCreate(); - Branch.getAutoInstance(this); + RNBranchModule.getAutoInstance(this); } @Override diff --git a/examples/testbed_simple/android/app/src/main/java/com/testbed_simple/MainApplication.java b/examples/testbed_simple/android/app/src/main/java/com/testbed_simple/MainApplication.java index 289147c43..d9d6a4101 100644 --- a/examples/testbed_simple/android/app/src/main/java/com/testbed_simple/MainApplication.java +++ b/examples/testbed_simple/android/app/src/main/java/com/testbed_simple/MainApplication.java @@ -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; @@ -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 diff --git a/fastlane/lib/actions/version_bump.rb b/fastlane/lib/actions/version_bump.rb index e84161573..62adff70a 100644 --- a/fastlane/lib/actions/version_bump.rb +++ b/fastlane/lib/actions/version_bump.rb @@ -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], diff --git a/fastlane/lib/helper/update_helper.rb b/fastlane/lib/helper/update_helper.rb index 7864fbbf8..7c788a3ae 100644 --- a/fastlane/lib/helper/update_helper.rb +++ b/fastlane/lib/helper/update_helper.rb @@ -1,6 +1,7 @@ require 'cocoapods' require 'fileutils' require 'pathname' +require 'xcodeproj' module UpdateHelper UI = FastlaneCore::UI @@ -135,6 +136,18 @@ def update_pods_in_tests_and_examples(context = nil, end end + def update_rnbranch_xcodeproj(version) + rnbranch_option = %[RNBRANCH_VERSION=@\\"#{version}\\"] + project = Xcodeproj::Project.open 'ios/RNBranch.xcodeproj' + project.build_configurations.each do |config| + options = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] || [] + options = options.reject { |o| o =~ /^RNBRANCH_VERSION=/ } + options << rnbranch_option + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = options + end + project.save + end + def update_npm_deps(context, include_examples: false) folders = %w[.] diff --git a/ios/RNBranch.m b/ios/RNBranch.m index 06a41dbf7..b0679b53e 100644 --- a/ios/RNBranch.m +++ b/ios/RNBranch.m @@ -158,6 +158,8 @@ + (void)initSessionWithLaunchOptions:(NSDictionary *)launchOptions isReferrable: savedLaunchOptions = launchOptions; savedIsReferrable = isReferrable; + [self.branch registerPluginName:@"ReactNative" version:RNBRANCH_VERSION]; + // Can't currently support this on Android. // if (!deferInitializationForJSLoad && !RNBranchConfig.instance.deferInitializationForJSLoad) [self initializeBranchSDK]; [self initializeBranchSDK]; diff --git a/ios/RNBranch.xcodeproj/project.pbxproj b/ios/RNBranch.xcodeproj/project.pbxproj index 51a12fcb0..f677e959b 100644 --- a/ios/RNBranch.xcodeproj/project.pbxproj +++ b/ios/RNBranch.xcodeproj/project.pbxproj @@ -276,6 +276,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", + "RNBRANCH_VERSION=@\\\"3.2.1\\\"", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; @@ -327,6 +328,7 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = "RNBRANCH_VERSION=@\\\"3.2.1\\\""; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; diff --git a/ios/react-native-branch-dev.podspec b/ios/react-native-branch-dev.podspec index e26c0946b..1bb5af393 100644 --- a/ios/react-native-branch-dev.podspec +++ b/ios/react-native-branch-dev.podspec @@ -20,6 +20,7 @@ Pod::Spec.new do |s| s.platform = :ios, "7.0" s.source = { spec['repository']['type'].to_sym => spec['repository']['url'].sub(/^[a-z]+\+/, '') } s.source_files = [ "ios/*.h", "ios/*.m"] + s.compiler_flags = %[-DRNBRANCH_VERSION=@\\"#{s.version}\\"] s.dependency 'Branch' # No version specified s.dependency 'React' # to ensure the correct build order end diff --git a/native-tests/ios/Podfile.lock b/native-tests/ios/Podfile.lock index 804582d42..2a7c98dbe 100644 --- a/native-tests/ios/Podfile.lock +++ b/native-tests/ios/Podfile.lock @@ -1,8 +1,8 @@ PODS: - boost-for-react-native (1.63.0) - - Branch (0.31.3): - - Branch/Core (= 0.31.3) - - Branch/Core (0.31.3) + - Branch (0.32.0): + - Branch/Core (= 0.32.0) + - Branch/Core (0.32.0) - DoubleConversion (1.1.5) - Folly (2018.10.22.00): - boost-for-react-native @@ -13,7 +13,7 @@ PODS: - React (0.59.10): - React/Core (= 0.59.10) - react-native-branch (3.2.1): - - Branch (= 0.31.3) + - Branch (= 0.32.0) - React - React/Core (0.59.10): - yoga (= 0.59.10.React) @@ -83,13 +83,13 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c - Branch: 9b299693ee54b308ff8c18146afe1f711c2069ec + Branch: 770a23c04d3f5410cf9231db099a444dd3060784 DoubleConversion: e22e0762848812a87afd67ffda3998d9ef29170c Folly: de497beb10f102453a1afa9edbf8cf8a251890de glog: 1de0bb937dccdc981596d3b5825ebfb765017ded OCMock: 5ea90566be239f179ba766fd9fbae5885040b992 React: 36d0768f9e93be2473b37e7fa64f92c1d5341eef - react-native-branch: 18ffa5516f2463d6fa05a5f10699e28495cc9510 + react-native-branch: f6f8f24151238718e4d9b26be18a7111078d7fc9 yoga: 684513b14b03201579ba3cee20218c9d1298b0cc PODFILE CHECKSUM: 7e9d5ee0f6ae095e090eae4851f9ec8bc15c4c31 diff --git a/react-native-branch.podspec b/react-native-branch.podspec index 52f1a492d..8b527cf03 100644 --- a/react-native-branch.podspec +++ b/react-native-branch.podspec @@ -20,6 +20,7 @@ Pod::Spec.new do |s| s.platform = :ios, "7.0" s.source = { spec['repository']['type'].to_sym => spec['repository']['url'].sub(/^[a-z]+\+/, '') } s.source_files = [ "ios/*.h", "ios/*.m"] - s.dependency 'Branch', '0.31.3' + s.compiler_flags = %[-DRNBRANCH_VERSION=@\\"#{s.version}\\"] + s.dependency 'Branch', '0.32.0' s.dependency 'React' # to ensure the correct build order end