1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 13:23:34 +00:00
Files
browser/libs/common
Andreas Coroiu 90b7197279 [PM-20210] Expand badge API (#14801)
* feat: scaffold new badge service structure

* feat: add state override

* feat: add priority-based override

* feat: implement state clearing

* feat: add docs to badge service functions

* feat: add support for setting icon

* feat: implement unsetting

* feat: implement setting text

* feat: add support for setting background

* fix: default icon

* feat: clean up old update-badge

* feat: save state using StateProvider

* feat: migrate auth status badge updating

* feat: migrate autofill badge updating

* fix: auto set to default values

* chore: woops, clean up copy-pasta

* fix: lint and types

* chore: nit updates from PR review

* feat: remove ability to send in arbitrary icons

* feat: move init to separate function

* fix: wrong import

* fix: typing issues

* fix: try again to fix typing issues

* feat: scaffold tests for new tabId-specific states

* feat: add diffence util function

* feat: add support for limiting state to tabId

* feat: re-implement autofill badge updater to only update when a tab actually changes

* feat[wip]: always set all tabs when changing the general state

* feat[wip]: implement general states for mutliple open tabs

* feat[wip]: implement fully working multi-tab functionality

* feat: optimize api calls

* feat: adjust storage

* chore: clean up old code

* chore: remove unused log service

* chore: minor tweaks

* fix: types

* fix: race condition causing wrong icon on startup

The service assumes that the first emission from the state will be an empty one and discards it
(techincally it just doesn't act on it because pairwise requires a minimum two emissions). This
caused issues when a service is able to update the state before the observable got a change to
properly initialize. To fix this we simply force an empty emission before anything else,
that way we will always react to the emission from the state provider (because that would end up
being the second emission). We then use distinctUntilChanged to avoid unecessarily acting on
an empty state.
2025-07-09 15:38:33 -04:00
..
2025-07-09 15:38:33 -04:00