program finalizat

This commit is contained in:
andrei-mihnea-cerbu
2024-10-29 15:07:26 +02:00
parent ab1eaec413
commit 979539d3db
138 changed files with 14602 additions and 5068 deletions
+9 -4
View File
@@ -9,9 +9,6 @@ document.addEventListener('DOMContentLoaded', async function () {
const shareFileButton = document.getElementById('share-file');
const logoutButton = document.getElementById('logout');
const restoreBackupButton = document.getElementById('restore-backup');
await fetchUserInfo();
await checkAndSetAllDirectories();
backupButton.addEventListener('click', async function () {
await setPath('backupDirectory');
@@ -43,6 +40,12 @@ document.addEventListener('DOMContentLoaded', async function () {
});
});
async function initialSetup(){
await checkAndSetAllDirectories();
await loadReceivedFiles();
await fetchUserInfo();
}
async function restoreBackup() {
const backupDirectory = await window.electronAPI.readApplicationInfo('backupDirectory');
@@ -59,7 +62,7 @@ async function restoreBackup() {
}
// Call the IPC method to initiate the backup retrieval process
await window.electronAPI.startBackupRetrieval(destinationPath);
window.electronAPI.startBackupRetrieval(destinationPath);
// Switch the content to the 'backup_retrieve' page
fadeOut('backup_retrieve');
@@ -89,6 +92,7 @@ async function attachNotificationButton(pathKey, buttonText, buttonId, buttonNam
if (!path) {
const notificationsDiv = document.getElementById('notifications');
const button = document.createElement('button');
button.className='alert';
button.id = buttonId;
button.name = buttonName;
button.textContent = buttonText;
@@ -152,6 +156,7 @@ async function loadReceivedFiles() {
if (!existingButtons.includes(filePath)) {
const button = document.createElement('button');
button.setAttribute('data-filepath', filePath); // Set a custom attribute to track the file path
button.className = 'notification';
button.name = 'notification';
button.textContent = `You received a file "${fileName}" from ${userName}`; // Display the userName and file name
button.addEventListener('click', () => handleFileReceivedButtonPressed(filePath, button));