diff --git a/CHANGELOG.md b/CHANGELOG.md index e7dc24e4..9f4ccda1 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.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 + +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 361a6018..1f898058 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,23 @@ ] }, "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" + "fs": "0.0.1-security", + "@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..07ca4aca 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. - + diff --git a/src/android/io/branch/BranchSDK.java b/src/android/io/branch/BranchSDK.java index 3818cd90..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")) { @@ -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)); } @@ -1154,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")) { diff --git a/src/index.js b/src/index.js index ec7db001..05b03757 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,19 @@ 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); + }); +}; + +// 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.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..ca38c9c7 100644 --- a/src/ios/BranchSDK.m +++ b/src/ios/BranchSDK.m @@ -153,14 +153,14 @@ - (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]; + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:enableLogging]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; }