Added unique ID generator

- Updated data cleaning feature
- Added fileID database logic
This commit is contained in:
2024-02-19 17:24:59 +01:00
parent e179cdf2dc
commit 6a1e91f5d8
7 changed files with 103 additions and 24 deletions

View File

@ -34,6 +34,7 @@ export class DownloadComponent {
fileDownloadFinished: boolean = false;
waitingForPassword: boolean = false;
downloadProgress: number = 0;
targetUploadProgress: number = 0;
downloadDuration: string = "";
passwordWrong: boolean = false;
@ -155,8 +156,8 @@ export class DownloadComponent {
// Calculate the percentage of download completed
if(progressEvent.total) {
const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
this.downloadProgress = percentCompleted;
console.log(percentCompleted + '%'); // Log the percentage or update any progress UI component
this.targetUploadProgress = percentCompleted;
this.smoothProgressUpdate();
}
}
})
@ -201,6 +202,16 @@ export class DownloadComponent {
private wrongPassword() {
this.passwordWrong = true;
}
smoothProgressUpdate() {
if (this.downloadProgress < this.targetUploadProgress) {
this.downloadProgress += 0.01 * (this.targetUploadProgress - this.downloadProgress);
requestAnimationFrame(this.smoothProgressUpdate.bind(this));
} else if (this.downloadProgress > this.targetUploadProgress) {
// Handle overshoot
this.downloadProgress = this.targetUploadProgress;
}
}
}
interface DownloadInfo {
downloadable: boolean;