mirror of
https://github.com/amir1376/ab-download-manager.git
synced 2025-02-20 11:43:24 +08:00
don't show new version notification every time home window is opened in first session
This commit is contained in:
parent
b7344bfedd
commit
6e6247ff32
@ -218,8 +218,7 @@ class DownloadActions(
|
|||||||
val copyDownloadLinkAction = simpleAction(
|
val copyDownloadLinkAction = simpleAction(
|
||||||
title = Res.string.copy_link.asStringSource(),
|
title = Res.string.copy_link.asStringSource(),
|
||||||
icon = MyIcons.copy,
|
icon = MyIcons.copy,
|
||||||
checkEnable =
|
checkEnable = selections.mapStateFlow { it.isNotEmpty() },
|
||||||
selections.mapStateFlow { it.isNotEmpty() },
|
|
||||||
onActionPerformed = {
|
onActionPerformed = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
ClipboardUtil.copy(
|
ClipboardUtil.copy(
|
||||||
@ -427,6 +426,14 @@ class HomeComponent(
|
|||||||
private val defaultCategories: DefaultCategories by inject()
|
private val defaultCategories: DefaultCategories by inject()
|
||||||
val fileIconProvider: FileIconProvider by inject()
|
val fileIconProvider: FileIconProvider by inject()
|
||||||
|
|
||||||
|
init {
|
||||||
|
HomeComponent.homeComponentCreationCount++
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isFirstVisitInThisSession(): Boolean {
|
||||||
|
return HomeComponent.homeComponentCreationCount == 1
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
homePageStateToPersist
|
homePageStateToPersist
|
||||||
.debounce(500)
|
.debounce(500)
|
||||||
@ -820,31 +827,33 @@ class HomeComponent(
|
|||||||
downloads.any { it.id == previouslySelectedItem }
|
downloads.any { it.id == previouslySelectedItem }
|
||||||
}
|
}
|
||||||
}.launchIn(scope)
|
}.launchIn(scope)
|
||||||
// if the app is updated then clean downloaded files
|
if (isFirstVisitInThisSession()) {
|
||||||
if (appVersionTracker.isUpgraded()) {
|
// if the app is updated then clean downloaded files
|
||||||
// clean update files
|
if (appVersionTracker.isUpgraded()) {
|
||||||
scope.launch {
|
// clean update files
|
||||||
// temporary fix:
|
scope.launch {
|
||||||
// at the moment we relly on DownloadMonitor for getting the list of downloads by their folder
|
// temporary fix:
|
||||||
// so wait for the download list to be updated by the download monitor
|
// at the moment we relly on DownloadMonitor for getting the list of downloads by their folder
|
||||||
delay(1000)
|
// so wait for the download list to be updated by the download monitor
|
||||||
// then clean up the downloaded files
|
delay(1000)
|
||||||
updateManager.cleanDownloadedFiles()
|
// then clean up the downloaded files
|
||||||
}
|
updateManager.cleanDownloadedFiles()
|
||||||
// show user about update
|
}
|
||||||
scope.launch {
|
// show user about update
|
||||||
// let user focus to the app
|
scope.launch {
|
||||||
delay(1000)
|
// let user focus to the app
|
||||||
notificationSender.sendNotification(
|
delay(1000)
|
||||||
title = Res.string.update_updater.asStringSource(),
|
notificationSender.sendNotification(
|
||||||
description = Res.string.update_app_updated_to_version_n.asStringSourceWithARgs(
|
title = Res.string.update_updater.asStringSource(),
|
||||||
Res.string.update_app_updated_to_version_n_createArgs(
|
description = Res.string.update_app_updated_to_version_n.asStringSourceWithARgs(
|
||||||
version = appVersionTracker.currentVersion.toString()
|
Res.string.update_app_updated_to_version_n_createArgs(
|
||||||
)
|
version = appVersionTracker.currentVersion.toString()
|
||||||
),
|
)
|
||||||
type = NotificationType.Success,
|
),
|
||||||
tag = "Updater"
|
type = NotificationType.Success,
|
||||||
)
|
tag = "Updater"
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -986,6 +995,7 @@ class HomeComponent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
private var homeComponentCreationCount = 0
|
||||||
val CATEGORIES_SIZE_RANGE = 0.dp..500.dp
|
val CATEGORIES_SIZE_RANGE = 0.dp..500.dp
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user