Skip to content

Commit 5c2529e

Browse files
add refresh hint
1 parent c6e0420 commit 5c2529e

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

popup.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,29 @@
134134
display: flex;
135135
align-items: center;
136136
}
137+
138+
.subtle-button {
139+
background: transparent;
140+
color: #c8c8c8;
141+
border: none;
142+
font-size: 12px;
143+
cursor: pointer;
144+
padding: 10px;
145+
margin-top: 16px;
146+
text-align: center;
147+
width: 100%;
148+
opacity: 0.8;
149+
transition: opacity 0.2s;
150+
}
151+
152+
.subtle-button:hover {
153+
opacity: 1;
154+
}
155+
156+
.subtle-button i {
157+
font-size: 11px;
158+
margin-right: 4px;
159+
}
137160
</style>
138161
</head>
139162
<body>
@@ -158,6 +181,11 @@
158181
<span id="statusText">Ready to process</span>
159182
</div>
160183

184+
<button id="resetButton" class="subtle-button">
185+
<i class="icon fas fa-sync-alt"></i>
186+
Can't see your new emojis? Try refreshing Teams
187+
</button>
188+
161189
<script src="dist/popup.js"></script>
162190
</body>
163191
</html>

src/popup.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,46 @@ document
182182
.getElementById("processButton")
183183
?.addEventListener("click", () => handleFileProcessing());
184184

185+
async function refreshTeams() {
186+
try {
187+
updateStatus("Refreshing Teams...", "processing");
188+
189+
await chrome.browsingData.remove(
190+
{
191+
origins: ["https://teams.microsoft.com"],
192+
},
193+
{
194+
cacheStorage: true,
195+
cookies: true,
196+
localStorage: true,
197+
serviceWorkers: true,
198+
indexedDB: true,
199+
cache: true,
200+
appcache: true,
201+
}
202+
);
203+
204+
await chrome.storage.local.clear();
205+
206+
const tabs = await chrome.tabs.query({
207+
active: true,
208+
currentWindow: true,
209+
});
210+
const tab = tabs[0];
211+
212+
if (tab.id) {
213+
await chrome.tabs.reload(tab.id);
214+
updateStatus("Teams refreshed successfully!", "success");
215+
}
216+
} catch (error) {
217+
updateStatus(`Refresh failed: ${error}`, "error");
218+
}
219+
}
220+
221+
document
222+
.getElementById("resetButton")
223+
?.addEventListener("click", refreshTeams);
224+
185225
chrome.runtime.onMessage.addListener(
186226
(message: { type: string; error: any; status: any; success: any }) => {
187227
if (message.type === "processUpdate") {

0 commit comments

Comments
 (0)