diff --git a/app/src/main/java/com/alphawallet/app/repository/SharedPreferenceRepository.java b/app/src/main/java/com/alphawallet/app/repository/SharedPreferenceRepository.java index 5ace4ee3f2..fc4e1d7dba 100644 --- a/app/src/main/java/com/alphawallet/app/repository/SharedPreferenceRepository.java +++ b/app/src/main/java/com/alphawallet/app/repository/SharedPreferenceRepository.java @@ -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 diff --git a/app/src/main/java/com/alphawallet/app/ui/TokenScriptJsActivity.java b/app/src/main/java/com/alphawallet/app/ui/TokenScriptJsActivity.java index 6dbefd2298..5fb86a5294 100644 --- a/app/src/main/java/com/alphawallet/app/ui/TokenScriptJsActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/TokenScriptJsActivity.java @@ -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; @@ -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) {