Use generic favorites API for pinned calendar events
This commit is contained in:
parent
c47a880d72
commit
8597b7ab49
@ -36,7 +36,6 @@ interface FavoritesRepository {
|
|||||||
): Flow<List<PinnableSearchable>>
|
): Flow<List<PinnableSearchable>>
|
||||||
|
|
||||||
|
|
||||||
fun getPinnedCalendarEvents(): Flow<List<PinnableSearchable>>
|
|
||||||
fun getHiddenCalendarEventKeys(): Flow<List<String>>
|
fun getHiddenCalendarEventKeys(): Flow<List<String>>
|
||||||
fun isPinned(searchable: PinnableSearchable): Flow<Boolean>
|
fun isPinned(searchable: PinnableSearchable): Flow<Boolean>
|
||||||
fun pinItem(searchable: PinnableSearchable)
|
fun pinItem(searchable: PinnableSearchable)
|
||||||
@ -134,17 +133,6 @@ internal class FavoritesRepositoryImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getPinnedCalendarEvents(): Flow<List<CalendarEvent>> {
|
|
||||||
return database.searchDao().getFavoritesWithTypes(
|
|
||||||
includeTypes = listOf("calendar"),
|
|
||||||
automaticallySorted = true,
|
|
||||||
manuallySorted = true,
|
|
||||||
limit = 50
|
|
||||||
).map {
|
|
||||||
it.mapNotNull { fromDatabaseEntity(it).searchable as? CalendarEvent }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getHiddenCalendarEventKeys(): Flow<List<String>> {
|
override fun getHiddenCalendarEventKeys(): Flow<List<String>> {
|
||||||
return database.searchDao().getHiddenCalendarEventKeys()
|
return database.searchDao().getHiddenCalendarEventKeys()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,11 @@ class CalendarWidgetVM : ViewModel(), KoinComponent {
|
|||||||
|
|
||||||
val calendarEvents = MutableLiveData<List<CalendarEvent>>(emptyList())
|
val calendarEvents = MutableLiveData<List<CalendarEvent>>(emptyList())
|
||||||
val pinnedCalendarEvents =
|
val pinnedCalendarEvents =
|
||||||
favoritesRepository.getPinnedCalendarEvents().asLiveData(viewModelScope.coroutineContext)
|
favoritesRepository.getFavorites(
|
||||||
|
includeTypes = listOf(CalendarEvent.Domain),
|
||||||
|
automaticallySorted = true,
|
||||||
|
manuallySorted = true,
|
||||||
|
).asLiveData(viewModelScope.coroutineContext)
|
||||||
val nextEvents = MutableLiveData<List<CalendarEvent>>(emptyList())
|
val nextEvents = MutableLiveData<List<CalendarEvent>>(emptyList())
|
||||||
var availableDates = listOf(LocalDate.now())
|
var availableDates = listOf(LocalDate.now())
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user