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

pull/3382/head
micwallace 6 months ago committed by GitHub
parent f3eedb5170
commit 455ae7069f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      app/src/main/java/com/alphawallet/app/repository/SharedPreferenceRepository.java
  2. 16
      app/src/main/java/com/alphawallet/app/ui/TokenScriptJsActivity.java

@ -478,7 +478,7 @@ public class SharedPreferenceRepository implements PreferenceRepositoryType {
@Override
public boolean getUseTSViewer()
{
return pref.getBoolean(USE_TOKENSCRIPT_VIEWER, false);
return pref.getBoolean(USE_TOKENSCRIPT_VIEWER, true);
}
@Override

@ -5,8 +5,10 @@ import static com.alphawallet.app.widget.AWalletAlertDialog.WARNING;
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 @@ public class TokenScriptJsActivity extends BaseActivity implements StandardFunct
{
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) {

Loading…
Cancel
Save