New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update browser extension icon state on private repositories #14926
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #14926 +/- ##
==========================================
+ Coverage 48.65% 52.17% +3.52%
==========================================
Files 1555 1555
Lines 79496 79511 +15
Branches 7107 7095 -12
==========================================
+ Hits 38676 41487 +2811
+ Misses 37073 34277 -2796
Partials 3747 3747
|
marekweb
added
browser-extension
team/web
RFC-221
Browser extension - improve discoverability and awerness
labels
Oct 21, 2020
3 tasks
felixfbecker
approved these changes
Oct 21, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! One suggestion, otherwise LGTM!
client/browser/src/browser-extension/scripts/backgroundPage.main.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Felix Becker <felix.b@outlook.com>
tjkandala
approved these changes
Oct 21, 2020
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 emitactive-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 idobserveCurrentTabPrivateRepository()
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
(aMap<number, boolean>
) directly when a private repository is detected, the background page callssetTabIsPrivateRepository
so that the change can be emitted through the subject.Closes #14867