Skip to content
Closed
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 @@ -353,15 +353,9 @@ class BrowserTabFragment : Fragment(), FindListener, CoroutineScope, DaxDialogLi

override fun onPause() {
logoHidingListener.onPause()
dismissDownloadFragment()
super.onPause()
}

private fun dismissDownloadFragment() {
val fragment = fragmentManager?.findFragmentByTag(DOWNLOAD_CONFIRMATION_TAG) as? DownloadConfirmationFragment
fragment?.dismiss()
}

private fun createPopupMenu() {
popupMenu = BrowserPopupMenu(layoutInflater)
val view = popupMenu.contentView
Expand Down Expand Up @@ -841,6 +835,14 @@ class BrowserTabFragment : Fragment(), FindListener, CoroutineScope, DaxDialogLi
}

it.setDownloadListener { url, _, contentDisposition, mimeType, _ ->
//handling target=_blank if link points to a file
if (viewModel.url == null) { //in an empty tab
launch {
viewModel.closeCurrentTab()
destroyWebView()
}
}

requestFileDownload(url, contentDisposition, mimeType, true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class DownloadConfirmationFragment : BottomSheetDialogFragment() {
return view
}

override fun onPause() {
dismiss()
super.onPause()
}

private fun setupDownload() {
file = if (!pendingDownload.isDataUrl) File(pendingDownload.directory, pendingDownload.guessFileName()) else null
}
Expand Down