1
0
Fork 0

Open "migration FAQ" when selecting "What's new" in a Fennec build.

master
Sebastian Kaspari 2020-01-10 15:21:30 +01:00
parent 4fb8398a3b
commit 6419d0cf13
3 changed files with 28 additions and 6 deletions

View File

@ -5,7 +5,15 @@
package org.mozilla.fenix package org.mozilla.fenix
enum class ReleaseChannel { enum class ReleaseChannel {
FenixDebug, FenixNightly, FenixBeta, FenixProduction, FennecProduction, FennecBeta, FennecNightly; FenixDebug,
FenixNightly,
FenixBeta,
FenixProduction,
FennecProduction,
FennecBeta,
FennecNightly;
val isReleased: Boolean val isReleased: Boolean
get() = when (this) { get() = when (this) {
@ -39,6 +47,9 @@ enum class ReleaseChannel {
FenixDebug -> true FenixDebug -> true
else -> false else -> false
} }
val isFennec: Boolean
get() = this in fennecChannels
} }
object Config { object Config {
@ -62,3 +73,9 @@ object Config {
} }
} }
} }
private val fennecChannels: List<ReleaseChannel> = listOf(
ReleaseChannel.FennecNightly,
ReleaseChannel.FennecBeta,
ReleaseChannel.FennecProduction
)

View File

@ -536,10 +536,7 @@ class HomeFragment : Fragment() {
WhatsNew.userViewedWhatsNew(context) WhatsNew.userViewedWhatsNew(context)
context.metrics.track(Event.WhatsNewTapped(Event.WhatsNewTapped.Source.HOME)) context.metrics.track(Event.WhatsNewTapped(Event.WhatsNewTapped.Source.HOME))
(activity as HomeActivity).openToBrowserAndLoad( (activity as HomeActivity).openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getSumoURLForTopic( searchTermOrURL = SupportUtils.getWhatsNewUrl(context),
context,
SupportUtils.SumoTopic.WHATS_NEW
),
newTab = true, newTab = true,
from = BrowserDirection.FromHome from = BrowserDirection.FromHome
) )

View File

@ -10,6 +10,7 @@ import androidx.browser.customtabs.CustomTabsIntent
import androidx.core.net.toUri import androidx.core.net.toUri
import mozilla.components.support.ktx.android.content.appVersionName import mozilla.components.support.ktx.android.content.appVersionName
import org.mozilla.fenix.BuildConfig import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.Config
import org.mozilla.fenix.IntentReceiverActivity import org.mozilla.fenix.IntentReceiverActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.ext.getColorFromAttr import org.mozilla.fenix.ext.getColorFromAttr
@ -32,7 +33,8 @@ object SupportUtils {
SEND_TABS("send-tab-preview"), SEND_TABS("send-tab-preview"),
SET_AS_DEFAULT_BROWSER("set-firefox-preview-default"), SET_AS_DEFAULT_BROWSER("set-firefox-preview-default"),
SEARCH_SUGGESTION("how-search-firefox-preview"), SEARCH_SUGGESTION("how-search-firefox-preview"),
CUSTOM_SEARCH_ENGINES("custom-search-engines") CUSTOM_SEARCH_ENGINES("custom-search-engines"),
UPGRADE_FAQ("firefox-preview-upgrade-faqs")
} }
/** /**
@ -64,6 +66,12 @@ object SupportUtils {
fun getPrivacyNoticeUrl(locale: Locale = Locale.getDefault()) = fun getPrivacyNoticeUrl(locale: Locale = Locale.getDefault()) =
"https://www.mozilla.org/${getLanguageTag(locale)}/privacy/firefox/" "https://www.mozilla.org/${getLanguageTag(locale)}/privacy/firefox/"
fun getWhatsNewUrl(context: Context) = if (Config.channel.isFennec) {
getGenericSumoURLForTopic(SumoTopic.UPGRADE_FAQ)
} else {
getSumoURLForTopic(context, SumoTopic.WHATS_NEW)
}
fun createCustomTabIntent(context: Context, url: String): Intent = CustomTabsIntent.Builder() fun createCustomTabIntent(context: Context, url: String): Intent = CustomTabsIntent.Builder()
.setInstantAppsEnabled(false) .setInstantAppsEnabled(false)
.setToolbarColor(context.getColorFromAttr(R.attr.foundation)) .setToolbarColor(context.getColorFromAttr(R.attr.foundation))