fix: Close "Add downloaders" dialog on add

This commit is contained in:
Ushie
2026-03-16 04:08:59 +03:00
parent 3a0836fe1f
commit f60ce02a81
2 changed files with 12 additions and 6 deletions

View File

@@ -5,10 +5,10 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.Add
@@ -117,8 +117,14 @@ fun DownloadsSettingsScreen(
ImportSourceDialog(
strings = ImportSourceDialogStrings.DOWNLOADERS,
onDismiss = { showImportDialog = false },
onLocalSubmit = viewModel::createLocalSource,
onRemoteSubmit = viewModel::createRemoteSource,
onLocalSubmit = { uri ->
showImportDialog = false
viewModel.createLocalSource(uri)
},
onRemoteSubmit = { url, autoUpdate ->
showImportDialog = false
viewModel.createRemoteSource(url, autoUpdate)
}
)
}

View File

@@ -62,8 +62,8 @@ class DownloadsViewModel(
}
@SuppressLint("Recycle")
fun createLocalSource(patchBundle: Uri) = viewModelScope.launch {
downloaderRepository.createLocal { contentResolver.openInputStream(patchBundle)!! }
fun createLocalSource(downloaderUri: Uri) = viewModelScope.launch {
downloaderRepository.createLocal { contentResolver.openInputStream(downloaderUri)!! }
}
fun createRemoteSource(apiUrl: String, autoUpdate: Boolean) = viewModelScope.launch {