File tree 2 files changed +7
-3
lines changed
core/src/main/java/org/kiwix/kiwixmobile/core/main
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ open class CoreWebViewClient(
77
77
}
78
78
79
79
@Suppress(" NestedBlockDepth" )
80
- private fun handleUnsupportedFiles (url : String ): Boolean {
80
+ fun handleUnsupportedFiles (url : String ): Boolean {
81
81
val extension = MimeTypeMap .getFileExtensionFromUrl(url)
82
82
if (DOCUMENT_TYPES .containsKey(extension)) {
83
83
callback.showSaveOrOpenUnsupportedFilesDialog(url, DOCUMENT_TYPES [extension])
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ open class KiwixWebView @SuppressLint("SetJavaScriptEnabled") constructor(
54
54
attrs : AttributeSet ,
55
55
nonVideoView : ViewGroup ,
56
56
videoView : ViewGroup ,
57
- webViewClient : CoreWebViewClient ,
57
+ private val webViewClient : CoreWebViewClient ,
58
58
val sharedPreferenceUtil : SharedPreferenceUtil
59
59
) : VideoEnabledWebView(context, attrs) {
60
60
@@ -108,7 +108,11 @@ open class KiwixWebView @SuppressLint("SetJavaScriptEnabled") constructor(
108
108
override fun performLongClick (): Boolean {
109
109
val result = hitTestResult
110
110
if (result.type == HitTestResult .SRC_ANCHOR_TYPE ) {
111
- result.extra?.let (callback::webViewLongClick)
111
+ result.extra?.let {
112
+ if (! webViewClient.handleUnsupportedFiles(it)) {
113
+ callback.webViewLongClick(it)
114
+ }
115
+ }
112
116
return true
113
117
}
114
118
return super .performLongClick()
You can’t perform that action at this time.
0 commit comments