fix: risoluzione importazione playlist tramite link di condivisione e fix installabilità PWA su Android
This commit is contained in:
@@ -5,14 +5,14 @@ import { Injectable, signal, effect } from '@angular/core';
|
||||
})
|
||||
export class SettingsService {
|
||||
/** Default mode for viewing songs: true = chords, false = text only */
|
||||
public showChordsDefault = signal<boolean>(false);
|
||||
public showChordsDefault = signal<boolean>(true);
|
||||
|
||||
/** UI Fullscreen mode (lyrics only): true = active */
|
||||
public fullscreenMode = signal<boolean>(false);
|
||||
|
||||
/** Browser Fullscreen state: true = fullscreen active */
|
||||
public browserFullscreen = signal<boolean>(
|
||||
!!(
|
||||
typeof document !== 'undefined' && !!(
|
||||
document.fullscreenElement ||
|
||||
(document as any).webkitFullscreenElement ||
|
||||
(document as any).mozFullScreenElement ||
|
||||
@@ -27,25 +27,25 @@ export class SettingsService {
|
||||
public showEditor = signal<boolean>(false);
|
||||
|
||||
/** Schermo sempre acceso: true = attiva Screen Wake Lock */
|
||||
public keepScreenOn = signal<boolean>(false);
|
||||
public keepScreenOn = signal<boolean>(true);
|
||||
|
||||
/** Funzionalità Comunità: true = il chip comunità è visibile nella home */
|
||||
public comunitaEnabled = signal<boolean>(true);
|
||||
public comunitaEnabled = signal<boolean>(false);
|
||||
|
||||
/** Invio dati statistici: true = invia pacchetto dati statistici */
|
||||
public invioDatiStatistici = signal<boolean>(false);
|
||||
|
||||
/** Visualizza tag sotto autore nella lista canti: true = attivo */
|
||||
public showTagsInList = signal<boolean>(false);
|
||||
public showTagsInList = signal<boolean>(true);
|
||||
|
||||
/** Visualizza data update sotto autore nella lista canti: true = attivo */
|
||||
public showUpdateDate = signal<boolean>(false);
|
||||
public showUpdateDate = signal<boolean>(true);
|
||||
|
||||
/** Attiva autoscroll standard nel dettaglio canto: true = attivo */
|
||||
public enableStandardAutoscroll = signal<boolean>(false);
|
||||
public enableStandardAutoscroll = signal<boolean>(true);
|
||||
|
||||
/** Attiva autoscroll acustico nel dettaglio canto: true = attivo */
|
||||
public enableAcousticAutoscroll = signal<boolean>(true);
|
||||
public enableAcousticAutoscroll = signal<boolean>(false);
|
||||
|
||||
private wakeLock: any = null;
|
||||
|
||||
@@ -54,6 +54,7 @@ export class SettingsService {
|
||||
public showInstallButton = signal<boolean>(false);
|
||||
public isStandalone = signal<boolean>(false);
|
||||
public isIos = signal<boolean>(false);
|
||||
public isAndroid = signal<boolean>(false);
|
||||
|
||||
constructor() {
|
||||
// Detect PWA status
|
||||
@@ -65,6 +66,9 @@ export class SettingsService {
|
||||
this.isIos.set(
|
||||
/iPad|iPhone|iPod/.test(navigator.userAgent) && !(window as any).MSStream
|
||||
);
|
||||
this.isAndroid.set(
|
||||
/Android/i.test(navigator.userAgent)
|
||||
);
|
||||
} catch (e) {
|
||||
console.warn('Browser environment does not support display-mode media query');
|
||||
}
|
||||
@@ -84,59 +88,103 @@ export class SettingsService {
|
||||
this.isStandalone.set(true);
|
||||
console.log('PWA was installed');
|
||||
});
|
||||
|
||||
// Migration: force settings defaults once for existing users to match the new rules
|
||||
const migrationKey = 'defaults-migrated-20260521';
|
||||
if (localStorage.getItem(migrationKey) !== 'true') {
|
||||
localStorage.setItem('show-chords-default', 'true');
|
||||
localStorage.setItem('fullscreen-mode', this.isIos().toString());
|
||||
localStorage.setItem('show-editor', 'false');
|
||||
localStorage.setItem('auto-advance', 'true');
|
||||
localStorage.setItem('keep-screen-on', 'true');
|
||||
localStorage.setItem('comunita-enabled', 'false');
|
||||
localStorage.setItem('invio-dati-statistici', 'false');
|
||||
localStorage.setItem('show-tags-in-list', 'true');
|
||||
localStorage.setItem('show-update-date', 'true');
|
||||
localStorage.setItem('enable-standard-autoscroll', 'true');
|
||||
localStorage.setItem('enable-acoustic-autoscroll', 'false');
|
||||
|
||||
// ThemeService high contrast default
|
||||
localStorage.setItem('high-contrast', 'true');
|
||||
|
||||
localStorage.setItem(migrationKey, 'true');
|
||||
}
|
||||
|
||||
const savedChords = localStorage.getItem('show-chords-default');
|
||||
if (savedChords !== null) {
|
||||
this.showChordsDefault.set(savedChords === 'true');
|
||||
} else {
|
||||
this.showChordsDefault.set(true);
|
||||
}
|
||||
|
||||
const savedFullscreen = localStorage.getItem('fullscreen-mode');
|
||||
if (savedFullscreen !== null) {
|
||||
this.fullscreenMode.set(savedFullscreen === 'true');
|
||||
} else {
|
||||
this.fullscreenMode.set(this.isIos());
|
||||
}
|
||||
|
||||
const savedEditor = localStorage.getItem('show-editor');
|
||||
if (savedEditor !== null) {
|
||||
this.showEditor.set(savedEditor === 'true');
|
||||
} else {
|
||||
this.showEditor.set(false);
|
||||
}
|
||||
|
||||
const savedAutoAdvance = localStorage.getItem('auto-advance');
|
||||
if (savedAutoAdvance !== null) {
|
||||
this.autoAdvance.set(savedAutoAdvance === 'true');
|
||||
} else {
|
||||
this.autoAdvance.set(true);
|
||||
}
|
||||
|
||||
const savedKeepScreenOn = localStorage.getItem('keep-screen-on');
|
||||
if (savedKeepScreenOn !== null) {
|
||||
this.keepScreenOn.set(savedKeepScreenOn === 'true');
|
||||
} else {
|
||||
this.keepScreenOn.set(true);
|
||||
}
|
||||
|
||||
const savedComunitaEnabled = localStorage.getItem('comunita-enabled');
|
||||
if (savedComunitaEnabled !== null) {
|
||||
this.comunitaEnabled.set(savedComunitaEnabled === 'true');
|
||||
} else {
|
||||
this.comunitaEnabled.set(false);
|
||||
}
|
||||
|
||||
const savedStats = localStorage.getItem('invio-dati-statistici');
|
||||
if (savedStats !== null) {
|
||||
this.invioDatiStatistici.set(savedStats === 'true');
|
||||
} else {
|
||||
this.invioDatiStatistici.set(false);
|
||||
}
|
||||
|
||||
const savedShowTags = localStorage.getItem('show-tags-in-list');
|
||||
if (savedShowTags !== null) {
|
||||
this.showTagsInList.set(savedShowTags === 'true');
|
||||
} else {
|
||||
this.showTagsInList.set(true);
|
||||
}
|
||||
|
||||
const savedShowUpdateDate = localStorage.getItem('show-update-date');
|
||||
if (savedShowUpdateDate !== null) {
|
||||
this.showUpdateDate.set(savedShowUpdateDate === 'true');
|
||||
} else {
|
||||
this.showUpdateDate.set(true);
|
||||
}
|
||||
|
||||
const savedStandardAutoscroll = localStorage.getItem('enable-standard-autoscroll');
|
||||
if (savedStandardAutoscroll !== null) {
|
||||
this.enableStandardAutoscroll.set(savedStandardAutoscroll === 'true');
|
||||
} else {
|
||||
this.enableStandardAutoscroll.set(true);
|
||||
}
|
||||
|
||||
const savedAcousticAutoscroll = localStorage.getItem('enable-acoustic-autoscroll');
|
||||
if (savedAcousticAutoscroll !== null) {
|
||||
this.enableAcousticAutoscroll.set(savedAcousticAutoscroll === 'true');
|
||||
} else {
|
||||
this.enableAcousticAutoscroll.set(false);
|
||||
}
|
||||
|
||||
// Sync browser fullscreen state with listeners (supporting vendor prefixes)
|
||||
|
||||
Reference in New Issue
Block a user