Skip to content

Commit

Permalink
Create AnnouncementId typealias
Browse files Browse the repository at this point in the history
  • Loading branch information
yasanglass committed Aug 25, 2024
1 parent 685b948 commit 93d7310
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import app.lawnchair.ui.preferences.data.liveinfo.model.AnnouncementId
import app.lawnchair.ui.preferences.data.liveinfo.model.LiveInformation
import com.android.launcher3.R
import com.android.launcher3.util.MainThreadInitializedObject
Expand Down Expand Up @@ -59,7 +60,7 @@ class LiveInformationManager private constructor(context: Context) : PreferenceM
defaultValue = emptySet(),
parse = {
val withUnknownKeys = Json { ignoreUnknownKeys = true }
withUnknownKeys.decodeFromString<Set<Pair<String, String?>>>(it)
withUnknownKeys.decodeFromString<Set<AnnouncementId>>(it)
},
save = {
Json.encodeToString(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ data class Announcement(
val channel: String? = null,
) {

val id get() = text to url
val id: AnnouncementId get() = text to url

val iconImageVector
get() = when (icon) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package app.lawnchair.ui.preferences.data.liveinfo.model

typealias AnnouncementId = Pair<String, String?>

0 comments on commit 93d7310

Please sign in to comment.