Commit c5061ebc authored by clairehurst's avatar clairehurst 🌱 Committed by Pier Angelo Vendrame
Browse files

fixup! [android] Disable features and functionality

Bug 45031: Disable AI features for android
parent b3ce8889
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import mozilla.components.concept.engine.translate.TranslationSupport
 * See [TranslationsState.translationError] for session level errors.
 */
data class TranslationsBrowserState(
    val isTranslationsEnabled: Boolean = true,
    val isTranslationsEnabled: Boolean = false,
    val isEngineSupported: Boolean? = null,
    val offerTranslation: Boolean? = null,
    val supportedLanguages: TranslationSupport? = null,
+2 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ interface AIFeatureBlock {
}

private class InMemoryAIFeatureBlock(initialBlocked: Boolean) : AIFeatureBlock {
    private val _isBlocked = MutableStateFlow(initialBlocked)
    private val _isBlocked = MutableStateFlow(true)
    override val isBlocked: Flow<Boolean> = _isBlocked

    override suspend fun block() {
@@ -40,6 +40,6 @@ private class InMemoryAIFeatureBlock(initialBlocked: Boolean) : AIFeatureBlock {
    }

    override suspend fun unblock() {
        _isBlocked.value = false
        _isBlocked.value = true
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -28,11 +28,11 @@ internal interface AIFeatureBlockStorage {
}

private class InMemoryAiFeatureBlockStorage(initialBlocked: Boolean) : AIFeatureBlockStorage {
    private val _isBlocked = MutableStateFlow(initialBlocked)
    private val _isBlocked = MutableStateFlow(true)
    override val isBlocked: Flow<Boolean> = _isBlocked

    override suspend fun setBlocked(isBlocked: Boolean) {
        _isBlocked.value = isBlocked
        _isBlocked.value = true
    }
}

@@ -46,13 +46,13 @@ internal class DataStoreBackedAIFeatureBlockStorage(

    override val isBlocked: Flow<Boolean>
        get() = dataStore.data.map { preferences ->
            preferences[isBlockedKey] ?: false
            true
        }

    override suspend fun setBlocked(isBlocked: Boolean) {
        dataStore.updateData {
            it.toMutablePreferences().also { preferences ->
                preferences[isBlockedKey] = isBlocked
                preferences[isBlockedKey] = true
            }
        }
    }
+11 −11
Original line number Diff line number Diff line
@@ -323,13 +323,13 @@ features:
    defaults:
      - channel: developer
        value:
          enabled: true
          enabled: false
      - channel: nightly
        value:
          enabled: true
          enabled: false
      - channel: beta
        value:
          enabled: true
          enabled: false

  setup-checklist:
    description: A feature on the home page that allows the user to track onboarding setup progress.
@@ -407,42 +407,42 @@ features:
        description: >
          Show the primary toolbar entry point into the translations feature. (Translations icon on URL toolbar.)
        type: Boolean
        default: true
        default: false
      main-flow-browser-menu-enabled:
        description: >
          Show the browser menu entry point into the translations feature. ('Translate Page' on browser menu.)
        type: Boolean
        default: true
        default: false
      page-settings-enabled:
        description: >
          Show the page settings entry point within the translations feature. (Gear icon on the translations main flow page.)
          'main-flow-toolbar-enabled' or 'main-flow-browser-menu-enabled' must also be enabled for users to access this feature.
        type: Boolean
        default: true
        default: false
      global-settings-enabled:
        description: >
          Show the global settings entry point within the translations feature. ('Translation Settings' on the page settings view.)
          'page-settings-enabled' must also be enabled for users to access this feature.
        type: Boolean
        default: true
        default: false
      global-lang-settings-enabled:
        description: >
          Show the global language options entry point for automatically translating. ('Automatic Translation' on the global settings view.)
          'global-settings-enabled' must also be enabled for users to access this feature.
        type: Boolean
        default: true
        default: false
      global-site-settings-enabled:
        description: >
          Show the global never translate this site options entry point for site management. ('Never translate these sites' on the global settings view.)
          'global-settings-enabled' must also be enabled for users to access this feature.
        type: Boolean
        default: true
        default: false
      downloads-enabled:
        description: >
          Show the global language model download options entry point for translations. ('Download languages' on the global settings view.)
          'global-settings-enabled' must also be enabled for users to access this feature.
        type: Boolean
        default: true
        default: false

  navigation-toolbar:
    description: Feature for navigation toolbar.
@@ -1276,7 +1276,7 @@ features:
    defaults:
      - channel: developer
        value:
          enabled: true
          enabled: false
      - channel: nightly
        value:
          enabled: false
+1 −1
Original line number Diff line number Diff line
@@ -390,7 +390,7 @@ class MenuDialogFragment : BottomSheetDialogFragment() {
                }.collectAsState(initial = false)

                val isTranslationsEnabled = TranslationsEnabledSettings.dataStore(requireContext())
                    .isEnabled.collectAsState(true)
                    .isEnabled.collectAsState(false)

                MenuDialogBottomSheet(
                    modifier = Modifier
Loading