mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-05-25 19:07:03 +00:00
Remove empty function clearAllNotifications
This commit is contained in:
parent
a87bec8227
commit
4585a2a570
@ -11,7 +11,6 @@ import {
|
|||||||
checkLocalFunc,
|
checkLocalFunc,
|
||||||
checkNewMessages,
|
checkNewMessages,
|
||||||
checkThreads,
|
checkThreads,
|
||||||
clearAllNotifications,
|
|
||||||
createEndpoint,
|
createEndpoint,
|
||||||
createGroup,
|
createGroup,
|
||||||
decryptDirectFunc,
|
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) {
|
export async function setGroupDataCase(request, event) {
|
||||||
try {
|
try {
|
||||||
const { groupId, secretKeyData, secretKeyResource, admins } =
|
const { groupId, secretKeyData, secretKeyResource, admins } =
|
||||||
|
@ -34,7 +34,6 @@ import {
|
|||||||
cancelBanCase,
|
cancelBanCase,
|
||||||
cancelInvitationToGroupCase,
|
cancelInvitationToGroupCase,
|
||||||
checkLocalCase,
|
checkLocalCase,
|
||||||
clearAllNotificationsCase,
|
|
||||||
createGroupCase,
|
createGroupCase,
|
||||||
createPollCase,
|
createPollCase,
|
||||||
createRewardShareCase,
|
createRewardShareCase,
|
||||||
@ -303,6 +302,7 @@ export const createEndpoint = async (endpoint, customApi?: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const walletVersion = 2;
|
export const walletVersion = 2;
|
||||||
|
|
||||||
// List of your API endpoints
|
// List of your API endpoints
|
||||||
const apiEndpoints = [
|
const apiEndpoints = [
|
||||||
'https://api.qortal.org',
|
'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) => {
|
const handleNotificationDirect = async (directs) => {
|
||||||
let isFocused;
|
let isFocused;
|
||||||
const wallet = await getSaveWallet();
|
const wallet = await getSaveWallet();
|
||||||
@ -603,7 +599,7 @@ export function updateThreadActivity({
|
|||||||
threads = JSON.parse(storedData);
|
threads = JSON.parse(storedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
let lastResetTime = threads.lastResetTime || 0;
|
const lastResetTime = threads.lastResetTime || 0;
|
||||||
|
|
||||||
// Check if a week has passed since the last reset
|
// Check if a week has passed since the last reset
|
||||||
if (currentTime - lastResetTime > ONE_WEEK_IN_MS) {
|
if (currentTime - lastResetTime > ONE_WEEK_IN_MS) {
|
||||||
@ -653,7 +649,7 @@ export function updateThreadActivity({
|
|||||||
const handleNotification = async (groups) => {
|
const handleNotification = async (groups) => {
|
||||||
const wallet = await getSaveWallet();
|
const wallet = await getSaveWallet();
|
||||||
const address = wallet.address0;
|
const address = wallet.address0;
|
||||||
let isDisableNotifications =
|
const isDisableNotifications =
|
||||||
(await getUserSettings({ key: 'disable-push-notifications' })) || false;
|
(await getUserSettings({ key: 'disable-push-notifications' })) || false;
|
||||||
|
|
||||||
let mutedGroups = (await getUserSettings({ key: 'mutedGroups' })) || [];
|
let mutedGroups = (await getUserSettings({ key: 'mutedGroups' })) || [];
|
||||||
@ -678,7 +674,6 @@ const handleNotification = async (groups) => {
|
|||||||
const newActiveChats = data;
|
const newActiveChats = data;
|
||||||
const oldActiveChats = await getChatHeads();
|
const oldActiveChats = await getChatHeads();
|
||||||
|
|
||||||
let results = [];
|
|
||||||
let newestLatestTimestamp = null;
|
let newestLatestTimestamp = null;
|
||||||
let oldestLatestTimestamp = null;
|
let oldestLatestTimestamp = null;
|
||||||
// Find the latest timestamp from newActiveChats
|
// 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() {
|
export async function getUserInfo() {
|
||||||
const wallet = await getSaveWallet();
|
const wallet = await getSaveWallet();
|
||||||
const address = wallet.address0;
|
const address = wallet.address0;
|
||||||
@ -3233,9 +3221,6 @@ function setupMessageListener() {
|
|||||||
case 'addGroupNotificationTimestamp':
|
case 'addGroupNotificationTimestamp':
|
||||||
addGroupNotificationTimestampCase(request, event);
|
addGroupNotificationTimestampCase(request, event);
|
||||||
break;
|
break;
|
||||||
case 'clearAllNotifications':
|
|
||||||
clearAllNotificationsCase(request, event);
|
|
||||||
break;
|
|
||||||
case 'setGroupData':
|
case 'setGroupData':
|
||||||
setGroupDataCase(request, event);
|
setGroupDataCase(request, event);
|
||||||
break;
|
break;
|
||||||
|
@ -12,49 +12,13 @@ import { RequestQueueWithPromise } from '../utils/queue/queue.ts';
|
|||||||
|
|
||||||
export const requestQueueGetPublicKeys = new RequestQueueWithPromise(10);
|
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() {
|
async function getSaveWallet() {
|
||||||
const res = await getData<any>('walletInfo').catch(() => null);
|
const res = await getData<any>('walletInfo').catch(() => null);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
return res;
|
return res;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('No wallet saved');
|
throw new Error('No wallet saved'); // TODO translate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user