(source = "popup")
| 2464 | } |
| 2465 | |
| 2466 | async function refreshImportStateFromBackground(source = "popup") { |
| 2467 | try { |
| 2468 | const state = await chrome.runtime.sendMessage({ |
| 2469 | action: "getImportState", |
| 2470 | }); |
| 2471 | if (!state || state.error) { |
| 2472 | console.warn( |
| 2473 | `[refreshImportStateFromBackground:${source}] Invalid response:`, |
| 2474 | state |
| 2475 | ); |
| 2476 | return; |
| 2477 | } |
| 2478 | await applyImportStatus( |
| 2479 | { |
| 2480 | action: "updateImportStatus", |
| 2481 | isImporting: state.isImporting, |
| 2482 | isPaused: state.isPaused, |
| 2483 | pausedTabId: state.pausedTabId, |
| 2484 | captchaReason: state.captchaReason, |
| 2485 | activeListKey: state.activeListKey, |
| 2486 | }, |
| 2487 | source |
| 2488 | ); |
| 2489 | } catch (error) { |
| 2490 | console.warn( |
| 2491 | `[refreshImportStateFromBackground:${source}] Failed:`, |
| 2492 | error?.message || error |
| 2493 | ); |
| 2494 | } |
| 2495 | } |
| 2496 | |
| 2497 | function formatImportActivityMessage(count, duplicateCount, prefix = "") { |
| 2498 | const importedCount = Number(count) || 0; |
no test coverage detected