mirror of
https://github.com/amir1376/ab-download-manager.git
synced 2025-02-20 11:43:24 +08:00
don't allow user to add download when link is in loading state
This commit is contained in:
parent
d51d63db4c
commit
efe381d555
@ -81,9 +81,17 @@ class AddSingleDownloadComponent(
|
||||
val canAddResult = downloadChecker.canAddToDownloadResult.asStateFlow()
|
||||
private val canAdd = downloadChecker.canAdd
|
||||
private val isDuplicate = downloadChecker.isDuplicate
|
||||
|
||||
val isLinkLoading = downloadChecker.gettingResponseInfo
|
||||
val linkResponseInfo = downloadChecker.responseInfo
|
||||
|
||||
val canAddToDownloads = combineStateFlows(
|
||||
canAdd, isDuplicate, onDuplicateStrategy
|
||||
) { canAdd, isDuplicate, onDuplicateStrategy ->
|
||||
canAdd, isDuplicate, onDuplicateStrategy, isLinkLoading
|
||||
) { canAdd, isDuplicate, onDuplicateStrategy, isLinkLoading ->
|
||||
if (isLinkLoading){
|
||||
// link is loading wait for it...
|
||||
return@combineStateFlows false
|
||||
}
|
||||
if (canAdd) {
|
||||
true
|
||||
} else if (isDuplicate && onDuplicateStrategy != null) {
|
||||
@ -93,9 +101,6 @@ class AddSingleDownloadComponent(
|
||||
}
|
||||
}
|
||||
|
||||
val isLinkLoading = downloadChecker.gettingResponseInfo
|
||||
val linkResponseInfo = downloadChecker.responseInfo
|
||||
|
||||
//extra settings
|
||||
private var threadCount = MutableStateFlow(null as Int?)
|
||||
private var speedLimit = MutableStateFlow(0L)
|
||||
|
Loading…
x
Reference in New Issue
Block a user