Skip to content

Instantly share code, notes, and snippets.

@skydoves
Last active September 10, 2024 03:36
Show Gist options
  • Save skydoves/2a97dce6ad3e4d92f7e0d9f5c3de013e to your computer and use it in GitHub Desktop.
Save skydoves/2a97dce6ad3e4d92f7e0d9f5c3de013e to your computer and use it in GitHub Desktop.
timeline_ui_response
@Serializable
data class TimelineUi(
val top: TimelineTopUi,
val center: TimelineCenterUi,
val bottom: TimelineBottomUi
) : UiComponent
internal class TimelineRepositoryImpl @Inject constructor(
private val databaseReference: DatabaseReference,
private val json: Json
) : TimelineRepository {
override fun fetchTimelineUi(): Flow<Result<TimelineUi?>> {
return databaseReference.flow(
path = { snapshot -> snapshot.child("timeline") },
decodeProvider = { jsonString -> json.decodeFromString(jsonString) }
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment