Skip to content

Commit

Permalink
Merge pull request #640 from BranchMetrics/staging
Browse files Browse the repository at this point in the history
Update native SDKs and accept PRs
  • Loading branch information
echo-branch committed Apr 16, 2021
2 parents 53c5fe9 + 64b3d91 commit c3e54e2
Show file tree
Hide file tree
Showing 17 changed files with 17,834 additions and 2,552 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 15.14.0
20 changes: 20 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
2021-04-16 Version 5.0.2
- Requires react-native >= 0.60

- Update iOS SDK to 1.39.2
- Update Android SDK to 5.0.7

- Adds addFacebookPartnerParameter method. See FB documentation on partner parameters for details.
```js
branch.addFacebookPartnerParameter('em', '11234e56af071e9c79927651156bd7a10bca8ac34672aba121056e2698ee7088')
```

- Adds clearPartnerParameter method
```js
branch.clearPartnerParameters()
```

- Adds typescript. Thanks runtrizapps!
- Adds enableLogging to the RNBranch class. Thanks jkadamczyk!
- Fix issue with Android LATD. Thanks mauryakk15!

2021-02-04 Version 5.0.1
- Requires react-native >= 0.60
- Adds lastAttributedTouchData method.
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ android {
dependencies {
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'com.facebook.react:react-native:+' // From node_modules
api 'io.branch.sdk.android:library:5.0.4'
api 'io.branch.sdk.android:library:5.0.7'
}
142 changes: 0 additions & 142 deletions android/src/main/java/io/branch/rnbranch/RNBranchConfig.java

This file was deleted.

52 changes: 23 additions & 29 deletions android/src/main/java/io/branch/rnbranch/RNBranchModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public class RNBranchModule extends ReactContextBaseJavaModule {
private static Branch.BranchUniversalReferralInitListener initListener = null;

private static Activity mActivity = null;
private static boolean mUseDebug = false;
private static boolean mInitialized = false;
private static volatile boolean mNewIntent = true;
private static JSONObject mRequestMetadata = new JSONObject();
Expand All @@ -98,26 +97,8 @@ public class RNBranchModule extends ReactContextBaseJavaModule {
private static Branch.BranchReferralInitListener referralInitListener = null;

public static void getAutoInstance(Context context) {
RNBranchConfig config = new RNBranchConfig(context);
String branchKey = config.getBranchKey();
String liveKey = config.getLiveKey();
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);
}
else if (useTest && testKey != null) {
Branch.getAutoInstance(context, testKey);
}
else if (!useTest && liveKey != null) {
Branch.getAutoInstance(context, liveKey);
}
else {
Branch.getAutoInstance(context);
}
Branch.getAutoInstance(context);
}

public static void reInitSession(Activity reactActivity) {
Expand Down Expand Up @@ -257,8 +238,15 @@ private static void notifyJSOfInitSessionStart(Context context, Uri uri) {
Log.d(REACT_CLASS, "Sent session start broadcast for " + uri);
}

public static void setDebug() {
mUseDebug = true;
/**
* @deprecated setDebug is deprecated and all functionality has been disabled. If you wish to enable
* logging, please invoke enableLogging. If you wish to simulate installs, please Test Devices
* (https://help.branch.io/using-branch/docs/adding-test-devices)
*/
public static void setDebug() { }

public static void enableLogging() {
Branch.enableLogging();
}

public static void setRequestMetadata(String key, String val) {
Expand Down Expand Up @@ -439,7 +427,7 @@ public void lastAttributedTouchData(int window, final Promise promise) {
@Override
public void onDataFetched(JSONObject jsonObject, BranchError error) {
if (error == null) {
promise.resolve(jsonObject);
promise.resolve(convertJsonToMap(jsonObject));
} else {
promise.reject(GENERIC_ERROR, error.getMessage());
}
Expand All @@ -460,6 +448,18 @@ public void setRequestMetadataKey(String key, String value) {
branch.setRequestMetadata(key, value);
}

@ReactMethod
public void addFacebookPartnerParameter(String name, String value) {
Branch branch = Branch.getInstance();
branch.addFacebookPartnerParameterWithName(name, value);
}

@ReactMethod
public void clearPartnerParameters() {
Branch branch = Branch.getInstance();
branch.clearPartnerParameters();
}

@ReactMethod
public void logout() {
Branch branch = Branch.getInstance();
Expand Down Expand Up @@ -748,12 +748,6 @@ private static Branch setupBranch(Context context) {
if (!mInitialized) {
Log.i(REACT_CLASS, "Initializing Branch SDK v. " + BuildConfig.VERSION_NAME);

RNBranchConfig config = new RNBranchConfig(context);

if (mUseDebug || config.getDebugMode()) branch.setDebug();

if (config.getEnableFacebookLinkCheck()) branch.enableFacebookAppLinkCheck();

if (mRequestMetadata != null) {
Iterator keys = mRequestMetadata.keys();
while (keys.hasNext()) {
Expand Down
2 changes: 1 addition & 1 deletion ios/RNBranch.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extern NSString * _Nonnull const RNBranchLinkOpenedNotificationLinkPropertiesKey
+ (void)deferInitializationForJSLoad;

+ (void)setDebug;
+ (void)enableLogging;
+ (void)delayInitToCheckForSearchAds;
+ (void)setRequestMetadataKey:(NSString * _Nonnull)key value:(NSObject * _Nonnull)value;

@end
Loading

0 comments on commit c3e54e2

Please sign in to comment.