Polish Part 3 (#2424)

This commit is contained in:
Joe Milazzo 2023-11-10 07:56:30 -06:00 committed by GitHub
parent a018d6828e
commit 944830ca73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 518 additions and 493 deletions

View file

@ -21,6 +21,7 @@ import { AccountService } from 'src/app/_services/account.service';
import { BytesPipe } from 'src/app/_pipes/bytes.pipe';
import {translate} from "@ngneat/transloco";
import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
import {SAVER, Saver} from "../../_providers/saver.provider";
export const DEBOUNCE_TIME = 100;
@ -66,9 +67,11 @@ export class DownloadService {
public activeDownloads$ = this.downloadsSource.asObservable();
private readonly destroyRef = inject(DestroyRef);
private readonly confirmService = inject(ConfirmService);
private readonly accountService = inject(AccountService);
private readonly httpClient = inject(HttpClient);
constructor(private httpClient: HttpClient, private confirmService: ConfirmService,
private accountService: AccountService) { }
constructor(@Inject(SAVER) private save: Saver) { }
/**
@ -269,22 +272,4 @@ export class DownloadService {
finalize(() => this.finalizeDownloadState(downloadType, subtitle))
);
}
private save(blob: Blob, filename: string) {
const saveLink = document.createElement('a');
saveLink.style.display = 'none';
document.body.appendChild(saveLink);
const url = URL.createObjectURL(blob);
saveLink.href = url;
saveLink.download = filename;
// Trigger the click event
saveLink.click();
// Cleanup
URL.revokeObjectURL(url);
document.body.removeChild(saveLink);
}
}