1
0
Fork 0

For #13135 - Replace about top header with Firefox Daylight

master
ekager 2020-07-31 14:48:37 -04:00 committed by Emily Kager
parent 5e38ccc5e4
commit 8b923fc7a4
3 changed files with 32 additions and 11 deletions

View File

@ -6,9 +6,7 @@ package org.mozilla.fenix
enum class ReleaseChannel { enum class ReleaseChannel {
FenixDebug, FenixDebug,
FenixProduction, FenixProduction,
FennecProduction, FennecProduction,
FennecBeta; FennecBeta;
@ -35,6 +33,12 @@ enum class ReleaseChannel {
else -> false else -> false
} }
val isRelease: Boolean
get() = when (this) {
FennecProduction -> true
else -> false
}
val isBeta: Boolean val isBeta: Boolean
get() = when (this) { get() = when (this) {
FennecBeta -> true FennecBeta -> true

View File

@ -17,6 +17,7 @@ import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import kotlinx.android.synthetic.main.fragment_about.* import kotlinx.android.synthetic.main.fragment_about.*
import org.mozilla.fenix.BrowserDirection import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.BuildConfig import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.Config
import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
@ -38,6 +39,7 @@ import org.mozilla.geckoview.BuildConfig as GeckoViewBuildConfig
*/ */
class AboutFragment : Fragment(), AboutPageListener { class AboutFragment : Fragment(), AboutPageListener {
private lateinit var headerAppName: String
private lateinit var appName: String private lateinit var appName: String
private val aboutPageAdapter: AboutPageAdapter = AboutPageAdapter(this) private val aboutPageAdapter: AboutPageAdapter = AboutPageAdapter(this)
@ -48,6 +50,8 @@ class AboutFragment : Fragment(), AboutPageListener {
): View? { ): View? {
val rootView = inflater.inflate(R.layout.fragment_about, container, false) val rootView = inflater.inflate(R.layout.fragment_about, container, false)
appName = getString(R.string.app_name) appName = getString(R.string.app_name)
headerAppName =
if (Config.channel.isRelease) getString(R.string.daylight_app_name) else appName
activity?.title = getString(R.string.preferences_about, appName) activity?.title = getString(R.string.preferences_about, appName)
return rootView return rootView
@ -64,10 +68,12 @@ class AboutFragment : Fragment(), AboutPageListener {
) )
} }
lifecycle.addObserver(SecretDebugMenuTrigger( lifecycle.addObserver(
logoView = wordmark, SecretDebugMenuTrigger(
settings = view.context.settings() logoView = wordmark,
)) settings = view.context.settings()
)
)
populateAboutHeader() populateAboutHeader()
aboutPageAdapter.submitList(populateAboutList()) aboutPageAdapter.submitList(populateAboutList())
@ -75,12 +81,15 @@ class AboutFragment : Fragment(), AboutPageListener {
private fun populateAboutHeader() { private fun populateAboutHeader() {
val aboutText = try { val aboutText = try {
val packageInfo = requireContext().packageManager.getPackageInfo(requireContext().packageName, 0) val packageInfo =
requireContext().packageManager.getPackageInfo(requireContext().packageName, 0)
val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo).toString() val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo).toString()
val componentsAbbreviation = getString(R.string.components_abbreviation) val componentsAbbreviation = getString(R.string.components_abbreviation)
val componentsVersion = mozilla.components.Build.version + ", " + mozilla.components.Build.gitHash val componentsVersion =
mozilla.components.Build.version + ", " + mozilla.components.Build.gitHash
val maybeGecko = getString(R.string.gecko_view_abbreviation) val maybeGecko = getString(R.string.gecko_view_abbreviation)
val geckoVersion = GeckoViewBuildConfig.MOZ_APP_VERSION + "-" + GeckoViewBuildConfig.MOZ_APP_BUILDID val geckoVersion =
GeckoViewBuildConfig.MOZ_APP_VERSION + "-" + GeckoViewBuildConfig.MOZ_APP_BUILDID
val appServicesAbbreviation = getString(R.string.app_services_abbreviation) val appServicesAbbreviation = getString(R.string.app_services_abbreviation)
val appServicesVersion = mozilla.components.Build.applicationServicesVersion val appServicesVersion = mozilla.components.Build.applicationServicesVersion
@ -99,7 +108,7 @@ class AboutFragment : Fragment(), AboutPageListener {
"" ""
} }
val content = getString(R.string.about_content, appName) val content = getString(R.string.about_content, headerAppName)
val buildDate = BuildConfig.BUILD_DATE val buildDate = BuildConfig.BUILD_DATE
about_text.text = aboutText about_text.text = aboutText
@ -160,7 +169,12 @@ class AboutFragment : Fragment(), AboutPageListener {
private fun openLibrariesPage() { private fun openLibrariesPage() {
startActivity(Intent(context, OssLicensesMenuActivity::class.java)) startActivity(Intent(context, OssLicensesMenuActivity::class.java))
OssLicensesMenuActivity.setActivityTitle(getString(R.string.open_source_licenses_title, appName)) OssLicensesMenuActivity.setActivityTitle(
getString(
R.string.open_source_licenses_title,
appName
)
)
} }
override fun onAboutItemClicked(item: AboutItem) { override fun onAboutItemClicked(item: AboutItem) {

View File

@ -36,4 +36,7 @@
<!-- Content description (not visible, for screen readers etc.) used to announce [LinkTextView]. --> <!-- Content description (not visible, for screen readers etc.) used to announce [LinkTextView]. -->
<string name="link_text_view_type_announcement" translatable="false">link</string> <string name="link_text_view_type_announcement" translatable="false">link</string>
<!-- Name of the application for about page -->
<string name="daylight_app_name" translatable="false">Firefox Daylight</string>
</resources> </resources>