Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf1236fc authored by Coco Duan's avatar Coco Duan
Browse files

Update isCommunalEnabled() for whether feature flags are enabled

Define get() for isCommunalEnabled so it calls through to FeatureFlags
based on best practices in go/sysui-flags#best-practices

Bug: b/301269121
Test: on device
Change-Id: I7a7fd82cb270488268dce24e54ec5079bdaa6aad
parent 1c3c42fd
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -15,7 +15,10 @@ interface CommunalRepository {
class CommunalRepositoryImpl
@Inject
constructor(
    featureFlags: FeatureFlagsClassic,
    private val featureFlags: FeatureFlagsClassic,
) : CommunalRepository {
    override val isCommunalEnabled = featureFlags.isEnabled(Flags.COMMUNAL_SERVICE_ENABLED)
    override val isCommunalEnabled: Boolean
        get() =
            featureFlags.isEnabled(Flags.COMMUNAL_SERVICE_ENABLED) &&
                featureFlags.isEnabled(Flags.COMMUNAL_HUB)
}
+4 −2
Original line number Diff line number Diff line
@@ -28,11 +28,13 @@ import kotlinx.coroutines.flow.Flow
class CommunalInteractor
@Inject
constructor(
    communalRepository: CommunalRepository,
    private val communalRepository: CommunalRepository,
    widgetRepository: CommunalWidgetRepository,
) {

    /** Whether communal features are enabled. */
    val isCommunalEnabled: Boolean = communalRepository.isCommunalEnabled
    val isCommunalEnabled: Boolean
        get() = communalRepository.isCommunalEnabled

    /** A flow of info about the widget to be displayed, or null if widget is unavailable. */
    val appWidgetInfo: Flow<CommunalAppWidgetInfo?> = widgetRepository.stopwatchAppWidgetInfo