Update backup media idle state after resuming download
This commit is contained in:
parent
0295cb3963
commit
ca20d07f75
4 changed files with 25 additions and 14 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue