Remove empty function clearAllNotifications

This commit is contained in:
Nicola Benaglia 2025-05-24 12:05:23 +02:00
parent a87bec8227
commit 4585a2a570
3 changed files with 4 additions and 82 deletions

View File

@ -11,7 +11,6 @@ import {
checkLocalFunc,
checkNewMessages,
checkThreads,
clearAllNotifications,
createEndpoint,
createGroup,
decryptDirectFunc,
@ -1142,32 +1141,6 @@ export async function getEnteredQmailTimestampCase(request, event) {
}
}
export async function clearAllNotificationsCase(request, event) {
try {
await clearAllNotifications();
event.source.postMessage(
{
requestId: request.requestId,
action: 'clearAllNotifications',
payload: true,
type: 'backgroundMessageResponse',
},
event.origin
);
} catch (error) {
event.source.postMessage(
{
requestId: request.requestId,
action: 'clearAllNotifications',
error: error?.message,
type: 'backgroundMessageResponse',
},
event.origin
);
}
}
export async function setGroupDataCase(request, event) {
try {
const { groupId, secretKeyData, secretKeyResource, admins } =

View File

@ -34,7 +34,6 @@ import {
cancelBanCase,
cancelInvitationToGroupCase,
checkLocalCase,
clearAllNotificationsCase,
createGroupCase,
createPollCase,
createRewardShareCase,
@ -303,6 +302,7 @@ export const createEndpoint = async (endpoint, customApi?: string) => {
};
export const walletVersion = 2;
// List of your API endpoints
const apiEndpoints = [
'https://api.qortal.org',
@ -436,10 +436,6 @@ export async function performPowTask(chatBytes, difficulty) {
});
}
function playNotificationSound() {
// chrome.runtime.sendMessage({ action: "PLAY_NOTIFICATION_SOUND" });
}
const handleNotificationDirect = async (directs) => {
let isFocused;
const wallet = await getSaveWallet();
@ -603,7 +599,7 @@ export function updateThreadActivity({
threads = JSON.parse(storedData);
}
let lastResetTime = threads.lastResetTime || 0;
const lastResetTime = threads.lastResetTime || 0;
// Check if a week has passed since the last reset
if (currentTime - lastResetTime > ONE_WEEK_IN_MS) {
@ -653,7 +649,7 @@ export function updateThreadActivity({
const handleNotification = async (groups) => {
const wallet = await getSaveWallet();
const address = wallet.address0;
let isDisableNotifications =
const isDisableNotifications =
(await getUserSettings({ key: 'disable-push-notifications' })) || false;
let mutedGroups = (await getUserSettings({ key: 'mutedGroups' })) || [];
@ -678,7 +674,6 @@ const handleNotification = async (groups) => {
const newActiveChats = data;
const oldActiveChats = await getChatHeads();
let results = [];
let newestLatestTimestamp = null;
let oldestLatestTimestamp = null;
// Find the latest timestamp from newActiveChats
@ -878,13 +873,6 @@ export async function storeWallets(wallets) {
});
}
export async function clearAllNotifications() {
// const notifications = await chrome.notifications.getAll();
// for (const notificationId of Object.keys(notifications)) {
// await chrome.notifications.clear(notificationId);
// }
}
export async function getUserInfo() {
const wallet = await getSaveWallet();
const address = wallet.address0;
@ -3233,9 +3221,6 @@ function setupMessageListener() {
case 'addGroupNotificationTimestamp':
addGroupNotificationTimestampCase(request, event);
break;
case 'clearAllNotifications':
clearAllNotificationsCase(request, event);
break;
case 'setGroupData':
setGroupDataCase(request, event);
break;

View File

@ -12,49 +12,13 @@ import { RequestQueueWithPromise } from '../utils/queue/queue.ts';
export const requestQueueGetPublicKeys = new RequestQueueWithPromise(10);
const apiEndpoints = [
'https://api.qortal.org',
'https://api2.qortal.org',
'https://appnode.qortal.org',
'https://apinode.qortalnodes.live',
'https://apinode1.qortalnodes.live',
'https://apinode2.qortalnodes.live',
'https://apinode3.qortalnodes.live',
'https://apinode4.qortalnodes.live',
];
async function findUsableApi() {
for (const endpoint of apiEndpoints) {
try {
const response = await fetch(`${endpoint}/admin/status`);
if (!response.ok) throw new Error('Failed to fetch');
const data = await response.json();
if (data.isSynchronizing === false && data.syncPercent === 100) {
console.log(`Usable API found: ${endpoint}`);
return endpoint;
} else {
console.log(`API not ready: ${endpoint}`);
}
} catch (error) {
console.error(`Error checking API ${endpoint}:`, error);
}
}
throw new Error(
i18n.t('question:message.error.no_api_found', {
postProcess: 'capitalizeFirstChar',
})
);
}
async function getSaveWallet() {
const res = await getData<any>('walletInfo').catch(() => null);
if (res) {
return res;
} else {
throw new Error('No wallet saved');
throw new Error('No wallet saved'); // TODO translate
}
}