From 314cbe1a32f848c97f9beded76897835b1de5a73 Mon Sep 17 00:00:00 2001 From: David Kaspar Date: Sat, 7 Dec 2024 15:14:46 +0100 Subject: [PATCH] Add content description to recommended apps icons - refactored --- .../screen/loggedIn/profile/ProfileScreen.kt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileScreen.kt index cd110952d..1b345f55b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileScreen.kt @@ -1302,18 +1302,15 @@ private fun WatchApp( var appLogo by remember(baseApp) { mutableStateOf(null) } var appName by remember(baseApp) { mutableStateOf(null) } - LaunchedEffect(key1 = appState) { + LaunchedEffect(appState) { withContext(Dispatchers.Default) { - val newAppLogo = - (appState?.note?.event as? AppDefinitionEvent)?.appMetaData()?.picture?.ifBlank { null } - if (newAppLogo != appLogo) { - appLogo = newAppLogo - } - - val newAppName = - (appState?.note?.event as? AppDefinitionEvent)?.appMetaData()?.name?.ifBlank { null } - if (newAppName != appName) { - appName = newAppName + (appState?.note?.event as? AppDefinitionEvent)?.appMetaData()?.let { metaData -> + metaData.picture?.ifBlank { null }?.let { newLogo -> + if (newLogo != appLogo) appLogo = newLogo + } + metaData.name?.ifBlank { null }?.let { newName -> + if (newName != appName) appName = newName + } } } }