Fix notification and add visual cues when triggering a second update (#7783)

This commit is contained in:
stevenyomi
2022-08-18 21:01:10 +08:00
committed by GitHub
parent 80b4b7bee6
commit 1f34f5277c
6 changed files with 21 additions and 21 deletions

View File

@@ -83,9 +83,9 @@ fun UpdateScreen(
val context = LocalContext.current
val onUpdateLibrary = {
if (LibraryUpdateService.start(context)) {
context.toast(R.string.updating_library)
}
val started = LibraryUpdateService.start(context)
context.toast(if (started) R.string.updating_library else R.string.update_already_running)
started
}
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState())
@@ -97,7 +97,7 @@ fun UpdateScreen(
UpdatesAppBar(
incognitoMode = presenter.isIncognitoMode,
downloadedOnlyMode = presenter.isDownloadOnly,
onUpdateLibrary = onUpdateLibrary,
onUpdateLibrary = { onUpdateLibrary() },
actionModeCounter = presenter.selected.size,
onSelectAll = { presenter.toggleAllSelection(true) },
onInvertSelection = { presenter.invertSelection() },
@@ -132,7 +132,8 @@ fun UpdateScreen(
SwipeRefresh(
state = rememberSwipeRefreshState(isRefreshing = isRefreshing),
onRefresh = {
onUpdateLibrary()
val started = onUpdateLibrary()
if (!started) return@SwipeRefresh
scope.launch {
// Fake refresh status but hide it after a second as it's a long running task
isRefreshing = true