Verified Commit 5cbefc88 authored by Alex Catarineu's avatar Alex Catarineu Committed by Pier Angelo Vendrame
Browse files

[android] Modify UI/UX

Bug 40015: Modify Home menu

Bug 40016: Hide unwanted Settings

Bug 40016: Modify Default toolbar menu

Bug 40016: Add Donate settings button

Bug 40016: Move Allow Screenshots under Advanced

Bug 40016: Don't install WebCompat webext

Bug 40016: Don't onboard Search Suggestions

Bug 40094: Do not use MasterPasswordTipProvider in HomeFragment

Bug 40095: Hide "Sign in to sync" in bookmarks

Bug 40031: Hide Mozilla-specific items on About page

Bug 40032: Set usesCleartextTraffic as false

Bug 40063: Do not sort search engines alphabetically

Bug 34378: Port external helper app prompting

With the corresponding android-components patch, this allows all `startActivity`
that may open external apps to be replaced by `TorUtils.startActivityPrompt`.

Bug 34403: Disable Normal mode by default

Bug 40087: Implement a switch for english locale spoofing

Bug 40144: Hide Download Manager

Bug 40141: Hide EME site permission

Bug 40166: Hide "Normal" tab (again) and Sync tab in TabTray

Bug 40167: Hide "Save to Collection" in menu

Bug 40172: Find the Quit button

Bug 40186: Hide Credit Cards in Settings

Bug 40198: Spoof English toggle now overlaps with locale list
parent d2f7c51c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -56,8 +56,8 @@ projects:
    - feature-toolbar
    - feature-top-sites
    - feature-webauthn
    - feature-webcompat
    - feature-webcompat-reporter
#   - feature-webcompat
#   - feature-webcompat-reporter
    - feature-webnotifications
    - lib-crash
    - lib-crash-sentry
+2 −2
Original line number Diff line number Diff line
@@ -633,9 +633,9 @@ dependencies {
    implementation project(':feature-share')
    implementation project(':feature-accounts-push')
    implementation project(':feature-webauthn')
    implementation project(':feature-webcompat')
//  implementation project(':feature-webcompat')
    implementation project(':feature-webnotifications')
    implementation project(':feature-webcompat-reporter')
//  implementation project(':feature-webcompat-reporter')

    implementation project(':service-pocket')
    implementation project(':service-contile')
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@
        android:roundIcon="@mipmap/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/NormalTheme"
        android:usesCleartextTraffic="true"
        android:usesCleartextTraffic="false"
        tools:ignore="UnusedAttribute">

        <profileable
+55 −2
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
package org.mozilla.fenix

import android.app.assist.AssistContent
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.Intent.ACTION_MAIN
@@ -56,6 +57,8 @@ import mozilla.components.browser.state.state.WebExtensionState
import mozilla.components.concept.engine.EngineSession
import mozilla.components.concept.engine.EngineView
import mozilla.components.concept.storage.HistoryMetadataKey
import mozilla.components.feature.app.links.RedirectDialogFragment
import mozilla.components.feature.app.links.SimpleRedirectDialogFragment
import mozilla.components.feature.contextmenu.DefaultSelectionActionDelegate
import mozilla.components.feature.media.ext.findActiveMediaTab
import mozilla.components.feature.privatemode.notification.PrivateNotificationFeature
@@ -75,6 +78,7 @@ import mozilla.components.support.utils.BootUtils
import mozilla.components.support.utils.BrowsersCache
import mozilla.components.support.utils.ManufacturerCodes
import mozilla.components.support.utils.SafeIntent
import mozilla.components.support.utils.TorUtils
import mozilla.components.support.utils.toSafeIntent
import mozilla.components.support.webextensions.WebExtensionPopupObserver
import mozilla.telemetry.glean.private.NoExtras
@@ -222,10 +226,13 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
    private val startupPathProvider = StartupPathProvider()
    private lateinit var startupTypeTelemetry: StartupTypeTelemetry

    private var dialog: RedirectDialogFragment? = null

    @Suppress("ComplexMethod")
    final override fun onCreate(savedInstanceState: Bundle?) {
        // DO NOT MOVE ANYTHING ABOVE THIS getProfilerTime CALL.
        val startTimeProfiler = components.core.engine.profiler?.getProfilerTime()
        components.core.engine.profiler?.addMarker("Activity.onCreate", "HomeActivity")

        // Setup nimbus-cli tooling. This is a NOOP when launching normally.
        components.nimbus.sdk.initializeTooling(applicationContext, intent)
@@ -655,6 +662,26 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
        super.recreate()
    }

    // Copied from mozac AppLinksFeature.kt
    internal fun getOrCreateDialog(): RedirectDialogFragment {
        val existingDialog = dialog
        if (existingDialog != null) {
            return existingDialog
        }

        SimpleRedirectDialogFragment.newInstance().also {
            dialog = it
            return it
        }
    }
    private fun isAlreadyADialogCreated(): Boolean {
        return findPreviousDialogFragment() != null
    }

    private fun findPreviousDialogFragment(): RedirectDialogFragment? {
        return supportFragmentManager.findFragmentByTag(RedirectDialogFragment.FRAGMENT_TAG) as? RedirectDialogFragment
    }

    /**
     * Handles intents received when the activity is open.
     */
@@ -672,6 +699,26 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
            return
        }

        val startIntent = intent.getParcelableExtra(TorUtils.TORBROWSER_START_ACTIVITY_PROMPT, PendingIntent::class.java); //  getParcelableExtra<PendingIntent>(TorUtils.TORBROWSER_START_ACTIVITY_PROMPT)
        if (startIntent != null) {
            if (startIntent.creatorPackage == applicationContext.packageName) {
                val dialog = getOrCreateDialog()
                dialog.onConfirmRedirect = {
                    @Suppress("EmptyCatchBlock")
                    try {
                        startIntent.send()
                    } catch (error: PendingIntent.CanceledException) {
                    }
                }
                dialog.onCancelRedirect = {}

                if (!isAlreadyADialogCreated()) {
                    dialog.showNow(supportFragmentManager, RedirectDialogFragment.FRAGMENT_TAG)
                }
            }
            return
        }

        // Diagnostic breadcrumb for "Display already aquired" crash:
        // https://github.com/mozilla-mobile/android-components/issues/7960
        breadcrumb(
@@ -906,11 +953,17 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
    internal fun getModeFromIntentOrLastKnown(intent: Intent?): BrowsingMode {
        intent?.toSafeIntent()?.let {
            if (it.hasExtra(PRIVATE_BROWSING_MODE)) {
                val startPrivateMode = it.getBooleanExtra(PRIVATE_BROWSING_MODE, false)
                val startPrivateMode = settings().shouldDisableNormalMode ||
                    it.getBooleanExtra(PRIVATE_BROWSING_MODE, settings().openLinksInAPrivateTab)

                return BrowsingMode.fromBoolean(isPrivate = startPrivateMode)
            }
        }
        return settings().lastKnownMode
        return when {
            settings().shouldDisableNormalMode -> BrowsingMode.Private
            settings().openLinksInAPrivateTab -> BrowsingMode.Private
            else -> settings().lastKnownMode
        }
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -619,7 +619,7 @@ abstract class BaseBrowserFragment :
                PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
                    context.getPreferenceKey(R.string.pref_key_external_download_manager),
                    false,
                )
                ) && false
            },
            promptsStyling = DownloadsFeature.PromptsStyling(
                gravity = Gravity.BOTTOM,
Loading