Skip to content

Commit dba98f3

Browse files
committed
feat(updater): add helper method String.fromGitmoji() to parse Gitmoji on release notes
1 parent 8c91f7f commit dba98f3

File tree

2 files changed

+87
-1
lines changed

2 files changed

+87
-1
lines changed

feature/mobile/update/src/main/kotlin/com/flixclusive/feature/mobile/update/UpdateScreen.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import com.flixclusive.core.theme.FlixclusiveTheme
6363
import com.flixclusive.core.ui.common.navigation.StartHomeScreenAction
6464
import com.flixclusive.core.ui.common.util.onMediumEmphasis
6565
import com.flixclusive.core.util.android.installApkActivity
66+
import com.flixclusive.feature.mobile.update.util.fromGitmoji
6667
import com.flixclusive.service.update.AppUpdaterService
6768
import com.flixclusive.service.update.AppUpdaterService.Companion.startAppUpdater
6869
import com.ramcosta.composedestinations.annotation.Destination
@@ -153,7 +154,7 @@ fun UpdateScreen(
153154
)
154155

155156
MarkdownText(
156-
markdown = args.updateInfo ?: stringResource(id = UtilR.string.default_update_info_message),
157+
markdown = args.updateInfo?.fromGitmoji() ?: stringResource(id = UtilR.string.default_update_info_message),
157158
isTextSelectable = true,
158159
linkColor = Color(0xFF5890FF),
159160
fontResource = com.flixclusive.core.theme.R.font.space_grotesk_medium,
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package com.flixclusive.feature.mobile.update.util
2+
3+
private val GITMOJIS: Map<String, String> = mapOf(
4+
":art:" to "🎨",
5+
":zap:" to "⚡️",
6+
":fire:" to "🔥",
7+
":bug:" to "🐛",
8+
":ambulance:" to "🚑️",
9+
":sparkles:" to "",
10+
":memo:" to "📝",
11+
":rocket:" to "🚀",
12+
":lipstick:" to "💄",
13+
":tada:" to "🎉",
14+
":white_check_mark:" to "",
15+
":lock:" to "🔒️",
16+
":closed_lock_with_key:" to "🔐",
17+
":bookmark:" to "🔖",
18+
":rotating_light:" to "🚨",
19+
":construction:" to "🚧",
20+
":green_heart:" to "💚",
21+
":arrow_down:" to "⬇️",
22+
":arrow_up:" to "⬆️",
23+
":pushpin:" to "📌",
24+
":construction_worker:" to "👷",
25+
":chart_with_upwards_trend:" to "📈",
26+
":recycle:" to "♻️",
27+
":heavy_plus_sign:" to "",
28+
":heavy_minus_sign:" to "",
29+
":wrench:" to "🔧",
30+
":hammer:" to "🔨",
31+
":globe_with_meridians:" to "🌐",
32+
":pencil2:" to "✏️",
33+
":pencil:" to "✏️",
34+
":poop:" to "💩",
35+
":rewind:" to "⏪️",
36+
":twisted_rightwards_arrows:" to "🔀",
37+
":package:" to "📦️",
38+
":alien:" to "👽️",
39+
":truck:" to "🚚",
40+
":page_facing_up:" to "📄",
41+
":boom:" to "💥",
42+
":bento:" to "🍱",
43+
":wheelchair:" to "♿️",
44+
":bulb:" to "💡",
45+
":beers:" to "🍻",
46+
":speech_balloon:" to "💬",
47+
":card_file_box:" to "🗃️",
48+
":loud_sound:" to "🔊",
49+
":mute:" to "🔇",
50+
":busts_in_silhouette:" to "👥",
51+
":children_crossing:" to "🚸",
52+
":building_construction:" to "🏗️",
53+
":iphone:" to "📱",
54+
":clown_face:" to "🤡",
55+
":egg:" to "🥚",
56+
":see_no_evil:" to "🙈",
57+
":camera_flash:" to "📸",
58+
":alembic:" to "⚗️",
59+
":mag:" to "🔍️",
60+
":label:" to "🏷️",
61+
":seedling:" to "🌱",
62+
":triangular_flag_on_post:" to "🚩",
63+
":goal_net:" to "🥅",
64+
":dizzy:" to "💫",
65+
":wastebasket:" to "🗑️",
66+
":passport_control:" to "🛂",
67+
":adhesive_bandage:" to "🩹",
68+
":monocle_face:" to "🧐",
69+
":coffin:" to "⚰️",
70+
":test_tube:" to "🧪",
71+
":necktie:" to "👔",
72+
":stethoscope:" to "🩺",
73+
":bricks:" to "🧱",
74+
":technologist:" to "🧑‍💻",
75+
":money_with_wings:" to "💸",
76+
":thread:" to "🧵",
77+
":safety_vest:" to "🦺"
78+
)
79+
80+
internal fun String.fromGitmoji(): String {
81+
val re = Regex(GITMOJIS.keys.joinToString("|"), RegexOption.IGNORE_CASE)
82+
return re.replace(this) { matchResult ->
83+
GITMOJIS[matchResult.value.lowercase()] ?: ""
84+
}.trim()
85+
}

0 commit comments

Comments
 (0)