Skip to content

Commit 537838f

Browse files
Merge pull request #617 from BranchMetrics/SDK-794/release_with_sdk_432
Sdk 794/release with sdk 432
2 parents 13db161 + 5f86bef commit 537838f

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ package-lock.json
88
npm-debug.log*
99
yarn-error.log*
1010
.vscode
11+
.idea
12+
src/android/.idea

plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ SOFTWARE.
6262
<!-- Manifest configuration is done via a js script. We should move it to this config in the future. -->
6363

6464
<source-file src="src/android/io/branch/BranchSDK.java" target-dir="src/io/branch" />
65-
<framework src="io.branch.sdk.android:library:4.2.1"/>
65+
<framework src="io.branch.sdk.android:library:4.3.2"/>
6666
</platform>
6767

6868
<!-- iOS -->

src/android/io/branch/BranchSDK.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
import io.branch.indexing.BranchUniversalObject;
2222
import io.branch.referral.Branch;
23+
import io.branch.referral.BranchUtil;
24+
import io.branch.referral.PrefHelper;
2325
import io.branch.referral.BranchError;
2426
import io.branch.referral.BranchViewHandler;
2527
import io.branch.referral.SharingHelper;
@@ -31,8 +33,9 @@
3133
import io.branch.referral.util.ProductCategory;
3234
import io.branch.referral.util.ShareSheetStyle;
3335

34-
import io.branch.referral.util.BranchCrossPlatformId;
35-
import io.branch.referral.util.BranchLastAttributedTouchData;
36+
import io.branch.referral.ServerRequestGetLATD.BranchLastAttributedTouchDataListener;
37+
import io.branch.referral.ServerRequestGetCPID.BranchCrossPlatformIdListener;
38+
import io.branch.referral.util.BranchCPID;
3639

3740
public class BranchSDK extends CordovaPlugin {
3841

@@ -68,17 +71,18 @@ public BranchSDK() {
6871
protected void pluginInitialize() {
6972

7073
this.activity = this.cordova.getActivity();
71-
7274
Branch.disableInstantDeepLinking(true);
73-
Branch.getAutoInstance(this.activity.getApplicationContext());
74-
75+
BranchUtil.setPluginType(BranchUtil.PluginType.CordovaIonic);
76+
if (this.instance == null) {
77+
this.instance = Branch.getAutoInstance(this.activity.getApplicationContext());
78+
}
7579
}
7680

7781
/**
7882
* Called when the activity receives a new intent.
7983
*/
8084
public void onNewIntent(Intent intent) {
81-
85+
intent.putExtra("branch_force_new_session", true);
8286
this.activity.setIntent(intent);
8387

8488
this.reInitSession();
@@ -292,7 +296,6 @@ private void initSession(CallbackContext callbackContext) {
292296
}
293297

294298
this.sessionListener = new SessionListener(callbackContext);
295-
this.instance = Branch.getAutoInstance(this.activity.getApplicationContext());
296299
this.instance.initSession(this.sessionListener, data, activity);
297300
}
298301

@@ -613,10 +616,8 @@ private void setCookieBasedMatching(String linkDomain, CallbackContext callbackC
613616

614617
this.activity = this.cordova.getActivity();
615618

616-
Branch instance = Branch.getAutoInstance(this.activity.getApplicationContext());
617-
618619
if (linkDomain != null) {
619-
instance.enableCookieBasedMatching(linkDomain);
620+
Branch.enableCookieBasedMatching(linkDomain);
620621
}
621622

622623
callbackContext.success("Success");
@@ -631,7 +632,7 @@ private void setCookieBasedMatching(String linkDomain, CallbackContext callbackC
631632
*/
632633
private void setDebug(boolean isEnable, CallbackContext callbackContext) {
633634
this.activity = this.cordova.getActivity();
634-
Branch.getAutoInstance(this.activity.getApplicationContext()).setDebug();
635+
Branch.enableDebugMode();
635636
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, isEnable));
636637
}
637638

@@ -645,7 +646,8 @@ private void setDebug(boolean isEnable, CallbackContext callbackContext) {
645646
*/
646647
private void disableTracking(boolean isEnable, CallbackContext callbackContext) {
647648
this.activity = this.cordova.getActivity();
648-
Branch.getAutoInstance(this.activity.getApplicationContext()).disableTracking(isEnable);
649+
650+
this.instance.disableTracking(isEnable);
649651
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, isEnable));
650652
}
651653

@@ -892,15 +894,15 @@ public BranchUniversalObjectWrapper(BranchUniversalObject branchUniversalObj) {
892894
//----------- INNER CLASS LISTENERS ------------//
893895
//////////////////////////////////////////////////
894896

895-
protected class BranchCPIDListener implements BranchCrossPlatformId.BranchCrossPlatformIdListener {
897+
protected class BranchCPIDListener implements BranchCrossPlatformIdListener {
896898
private CallbackContext _callbackContext;
897899

898900
public BranchCPIDListener(CallbackContext callbackContext) {
899901
this._callbackContext = callbackContext;
900902
}
901903

902904
@Override
903-
public void onDataFetched(BranchCrossPlatformId.BranchCPID branchCPID, BranchError error) {
905+
public void onDataFetched(BranchCPID branchCPID, BranchError error) {
904906
if (error != null) {
905907
Log.d(LCAT, "CPID unavailable");
906908
this._callbackContext.error("CPID unavailable");
@@ -925,7 +927,7 @@ public void onDataFetched(BranchCrossPlatformId.BranchCPID branchCPID, BranchErr
925927
}
926928
}
927929

928-
protected class BranchLATDListener implements BranchLastAttributedTouchData.BranchLastAttributedTouchDataListener {
930+
protected class BranchLATDListener implements BranchLastAttributedTouchDataListener {
929931
private CallbackContext _callbackContext;
930932

931933
public BranchLATDListener(CallbackContext callbackContext) {

0 commit comments

Comments
 (0)