Update browser extension icon state on private repositories
Created by: marekweb
Summary
Make browser extension show the alert icon when the user is looking at a private repository. This invites the user to open the options popup, where a message is displayed that indicates the steps to take to use the browser extension on private repositories.
Implementation
Update observeBrowserActionState
to emit active-with-alert
when the currently active tab is open on a private repository (when the extension is not disabled.) The emitted values of this observable are used to update the icon.
Adds two observables to the background page:
-
observeCurrentTabId()
emits the current active tab id -
observeCurrentTabPrivateRepository()
emits a boolean flag indicating whether the current active tab contains a private repository.
Also adds a subject that emits the background page's cache of which tabs are open on a private repository: privateRepositoryCacheSubject
Now, instead of updating the tabPrivateRepositoryCache
(a Map<number, boolean>
) directly when a private repository is detected, the background page calls setTabIsPrivateRepository
so that the change can be emitted through the subject.
Closes #14867