Small Bugfixes (#2414)

This commit is contained in:
Joe Milazzo 2023-11-08 12:38:44 -06:00 committed by GitHub
parent 26b0cb7d0c
commit b7e7eaf1a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 91 additions and 87 deletions

View file

@ -14,7 +14,6 @@ import {
of,
filter,
} from 'rxjs';
import { SAVER, Saver } from '../_providers/saver.provider';
import { download, Download } from '../_models/download';
import { PageBookmark } from 'src/app/_models/readers/page-bookmark';
import {switchMap, take, takeWhile, throttleTime} from 'rxjs/operators';
@ -69,7 +68,7 @@ export class DownloadService {
private readonly destroyRef = inject(DestroyRef);
constructor(private httpClient: HttpClient, private confirmService: ConfirmService,
@Inject(SAVER) private save: Saver, private accountService: AccountService) { }
private accountService: AccountService) { }
/**
@ -270,4 +269,15 @@ export class DownloadService {
finalize(() => this.finalizeDownloadState(downloadType, subtitle))
);
}
private save(blob: Blob, filename: string) {
const saveLink = document.createElement( 'a' );
if (saveLink.href) {
URL.revokeObjectURL(saveLink.href);
}
saveLink.href = URL.createObjectURL(blob);
saveLink.download = filename;
saveLink.dispatchEvent( new MouseEvent( 'click' ) );
}
}