diff --git a/app/src/main/java/dev/lowrespalmtree/comet/History.kt b/app/src/main/java/dev/lowrespalmtree/comet/History.kt index bc6e1d9..501e852 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/History.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/History.kt @@ -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) diff --git a/app/src/main/java/dev/lowrespalmtree/comet/PageFragment.kt b/app/src/main/java/dev/lowrespalmtree/comet/PageFragment.kt index 74aa6bc..6cb6a64 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/PageFragment.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/PageFragment.kt @@ -182,7 +182,6 @@ class PageFragment : Fragment(), PageAdapter.Listener { }) } .show() - vm.visitedUrls.add(event.uri.toString()) } is PageViewModel.RedirectEvent -> { openUrl( diff --git a/app/src/main/java/dev/lowrespalmtree/comet/PageViewModel.kt b/app/src/main/java/dev/lowrespalmtree/comet/PageViewModel.kt index f9684e9..ae055ae 100644 --- a/app/src/main/java/dev/lowrespalmtree/comet/PageViewModel.kt +++ b/app/src/main/java/dev/lowrespalmtree/comet/PageViewModel.kt @@ -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") } )