From f7436623d189d8f3fd925b0f3af90b8c3497df3b Mon Sep 17 00:00:00 2001 From: Renemari Padillo Date: Sun, 29 May 2016 21:42:45 +0800 Subject: [PATCH] [FIX] Fixed NonBranchLinkHandler should not be mandatory to be defined. Fixed callback string format error in Java. --- src/android/io/branch/BranchSDK.java | 2 +- testbed/www/js/index.js | 7 ------- www/branch.js | 7 +++++++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/android/io/branch/BranchSDK.java b/src/android/io/branch/BranchSDK.java index 33ed9f2b..d129b123 100644 --- a/src/android/io/branch/BranchSDK.java +++ b/src/android/io/branch/BranchSDK.java @@ -713,7 +713,7 @@ public void onInitFinished(JSONObject referringParams, BranchError error) { } else { String errorMessage = error.getMessage(); - out = String.format("NonBranchLinkHandler(%s)", error.toString()); + out = String.format("NonBranchLinkHandler(\"%s\")", error.toString()); webView.sendJavascript(out); if (this._callbackContext != null) { diff --git a/testbed/www/js/index.js b/testbed/www/js/index.js index 9e32479d..a63820a2 100644 --- a/testbed/www/js/index.js +++ b/testbed/www/js/index.js @@ -69,13 +69,6 @@ function NonBranchLinkHandler(data) } } -function NonBranchLinkHandler(data) -{ - if (data) { - alert('Non-branch link found: ' + JSON.stringify(data)); - } -} - function SetDebug(isEnabled) { console.log('Trigger SetDebug()'); diff --git a/www/branch.js b/www/branch.js index c82e46bc..3e500cc2 100644 --- a/www/branch.js +++ b/www/branch.js @@ -390,4 +390,11 @@ Branch.prototype.creditHistory = function () { }; +/** + * NonBranchLinkHandler callback placeholder. + * + * @param {String} response + */ +window.NonBranchLinkHandler = (typeof NonBranchLinkHandler === 'undefined') ? function (response) {} : NonBranchLinkHandler; + module.exports = new Branch;