-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Antoine Robiez
committed
Mar 13, 2024
1 parent
f176663
commit df11777
Showing
27 changed files
with
187 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 15 additions & 3 deletions
18
androidApp/src/main/java/fr/paug/androidmakers/ui/components/agenda/AgendaPagerViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,36 @@ | ||
package fr.paug.androidmakers.ui.components.agenda | ||
|
||
import androidx.lifecycle.viewModelScope | ||
import at.asitplus.KmmResult | ||
import fr.androidmakers.domain.interactor.GetAgendaUseCase | ||
import fr.androidmakers.domain.interactor.SyncBookmarksUseCase | ||
import fr.androidmakers.domain.interactor.GetFavoriteSessionsUseCase | ||
import fr.androidmakers.domain.interactor.SetSessionBookmarkUseCase | ||
import fr.androidmakers.domain.model.Agenda | ||
import fr.androidmakers.domain.model.Session | ||
import fr.androidmakers.domain.repo.BookmarksRepository | ||
import fr.paug.androidmakers.ui.model.UISession | ||
import fr.paug.androidmakers.ui.viewmodel.LceViewModel | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.launch | ||
import kotlinx.datetime.TimeZone | ||
import kotlinx.datetime.toLocalDateTime | ||
|
||
class AgendaPagerViewModel( | ||
private val getAgendaUseCase: GetAgendaUseCase, | ||
private val bookmarksRepository: BookmarksRepository | ||
private val setSessionBookmarkUseCase: SetSessionBookmarkUseCase, | ||
private val getFavoriteSessionsUseCase: GetFavoriteSessionsUseCase | ||
) : LceViewModel<Agenda>() { | ||
override fun produce(): Flow<KmmResult<Agenda>> { | ||
return getAgendaUseCase() | ||
} | ||
|
||
fun getFavoriteSessions() = bookmarksRepository.getFavoriteSessions() | ||
fun getFavoriteSessions() = getFavoriteSessionsUseCase() | ||
|
||
init { | ||
launch(false) | ||
} | ||
|
||
fun setSessionBookmark(uiSession: UISession, bookmark: Boolean) = viewModelScope.launch { | ||
setSessionBookmarkUseCase(uiSession.id, bookmark) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.