Skip to content

Commit cb485ca

Browse files
committed
feat: clean up whitespace in update notification and update manager files
1 parent 3d897cf commit cb485ca

File tree

4 files changed

+48
-44
lines changed

4 files changed

+48
-44
lines changed

src/components/update-notification.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class UpdateNotification {
3535
if (getUpdateManager()) {
3636
console.log('✅ [UpdateNotification] UpdateManager trovato, bind eventi notifica');
3737
this.bindEvents();
38-
38+
3939
// RIMOSSO: Il controllo dello stato iniziale può causare problemi
4040
// L'updateManager dovrebbe emettere gli eventi corretti al momento giusto
4141
} else {
@@ -366,7 +366,7 @@ export class UpdateNotification {
366366
while (target && !target.dataset.action) {
367367
target = target.parentElement;
368368
}
369-
369+
370370
const action = target ? target.dataset.action : null;
371371
console.log('🔔 [UpdateNotification] Target trovato:', target, 'Action:', action);
372372
if (action) {

src/main.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -299,42 +299,42 @@ async function initializeEarlyTheme() {
299299

300300
// Helper function to check if Tauri is available and ready
301301
function isTauriReady() {
302-
return typeof window !== 'undefined' &&
303-
window.__TAURI__ &&
304-
window.__TAURI__.core &&
305-
typeof window.__TAURI__.core.invoke === 'function';
302+
return typeof window !== 'undefined' &&
303+
window.__TAURI__ &&
304+
window.__TAURI__.core &&
305+
typeof window.__TAURI__.core.invoke === 'function';
306306
}
307307

308308
// Helper function to wait for Tauri to be ready (with timeout)
309309
function waitForTauri(maxWaitTime = 2000) {
310310
return new Promise((resolve) => {
311311
const startTime = Date.now();
312-
312+
313313
const checkTauri = () => {
314314
if (isTauriReady()) {
315315
resolve(true);
316316
return;
317317
}
318-
318+
319319
if (Date.now() - startTime > maxWaitTime) {
320320
resolve(false);
321321
return;
322322
}
323-
323+
324324
setTimeout(checkTauri, 50);
325325
};
326-
326+
327327
checkTauri();
328328
});
329329
}
330330

331331
try {
332332
// Wait for Tauri to be ready before trying to load settings
333333
const tauriReady = await waitForTauri();
334-
334+
335335
if (tauriReady) {
336336
console.log('🎨 Tauri is ready, loading theme from settings...');
337-
337+
338338
try {
339339
const { invoke } = window.__TAURI__.core;
340340
const savedSettings = await invoke('load_settings');
@@ -1467,19 +1467,19 @@ async function initializeApplication() {
14671467
console.log('🚀 Application already fully initialized, skipping...');
14681468
return;
14691469
}
1470-
1470+
14711471
// Prevent concurrent initialization attempts
14721472
if (window._appInitializing) {
14731473
console.log('🚀 Application initialization already in progress, skipping...');
14741474
return;
14751475
}
1476-
1476+
14771477
// Set initialization flag early to prevent race conditions
14781478
window._appInitializing = true;
1479-
1479+
14801480
try {
14811481
console.log('🚀 Initializing Presto application...');
1482-
1482+
14831483
// Show loading state
14841484
const loadingOverlay = document.createElement('div');
14851485
loadingOverlay.id = 'app-loading';
@@ -1512,7 +1512,7 @@ async function initializeApplication() {
15121512
if (stuckOverlay) {
15131513
console.error('⚠️ Initialization timeout - removing loading overlay');
15141514
stuckOverlay.remove();
1515-
1515+
15161516
// Show error message
15171517
NotificationUtils.showNotificationPing('Initialization timed out. Please refresh! 🔄', 'error');
15181518
}
@@ -1618,7 +1618,7 @@ async function initializeApplication() {
16181618

16191619
// Clear safety timeout
16201620
clearTimeout(safetyTimeout);
1621-
1621+
16221622
// Mark as fully initialized
16231623
window._appFullyInitialized = true;
16241624
window._appInitializing = false;
@@ -1634,21 +1634,21 @@ async function initializeApplication() {
16341634

16351635
} catch (error) {
16361636
console.error('❌ Failed to initialize application:', error);
1637-
1637+
16381638
// Clear safety timeout and remove loading overlay even on error
16391639
clearTimeout(safetyTimeout);
16401640
const loadingOverlayError = document.getElementById('app-loading');
16411641
if (loadingOverlayError) {
16421642
loadingOverlayError.remove();
16431643
}
1644-
1644+
16451645
// Show error notification
16461646
NotificationUtils.showNotificationPing('Failed to initialize app. Please refresh! 🔄', 'error');
1647-
1647+
16481648
// Reset initialization flags on error so user can retry
16491649
window._appInitializing = false;
16501650
window._appFullyInitialized = false;
1651-
1651+
16521652
// Show error screen instead of leaving user with blank screen
16531653
const errorScreen = document.createElement('div');
16541654
errorScreen.id = 'app-error';

src/managers/update-manager-global.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
9797
if (window.__TAURI__?.app?.getVersion) {
9898
return await window.__TAURI__.app.getVersion();
9999
}
100-
100+
101101
if (window.__TAURI__?.core?.invoke) {
102102
return await window.__TAURI__.core.invoke('plugin:app|version');
103103
}
@@ -140,7 +140,7 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
140140
enableTestMode() {
141141
localStorage.setItem('presto_force_update_test', 'true');
142142
console.warn('⚠️ MODALITÀ TEST AGGIORNAMENTI ATTIVATA');
143-
143+
144144
if (!this.isDevelopmentMode() && this.autoCheck && !this.checkInterval) {
145145
this.startAutoCheck();
146146
}
@@ -154,7 +154,7 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
154154
disableTestMode() {
155155
localStorage.removeItem('presto_force_update_test');
156156
console.log('ℹ️ Modalità test aggiornamenti disattivata');
157-
157+
158158
if (this.isDevelopmentMode()) {
159159
this.stopAutoCheck();
160160
}
@@ -277,7 +277,7 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
277277
compareVersions(a, b) {
278278
const cleanA = a.replace(/^v/, '');
279279
const cleanB = b.replace(/^v/, '');
280-
280+
281281
const aParts = cleanA.split('.').map(n => parseInt(n) || 0);
282282
const bParts = cleanB.split('.').map(n => parseInt(n) || 0);
283283

@@ -319,7 +319,7 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
319319

320320
const githubRelease = await response.json();
321321
const latestVersion = githubRelease.tag_name.replace(/^v/, '');
322-
322+
323323
console.log(`📋 Ultima versione GitHub: ${latestVersion}`);
324324

325325
// Confronta versioni
@@ -328,7 +328,7 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
328328
this.updateAvailable = false;
329329
this.currentUpdate = null;
330330
this.emit('updateNotAvailable');
331-
331+
332332
if (showDialog) {
333333
alert(`Nessun aggiornamento disponibile.\n\nVersione corrente: ${currentVersion}\nUltima versione: ${latestVersion}`);
334334
}
@@ -349,9 +349,9 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
349349

350350
if (showDialog) {
351351
const message = `🎉 Aggiornamento disponibile!\n\n` +
352-
`Versione corrente: ${currentVersion}\n` +
353-
`Nuova versione: ${latestVersion}\n\n` +
354-
`Nota: In modalità sviluppo, scarica manualmente da GitHub.`;
352+
`Versione corrente: ${currentVersion}\n` +
353+
`Nuova versione: ${latestVersion}\n\n` +
354+
`Nota: In modalità sviluppo, scarica manualmente da GitHub.`;
355355
alert(message);
356356
}
357357

@@ -447,7 +447,7 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
447447
if (tauriAPI) {
448448
console.log('🔄 Usando API Tauri updater...');
449449
const tauriUpdate = await tauriAPI.check();
450-
450+
451451
if (tauriUpdate && tauriUpdate.available) {
452452
console.log('✅ Aggiornamento confermato via Tauri API');
453453
this.updateAvailable = true;
@@ -504,10 +504,10 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
504504
*/
505505
async simulateUpdate() {
506506
console.log('🧪 Simulazione aggiornamento per test...');
507-
507+
508508
const currentVersion = await this.getAppVersion();
509509
const simulatedNewVersion = this.incrementVersion(currentVersion);
510-
510+
511511
const update = {
512512
version: simulatedNewVersion,
513513
date: new Date().toISOString(),
@@ -577,16 +577,16 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
577577
// Se supporta download automatico via Tauri
578578
if (this.currentUpdate.isAutoDownloadable && this.currentUpdate.source === 'tauri-api') {
579579
console.log('📥 Download automatico via Tauri...');
580-
580+
581581
const tauriAPI = await this.getTauriUpdaterAPI();
582582
if (tauriAPI && tauriAPI.downloadAndInstall) {
583583
await tauriAPI.downloadAndInstall((progress) => {
584584
console.log(`📥 Progresso download: ${progress}%`);
585585
this.downloadProgress = progress;
586-
this.emit('downloadProgress', {
586+
this.emit('downloadProgress', {
587587
progress,
588588
chunkLength: progress,
589-
contentLength: 100
589+
contentLength: 100
590590
});
591591
});
592592

@@ -598,10 +598,10 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
598598
});
599599

600600
this.emit('downloadFinished');
601-
601+
602602
// Installa e riavvia
603603
this.emit('installFinished');
604-
604+
605605
const shouldRestart = await this.askConfirmation(
606606
'Aggiornamento scaricato e installato con successo!\n\nVuoi riavviare ora l\'applicazione?',
607607
{ title: 'Aggiornamento Completato' }
@@ -615,7 +615,7 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
615615
// Download manuale
616616
console.log('🌐 Reindirizzamento a download manuale...');
617617
await this.openDownloadUrl(this.currentUpdate.downloadUrl);
618-
618+
619619
this.emit('downloadError', new Error('Download manuale richiesto'));
620620
}
621621

@@ -633,15 +633,15 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
633633
*/
634634
async simulateDownloadAndInstall() {
635635
console.log('🧪 Simulazione download...');
636-
636+
637637
// Simula progresso download
638638
for (let i = 0; i <= 100; i += 10) {
639639
await new Promise(resolve => setTimeout(resolve, 100));
640640
this.downloadProgress = i;
641-
this.emit('downloadProgress', {
641+
this.emit('downloadProgress', {
642642
progress: i,
643643
chunkLength: i,
644-
contentLength: 100
644+
contentLength: 100
645645
});
646646
}
647647

@@ -671,7 +671,7 @@ window.UpdateManagerV2 = class UpdateManagerV2 {
671671
*/
672672
setAutoCheck(enabled) {
673673
this.autoCheck = enabled;
674-
674+
675675
if (enabled) {
676676
this.startAutoCheck();
677677
} else {

src/version-global.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Rende APP_VERSION disponibile globalmente per script non-module
2+
// Questo file viene generato automaticamente durante il build
3+
// Contiene la versione corrente dell'applicazione
4+
window.APP_VERSION = '0.3.10';

0 commit comments

Comments
 (0)