diff --git a/app/src/main/assets/referral_bridge_provider.js b/app/src/main/assets/referral_bridge_provider.js index e66166a24c..ffebf5fc27 100644 --- a/app/src/main/assets/referral_bridge_provider.js +++ b/app/src/main/assets/referral_bridge_provider.js @@ -13,7 +13,7 @@ window.ReferralBridge = { AndroidReferralBridge.showShareDialog(link); }, getClipboardContent: function() { - return AndroidReferralBridge.getClipboardValue(); + return JSON.parse(AndroidReferralBridge.getClipboardValue()); }, signMessageAsync: async function(message) { const result = AndroidReferralBridge.signMessageAsync(message); diff --git a/app/src/main/java/org/p2p/wallet/referral/ReferralBridge.kt b/app/src/main/java/org/p2p/wallet/referral/ReferralBridge.kt index 6ea3f6304c..177b5e063b 100644 --- a/app/src/main/java/org/p2p/wallet/referral/ReferralBridge.kt +++ b/app/src/main/java/org/p2p/wallet/referral/ReferralBridge.kt @@ -18,6 +18,9 @@ import org.p2p.wallet.utils.getClipboardText private typealias JsResultWrapper = String +/** + * @see [assets/referral_bridge_provider.js] + */ class ReferralWebViewBridge( webView: WebView, private val tokenKeyProvider: TokenKeyProvider, @@ -131,7 +134,7 @@ class ReferralWebViewBridge( @JavascriptInterface fun getClipboardValue(): JsResultWrapper { - val context = referralWebView?.context ?: return wrapInJsResult("No Android context found") + val context = referralWebView?.context ?: return wrapInJsResult(Exception("No Android context found")) return wrapInJsResult(context.getClipboardText(trimmed = true).orEmpty()) } diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml index 464b038548..bad695c4a4 100644 --- a/app/src/main/res/xml/network_security_config.xml +++ b/app/src/main/res/xml/network_security_config.xml @@ -13,4 +13,4 @@ beardict.net:5051 beardict.net - \ No newline at end of file +