address review feedback

This commit is contained in:
Ida Delphine
2026-07-01 19:28:58 +01:00
parent b1f540732f
commit 0892909b0c
7 changed files with 22 additions and 22 deletions
+2 -1
View File
@@ -37,7 +37,8 @@ kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xexpect-actual-classes"
"-Xexpect-actual-classes",
"-Xexplicit-backing-fields"
)
optIn.addAll(
"androidx.compose.material3.ExperimentalMaterial3Api",
@@ -25,25 +25,18 @@ import net.newpipe.app.composable.PreferenceRow
import net.newpipe.app.composable.TopAppBar
import net.newpipe.app.navigation.Navigator
import net.newpipe.app.preview.ThemePreviewProvider
import net.newpipe.app.screen.settings.model.SettingsCategory
import net.newpipe.app.screen.settings.model.SettingsCategoryType
import net.newpipe.app.viewmodel.settings.SettingsViewModel
import newpipe.shared.generated.resources.Res
import newpipe.shared.generated.resources.ic_search
import newpipe.shared.generated.resources.search
import newpipe.shared.generated.resources.settings
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
import org.koin.compose.koinInject
import org.koin.compose.viewmodel.koinViewModel
data class SettingsCategory(
val title: StringResource,
val icon: DrawableResource,
// TODO: Replace with a Destination once sub-screens are migrated
val onClick: () -> Unit = {}
)
@Composable
fun SettingsHomeScreen(
navigator: Navigator = koinInject(),
@@ -0,0 +1,11 @@
package net.newpipe.app.screen.settings.model
import org.jetbrains.compose.resources.DrawableResource
import org.jetbrains.compose.resources.StringResource
data class SettingsCategory(
val title: StringResource,
val icon: DrawableResource,
// TODO: Replace with a Destination once sub-screens are migrated
val onClick: () -> Unit = {}
)
@@ -1,9 +1,4 @@
/*
* SPDX-FileCopyrightText: 2026 NewPipe e.V. <https://newpipe-ev.de>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package net.newpipe.app.screen.settings
package net.newpipe.app.screen.settings.model
import newpipe.shared.generated.resources.Res
import newpipe.shared.generated.resources.content
@@ -7,16 +7,16 @@ package net.newpipe.app.viewmodel.settings
import androidx.lifecycle.ViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.StateFlow
import net.newpipe.app.platform.BuildInfo
import net.newpipe.app.screen.settings.SettingsCategoryType
import net.newpipe.app.screen.settings.model.SettingsCategoryType
import org.koin.core.annotation.KoinViewModel
@KoinViewModel
class SettingsViewModel(buildInfo: BuildInfo) : ViewModel() {
private val _categories = MutableStateFlow(computeVisible(buildInfo))
val categories = _categories.asStateFlow()
val categories: StateFlow<List<SettingsCategoryType>>
field = MutableStateFlow(computeVisible(buildInfo))
private fun computeVisible(buildInfo: BuildInfo): List<SettingsCategoryType> =
SettingsCategoryType.entries.filter { type ->
@@ -6,4 +6,4 @@ import org.koin.core.annotation.Singleton
class IOSBuildInfo : BuildInfo {
override val isReleaseApk: Boolean = false
override val isDebug: Boolean = false
}
}
@@ -6,4 +6,4 @@ import org.koin.core.annotation.Singleton
class JVMBuildInfo : BuildInfo {
override val isReleaseApk: Boolean = false
override val isDebug: Boolean = false
}
}