PageFragment: fix back button issue after download
This commit is contained in:
parent
7658212a76
commit
44aa42e67d
|
@ -28,7 +28,7 @@ object History {
|
|||
suspend fun update(vararg entries: HistoryEntry)
|
||||
}
|
||||
|
||||
suspend fun record(uri: String, title: String?) {
|
||||
suspend fun record(uri: String, title: String? = null) {
|
||||
val now = System.currentTimeMillis()
|
||||
val dao = Database.INSTANCE.historyEntryDao()
|
||||
val entry = dao.get(uri)
|
||||
|
|
|
@ -182,7 +182,6 @@ class PageFragment : Fragment(), PageAdapter.Listener {
|
|||
})
|
||||
}
|
||||
.show()
|
||||
vm.visitedUrls.add(event.uri.toString())
|
||||
}
|
||||
is PageViewModel.RedirectEvent -> {
|
||||
openUrl(
|
||||
|
|
|
@ -311,6 +311,7 @@ class PageViewModel(
|
|||
onSuccess = { mediaUri ->
|
||||
event.postValue(DownloadCompletedEvent(mediaUri, mimeType))
|
||||
state.postValue(State.IDLE)
|
||||
viewModelScope.launch(Dispatchers.IO) { History.record(uri.toString()) }
|
||||
},
|
||||
onError = { msg -> signalError("Download failed: $msg") }
|
||||
)
|
||||
|
|
Reference in a new issue