-
-
Notifications
You must be signed in to change notification settings - Fork 6
Status bar update #706
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
Merged
Merged
Status bar update #706
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c96def3
feat(status-bar): enhance functionality with action service integrati…
dharmesh-hemaram d5ef0c8
feat(port-service): implement PortService for managing runtime connec…
dharmesh-hemaram bf72ccd
fix(service): simplify constructor parameter default value syntax
dharmesh-hemaram d6591e2
refactor(status-bar): remove enable/disable methods and streamline ba…
dharmesh-hemaram e9ff8c6
refactor(action): remove parameters from enable/disable methods and u…
dharmesh-hemaram 428b54f
refactor(status-bar): update description and enhance badge functional…
dharmesh-hemaram be92aed
refactor(status-bar): update action property type and modify actionUp…
dharmesh-hemaram 29f8bd5
refactor(runtime): remove unused onConnectExternal method
dharmesh-hemaram File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
30 changes: 21 additions & 9 deletions
30
packages/core/extension/src/lib/background/chrome/messenger/action.messenger.ts
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
export interface ActionRequest { | ||
messenger: 'action'; | ||
methodName: 'setIcon' | 'setBadgeBackgroundColor' | 'setBadgeText' | 'setTitle'; | ||
methodName: 'setIcon' | 'setBadgeBackgroundColor' | 'setBadgeText' | 'setTitle' | 'setBadgeTextColor' | 'enable' | 'disable'; | ||
message: chrome.action.TabIconDetails | chrome.action.BadgeColorDetails | chrome.action.BadgeTextDetails | chrome.action.TitleDetails; | ||
} | ||
dharmesh-hemaram marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export class ActionMessenger { | ||
setIcon(details: chrome.action.TabIconDetails) { | ||
return chrome.action.setIcon(details); | ||
disable(sender: chrome.runtime.MessageSender) { | ||
return chrome.action.disable(sender.tab?.id); | ||
} | ||
|
||
setBadgeBackgroundColor(details: chrome.action.BadgeColorDetails) { | ||
return chrome.action.setBadgeBackgroundColor(details); | ||
enable(sender: chrome.runtime.MessageSender) { | ||
return chrome.action.enable(sender.tab?.id); | ||
} | ||
dharmesh-hemaram marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dharmesh-hemaram marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
setBadgeText(details: chrome.action.BadgeTextDetails) { | ||
return chrome.action.setBadgeText(details); | ||
setIcon(details: chrome.action.TabIconDetails, sender: chrome.runtime.MessageSender) { | ||
return chrome.action.setIcon({ ...details, tabId: sender.tab?.id }); | ||
} | ||
|
||
setTitle(details: chrome.action.TitleDetails) { | ||
return chrome.action.setTitle(details); | ||
setBadgeBackgroundColor(details: chrome.action.BadgeColorDetails, sender: chrome.runtime.MessageSender) { | ||
return chrome.action.setBadgeBackgroundColor({ ...details, tabId: sender.tab?.id }); | ||
} | ||
|
||
setBadgeText(details: chrome.action.BadgeTextDetails, sender: chrome.runtime.MessageSender) { | ||
return chrome.action.setBadgeText({ ...details, tabId: sender.tab?.id }); | ||
} | ||
|
||
setBadgeTextColor(details: chrome.action.BadgeColorDetails, sender: chrome.runtime.MessageSender) { | ||
return chrome.action.setBadgeTextColor({ ...details, tabId: sender.tab?.id }); | ||
} | ||
|
||
setTitle(details: chrome.action.TitleDetails, sender: chrome.runtime.MessageSender) { | ||
return chrome.action.setTitle({ ...details, tabId: sender.tab?.id }); | ||
} | ||
} |
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
import { ActionRequest } from '@dhruv-techapps/core-extension'; | ||
import { CoreService } from './service'; | ||
import { PortService } from './service'; | ||
|
||
export class ActionService extends CoreService { | ||
static async setBadgeBackgroundColor(details: chrome.action.BadgeColorDetails) { | ||
return await this.message<ActionRequest>({ messenger: 'action', methodName: 'setBadgeBackgroundColor', message: details }); | ||
export class ActionService { | ||
static setBadgeBackgroundColor(details: chrome.action.BadgeColorDetails) { | ||
PortService.getInstance().message<ActionRequest>({ messenger: 'action', methodName: 'setBadgeBackgroundColor', message: details }); | ||
} | ||
|
||
static async setBadgeText(details: chrome.action.BadgeTextDetails) { | ||
return await this.message<ActionRequest>({ messenger: 'action', methodName: 'setBadgeText', message: details }); | ||
static setBadgeText(details: chrome.action.BadgeTextDetails) { | ||
PortService.getInstance().message<ActionRequest>({ messenger: 'action', methodName: 'setBadgeText', message: details }); | ||
} | ||
dharmesh-hemaram marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
static async setIcon(details: chrome.action.TabIconDetails) { | ||
return await this.message<ActionRequest>({ messenger: 'action', methodName: 'setIcon', message: details }); | ||
static setIcon(details: chrome.action.TabIconDetails) { | ||
PortService.getInstance().message<ActionRequest>({ messenger: 'action', methodName: 'setIcon', message: details }); | ||
} | ||
|
||
static async setTitle(details: chrome.action.TitleDetails) { | ||
return await this.message<ActionRequest>({ messenger: 'action', methodName: 'setTitle', message: details }); | ||
static setTitle(details: chrome.action.TitleDetails) { | ||
PortService.getInstance().message<ActionRequest>({ messenger: 'action', methodName: 'setTitle', message: details }); | ||
} | ||
|
||
static setBadgeTextColor(details: chrome.action.BadgeColorDetails) { | ||
PortService.getInstance().message<ActionRequest>({ messenger: 'action', methodName: 'setBadgeTextColor', message: details }); | ||
} | ||
|
||
static enable(tabId?: number) { | ||
PortService.getInstance().message<ActionRequest>({ messenger: 'action', methodName: 'enable', message: { tabId } }); | ||
} | ||
|
||
static disable(tabId?: number) { | ||
PortService.getInstance().message<ActionRequest>({ messenger: 'action', methodName: 'disable', message: { tabId } }); | ||
} | ||
} |
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/// <reference types="chrome"/> | ||
|
||
export * from './lib/status-bar'; | ||
export * from './lib/status-bar.types'; |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.