Skip to content

Commit

Permalink
fix add multiple download page bug that when save mode is set to Same…
Browse files Browse the repository at this point in the history
…Location not works as expected (#326)
  • Loading branch information
amir1376 authored Dec 27, 2024
1 parent c91cbb0 commit 8fd5e72
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,12 @@ class AddMultiDownloadComponent(

private fun getFolderForItem(
categorySelectionMode: CategorySelectionMode?,
allInSameLocation: Boolean,
url: String,
fleName: String,
defaultFolder: String,
): String {
if (allInSameLocation) return defaultFolder
return when (categorySelectionMode) {
CategorySelectionMode.Auto -> {
downloadSystem.categoryManager
Expand All @@ -209,7 +211,8 @@ class AddMultiDownloadComponent(
fun requestAddDownloads(
queueId: Long?,
) {
val categorySelectionMode = when (saveMode.value) {
val saveMode = saveMode.value
val categorySelectionMode = when (saveMode) {
EachFileInTheirOwnCategory -> CategorySelectionMode.Auto
AllInOneCategory -> selectedCategory.value?.let {
CategorySelectionMode.Fixed(it.id)
Expand All @@ -233,7 +236,8 @@ class AddMultiDownloadComponent(
categorySelectionMode = categorySelectionMode,
url = it.credentials.value.link,
fleName = it.name.value,
defaultFolder = it.folder.value
defaultFolder = it.folder.value,
allInSameLocation = saveMode == InSameLocation
),
name = it.name.value,
link = it.credentials.value.link,
Expand All @@ -248,7 +252,7 @@ class AddMultiDownloadComponent(
categorySelectionMode = categorySelectionMode
)
val folder = folder.value
if (saveMode.value == InSameLocation) {
if (this.saveMode.value == InSameLocation) {
addToLastUsedLocations(folder)
}
requestClose()
Expand Down

0 comments on commit 8fd5e72

Please sign in to comment.