Reload library when reloading home (#656)

So that library is reloaded when switching accounts.

Fixes #650
This commit is contained in:
Luna712 2023-10-06 15:50:31 -06:00 committed by GitHub
parent 177b1e47f3
commit 0a327ccbda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -6,6 +6,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import com.lagradost.cloudstream3.AcraApplication.Companion.getKey import com.lagradost.cloudstream3.AcraApplication.Companion.getKey
import com.lagradost.cloudstream3.AcraApplication.Companion.setKey import com.lagradost.cloudstream3.AcraApplication.Companion.setKey
import com.lagradost.cloudstream3.MainActivity
import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.mvvm.Resource import com.lagradost.cloudstream3.mvvm.Resource
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.SyncApis import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.SyncApis
@ -101,4 +102,13 @@ class LibraryViewModel : ViewModel() {
} }
} }
} }
init {
MainActivity.reloadHomeEvent += ::reloadPages
}
override fun onCleared() {
MainActivity.reloadHomeEvent -= ::reloadPages
super.onCleared()
}
} }

View file

@ -131,7 +131,6 @@ object DataStoreHelper {
// update UI // update UI
setAccount(getDefaultAccount(context), true) setAccount(getDefaultAccount(context), true)
MainActivity.bookmarksUpdatedEvent(true)
dialog?.dismissSafe() dialog?.dismissSafe()
} }