Skip to content

Commit 12a1f55

Browse files
committed
Replace RLD badge with pending icon for reload-required state
When Safari cannot capture headers (bookmarks, external links), the extension now shows a cloud with question mark icon instead of the "RLD" text badge. This provides clearer visual feedback that the status is unknown/pending. Changes: - Add icon-pending-*.png files (cloud with ? mark) - Add showPendingIcon() function using browser.action.setIcon() - Update tab/window activation to show correct icon for noHeaders state - Reset to default icon when normal headers are received
1 parent 6d2af8a commit 12a1f55

7 files changed

Lines changed: 55 additions & 9 deletions

File tree

CF Cache Status/CF Cache Status Extension/Resources/background.js

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@
55
* the toolbar badge with the cache status (HIT/MISS/etc).
66
*/
77

8+
// =============================================================================
9+
// Icon Paths
10+
// =============================================================================
11+
12+
const DEFAULT_ICON = {
13+
16: 'images/icon-16.png',
14+
32: 'images/icon-32.png',
15+
48: 'images/icon-48.png',
16+
128: 'images/icon-128.png'
17+
};
18+
19+
const PENDING_ICON = {
20+
16: 'images/icon-pending-16.png',
21+
32: 'images/icon-pending-32.png',
22+
48: 'images/icon-pending-48.png',
23+
128: 'images/icon-pending-128.png'
24+
};
25+
826
// =============================================================================
927
// State Management
1028
// =============================================================================
@@ -37,10 +55,13 @@ function updateBadge(tabId, status) {
3755
const badgeText = status ? (badgeTextMap[status.toUpperCase()] || status) : '';
3856
const color = status === 'HIT' ? '#34C759' : status === 'MISS' ? '#FF3B30' : '#8E8E93';
3957

58+
// Reset to default icon
59+
browser.action.setIcon({ path: DEFAULT_ICON });
4060
browser.action.setBadgeText({ text: badgeText });
4161
browser.action.setBadgeBackgroundColor({ color });
4262

4363
try {
64+
browser.action.setIcon({ path: DEFAULT_ICON, tabId });
4465
browser.action.setBadgeText({ text: badgeText, tabId });
4566
browser.action.setBadgeBackgroundColor({ color, tabId });
4667
} catch (e) {
@@ -49,8 +70,19 @@ function updateBadge(tabId, status) {
4970
}
5071

5172
function clearBadge(tabId) {
73+
browser.action.setIcon({ path: DEFAULT_ICON });
5274
browser.action.setBadgeText({ text: '' });
5375
try {
76+
browser.action.setIcon({ path: DEFAULT_ICON, tabId });
77+
browser.action.setBadgeText({ text: '', tabId });
78+
} catch (e) {}
79+
}
80+
81+
function showPendingIcon(tabId) {
82+
browser.action.setIcon({ path: PENDING_ICON });
83+
browser.action.setBadgeText({ text: '' });
84+
try {
85+
browser.action.setIcon({ path: PENDING_ICON, tabId });
5486
browser.action.setBadgeText({ text: '', tabId });
5587
} catch (e) {}
5688
}
@@ -109,13 +141,8 @@ browser.webNavigation.onCompleted.addListener((details) => {
109141
});
110142
}
111143

112-
// Show reload badge
113-
browser.action.setBadgeText({ text: 'RLD' });
114-
browser.action.setBadgeBackgroundColor({ color: '#8E8E93' });
115-
try {
116-
browser.action.setBadgeText({ text: 'RLD', tabId: details.tabId });
117-
browser.action.setBadgeBackgroundColor({ color: '#8E8E93', tabId: details.tabId });
118-
} catch (e) {}
144+
// Show pending icon (cloud with question mark)
145+
showPendingIcon(details.tabId);
119146

120147
notifyPopup(details.tabId);
121148
}
@@ -205,7 +232,11 @@ browser.tabs.onRemoved.addListener((tabId) => {
205232
browser.tabs.onActivated.addListener((activeInfo) => {
206233
const data = tabData.get(activeInfo.tabId);
207234
if (data) {
208-
updateBadge(activeInfo.tabId, data.status);
235+
if (data.noHeaders) {
236+
showPendingIcon(activeInfo.tabId);
237+
} else {
238+
updateBadge(activeInfo.tabId, data.status);
239+
}
209240
} else {
210241
clearBadge(activeInfo.tabId);
211242
}
@@ -221,7 +252,11 @@ browser.windows.onFocusChanged.addListener(async (windowId) => {
221252
if (tabs?.[0]) {
222253
const data = tabData.get(tabs[0].id);
223254
if (data) {
224-
updateBadge(tabs[0].id, data.status);
255+
if (data.noHeaders) {
256+
showPendingIcon(tabs[0].id);
257+
} else {
258+
updateBadge(tabs[0].id, data.status);
259+
}
225260
} else {
226261
clearBadge(tabs[0].id);
227262
}
1.75 KB
Loading
314 Bytes
Loading
502 Bytes
Loading
662 Bytes
Loading

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Changed
8+
- "Reload Required" state now uses a dedicated icon (cloud with question mark) instead of "RLD" text badge
9+
- App icon now uses Xcode Icon Composer format (.icon) with layered composition
10+
- Renamed internal ToolbarIcon asset to HeroIcon for clarity
11+
- Moved toolbar icon SVG source to `assets/toolbarIcon.svg`
12+
713
### Fixed
814
- Fastly tiered cache diagram arrow alignment in popup
915

16+
### Removed
17+
- Unused LargeIcon asset from Xcode project
18+
1019
## [v0.0.9] - 2026-01-07
1120

1221
### Added

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ What's new in each version of Cache Status.
66

77
## Unreleased
88

9+
- "Reload Required" state now shows a cloud with question mark icon instead of text badge
910
- Fixed Fastly cache diagram alignment
11+
- New app icon
1012

1113
---
1214

0 commit comments

Comments
 (0)