mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Use a reloadLibraryEvent so it does not get triggered when we don't need it to
This commit is contained in:
parent
b167317e11
commit
d0cf4c20da
3 changed files with 8 additions and 3 deletions
|
@ -309,9 +309,13 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
// kinda shitty solution, but cant com main->home otherwise for popups
|
||||
val bookmarksUpdatedEvent = Event<Boolean>()
|
||||
/**
|
||||
* Used by data store helper to fully reload home when switching accounts
|
||||
* Used by DataStoreHelper to fully reload home when switching accounts
|
||||
*/
|
||||
val reloadHomeEvent = Event<Boolean>()
|
||||
/**
|
||||
* Used by DataStoreHelper to fully reload library when switching accounts
|
||||
*/
|
||||
val reloadLibraryEvent = Event<Boolean>()
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -120,11 +120,11 @@ class LibraryViewModel : ViewModel() {
|
|||
}
|
||||
|
||||
init {
|
||||
MainActivity.bookmarksUpdatedEvent += ::reloadPages
|
||||
MainActivity.reloadLibraryEvent += ::reloadPages
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
MainActivity.bookmarksUpdatedEvent -= ::reloadPages
|
||||
MainActivity.reloadLibraryEvent -= ::reloadPages
|
||||
super.onCleared()
|
||||
}
|
||||
}
|
|
@ -153,6 +153,7 @@ object DataStoreHelper {
|
|||
selectedKeyIndex = account.keyIndex
|
||||
showToast(account.name)
|
||||
MainActivity.bookmarksUpdatedEvent(true)
|
||||
MainActivity.reloadLibraryEvent(true)
|
||||
if (refreshHomePage) {
|
||||
MainActivity.reloadHomeEvent(true)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue