diff --git a/app/src/main/java/org/mozilla/fenix/components/tips/providers/MigrationTipProvider.kt b/app/src/main/java/org/mozilla/fenix/components/tips/providers/MigrationTipProvider.kt deleted file mode 100644 index 9eea0d6eda..0000000000 --- a/app/src/main/java/org/mozilla/fenix/components/tips/providers/MigrationTipProvider.kt +++ /dev/null @@ -1,111 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.fenix.components.tips.providers - -import android.content.Context -import android.content.Intent -import android.net.Uri -import org.mozilla.fenix.R -import org.mozilla.fenix.components.metrics.MozillaProductDetector -import org.mozilla.fenix.components.metrics.MozillaProductDetector.MozillaProducts.FENIX -import org.mozilla.fenix.components.metrics.MozillaProductDetector.MozillaProducts.FENIX_NIGHTLY -import org.mozilla.fenix.components.metrics.MozillaProductDetector.MozillaProducts.FIREFOX_NIGHTLY -import org.mozilla.fenix.components.tips.Tip -import org.mozilla.fenix.components.tips.TipProvider -import org.mozilla.fenix.components.tips.TipType -import org.mozilla.fenix.ext.settings -import org.mozilla.fenix.settings.SupportUtils - -/** - * Tip explaining to users the migration of Fenix channels - */ -class MigrationTipProvider(private val context: Context) : TipProvider { - - override val tip: Tip? = - when (context.packageName) { - FENIX.productName -> firefoxPreviewMovedTip() - FIREFOX_NIGHTLY.productName -> getNightlyMigrationTip() - FENIX_NIGHTLY.productName -> getNightlyMigrationTip() - else -> null - } - - override val shouldDisplay: Boolean = context.settings().shouldDisplayFenixMovingTip() - - private fun firefoxPreviewMovedTip(): Tip = - Tip( - type = TipType.Button( - text = context.getString(R.string.tip_firefox_preview_moved_button_2), - action = ::getFirefoxMovedButtonAction - ), - identifier = getIdentifier(), - title = context.getString(R.string.tip_firefox_preview_moved_header), - description = context.getString(R.string.tip_firefox_preview_moved_description), - learnMoreURL = SupportUtils.getGenericSumoURLForTopic(SupportUtils.SumoTopic.FENIX_MOVING) - ) - - private fun firefoxPreviewMovedPreviewInstalledTip(): Tip = - Tip( - type = TipType.Button( - text = context.getString(R.string.tip_firefox_preview_moved_button_preview_installed), - action = ::getFirefoxMovedButtonAction - ), - identifier = getIdentifier(), - title = context.getString(R.string.tip_firefox_preview_moved_header_preview_installed), - description = context.getString(R.string.tip_firefox_preview_moved_description_preview_installed), - learnMoreURL = SupportUtils.getGenericSumoURLForTopic(SupportUtils.SumoTopic.FENIX_MOVING) - ) - - private fun firefoxPreviewMovedPreviewNotInstalledTip(): Tip = - Tip( - type = TipType.Button( - text = context.getString(R.string.tip_firefox_preview_moved_button_preview_not_installed), - action = ::getFirefoxMovedButtonAction - ), - identifier = getIdentifier(), - title = context.getString(R.string.tip_firefox_preview_moved_header_preview_not_installed), - description = context.getString(R.string.tip_firefox_preview_moved_description_preview_not_installed), - learnMoreURL = SupportUtils.getGenericSumoURLForTopic(SupportUtils.SumoTopic.FENIX_MOVING) - ) - - private fun getNightlyMigrationTip(): Tip? { - return if (MozillaProductDetector.packageIsInstalled(context, FENIX.productName)) { - firefoxPreviewMovedPreviewInstalledTip() - } else { - firefoxPreviewMovedPreviewNotInstalledTip() - } - } - - private fun getFirefoxMovedButtonAction() { - when (context.packageName) { - FENIX.productName -> context.startActivity( - Intent(Intent.ACTION_VIEW, Uri.parse(SupportUtils.FIREFOX_BETA_PLAY_STORE_URL)) - ) - FIREFOX_NIGHTLY.productName -> getNightlyMigrationAction() - FENIX_NIGHTLY.productName -> getNightlyMigrationAction() - else -> { } - } - } - - private fun getNightlyMigrationAction() { - return if (MozillaProductDetector.packageIsInstalled(context, FENIX.productName)) { - context.startActivity(context.packageManager.getLaunchIntentForPackage(FENIX.productName)) - } else { - context.startActivity( - Intent( - Intent.ACTION_VIEW, Uri.parse(SupportUtils.FIREFOX_NIGHTLY_PLAY_STORE_URL) - ) - ) - } - } - - private fun getIdentifier(): String { - return when (context.packageName) { - FENIX.productName -> context.getString(R.string.pref_key_migrating_from_fenix_tip) - FIREFOX_NIGHTLY.productName -> context.getString(R.string.pref_key_migrating_from_firefox_nightly_tip) - FENIX_NIGHTLY.productName -> context.getString(R.string.pref_key_migrating_from_fenix_nightly_tip) - else -> { "" } - } - } -} diff --git a/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt b/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt index 9a297b576e..77ee7debd5 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt @@ -24,8 +24,6 @@ object SupportUtils { const val POCKET_TRENDING_URL = "https://getpocket.com/fenix-top-articles" const val WIKIPEDIA_URL = "https://www.wikipedia.org/" const val FENIX_PLAY_STORE_URL = "https://play.google.com/store/apps/details?id=${BuildConfig.APPLICATION_ID}" - const val FIREFOX_BETA_PLAY_STORE_URL = "market://details?id=org.mozilla.firefox_beta" - const val FIREFOX_NIGHTLY_PLAY_STORE_URL = "market://details?id=org.mozilla.fenix" const val GOOGLE_URL = "https://www.google.com/" const val BAIDU_URL = "https://m.baidu.com/?from=1000969a" const val JD_URL = "https://union-click.jd.com/jdc" + @@ -40,7 +38,6 @@ object SupportUtils { const val GOOGLE_XX_URL = "https://www.google.com/webhp?client=firefox-b-m&channel=ts" enum class SumoTopic(internal val topicStr: String) { - FENIX_MOVING("sync-delist"), HELP("faq-android"), PRIVATE_BROWSING_MYTHS("common-myths-about-private-browsing"), YOUR_RIGHTS("your-rights"), diff --git a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt index 6ab97acaff..67d7465ddb 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt @@ -214,21 +214,6 @@ class Settings(private val appContext: Context) : PreferencesHolder { false ) - // If any of the prefs have been modified, quit displaying the fenix moved tip - fun shouldDisplayFenixMovingTip(): Boolean = - preferences.getBoolean( - appContext.getString(R.string.pref_key_migrating_from_fenix_nightly_tip), - true - ) && - preferences.getBoolean( - appContext.getString(R.string.pref_key_migrating_from_firefox_nightly_tip), - true - ) && - preferences.getBoolean( - appContext.getString(R.string.pref_key_migrating_from_fenix_tip), - true - ) - var defaultSearchEngineName by stringPreference( appContext.getPreferenceKey(R.string.pref_key_search_engine), default = "" diff --git a/app/src/main/res/values/preference_keys.xml b/app/src/main/res/values/preference_keys.xml index 8a8ff68515..076a41518e 100644 --- a/app/src/main/res/values/preference_keys.xml +++ b/app/src/main/res/values/preference_keys.xml @@ -226,9 +226,6 @@ pref_key_should_show_jump_back_in_tabs_popup - pref_key_migrating_from_fenix_nightly_tip - pref_key_migrating_from_firefox_nightly_tip - pref_key_migrating_from_fenix_tip pref_key_master_password_tip pref_key_debug_settings diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3b16b326d1..13aba6713e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1114,31 +1114,31 @@ - Firefox Preview is now Firefox Nightly + Firefox Preview is now Firefox Nightly - + Firefox Nightly gets updated every night and has experimental new features. However, it may be less stable. Download our beta browser for a more stable experience. - Get Firefox for Android Beta + Get Firefox for Android Beta - Firefox Nightly has moved + Firefox Nightly has moved - + This app will no longer receive security updates. Stop using this app and switch to the new Nightly. \n\nTo transfer your bookmarks, logins, and history to another app, create a Firefox account. - Switch to the new Nightly + Switch to the new Nightly - Firefox Nightly has moved + Firefox Nightly has moved - + This app will no longer receive security updates. Get the new Nightly and stop using this app. \n\nTo transfer your bookmarks, logins, and history to another app, create a Firefox account. - Get the new Nightly + Get the new Nightly