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
|
// kinda shitty solution, but cant com main->home otherwise for popups
|
||||||
val bookmarksUpdatedEvent = Event<Boolean>()
|
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>()
|
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 {
|
init {
|
||||||
MainActivity.bookmarksUpdatedEvent += ::reloadPages
|
MainActivity.reloadLibraryEvent += ::reloadPages
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCleared() {
|
override fun onCleared() {
|
||||||
MainActivity.bookmarksUpdatedEvent -= ::reloadPages
|
MainActivity.reloadLibraryEvent -= ::reloadPages
|
||||||
super.onCleared()
|
super.onCleared()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -153,6 +153,7 @@ object DataStoreHelper {
|
||||||
selectedKeyIndex = account.keyIndex
|
selectedKeyIndex = account.keyIndex
|
||||||
showToast(account.name)
|
showToast(account.name)
|
||||||
MainActivity.bookmarksUpdatedEvent(true)
|
MainActivity.bookmarksUpdatedEvent(true)
|
||||||
|
MainActivity.reloadLibraryEvent(true)
|
||||||
if (refreshHomePage) {
|
if (refreshHomePage) {
|
||||||
MainActivity.reloadHomeEvent(true)
|
MainActivity.reloadHomeEvent(true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue