For #13135 - Replace about top header with Firefox Daylight
parent
5e38ccc5e4
commit
8b923fc7a4
|
@ -6,9 +6,7 @@ package org.mozilla.fenix
|
|||
|
||||
enum class ReleaseChannel {
|
||||
FenixDebug,
|
||||
|
||||
FenixProduction,
|
||||
|
||||
FennecProduction,
|
||||
FennecBeta;
|
||||
|
||||
|
@ -35,6 +33,12 @@ enum class ReleaseChannel {
|
|||
else -> false
|
||||
}
|
||||
|
||||
val isRelease: Boolean
|
||||
get() = when (this) {
|
||||
FennecProduction -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
val isBeta: Boolean
|
||||
get() = when (this) {
|
||||
FennecBeta -> true
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
|
|||
import kotlinx.android.synthetic.main.fragment_about.*
|
||||
import org.mozilla.fenix.BrowserDirection
|
||||
import org.mozilla.fenix.BuildConfig
|
||||
import org.mozilla.fenix.Config
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
|
@ -38,6 +39,7 @@ import org.mozilla.geckoview.BuildConfig as GeckoViewBuildConfig
|
|||
*/
|
||||
class AboutFragment : Fragment(), AboutPageListener {
|
||||
|
||||
private lateinit var headerAppName: String
|
||||
private lateinit var appName: String
|
||||
private val aboutPageAdapter: AboutPageAdapter = AboutPageAdapter(this)
|
||||
|
||||
|
@ -48,6 +50,8 @@ class AboutFragment : Fragment(), AboutPageListener {
|
|||
): View? {
|
||||
val rootView = inflater.inflate(R.layout.fragment_about, container, false)
|
||||
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)
|
||||
|
||||
return rootView
|
||||
|
@ -64,10 +68,12 @@ class AboutFragment : Fragment(), AboutPageListener {
|
|||
)
|
||||
}
|
||||
|
||||
lifecycle.addObserver(SecretDebugMenuTrigger(
|
||||
logoView = wordmark,
|
||||
settings = view.context.settings()
|
||||
))
|
||||
lifecycle.addObserver(
|
||||
SecretDebugMenuTrigger(
|
||||
logoView = wordmark,
|
||||
settings = view.context.settings()
|
||||
)
|
||||
)
|
||||
|
||||
populateAboutHeader()
|
||||
aboutPageAdapter.submitList(populateAboutList())
|
||||
|
@ -75,12 +81,15 @@ class AboutFragment : Fragment(), AboutPageListener {
|
|||
|
||||
private fun populateAboutHeader() {
|
||||
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 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 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 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
|
||||
|
||||
about_text.text = aboutText
|
||||
|
@ -160,7 +169,12 @@ class AboutFragment : Fragment(), AboutPageListener {
|
|||
|
||||
private fun openLibrariesPage() {
|
||||
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) {
|
||||
|
|
|
@ -36,4 +36,7 @@
|
|||
|
||||
<!-- Content description (not visible, for screen readers etc.) used to announce [LinkTextView]. -->
|
||||
<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>
|
||||
|
|
Loading…
Reference in New Issue