opt handleBulkArchive

This commit is contained in:
qcrao
2024-07-10 21:12:06 +08:00
parent e30fc7fa56
commit dafbc04972

View File

@@ -33,9 +33,8 @@ function initializeButtons() {
bulkArchiveButton.addEventListener("click", handleBulkArchive);
}
const storageKey = "BulkDeleteChatGPT_isPaid";
async function checkMembershipStatus() {
const storageKey = "BulkDeleteChatGPT_isPaid";
const localIsPaid = localStorage.getItem(storageKey) === "true";
updateBulkArchiveButton(localIsPaid);
@@ -74,6 +73,19 @@ function updateBulkArchiveButton(isPaid) {
}
async function handleBulkArchive() {
const localIsPaid = localStorage.getItem(storageKey) === "true";
if (localIsPaid) {
chrome.tabs.query({ active: true, currentWindow: true }, ([tab]) => {
if (tab) {
chrome.scripting.executeScript({
target: { tabId: tab.id },
files: ["bulkArchiveConversations.js"],
});
}
});
return;
}
const userInfo = await getUserInfo();
if (!userInfo) {
console.error("Unable to get user info");