[fenix] For https://github.com/mozilla-mobile/fenix/issues/6434: Fixes downloadCompleted for paused downloads

pull/600/head
Sawyer Blatz 5 years ago committed by Emily Kager
parent 458dee5101
commit 213c3ef3e1

@ -23,7 +23,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavDirections import androidx.navigation.NavDirections
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.component_search.toolbar import kotlinx.android.synthetic.main.component_search.*
import kotlinx.android.synthetic.main.fragment_browser.* import kotlinx.android.synthetic.main.fragment_browser.*
import kotlinx.android.synthetic.main.fragment_browser.view.* import kotlinx.android.synthetic.main.fragment_browser.view.*
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
@ -264,13 +264,17 @@ abstract class BaseBrowserFragment : Fragment(), BackHandler, SessionManager.Obs
) )
downloadFeature.onDownloadCompleted = { download, _, downloadJobStatus -> downloadFeature.onDownloadCompleted = { download, _, downloadJobStatus ->
val dialog = DownloadNotificationBottomSheetDialog( // If the download is just paused, don't show any in-app notification
context = context, if (downloadJobStatus == AbstractFetchDownloadService.DownloadJobStatus.COMPLETED ||
didFail = downloadJobStatus == AbstractFetchDownloadService.DownloadJobStatus.FAILED, downloadJobStatus == AbstractFetchDownloadService.DownloadJobStatus.FAILED) {
download = download, val dialog = DownloadNotificationBottomSheetDialog(
tryAgain = downloadFeature::tryAgain context = context,
) didFail = downloadJobStatus == AbstractFetchDownloadService.DownloadJobStatus.FAILED,
dialog.show() download = download,
tryAgain = downloadFeature::tryAgain
)
dialog.show()
}
} }
downloadsFeature.set( downloadsFeature.set(

Loading…
Cancel
Save