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 update(vararg entries: HistoryEntry)
} }
suspend fun record(uri: String, title: String?) { suspend fun record(uri: String, title: String? = null) {
val now = System.currentTimeMillis() val now = System.currentTimeMillis()
val dao = Database.INSTANCE.historyEntryDao() val dao = Database.INSTANCE.historyEntryDao()
val entry = dao.get(uri) val entry = dao.get(uri)

View file

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

View file

@ -311,6 +311,7 @@ class PageViewModel(
onSuccess = { mediaUri -> onSuccess = { mediaUri ->
event.postValue(DownloadCompletedEvent(mediaUri, mimeType)) event.postValue(DownloadCompletedEvent(mediaUri, mimeType))
state.postValue(State.IDLE) state.postValue(State.IDLE)
viewModelScope.launch(Dispatchers.IO) { History.record(uri.toString()) }
}, },
onError = { msg -> signalError("Download failed: $msg") } onError = { msg -> signalError("Download failed: $msg") }
) )