diff --git a/ChangeLog.md b/ChangeLog.md index ba6a94b77..57a28a426 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -135,3 +135,7 @@ * This release adds some native wrapper methods to simplify certain native code changes that cannot be supported in JS. * Includes native SDKs 0.15.3 (iOS), 2.8.0 (Android). + +2017-06-19 Version 2.0.0-beta.7 + * This release adds support for an optional `branch.json` configuration file. See https://rnbranch.app.link/branch-json for details. + * Includes native SDKs 0.15.3 (iOS), 2.9.0 (Android). diff --git a/README.md b/README.md index d140b23b8..9e616bb09 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,10 @@ This is a repository of our open source React Native SDK. Huge shoutout to our f [Release 2.0.0]: ./docs/Release-2.0.0.md -Version 2.0.0-beta.6 is now available in NPM with a simplified SDK integration process. See [Release 2.0.0] for details. +Version 2.0.0-beta.7 is now available in NPM with a simplified SDK integration process. See [Release 2.0.0] for details. + +**branch.json** It is now possible to control certain features of the Branch SDK using an optional +configuration file in your project. See https://rnbranch.app.link/branch-json for details. **v1.1.0** The `createBranchUniversalObject` method is now async, so be sure to use `await` or handle the promise resolution, e.g. ```js diff --git a/docs/Release-2.0.0.md b/docs/Release-2.0.0.md index 0f1331a19..8b86a804c 100644 --- a/docs/Release-2.0.0.md +++ b/docs/Release-2.0.0.md @@ -1,38 +1,20 @@ # Release 2.0.0 -## Goals - -The main motives behind this release are to: - -- Reduce the number of manual steps required to get started. -- Remove any need for CocoaPods, Carthage or manual iOS SDK installation in a React Native app. -- Pin to specific versions of the native SDKs to avoid issues arising from version mismatches. -- Fully support integration of react-native-branch in a React Native component within a native - app that also uses the native Branch SDK. - -These changes are fairly radical, so we're eager to get feedback before rolling this out to -production. Please open issues in this repo with any questions or problems. - -Further plans for 2.0.0: - -- Provide a script to automate project configuration changes, such as adding a Branch key and setting up Universal Link/App Link domains. -- Review/flesh out the native API for link routing on both platforms. -- Consistent error codes across the two platforms. -- TBD - ## Changes ### Building, configuration and examples -- The native iOS SDK source (version 0.14.12) is now included in the RNBranch project and is no longer a required external dependency. -- A jar file (version 2.8.0) is included for the Android SDK. +- The native iOS SDK source is now included in the RNBranch project and is no longer a required external dependency. +- A jar file is included for the Android SDK. - A Branch-SDK podspec is included in the NPM module for use in native apps that use the React pod from node_modules. -- Five new testbed apps are available: +- Five new example apps are available: + testbed_simple illustrates the simplest way to integrate the SDK using `react-native link`. + testbed_native_ios illustrates including `react-native-branch` in a React Native component within a native iOS app. + testbed_native_android illustrates including `react-native-branch` in a React Native component within a native Android app. + webview_example is a realistic example of SDK integration following best practices. + webview_example_native_ios is a realistic example of SDK integration in a React Native component within a Swift app. +- An optional `branch.json` file may be added to an app to control certain Branch configuration + parameters. If presetnt, it is automatically integrated when using `react-native link`. ### JS API changes diff --git a/docs/branch.json.md b/docs/branch.json.md new file mode 100644 index 000000000..0afdc4883 --- /dev/null +++ b/docs/branch.json.md @@ -0,0 +1,86 @@ +# branch.json configuration file (optional) + +Certain Branch configuration options may be controlled using a JSON configuration file +in a React Native app project. This feature is rapidly evolving. Support will be added +for further parameters and custom product flavors (Android) and build schemes (iOS). +Watch this space for changes. + +Starting in release 2.0.0-beta.7, if `branch.json` is present in the app bundle, the +react-native-branch SDK will use it to set certain options. This is useful for supporting +certain methods in the native SDKs that must be called before the native SDK initializes. + +## Add the files to your project + +Be sure to commit `branch.json` and `branch.debug.json` to source control after adding +them to your project. + +### Using react-native link + +If `branch.json` or `branch.debug.json` exists in a React Native application project +using react-native-branch, they will be added to the native projects when `react-native link` +is run. For example: + +```bash +yarn add react-native-branch@2.0.0-beta.7 +cp node_modules/react-native-branch/branch.example.json branch.json +react-native link react-native-branch +``` + +#### Projects that already use react-native-branch + +Run `react-native unlink react-native-branch` first. For example: + +```bash +react-native unlink react-native-branch +cp node_modules/react-native-branch/branch.example.json branch.json +react-native link react-native-branch +``` + +### Manual integration without react-native link + +#### Android + +Put your `branch.json` file in `app/src/main/assets/branch.json`. + +#### iOS + +Add `branch.json` to your Xcode project using File > Add Files to "MyProject.xcodeproj". +Also add it to the Copy Bundle Resources build phase for each application target in +the project that uses the Branch SDK. + +## Configurations for debug and release builds + +It is possible to include different versions of the configuration for debug and release +builds. + +### Using react-native link + +Optionally add both `branch.json` and `branch.debug.json` to the root of your app +project and run `react-native link react-native-branch` (after running `react-native unlink react-native-branch` first if the module is already integrated). + +### Android + +If `app/src/debug/assets/branch.json` exists, that configuration will be used for +debug builds instead of `app/src/main/assets/branch.json`. + +### iOS + +Add `branch.debug.json` to your project and the Copy Bundle Resources build phase(s) +as discussed above. If this file is present, it will be used in debug builds instead +of `branch.json`. + +## Contents + +|key|description|type| +|---|---|---| +|debugMode|If true, `setDebug` will be called in the native SDK, enabling testing of install events.|Boolean| + +## Example + +See [branch.example.json](https://github.com/BranchMetrics/react-native-branch-deep-linking/blob/master/branch.example.json) in the root of this repo. + +```json +{ + "debugMode": true +} +``` diff --git a/docs/setDebug.md b/docs/setDebug.md index 4bee5b11b..ed24f838b 100644 --- a/docs/setDebug.md +++ b/docs/setDebug.md @@ -8,6 +8,10 @@ it is too late to call it. This is likely to change in a future release. For now, it is necessary to make the call directly in native code on both platforms. +As of 2.0.0-beta.7, it is also possible to call `setDebug` using the `debugMode` +parameter in the `branch.json` configuration file. See +https://rnbranch.app.link/branch-json for details. + #### iOS ##### Objective-C