mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-25 04:36:46 +00:00
Update backup media idle state after resuming download
This commit is contained in:
@@ -1,14 +1,28 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { AttachmentDownloadManager } from '../jobs/AttachmentDownloadManager';
|
||||
import { DataWriter } from '../sql/Client';
|
||||
import { drop } from './drop';
|
||||
|
||||
export async function startBackupMediaDownload(): Promise<void> {
|
||||
await window.storage.put('backupMediaDownloadPaused', false);
|
||||
await window.storage.put('backupMediaDownloadIdle', false);
|
||||
|
||||
await AttachmentDownloadManager.start();
|
||||
drop(
|
||||
AttachmentDownloadManager.waitForIdle(async () => {
|
||||
await window.storage.put('backupMediaDownloadIdle', true);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
export async function pauseBackupMediaDownload(): Promise<void> {
|
||||
await window.storage.put('backupMediaDownloadPaused', true);
|
||||
}
|
||||
|
||||
export async function resumeBackupMediaDownload(): Promise<void> {
|
||||
await window.storage.put('backupMediaDownloadPaused', false);
|
||||
return startBackupMediaDownload();
|
||||
}
|
||||
|
||||
export async function resetBackupMediaDownloadItems(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user