Skip to content

Commit

Permalink
PWN-897 - fix webview paste button
Browse files Browse the repository at this point in the history
  • Loading branch information
gslevinkov committed Feb 8, 2024
1 parent bc09802 commit 7a962bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/src/main/assets/referral_bridge_provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/org/p2p/wallet/referral/ReferralBridge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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())
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
<domain includeSubdomains="true">beardict.net:5051</domain>
<domain includeSubdomains="true">beardict.net</domain>
</domain-config>
</network-security-config>
</network-security-config>

0 comments on commit 7a962bf

Please sign in to comment.