Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use TS viewer by default & allow opening links in external browser #3380

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading