Skip to content

Commit

Permalink
fix: use TS viewer by default & allow opening links in external brows…
Browse files Browse the repository at this point in the history
…er (#3380)
  • Loading branch information
micwallace authored Apr 23, 2024
1 parent f3eedb5 commit 455ae70
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ public void setPostNotificationsPermissionRequested(String address, boolean hasR
@Override
public boolean getUseTSViewer()
{
return pref.getBoolean(USE_TOKENSCRIPT_VIEWER, false);
return pref.getBoolean(USE_TOKENSCRIPT_VIEWER, true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import static org.web3j.protocol.core.methods.request.Transaction.createFunctionCallTransaction;
import static java.util.Collections.singletonList;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Pair;
Expand Down Expand Up @@ -455,7 +457,19 @@ private void openTokenscriptWebview(Wallet wallet)
{
tokenScriptView = findViewById(R.id.web3view);

tokenScriptView.setWebChromeClient(new WebChromeClient());
tokenScriptView.getSettings().setSupportMultipleWindows(true);
tokenScriptView.setWebChromeClient(new WebChromeClient(){
@Override
public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, android.os.Message resultMsg)
{
WebView.HitTestResult result = view.getHitTestResult();
String data = result.getExtra();
Context context = view.getContext();
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(data));
context.startActivity(browserIntent);
return false;
}
});
tokenScriptView.setWebViewClient(new WebViewClient(){
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
Expand Down

0 comments on commit 455ae70

Please sign in to comment.