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

Verified Commit 995a2afd authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

fix: fix icons in the Categories screen

Parse Google Play category IDs from the current browseUrl format and keep the legacy query format working.

Add icon aliases for the current CleanAPK category slugs so categories with existing artwork no longer fall back to the default icon.
parent 8f469fc1
Loading
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
@@ -105,6 +105,53 @@ object CategoryUtils {
        "pwa_business" to R.drawable.ic_business,
        "watch_face" to R.drawable.ic_watchface,
        "android_wear" to R.drawable.ic_watch_apps,
        "ai-chat" to R.drawable.ic_cat_communication,
        "app-store-updater" to R.drawable.ic_cat_tools,
        "battery" to R.drawable.ic_cat_tools,
        "bookmark" to R.drawable.ic_books_and_reference,
        "browser" to R.drawable.ic_cat_browser,
        "calculator" to R.drawable.ic_cat_tools,
        "calendar-agenda" to R.drawable.ic_cat_events,
        "clock" to R.drawable.ic_cat_time,
        "cloud-storage-file-sync" to R.drawable.ic_cat_cloud,
        "dns-hosts" to R.drawable.ic_cat_connectivity,
        "draw" to R.drawable.ic_art_and_design,
        "ebook-reader" to R.drawable.ic_books_and_reference,
        "email" to R.drawable.ic_cat_communication,
        "file-encryption-vault" to R.drawable.ic_cat_security,
        "file-transfer" to R.drawable.ic_cat_connectivity,
        "finance-manager" to R.drawable.ic_cat_finance,
        "flashlight" to R.drawable.ic_cat_tools,
        "forum" to R.drawable.ic_cat_social,
        "gallery" to R.drawable.ic_cat_photography,
        "habit-tracker" to R.drawable.ic_cat_productivity,
        "icon-pack" to R.drawable.ic_cat_personalization,
        "keyboard-ime" to R.drawable.ic_cat_personalization,
        "launcher" to R.drawable.ic_cat_personalization,
        "local-media-player" to R.drawable.ic_cat_video_players,
        "location-tracker-sharer" to R.drawable.ic_cat_maps_and_navigation,
        "messaging" to R.drawable.ic_cat_communication,
        "music-practice-tool" to R.drawable.ic_cat_music_and_audio,
        "network-analyzer" to R.drawable.ic_cat_connectivity,
        "note" to R.drawable.ic_cat_productivity,
        "online-media-player" to R.drawable.ic_cat_video_players,
        "pass-wallet" to R.drawable.ic_cat_finance,
        "password-2fa" to R.drawable.ic_cat_security,
        "podcast" to R.drawable.ic_cat_music_and_audio,
        "radio" to R.drawable.ic_cat_music_and_audio,
        "recipe-manager" to R.drawable.ic_cat_food_and_drink,
        "religion" to R.drawable.ic_cat_lifestyle,
        "shopping-list" to R.drawable.ic_cat_shopping,
        "social-network" to R.drawable.ic_cat_social,
        "task" to R.drawable.ic_cat_productivity,
        "text-editor" to R.drawable.ic_cat_productivity,
        "translation-dictionary" to R.drawable.ic_cat_reference,
        "unit-convertor" to R.drawable.ic_cat_tools,
        "voice-video-chat" to R.drawable.ic_cat_communication,
        "vpn-proxy" to R.drawable.ic_cat_security,
        "wallet" to R.drawable.ic_cat_finance,
        "wallpaper" to R.drawable.ic_cat_personalization,
        "workout" to R.drawable.ic_cat_health_and_fitness,
    )

    fun provideAppsCategoryIconResource(categoryId: String) =
+7 −7
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ package foundation.e.apps.data.application.utils
import android.content.Context
import android.text.format.Formatter
import com.aurora.gplayapi.data.models.App
import com.aurora.gplayapi.data.models.Artwork
import com.aurora.gplayapi.data.models.Category
import foundation.e.apps.data.application.data.Application
import foundation.e.apps.data.application.data.Ratings
@@ -66,7 +65,7 @@ fun App.toApplication(context: Context): Application {
}

fun Category.toCategory(): AppLoungeCategory {
    val id = this.browseUrl.substringAfter("cat=").substringBefore("&c=")
    val id = getCategoryId(this.browseUrl)
    return AppLoungeCategory(
        id = id.lowercase(),
        title = this.title,
@@ -75,10 +74,11 @@ fun Category.toCategory(): AppLoungeCategory {
    )
}

private fun MutableList<Artwork>.toList(): List<String> {
    val list = mutableListOf<String>()
    this.forEach {
        list.add(it.url)
private fun getCategoryId(browseUrl: String): String {
    val queryCategory = browseUrl.substringAfter("cat=", "").substringBefore("&")
    if (queryCategory.isNotBlank()) {
        return queryCategory
    }
    return list

    return browseUrl.substringBefore("?").trimEnd('/').substringAfterLast('/')
}
+20 −0
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="32dp"
    android:height="32dp"
    android:viewportWidth="32"
    android:viewportHeight="32">
  <group>
    <clip-path
        android:pathData="M0,0h32v32h-32z"/>
    <path
        android:pathData="M16,16m-13,0a13,13 0,1 1,26 0a13,13 0,1 1,-26 0"
        android:strokeWidth="2"
        android:fillColor="#00000000"
        android:strokeColor="@color/colorAccent"/>
    <path
        android:pathData="M17,29V26.414C17,26.149 16.895,25.895 16.707,25.707C16.317,25.317 15.683,25.317 15.293,25.707C15.105,25.895 14.851,26 14.586,26H13.997C13.08,26 12.241,25.482 11.831,24.661L11.726,24.453C11.277,23.554 11.344,22.484 11.901,21.649L12.257,21.115C12.738,20.392 13.447,19.851 14.271,19.576L14.522,19.493C15.481,19.173 16.519,19.173 17.478,19.493L18.088,19.696C18.68,19.893 19.32,19.893 19.912,19.696L19.989,19.67C21.176,19.275 22.482,19.722 23.176,20.764L23.614,21.421C23.855,21.783 24.261,22 24.696,22C25.583,22 26.21,22.869 25.93,23.712L25.5,25M29,15H28H26.118C25.777,15 25.5,15.277 25.5,15.618C25.5,15.852 25.632,16.066 25.842,16.171L25.975,16.238C26.499,16.5 26.414,17.271 25.846,17.413C25.632,17.467 25.404,17.404 25.248,17.248L24.811,16.811C24.612,16.612 24.342,16.5 24.061,16.5H23.309C23.138,16.5 23,16.362 23,16.191C23,16.074 23.066,15.967 23.171,15.915L23.5,15.75C23.806,15.597 24,15.284 24,14.941V14.5C24,13.948 23.552,13.5 23,13.5H22.89C22.399,13.5 22,13.899 22,14.39C22,14.463 21.991,14.536 21.973,14.606L21.86,15.059C21.685,15.761 20.866,16.077 20.264,15.676C20.092,15.561 19.89,15.5 19.683,15.5H19.658C19.553,15.5 19.449,15.515 19.348,15.543L17.116,16.181C16.506,16.355 15.872,15.99 15.718,15.374C15.591,14.863 15.835,14.333 16.306,14.097L18.045,13.227C18.969,12.766 19.644,11.924 19.894,10.922L19.98,10.581C19.993,10.527 20,10.472 20,10.417V10.309C20,10.12 19.893,9.946 19.724,9.862L19.553,9.776C19.299,9.649 19,9.834 19,10.118C19,10.329 18.829,10.5 18.618,10.5H18.5C18.224,10.5 18,10.276 18,10V8.621C18,8.224 18.158,7.842 18.439,7.561L18.5,7.5C19.052,6.948 19.948,6.948 20.5,7.5L20.824,7.824C21.198,8.197 21.802,8.197 22.176,7.824L22.299,7.7C22.662,7.338 22.602,6.735 22.176,6.45C21.802,6.202 21.702,5.697 21.951,5.324L22.5,4.5M13.5,3.5L12.299,5.102C12.1,5.367 11.882,5.618 11.648,5.852L10.345,7.154C10.117,7.383 9.852,7.574 9.563,7.719C8.596,8.202 7.445,8.13 6.546,7.531L6.5,7.5M5,10C5.31,10.31 5.435,10.76 5.328,11.186L5.081,12.175C5.027,12.391 4.95,12.6 4.85,12.799L4.83,12.84C4.311,13.877 4.345,15.104 4.921,16.111L5.11,16.443C5.678,17.437 5.814,18.621 5.485,19.718L4.5,23M15.944,11C15.465,11 15.113,10.549 15.229,10.084L15.435,9.259C15.477,9.091 15.575,8.943 15.713,8.84C16.289,8.408 17.084,8.955 16.886,9.647L16.653,10.465C16.562,10.782 16.273,11 15.944,11Z"
        android:strokeWidth="2"
        android:fillColor="#00000000"
        android:strokeColor="@color/colorAccent"/>
  </group>
</vector>
+12 −0
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="32dp"
    android:height="32dp"
    android:viewportWidth="32"
    android:viewportHeight="32">
    <group>
        <clip-path android:pathData="M0,0h32v32h-32z" />
        <path
            android:fillColor="@color/colorAccent"
            android:pathData="M2.286,19.626C2.286,16.403 4.467,13.689 7.434,12.879L7.429,12.597C7.429,8.81 10.5,5.74 14.286,5.74C16.787,5.741 18.97,7.079 20.167,9.076C20.48,9.003 20.807,8.963 21.143,8.963L21.363,8.968C23.605,9.082 25.389,10.918 25.426,13.178C27.945,14.236 29.714,16.722 29.714,19.626C29.714,23.489 26.583,26.62 22.72,26.62H9.28C5.417,26.62 2.286,23.489 2.286,19.626ZM9.143,12.597C9.143,13.211 9.251,13.8 9.448,14.346H9.28C6.364,14.346 4,16.71 4,19.626C4,22.542 6.364,24.906 9.28,24.906H22.72C25.636,24.906 28,22.542 28,19.626C28,16.955 26.016,14.749 23.441,14.397C23.614,14.051 23.714,13.662 23.714,13.249C23.714,11.829 22.563,10.677 21.143,10.677C20.42,10.677 19.767,10.976 19.3,11.456C18.781,9.165 16.734,7.455 14.286,7.454C11.446,7.454 9.143,9.757 9.143,12.597Z" />
    </group>
</vector>
+10 −0
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="32dp"
    android:height="32dp"
    android:viewportWidth="32"
    android:viewportHeight="32">
  <path
      android:pathData="M16,3.867C9.299,3.867 3.867,9.299 3.867,16C3.867,22.701 9.299,28.133 16,28.133C22.701,28.133 28.133,22.701 28.133,16C28.133,9.299 22.701,3.867 16,3.867ZM2,16C2,8.268 8.268,2 16,2C23.732,2 30,8.268 30,16C30,23.732 23.732,30 16,30C8.268,30 2,23.732 2,16ZM15.067,7.6H16.933V15.067H22.533V16.933H15.067V7.6Z"
      android:fillColor="@color/colorAccent"
      android:fillType="evenOdd"/>
</vector>
Loading