From c5ad0bb0e71b9b417604728aa4c2fa0e11643fd8 Mon Sep 17 00:00:00 2001 From: marcomariscal Date: Tue, 25 Jun 2024 10:31:30 -0700 Subject: [PATCH] feat: handle scanning latest announcements from last fetched block --- .../src/components/AccountReceiveTable.vue | 29 ++++++++++++++++--- frontend/src/i18n/locales/en-US.json | 1 + frontend/src/i18n/locales/zh-CN.json | 1 + frontend/src/pages/AccountReceive.vue | 7 +++-- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/AccountReceiveTable.vue b/frontend/src/components/AccountReceiveTable.vue index 02c1e292..91b8ab5a 100644 --- a/frontend/src/components/AccountReceiveTable.vue +++ b/frontend/src/components/AccountReceiveTable.vue @@ -71,10 +71,31 @@ {{ formatTime(mostRecentAnnouncementTimestamp * 1000) }} - -
- {{ $t('Receive.fetching-latest-from-last-fetched-block') }} - + +
+
+ {{ + scanStatus === 'fetching' + ? $t('Receive.fetching') + : $t('Receive.fetching-latest-from-last-fetched-block') + }} + +
+
+ {{ + scanStatus === 'scanning latest from last fetched block' + ? $t('Receive.scanning-latest-from-last-fetched-block') + : $t('Receive.scanning') + }} + +
diff --git a/frontend/src/i18n/locales/en-US.json b/frontend/src/i18n/locales/en-US.json index b3aa9566..20101cc5 100644 --- a/frontend/src/i18n/locales/en-US.json +++ b/frontend/src/i18n/locales/en-US.json @@ -123,6 +123,7 @@ "fetching-latest-from-last-fetched-block": "Fetching latest announcements...", "scanning": "Scanning all announcements for funds...", "scanning-latest": "Scanning latest announcements for funds...", + "scanning-latest-from-last-fetched-block": "Scanning latest announcements...", "wait": "This may take a couple of minutes depending on your connection and device. This is normal— please be patient.", "stop": "Stop" }, diff --git a/frontend/src/i18n/locales/zh-CN.json b/frontend/src/i18n/locales/zh-CN.json index 3188fba9..9503273a 100644 --- a/frontend/src/i18n/locales/zh-CN.json +++ b/frontend/src/i18n/locales/zh-CN.json @@ -123,6 +123,7 @@ "scanning": "在所有的公告中扫描资金...", "scanning-latest": "在最新公告中扫描资金...", + "scanning-latest-from-last-fetched-block": "在最新公告中扫描资金...", "wait": "这可能需要几分钟,具体取决于您的连接和设备。这是正常的 — 请耐心等待。", "stop": "停止" }, diff --git a/frontend/src/pages/AccountReceive.vue b/frontend/src/pages/AccountReceive.vue index 8b1687bc..461c0b1c 100644 --- a/frontend/src/pages/AccountReceive.vue +++ b/frontend/src/pages/AccountReceive.vue @@ -143,6 +143,7 @@ function useScan() { | 'fetching latest' | 'scanning' | 'scanning latest' + | 'scanning latest from last fetched block' | 'complete' | 'complete latest'; const scanStatus = ref('waiting'); @@ -391,6 +392,8 @@ function useScan() { // Reset paused state paused.value = false; if (!umbra.value) throw new Error('No umbra instance found. Please make sure you are on a supported network'); + + const isInitialScan = userAnnouncements.value.length === 0; scanStatus.value = 'fetching latest'; // Check for manually entered private key in advancedMode, otherwise use the key from user's signature @@ -509,7 +512,7 @@ function useScan() { announcementsQueue = [...announcementsQueue, ...announcementsBatch]; if (announcementsCount == 10000) { - scanStatus.value = 'scanning latest'; + scanStatus.value = isInitialScan ? 'scanning latest' : 'scanning latest from last fetched block'; firstScanPromise = filterUserAnnouncementsAsync(spendingPubKey, viewingPrivKey, announcementsQueue); announcementsQueue = []; } @@ -522,7 +525,7 @@ function useScan() { await firstScanPromise; // Clear out existing workers workers.length = 0; - scanStatus.value = 'scanning'; + scanStatus.value = isInitialScan ? 'scanning' : 'scanning latest from last fetched block'; await filterUserAnnouncementsAsync(spendingPubKey, viewingPrivKey, announcementsQueue); scanStatus.value = 'complete';