PageFragment: fix back button issue after download

This commit is contained in:
dece 2022-02-17 17:58:14 +01:00
parent 7658212a76
commit 44aa42e67d
3 changed files with 2 additions and 2 deletions

View file

@ -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)

View file

@ -182,7 +182,6 @@ class PageFragment : Fragment(), PageAdapter.Listener {
})
}
.show()
vm.visitedUrls.add(event.uri.toString())
}
is PageViewModel.RedirectEvent -> {
openUrl(

View file

@ -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") }
)