Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit 4b9c73e9 authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

refactor: extract F-Droid and PWA games categories into constants

parent b61f6505
Loading
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -149,6 +149,8 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) {
        private const val PRIVACY_GUIDELINE_URL = "https://doc.e.foundation/privacy_score"
        private const val REQUEST_EXODUS_REPORT_URL =
            "https://reports.exodus-privacy.eu.org/en/analysis/submit#"
        private const val CATEGORY_GAMES_F_DROID = "game_open_games"
        private const val CATEGORY_GAMES_PWA = "web_games"
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@@ -461,18 +463,17 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) {

    private fun updateCategoryTitle(app: Application) {
        binding.titleInclude.apply {
            var catText = app.category.ifBlank { args.category }
            var categoryText = app.category.ifBlank { args.category }

            catText = when (catText) {
                "game_open_games" -> getString(R.string.games) // F-droid games
                "web_games" -> getString(R.string.games) // PWA games
                else -> catText
            categoryText = when (categoryText) {
                CATEGORY_GAMES_F_DROID, CATEGORY_GAMES_PWA -> getString(R.string.games)
                else -> CategoryStringFormatter.format(categoryText)
            }

            catText = CategoryStringFormatter.format(catText)

            categoryTitle.isVisible = catText.isNotBlank()
            categoryTitle.text = catText
            this.categoryTitle.apply {
                isVisible = categoryText.isNotBlank()
                text = categoryText
            }
        }
    }