Fix crash with sticker availability change.

This commit is contained in:
Cody Henthorne 2022-02-04 14:20:15 -05:00
parent b081452bed
commit 007e8a9dca

View file

@ -36,13 +36,13 @@ class KeyboardPagerViewModel : ViewModel() {
fun pages(): LiveData<Set<KeyboardPage>> = pages
fun setOnlyPage(page: KeyboardPage) {
pages.value = setOf(page)
pages.postValue(setOf(page))
switchToPage(page)
}
fun switchToPage(page: KeyboardPage) {
if (this.pages.value.contains(page) && this.page.value != page) {
this.page.value = page
this.page.postValue(page)
}
}
}