Skip to content

Commit

Permalink
Replace getIcon with iconVector
Browse files Browse the repository at this point in the history
  • Loading branch information
yasanglass committed Jan 18, 2025
1 parent 99f9412 commit 6b2813f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private fun AnnouncementItem(
AnnouncementItemContent(
text = announcement.text,
url = announcement.url,
icon = announcement.getIcon(),
icon = announcement.iconVector,
onClose = onClose,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.compose.material.icons.rounded.Sos
import androidx.compose.material.icons.rounded.Star
import androidx.compose.material.icons.rounded.Support
import androidx.compose.material.icons.rounded.Warning
import androidx.compose.ui.graphics.vector.ImageVector
import com.android.launcher3.BuildConfig
import kotlinx.serialization.Serializable

Expand All @@ -31,23 +32,24 @@ data class Announcement(

val id: AnnouncementId get() = text to url

fun getIcon() = when (icon) {
"bug-report" -> Icons.Rounded.BugReport
"check-circle" -> Icons.Rounded.CheckCircle
"error" -> Icons.Rounded.Error
"favorite" -> Icons.Rounded.Favorite
"feedback" -> Icons.Rounded.Feedback
"forum" -> Icons.Rounded.Forum
"hub" -> Icons.Rounded.Hub
"loyalty" -> Icons.Rounded.Loyalty
"priority-high" -> Icons.Rounded.PriorityHigh
"privacy-tip" -> Icons.Rounded.PrivacyTip
"sos" -> Icons.Rounded.Sos
"star" -> Icons.Rounded.Star
"support" -> Icons.Rounded.Support
"warning" -> Icons.Rounded.Warning
else -> Icons.Rounded.NewReleases
}
val iconVector: ImageVector
get() = when (icon) {
"bug-report" -> Icons.Rounded.BugReport
"check-circle" -> Icons.Rounded.CheckCircle
"error" -> Icons.Rounded.Error
"favorite" -> Icons.Rounded.Favorite
"feedback" -> Icons.Rounded.Feedback
"forum" -> Icons.Rounded.Forum
"hub" -> Icons.Rounded.Hub
"loyalty" -> Icons.Rounded.Loyalty
"priority-high" -> Icons.Rounded.PriorityHigh
"privacy-tip" -> Icons.Rounded.PrivacyTip
"sos" -> Icons.Rounded.Sos
"star" -> Icons.Rounded.Star
"support" -> Icons.Rounded.Support
"warning" -> Icons.Rounded.Warning
else -> Icons.Rounded.NewReleases
}

val shouldBeVisible
get(): Boolean {
Expand Down

0 comments on commit 6b2813f

Please sign in to comment.