Add FeatureFlags to disable features in release builds

This commit is contained in:
MM20
2026-03-14 13:17:36 +01:00
parent 910a64480a
commit 0b22f52823
3 changed files with 31 additions and 15 deletions

View File

@@ -25,6 +25,7 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation3.runtime.NavKey
import de.mm20.launcher2.FeatureFlags
import de.mm20.launcher2.icons.LauncherIcon
import de.mm20.launcher2.ktx.isAtLeastApiLevel
import de.mm20.launcher2.preferences.GestureAction
@@ -77,7 +78,9 @@ fun GestureSettingsScreen() {
}
val optionsWithFeed =
options + (stringResource(R.string.gesture_action_feed) to GestureAction.Feed)
if (FeatureFlags.feed) {
options + (stringResource(R.string.gesture_action_feed) to GestureAction.Feed)
} else options
val context = LocalContext.current

View File

@@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation3.runtime.NavKey
import de.mm20.launcher2.FeatureFlags
import de.mm20.launcher2.ktx.isAtLeastApiLevel
import de.mm20.launcher2.ui.R
import de.mm20.launcher2.ui.component.preferences.Preference
@@ -46,13 +47,15 @@ fun IntegrationsSettingsScreen() {
backStack.add(MediaIntegrationSettingsRoute)
}
)
Preference(
title = stringResource(R.string.preference_feed_integration),
icon = R.drawable.news_24px,
onClick = {
backStack.add(FeedIntegrationSettingsRoute)
}
)
if (FeatureFlags.feed) {
Preference(
title = stringResource(R.string.preference_feed_integration),
icon = R.drawable.news_24px,
onClick = {
backStack.add(FeedIntegrationSettingsRoute)
}
)
}
}
}
item {
@@ -97,13 +100,15 @@ fun IntegrationsSettingsScreen() {
}
)
if (isAtLeastApiLevel(29)) {
Preference(
title = stringResource(R.string.preference_smartspacer_integration),
icon = R.drawable.smartspacer,
onClick = {
backStack.add(SmartspacerSettingsRoute)
}
)
if (FeatureFlags.smartspacerIntegration) {
Preference(
title = stringResource(R.string.preference_smartspacer_integration),
icon = R.drawable.smartspacer,
onClick = {
backStack.add(SmartspacerSettingsRoute)
}
)
}
}
}
}

View File

@@ -0,0 +1,8 @@
package de.mm20.launcher2
import de.mm20.launcher2.base.BuildConfig
object FeatureFlags {
val feed = BuildConfig.BUILD_TYPE != "release"
val smartspacerIntegration = BuildConfig.BUILD_TYPE != "release"
}