mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Add root path setting
This commit is contained in:
@@ -55,6 +55,7 @@ actual fun getServerHostItems(viewModel: @Composable () -> SettingsServerHostVie
|
||||
host = serverVm.host,
|
||||
ip = serverVm.ip,
|
||||
port = serverVm.port,
|
||||
rootPath = serverVm.rootPath,
|
||||
downloadPath = serverVm.downloadPath,
|
||||
backupPath = serverVm.backupPath,
|
||||
localSourcePath = serverVm.localSourcePath,
|
||||
@@ -74,9 +75,14 @@ actual class SettingsServerHostViewModel
|
||||
contextWrapper: ContextWrapper,
|
||||
) : ViewModel(contextWrapper) {
|
||||
val host = serverHostPreferences.host().asStateIn(scope)
|
||||
|
||||
// IP
|
||||
val ip = serverHostPreferences.ip().asStateIn(scope)
|
||||
val port = serverHostPreferences.port().asStringStateIn(scope)
|
||||
|
||||
// Root
|
||||
val rootPath = serverHostPreferences.rootPath().asStateIn(scope)
|
||||
|
||||
// Downloader
|
||||
val downloadPath = serverHostPreferences.downloadPath().asStateIn(scope)
|
||||
|
||||
@@ -133,6 +139,7 @@ fun LazyListScope.ServerHostItems(
|
||||
host: MutableStateFlow<Boolean>,
|
||||
ip: MutableStateFlow<String>,
|
||||
port: MutableStateFlow<String>,
|
||||
rootPath: MutableStateFlow<String>,
|
||||
downloadPath: MutableStateFlow<String>,
|
||||
backupPath: MutableStateFlow<String>,
|
||||
localSourcePath: MutableStateFlow<String>,
|
||||
@@ -169,6 +176,27 @@ fun LazyListScope.ServerHostItems(
|
||||
changeListener = serverSettingChanged,
|
||||
)
|
||||
}
|
||||
item {
|
||||
val rootPathValue by rootPath.collectAsState()
|
||||
PreferenceRow(
|
||||
title = stringResource(MR.strings.host_root_path),
|
||||
subtitle = if (rootPathValue.isEmpty()) {
|
||||
stringResource(MR.strings.host_root_path_sub_empty)
|
||||
} else {
|
||||
stringResource(MR.strings.host_root_path_sub, rootPathValue)
|
||||
},
|
||||
onClick = {
|
||||
folderPicker {
|
||||
rootPath.value = it.toString()
|
||||
serverSettingChanged()
|
||||
}
|
||||
},
|
||||
onLongClick = {
|
||||
rootPath.value = ""
|
||||
serverSettingChanged()
|
||||
},
|
||||
)
|
||||
}
|
||||
item {
|
||||
val downloadPathValue by downloadPath.collectAsState()
|
||||
PreferenceRow(
|
||||
|
||||
Reference in New Issue
Block a user