Hide Android-specific settings on Desktop platforms

This commit is contained in:
Artem Chepurnoy 2024-01-31 09:32:34 +02:00
parent f639054b03
commit bf838fa302
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
6 changed files with 29 additions and 4 deletions

View File

@ -92,6 +92,7 @@ import com.artemchep.keyguard.feature.home.settings.component.settingVaultPersis
import com.artemchep.keyguard.feature.home.settings.component.settingWebsiteIconsProvider
import com.artemchep.keyguard.feature.home.settings.component.settingWriteAccessProvider
import com.artemchep.keyguard.feature.navigation.NavigationIcon
import com.artemchep.keyguard.platform.CurrentPlatform
import com.artemchep.keyguard.ui.ScaffoldLazyColumn
import com.artemchep.keyguard.ui.skeleton.SkeletonItem
import com.artemchep.keyguard.ui.toolbar.LargeToolbar
@ -266,6 +267,8 @@ fun SettingPaneContent(
) {
val di = localDI()
val state by remember(items, di, hub) {
val platform = CurrentPlatform
fun create(
item: SettingPaneItem.Item,
group: String = "",
@ -279,7 +282,18 @@ fun SettingPaneContent(
itemKey = item.key,
groupKey = group,
args = args,
content = content?.content,
content = content
?.takeIf {
if (
it.platformClass != null &&
!it.platformClass.isInstance(platform)
) {
return@takeIf false
}
true
}
?.content,
)
}

View File

@ -13,6 +13,7 @@ import com.artemchep.keyguard.common.usecase.PutClipboardAutoClear
import com.artemchep.keyguard.common.usecase.WindowCoroutineScope
import com.artemchep.keyguard.feature.localization.textResource
import com.artemchep.keyguard.platform.LeContext
import com.artemchep.keyguard.platform.Platform
import com.artemchep.keyguard.res.Res
import com.artemchep.keyguard.ui.FlatDropdown
import com.artemchep.keyguard.ui.FlatItemAction
@ -57,7 +58,9 @@ fun settingClipboardAutoClearProvider(
)
}
SettingIi {
SettingIi(
platformClass = Platform.Mobile::class,
) {
SettingClipboardAutoClear(
text = text,
dropdown = dropdown,

View File

@ -18,6 +18,7 @@ import com.artemchep.keyguard.common.usecase.PutClipboardAutoRefresh
import com.artemchep.keyguard.common.usecase.WindowCoroutineScope
import com.artemchep.keyguard.feature.localization.textResource
import com.artemchep.keyguard.platform.LeContext
import com.artemchep.keyguard.platform.Platform
import com.artemchep.keyguard.res.Res
import com.artemchep.keyguard.ui.FlatDropdown
import com.artemchep.keyguard.ui.FlatItemAction
@ -65,7 +66,9 @@ fun settingClipboardAutoRefreshProvider(
)
}
SettingIi {
SettingIi(
platformClass = Platform.Mobile::class,
) {
SettingClipboardAutoRefresh(
text = text,
dropdown = dropdown,

View File

@ -5,11 +5,12 @@ import androidx.compose.runtime.Composable
import com.artemchep.keyguard.platform.Platform
import com.artemchep.keyguard.ui.FlatItem
import kotlinx.coroutines.flow.Flow
import kotlin.reflect.KClass
typealias SettingComponent = Flow<SettingIi?>
data class SettingIi(
val platform: Platform? = null,
val platformClass: KClass<out Platform>? = null,
val search: Search? = null,
val content: @Composable () -> Unit,
) {

View File

@ -13,6 +13,7 @@ import com.artemchep.keyguard.common.io.launchIn
import com.artemchep.keyguard.common.usecase.GetAllowScreenshots
import com.artemchep.keyguard.common.usecase.PutAllowScreenshots
import com.artemchep.keyguard.common.usecase.WindowCoroutineScope
import com.artemchep.keyguard.platform.Platform
import com.artemchep.keyguard.res.Res
import com.artemchep.keyguard.ui.FlatItem
import com.artemchep.keyguard.ui.icons.icon
@ -41,6 +42,7 @@ fun settingScreenshotsProvider(
}
SettingIi(
platformClass = Platform.Mobile::class,
search = SettingIi.Search(
group = "conceal",
tokens = listOf(

View File

@ -14,6 +14,7 @@ import com.artemchep.keyguard.common.usecase.GetVaultLockAfterScreenOff
import com.artemchep.keyguard.common.usecase.GetVaultPersist
import com.artemchep.keyguard.common.usecase.PutVaultLockAfterScreenOff
import com.artemchep.keyguard.common.usecase.WindowCoroutineScope
import com.artemchep.keyguard.platform.Platform
import com.artemchep.keyguard.res.Res
import com.artemchep.keyguard.ui.FlatItem
import com.artemchep.keyguard.ui.icons.icon
@ -47,6 +48,7 @@ fun settingVaultLockAfterScreenOffProvider(
}
SettingIi(
platformClass = Platform.Mobile::class,
search = SettingIi.Search(
group = "lock",
tokens = listOf(