Skip to content

Instantly share code, notes, and snippets.

@gastsail
Last active December 21, 2019 16:06
Show Gist options
  • Save gastsail/43768759589891fa054eef10cedbded1 to your computer and use it in GitHub Desktop.
Save gastsail/43768759589891fa054eef10cedbded1 to your computer and use it in GitHub Desktop.
class EventsRepoImpl : IEventsRepo {
override suspend fun getEventsDB(): Resource<MutableList<Event>> {
val eventList = mutableListOf<Event>()
val resultList = FirebaseFirestore.getInstance()
.collection("events")
.get().await()
for (document in resultList) {
val photoUrl = document.getString("photoUrl")
val eventName = document.getString("eventName")
val time = document.getString("time")
eventList.add(Event(photoUrl!!, eventName!!, time!!))
}
return Resource.Success(eventList)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment