feat: condivisione e importazione automatica del codice comunità nelle playlist con priorità tonalità e autoscroll e rifinitura UI

This commit is contained in:
David Frassi
2026-05-23 16:53:09 +02:00
parent b220167794
commit 960c73fbd0
20 changed files with 680 additions and 122 deletions
+22 -3
View File
@@ -60,6 +60,15 @@ export class PlaylistPage {
moveItemInArray(this.localSongs, event.previousIndex, event.currentIndex);
}
getPlaylistSongSettings(): any {
const activeId = this.playlistService.activePlaylistId();
if (activeId) {
const pl = this.playlistService.playlists().find(p => p.id === activeId);
return pl ? pl.songSettings : undefined;
}
return undefined;
}
async savePlaylist() {
const alert = await this.alertCtrl.create({
header: 'Salva Playlist',
@@ -118,7 +127,8 @@ export class PlaylistPage {
this.savedPlaylistName = data.name;
const ids = this.localSongs.map(s => s.id);
await this.playlistService.savePlaylist(data.name, ids);
this.qrCodeImage = await this.playlistService.generateQR(ids, data.name);
const songSettings = this.getPlaylistSongSettings();
this.qrCodeImage = await this.playlistService.generateQR(ids, data.name, songSettings);
this.showToast('Playlist salvata!');
return true;
}
@@ -135,7 +145,8 @@ export class PlaylistPage {
const ids = this.localSongs.map(s => s.id);
const name = this.savedPlaylistName || 'Playlist Condivisa';
this.qrCodeImage = await this.playlistService.generateQR(ids, name);
const songSettings = this.getPlaylistSongSettings();
this.qrCodeImage = await this.playlistService.generateQR(ids, name, songSettings);
}
downloadQR() {
@@ -157,7 +168,8 @@ export class PlaylistPage {
async shareQR() {
if (!this.qrCodeImage) return;
const name = this.savedPlaylistName || 'playlist';
const shareLink = this.playlistService.getShareLink(this.localSongs.map(s => s.id), name);
const songSettings = this.getPlaylistSongSettings();
const shareLink = this.playlistService.getShareLink(this.localSongs.map(s => s.id), name, songSettings);
const fileName = `${name.toLowerCase().replace(/\s+/g, '_')}_qr.png`;
try {
@@ -180,6 +192,13 @@ export class PlaylistPage {
text: `Ecco la playlist: ${name}\n\nClicca qui per aprirla: ${shareLink}`
});
} else {
// Copy to clipboard AND download QR!
try {
if (navigator.clipboard) {
await navigator.clipboard.writeText(shareLink);
this.showToast('Link copiato negli appunti! QR scaricato.');
}
} catch(e) {}
this.downloadQR();
}
}