From cbb06dbd23f57602014abe23f780fb3042129d2a Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 25 May 2022 21:47:48 -0700 Subject: [PATCH 1/7] Update dependencies --- package.json | 25 ++++++++++++------------- plugin.xml | 6 +++--- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 361a6018..ea065a22 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "branch-cordova-sdk", "description": "Branch Metrics Cordova SDK", "main": "src/index.js", - "version": "5.0.2", + "version": "5.1.0", "homepage": "https://github.com/BranchMetrics/cordova-ionic-phonegap-branch-deep-linking", "repository": { "type": "git", @@ -55,23 +55,22 @@ ] }, "dependencies": { - "fs": "0.0.1-security", - "glob": "^7.2.0", + "glob": "^8.0.3", "mkpath": "^1.0.0", "node-version-compare": "^1.0.3", - "plist": "^3.0.4", + "plist": "^3.0.5", "shelljs": "^0.8.5", - "xcode": "^2.1.0", + "xcode": "^3.0.1", "xml2js": "^0.4.23" }, "devDependencies": { - "@commitlint/cli": "^8.3.5", - "@commitlint/config-conventional": "^8.3.4", - "eslint": "^6.8.0", - "eslint-config-airbnb-base": "^14.2.1", - "eslint-plugin-import": "^2.25.2", - "husky": "^4.3.8", - "lint-staged": "^10.5.4", - "prettier": "^2.5.1" + "@commitlint/cli": "^17.0.1", + "@commitlint/config-conventional": "^17.0.0", + "eslint": "^8.16.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-plugin-import": "^2.26.0", + "husky": "^8.0.1", + "lint-staged": "^12.4.2", + "prettier": "^2.6.2" } } diff --git a/plugin.xml b/plugin.xml index 082c059f..626307c5 100644 --- a/plugin.xml +++ b/plugin.xml @@ -24,7 +24,7 @@ SOFTWARE. + version="5.1.0"> branch-cordova-sdk @@ -63,7 +63,7 @@ SOFTWARE. - + @@ -87,7 +87,7 @@ SOFTWARE. - + From 4fbf0592591bab9538f46acbb3b6d8874ffa5724 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 27 May 2022 20:41:23 -0700 Subject: [PATCH 2/7] SDK-1440 fix logging method, update iOS SDK --- CHANGELOG.md | 9 +++++++++ package.json | 1 + plugin.xml | 2 +- src/index.js | 13 ++++++++++--- src/ios/BranchSDK.h | 2 +- src/ios/BranchSDK.m | 13 ++++--------- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7dc24e4..b4876085 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +5.1.0 May 27, 2022 +* Update iOS SDK to 1.42.0 +* Update Android SDK to 5.1.4 +* Update 3rd party dependencies. Of note the plist vulnerability. (Thanks Sujay-shetty) +* Replace setDebug with setLogging and test devices. https://help.branch.io/using-branch/docs/adding-test-devices + +5.0.2 February 9, 2022 +* Update dependencies to latest non-breaking versions, of note the shelljs vulnerability. (Thanks again Sujay-shetty!) + 5.0.1 February 8, 2022 * Remove request package (thanks for catching Sujay-shetty) diff --git a/package.json b/package.json index ea065a22..1f898058 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "xml2js": "^0.4.23" }, "devDependencies": { + "fs": "0.0.1-security", "@commitlint/cli": "^17.0.1", "@commitlint/config-conventional": "^17.0.0", "eslint": "^8.16.0", diff --git a/plugin.xml b/plugin.xml index 626307c5..9b8de90b 100644 --- a/plugin.xml +++ b/plugin.xml @@ -87,7 +87,7 @@ SOFTWARE. - + diff --git a/src/index.js b/src/index.js index ec7db001..30768635 100644 --- a/src/index.js +++ b/src/index.js @@ -34,7 +34,7 @@ const standardEvent = { // Branch prototype var Branch = function Branch() { - this.debugMode = false; + this.enableLogging = false; this.trackingDisabled = false; this.sessionInitialized = false; }; @@ -113,11 +113,18 @@ Branch.prototype.setRequestMetadata = function setRequestMetadata(key, val) { return execute("setRequestMetadata", [key, val]); }; +// Deprecated. Replaced by setLogging(isEnabled) and test devices. https://help.branch.io/using-branch/docs/adding-test-devices Branch.prototype.setDebug = function setDebug(isEnabled) { + return new Promise(function promise(resolve, reject) { + resolve(false); + }); +}; + +Branch.prototype.setLogging = function setLogging(isEnabled) { var value = typeof isEnabled !== "boolean" ? false : isEnabled; - this.debugMode = value; + this.enableLogging = value; - return execute("setDebug", [value]); + return execute("enableLogging", [value]); }; Branch.prototype.setCookieBasedMatching = function setCookieBasedMatching( diff --git a/src/ios/BranchSDK.h b/src/ios/BranchSDK.h index 86d83097..bc52b107 100644 --- a/src/ios/BranchSDK.h +++ b/src/ios/BranchSDK.h @@ -29,7 +29,7 @@ - (void)enableTestMode:(CDVInvokedUrlCommand*)command; - (void)initSession:(CDVInvokedUrlCommand*)command; - (void)disableTracking:(CDVInvokedUrlCommand*)command; -- (void)setDebug:(CDVInvokedUrlCommand*)command; +- (void)enableLogging:(CDVInvokedUrlCommand*)command; - (void)getAutoInstance:(CDVInvokedUrlCommand*)command; - (void)getLatestReferringParams:(CDVInvokedUrlCommand*)command; - (void)getFirstReferringParams:(CDVInvokedUrlCommand*)command; diff --git a/src/ios/BranchSDK.m b/src/ios/BranchSDK.m index 278426a2..ece51e1c 100644 --- a/src/ios/BranchSDK.m +++ b/src/ios/BranchSDK.m @@ -86,11 +86,6 @@ - (void)continueUserActivity:(CDVInvokedUrlCommand*)command #pragma mark - Public APIs #pragma mark - Branch Basic Methods -- (void)enableTestMode:(CDVInvokedUrlCommand*)command -{ - [Branch setUseTestBranchKey:TRUE]; -} - - (void)initSession:(CDVInvokedUrlCommand*)command { [[Branch getInstance] registerPluginName:@"CordovaIonic" version:pluginVersion]; @@ -153,11 +148,11 @@ - (void)disableTracking:(CDVInvokedUrlCommand*)command [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } -- (void)setDebug:(CDVInvokedUrlCommand*)command +- (void)enableLogging:(CDVInvokedUrlCommand*)command { - bool enableDebug = [[command.arguments objectAtIndex:0] boolValue]; - if (enableDebug) { - [[Branch getInstance] setDebug]; + bool enableLogging = [[command.arguments objectAtIndex:0] boolValue]; + if (enableLogging) { + [[Branch getInstance] enableLogging]; } CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:enableDebug]; From c4d67c1abbce2e407fef2b0188adc7710d502fde Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 27 May 2022 20:42:47 -0700 Subject: [PATCH 3/7] SDK-1440 revert removal of enableTestMode on iOS --- src/ios/BranchSDK.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ios/BranchSDK.m b/src/ios/BranchSDK.m index ece51e1c..31d3c040 100644 --- a/src/ios/BranchSDK.m +++ b/src/ios/BranchSDK.m @@ -86,6 +86,11 @@ - (void)continueUserActivity:(CDVInvokedUrlCommand*)command #pragma mark - Public APIs #pragma mark - Branch Basic Methods +- (void)enableTestMode:(CDVInvokedUrlCommand*)command +{ + [Branch setUseTestBranchKey:TRUE]; +} + - (void)initSession:(CDVInvokedUrlCommand*)command { [[Branch getInstance] registerPluginName:@"CordovaIonic" version:pluginVersion]; From e4b705cf4a1e23e3a9cb0dc82085ff3af86180b5 Mon Sep 17 00:00:00 2001 From: echo Date: Fri, 27 May 2022 21:44:33 -0700 Subject: [PATCH 4/7] SDK-1440 enable android logging. Fix issue with iOS logging. Add note about early lifecycle events prior to JS runtime init --- src/android/io/branch/BranchSDK.java | 14 +++++++++----- src/index.js | 1 + src/ios/BranchSDK.m | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/android/io/branch/BranchSDK.java b/src/android/io/branch/BranchSDK.java index 3818cd90..ca898f3a 100644 --- a/src/android/io/branch/BranchSDK.java +++ b/src/android/io/branch/BranchSDK.java @@ -527,15 +527,19 @@ private void setCookieBasedMatching(String linkDomain, CallbackContext callbackC } /** - *

Sets the library to function in debug mode, enabling logging of all requests.

- *

If you want to flag debug, call this before initUserSession

+ *

Enabling Branch SDK logging

* - * @param isEnable A {@link Boolean} value to enable/disable debugging mode for the app. + * @param isEnable A {@link Boolean} value to enable/disable logging * @param callbackContext A callback to execute at the end of this method */ - private void setDebug(boolean isEnable, CallbackContext callbackContext) { + private void setLogging(boolean isEnable, CallbackContext callbackContext) { this.activity = this.cordova.getActivity(); - Branch.enableDebugMode(); + if (isEnable == true) { + Branch.enableLogging(); + } else { + Branch.disableLogging(); + } + callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, isEnable)); } diff --git a/src/index.js b/src/index.js index 30768635..05b03757 100644 --- a/src/index.js +++ b/src/index.js @@ -120,6 +120,7 @@ Branch.prototype.setDebug = function setDebug(isEnabled) { }); }; +// For early lifecycle logging, we recommend you enable logging in the native iOS or Android code. Branch.prototype.setLogging = function setLogging(isEnabled) { var value = typeof isEnabled !== "boolean" ? false : isEnabled; this.enableLogging = value; diff --git a/src/ios/BranchSDK.m b/src/ios/BranchSDK.m index 31d3c040..ca38c9c7 100644 --- a/src/ios/BranchSDK.m +++ b/src/ios/BranchSDK.m @@ -160,7 +160,7 @@ - (void)enableLogging:(CDVInvokedUrlCommand*)command [[Branch getInstance] enableLogging]; } - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:enableDebug]; + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:enableLogging]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } From e18d4898f471f9030be483b4e8428f2471a07d40 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 2 Jun 2022 09:34:52 -0700 Subject: [PATCH 5/7] SDK-1440 pick up android 5.1.5 --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 9b8de90b..07ca4aca 100644 --- a/plugin.xml +++ b/plugin.xml @@ -63,7 +63,7 @@ SOFTWARE. - + From 9cf229a31dcab191c54fa2cf1b895c864ec9e484 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 2 Jun 2022 10:38:13 -0700 Subject: [PATCH 6/7] SDK-1440 update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4876085..9f4ccda1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ 5.1.0 May 27, 2022 * Update iOS SDK to 1.42.0 -* Update Android SDK to 5.1.4 +* Update Android SDK to 5.1.5 * Update 3rd party dependencies. Of note the plist vulnerability. (Thanks Sujay-shetty) * Replace setDebug with setLogging and test devices. https://help.branch.io/using-branch/docs/adding-test-devices From c6fdb7fea9bf6d49d86d939f726070f75877c3ca Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 2 Jun 2022 16:23:38 -0700 Subject: [PATCH 7/7] SDK-1440 update android logging method --- src/android/io/branch/BranchSDK.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/android/io/branch/BranchSDK.java b/src/android/io/branch/BranchSDK.java index ca898f3a..97dddfd8 100644 --- a/src/android/io/branch/BranchSDK.java +++ b/src/android/io/branch/BranchSDK.java @@ -115,7 +115,7 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo Runnable r = new RunnableThread(action, args, callbackContext); - if (action.equals("setDebug")) { + if (action.equals("setLogging")) { cordova.getActivity().runOnUiThread(r); return true; } else if (action.equals("setCookieBasedMatching")) { @@ -1158,8 +1158,8 @@ public void run() { try { Log.d(LCAT, "Runnable: " + this.action); - if (this.action.equals("setDebug")) { - setDebug(this.args.getBoolean(0), this.callbackContext); + if (this.action.equals("setLogging")) { + setLogging(this.args.getBoolean(0), this.callbackContext); } else if (this.action.equals("setCookieBasedMatching")) { setCookieBasedMatching(this.args.getString(0), this.callbackContext); } else if (this.action.equals("disableTracking")) {