File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed
AnkiDroid/src/main/java/com/ichi2/anki Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,13 @@ import com.ichi2.anki.utils.Destination
2626/* *
2727 * Opens the [CardBrowser]
2828 */
29- class BrowserDestination (
30- val deckId : DeckId ,
31- ) : Destination {
32- override fun toIntent (context : Context ): Intent {
33- AnkiDroidApp .instance.sharedPrefsLastDeckIdRepository.lastDeckId = deckId
34- return Intent (context, CardBrowser ::class .java)
29+ sealed interface BrowserDestination : Destination {
30+ data class ToDeck (
31+ val deckId : DeckId ,
32+ ) : BrowserDestination {
33+ override fun toIntent (context : Context ): Intent {
34+ AnkiDroidApp .instance.sharedPrefsLastDeckIdRepository.lastDeckId = deckId
35+ return Intent (context, CardBrowser ::class .java)
36+ }
3537 }
3638}
Original file line number Diff line number Diff line change @@ -253,7 +253,7 @@ class DeckPickerViewModel :
253253 fun browseCards (deckId : DeckId ) =
254254 launchCatchingIO {
255255 withCol { decks.select(deckId) }
256- flowOfDestination.emit(BrowserDestination (deckId))
256+ flowOfDestination.emit(BrowserDestination . ToDeck (deckId))
257257 }
258258
259259 fun addNote (
Original file line number Diff line number Diff line change @@ -291,7 +291,7 @@ class ReviewerViewModel(
291291
292292 private suspend fun emitBrowseDestination () {
293293 val deckId = withCol { decks.getCurrentId() }
294- val destination = BrowserDestination (deckId)
294+ val destination = BrowserDestination . ToDeck (deckId)
295295 Timber .i(" Launching 'browse options' for deck %d" , deckId)
296296 destinationFlow.emit(destination)
297297 }
You can’t perform that action at this time.
0 commit comments