File tree Expand file tree Collapse file tree 5 files changed +20
-8
lines changed
Expand file tree Collapse file tree 5 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 1- <!doctype html>
1+ <!DOCTYPE html>
22< html lang ="en ">
33 < head >
44 < meta charset ="UTF-8 " />
1111 < script type ="module " src ="./block.ts "> </ script >
1212 </ body >
1313
14- <!-- <link rel="stylesheet" href="assets/css/blocked.css" /> -->
1514 < link rel ="stylesheet " href ="assets/css/general.css " />
1615</ html >
Original file line number Diff line number Diff line change @@ -8,9 +8,9 @@ export interface BadgeState {
88}
99
1010export enum BadgeIcon {
11- timer = '/assets/icons/128x128.png' ,
12- pomodoroWorkingTime = '/assets/icons/empty .png' ,
13- pomodoroRestTime = '/assets/icons/empty .png' ,
11+ default = '/assets/icons/128x128.png' ,
12+ pomodoroWorkingTime = '/assets/icons/pomodoro .png' ,
13+ pomodoroRestTime = '/assets/icons/pomodoro-rest-icon .png' ,
1414}
1515
1616export enum BadgeColor {
@@ -26,8 +26,15 @@ export async function useBadge(badge: BadgeState): Promise<void> {
2626 tabId : badge . tabId ,
2727 text : badge . text ,
2828 } ) ;
29- if ( badge . icon )
29+ if ( badge . icon ) {
3030 await Browser . action . setIcon ( {
3131 path : badge . icon ,
3232 } ) ;
33+ await Browser . action . setBadgeText ( {
34+ text : badge . text ,
35+ } ) ;
36+ } else
37+ await Browser . action . setIcon ( {
38+ path : BadgeIcon . default ,
39+ } ) ;
3340}
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ async function trackTime() {
4242
4343 await checkPomodoro ( ) ;
4444
45- if ( await isInBlackList ( activeDomain ) ) {
45+ if ( ( await isInBlackList ( activeDomain ) ) && ( await canChangeBadge ( ) ) ) {
4646 await useBadge ( {
4747 tabId : activeTab ?. id ,
4848 text : 'n/a' ,
@@ -127,7 +127,9 @@ async function mainTracker(
127127
128128 tab . incSummaryTime ( ) ;
129129
130- const viewInBadge = await Settings . getInstance ( ) . getSetting ( StorageParams . VIEW_TIME_IN_BADGE ) ;
130+ const viewInBadge =
131+ ( await Settings . getInstance ( ) . getSetting ( StorageParams . VIEW_TIME_IN_BADGE ) ) &&
132+ ( await canChangeBadge ( ) ) ;
131133
132134 if ( viewInBadge )
133135 await useBadge ( {
@@ -164,6 +166,10 @@ async function saveTabs() {
164166 await storage . saveTabs ( tabs ) ;
165167}
166168
169+ async function canChangeBadge ( ) {
170+ return ! ( await Settings . getInstance ( ) . getSetting ( StorageParams . IS_POMODORO_ENABLED ) ) as boolean ;
171+ }
172+
167173Browser . runtime . onMessage . addListener ( async message => {
168174 if ( message == Messages . ClearAllData ) {
169175 const storage = injecStorage ( ) ;
You can’t perform that action at this time.
0 commit comments