Skip to content

Commit

Permalink
Disable text selection in wkwebview authgear/authgear-server#3846
Browse files Browse the repository at this point in the history
  • Loading branch information
IniZio committed Mar 7, 2024
1 parent ad551e9 commit 0528923
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,14 @@ class WebKitWebViewActivity: AppCompatActivity() {
view.context.startActivity(browserIntent)
return false
}

SRC_ANCHOR_TYPE -> {
val data = result.extra ?: return false
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(data))
view.context.startActivity(browserIntent)
return false
}

else -> false
}
}
Expand Down Expand Up @@ -200,6 +202,13 @@ class WebKitWebViewActivity: AppCompatActivity() {
this.mWebView = WebView(this)
this.mWebView.settings.setSupportMultipleWindows(true)
this.mWebView.settings.domStorageEnabled = true

// Disable text selection
// NOTE: `evaluateJavascript` cannot be set to run on page load in WebChromeClient,
// need to disable long click instead.
// Selection in text fields should still work
this.mWebView.setOnLongClickListener { true }

this.setContentView(this.mWebView)
this.mWebView.setWebViewClient(MyWebViewClient(this))
this.mWebView.setWebChromeClient(MyWebChromeClient(this))
Expand Down

0 comments on commit 0528923

Please sign in to comment.