package com.suno.android.hooks import com.suno.android.common_core_utils.SunoLogger import com.suno.android.gating.Feature import com.suno.android.gating.FeatureManager import javax.inject.Inject import javax.inject.Singleton /** * Manages all of the feature gates and experiments related to the hooks feature. */ @Singleton class HooksFeatureGateManager @Inject constructor( loggerFactory: SunoLogger.Factory, private val featureManager: FeatureManager, ) { private val logger = loggerFactory.create(this@HooksFeatureGateManager) val hooksFeedTab: HooksFeedTab get() { val feedLocation = featureManager.getFeatureValue(Feature.HooksFeedLocation).value logger.d { "Feed location: $feedLocation" } return HooksFeedTab.fromValue(feedLocation) } val hooksFeedType: HooksFeedType? get() { val feedType = featureManager.getFeatureValue(Feature.HooksFeedType).value logger.d { "Feed type: $feedType" } return HooksFeedType.fromValue(feedType) } val isHooksCreateEnabled: Boolean get() = featureManager.hasFeature(Feature.HooksCreate) val isHooksInAppNotificationsEnabled: Boolean get() = featureManager.hasFeature(Feature.HooksInAppNotifications) val isHooksDownloadEnabled: Boolean get() = featureManager.hasFeature(Feature.HooksDownload) val isHooksDownloadSelfEnabled: Boolean get() = featureManager.hasFeature(Feature.HooksDownloadSelf) } enum class HooksFeedTab( val value: String, ) { First("first"), Second("second"), Disabled("disabled"), ; companion object { fun fromValue( value: String?, ): HooksFeedTab = entries.find { it.value == value } ?: Disabled } } enum class HooksFeedType( val value: String, ) { Fullscreen("fullscreen"), Carousel("carousel"), ; companion object { fun fromValue( value: String?, ): HooksFeedType? = HooksFeedType.entries.find { it.value == value } } }