diff --git a/src/App.vue b/src/App.vue index 56ca0f9fe..038ae3f31 100644 --- a/src/App.vue +++ b/src/App.vue @@ -266,19 +266,19 @@ interface ServiceWorkerMessage { type: string; data: string; } - + interface ServiceWorkerResponse { // Define the properties and their types success: boolean; message?: string; } - + // Example interface for error interface ErrorResponse { message: string; // Other properties as needed } - + interface VapidResponse { data: { vapidKey: string; @@ -302,7 +302,7 @@ export default class App extends Vue { console.error("API error", error); }); } - + private sendMessageToServiceWorker( message: ServiceWorkerMessage, ): Promise { @@ -342,7 +342,7 @@ export default class App extends Vue { .then(() => this.requestNotificationPermission()) .catch((error) => Promise.reject(error)); } - + private sendSecretToServiceWorker(secret: string): Promise { const message: ServiceWorkerMessage = { type: "SEND_LOCAL_DATA", diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index 8db51eb8c..64454e278 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -157,8 +157,8 @@ export function didInfo( return contact ? contact.name || "Contact With No Name" : isHiddenDid(did) - ? "Someone Not In Network" - : "Someone Not In Contacts"; + ? "Someone Not In Network" + : "Someone Not In Contacts"; } export interface ResultWithType { diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index c7ca1dff6..116ec681d 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -67,8 +67,8 @@ showGiveTotals ? "Total" : showGiveConfirmed - ? "Confirmed" - : "Unconfirmed" + ? "Confirmed" + : "Unconfirmed" }}
diff --git a/sw_scripts/safari-notifications.js b/sw_scripts/safari-notifications.js index a32268bc8..158372c1a 100644 --- a/sw_scripts/safari-notifications.js +++ b/sw_scripts/safari-notifications.js @@ -384,61 +384,56 @@ async function getSettingById(id) { }); } - async function setMostRecentNotified(id) { - try { - const db = await openIndexedDB("TimeSafari"); - const transaction = db.transaction("settings", "readwrite"); - const store = transaction.objectStore("settings"); - - const data = await getRecord(store, 1); - if (data) { - data["lastNotifiedClaimId"] = id; - await updateRecord(store, data); - } else { - console.error("Record not found"); - } - - transaction.oncomplete = () => db.close(); - } catch (error) { - console.error("Database error: " + error.message); + try { + const db = await openIndexedDB("TimeSafari"); + const transaction = db.transaction("settings", "readwrite"); + const store = transaction.objectStore("settings"); + + const data = await getRecord(store, 1); + if (data) { + data["lastNotifiedClaimId"] = id; + await updateRecord(store, data); + } else { + console.error("Record not found"); } -} + transaction.oncomplete = () => db.close(); + } catch (error) { + console.error("Database error: " + error.message); + } +} function openIndexedDB(dbName) { - return new Promise((resolve, reject) => { - const request = indexedDB.open(dbName); - request.onerror = () => reject(request.error); - request.onsuccess = () => resolve(request.result); - request.onupgradeneeded = (event) => { - const db = event.target.result; - if (!db.objectStoreNames.contains("settings")) { - db.createObjectStore("settings"); - } - }; - }); + return new Promise((resolve, reject) => { + const request = indexedDB.open(dbName); + request.onerror = () => reject(request.error); + request.onsuccess = () => resolve(request.result); + request.onupgradeneeded = (event) => { + const db = event.target.result; + if (!db.objectStoreNames.contains("settings")) { + db.createObjectStore("settings"); + } + }; + }); } - function getRecord(store, key) { - return new Promise((resolve, reject) => { - const request = store.get(key); - request.onsuccess = () => resolve(request.result); - request.onerror = () => reject(request.error); - }); + return new Promise((resolve, reject) => { + const request = store.get(key); + request.onsuccess = () => resolve(request.result); + request.onerror = () => reject(request.error); + }); } - function updateRecord(store, data) { - return new Promise((resolve, reject) => { - const request = store.put(data); - request.onsuccess = () => resolve(request.result); - request.onerror = () => reject(request.error); - }); + return new Promise((resolve, reject) => { + const request = store.put(data); + request.onsuccess = () => resolve(request.result); + request.onerror = () => reject(request.error); + }); } - async function fetchAllAccounts() { return new Promise((resolve, reject) => { let openRequest = indexedDB.open("TimeSafariAccounts"); @@ -531,7 +526,7 @@ async function getNotificationCount() { } const most_recent_notified = claims[0]["id"]; await setMostRecentNotified(most_recent_notified); - return "TEST"; + return "TEST"; } else { console.error(response.status); }