Add check for current controller before setting extension update tab badge (#5733)

(cherry picked from commit faef35ec4758b9a14bbcddb9a8edc20b7b623769)
This commit is contained in:
Hunter Nickel 2021-08-16 09:58:30 -06:00 committed by Jobobby04
parent 8da397c7ed
commit 77138aba72

View File

@ -93,6 +93,11 @@ class BrowseController :
}
fun setExtensionUpdateBadge() {
/* It's possible to switch to the Library controller by the time setExtensionUpdateBadge
is called, resulting in a badge being put on the category tabs (if enabled).
This check prevents that from happening */
if (router.backstack.last().controller !is BrowseController) return
(activity as? MainActivity)?.binding?.tabs?.apply {
val updates = preferences.extensionUpdatesCount().get()
if (updates > 0) {