Skip to content

Commit c3e54e2

Browse files
authored
Merge pull request #640 from BranchMetrics/staging
Update native SDKs and accept PRs
2 parents 53c5fe9 + 64b3d91 commit c3e54e2

File tree

17 files changed

+17834
-2552
lines changed

17 files changed

+17834
-2552
lines changed

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 15.14.0

ChangeLog.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
2021-04-16 Version 5.0.2
2+
- Requires react-native >= 0.60
3+
4+
- Update iOS SDK to 1.39.2
5+
- Update Android SDK to 5.0.7
6+
7+
- Adds addFacebookPartnerParameter method. See FB documentation on partner parameters for details.
8+
```js
9+
branch.addFacebookPartnerParameter('em', '11234e56af071e9c79927651156bd7a10bca8ac34672aba121056e2698ee7088')
10+
```
11+
12+
- Adds clearPartnerParameter method
13+
```js
14+
branch.clearPartnerParameters()
15+
```
16+
17+
- Adds typescript. Thanks runtrizapps!
18+
- Adds enableLogging to the RNBranch class. Thanks jkadamczyk!
19+
- Fix issue with Android LATD. Thanks mauryakk15!
20+
121
2021-02-04 Version 5.0.1
222
- Requires react-native >= 0.60
323
- Adds lastAttributedTouchData method.

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ android {
3333
dependencies {
3434
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
3535
implementation 'com.facebook.react:react-native:+' // From node_modules
36-
api 'io.branch.sdk.android:library:5.0.4'
36+
api 'io.branch.sdk.android:library:5.0.7'
3737
}

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

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

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

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public class RNBranchModule extends ReactContextBaseJavaModule {
8888
private static Branch.BranchUniversalReferralInitListener initListener = null;
8989

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

10099
public static void getAutoInstance(Context context) {
101-
RNBranchConfig config = new RNBranchConfig(context);
102-
String branchKey = config.getBranchKey();
103-
String liveKey = config.getLiveKey();
104-
String testKey = config.getTestKey();
105-
boolean useTest = config.getUseTestInstance();
106-
107100
Branch.registerPlugin(PLUGIN_NAME, io.branch.rnbranch.BuildConfig.RNBRANCH_VERSION);
108-
109-
if (branchKey != null) {
110-
Branch.getAutoInstance(context, branchKey);
111-
}
112-
else if (useTest && testKey != null) {
113-
Branch.getAutoInstance(context, testKey);
114-
}
115-
else if (!useTest && liveKey != null) {
116-
Branch.getAutoInstance(context, liveKey);
117-
}
118-
else {
119-
Branch.getAutoInstance(context);
120-
}
101+
Branch.getAutoInstance(context);
121102
}
122103

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

260-
public static void setDebug() {
261-
mUseDebug = true;
241+
/**
242+
* @deprecated setDebug is deprecated and all functionality has been disabled. If you wish to enable
243+
* logging, please invoke enableLogging. If you wish to simulate installs, please Test Devices
244+
* (https://help.branch.io/using-branch/docs/adding-test-devices)
245+
*/
246+
public static void setDebug() { }
247+
248+
public static void enableLogging() {
249+
Branch.enableLogging();
262250
}
263251

264252
public static void setRequestMetadata(String key, String val) {
@@ -439,7 +427,7 @@ public void lastAttributedTouchData(int window, final Promise promise) {
439427
@Override
440428
public void onDataFetched(JSONObject jsonObject, BranchError error) {
441429
if (error == null) {
442-
promise.resolve(jsonObject);
430+
promise.resolve(convertJsonToMap(jsonObject));
443431
} else {
444432
promise.reject(GENERIC_ERROR, error.getMessage());
445433
}
@@ -460,6 +448,18 @@ public void setRequestMetadataKey(String key, String value) {
460448
branch.setRequestMetadata(key, value);
461449
}
462450

451+
@ReactMethod
452+
public void addFacebookPartnerParameter(String name, String value) {
453+
Branch branch = Branch.getInstance();
454+
branch.addFacebookPartnerParameterWithName(name, value);
455+
}
456+
457+
@ReactMethod
458+
public void clearPartnerParameters() {
459+
Branch branch = Branch.getInstance();
460+
branch.clearPartnerParameters();
461+
}
462+
463463
@ReactMethod
464464
public void logout() {
465465
Branch branch = Branch.getInstance();
@@ -748,12 +748,6 @@ private static Branch setupBranch(Context context) {
748748
if (!mInitialized) {
749749
Log.i(REACT_CLASS, "Initializing Branch SDK v. " + BuildConfig.VERSION_NAME);
750750

751-
RNBranchConfig config = new RNBranchConfig(context);
752-
753-
if (mUseDebug || config.getDebugMode()) branch.setDebug();
754-
755-
if (config.getEnableFacebookLinkCheck()) branch.enableFacebookAppLinkCheck();
756-
757751
if (mRequestMetadata != null) {
758752
Iterator keys = mRequestMetadata.keys();
759753
while (keys.hasNext()) {

ios/RNBranch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern NSString * _Nonnull const RNBranchLinkOpenedNotificationLinkPropertiesKey
2828
+ (void)deferInitializationForJSLoad;
2929

3030
+ (void)setDebug;
31+
+ (void)enableLogging;
3132
+ (void)delayInitToCheckForSearchAds;
32-
+ (void)setRequestMetadataKey:(NSString * _Nonnull)key value:(NSObject * _Nonnull)value;
3333

3434
@end

0 commit comments

Comments
 (0)