feat: condivisione e importazione automatica del codice comunità nelle playlist con priorità tonalità e autoscroll e rifinitura UI
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user