fix: link provider

This commit is contained in:
2025-11-05 10:15:50 +01:00
parent 91818e58ec
commit 8180e0b375
5 changed files with 196 additions and 36 deletions
+42
View File
@@ -135,6 +135,48 @@ export const createMusicSharePayload = ({ projectId, title, artist } = {}) => {
};
};
export const createPlaybackSharePayload = ({
projectId,
title,
artist,
playbackUrl,
} = {}) => {
if (!projectId) return null;
const baseUrl = trimTrailingSlash(resolveBaseShareUrl());
if (!baseUrl) return null;
const encodedProjectId = encodeURIComponent(projectId);
const sharePath = `playback/${encodedProjectId}`;
const shareUrl = `${baseUrl}/${sharePath}`;
const schemeDeepLink = createSchemeDeepLink(sharePath);
const qrUrl = createShareQrUrl({
sharePath,
fallbackUrl: playbackUrl || shareUrl,
});
let shareMessage = "Découvre ce playback sur MusicLand.";
if (title) {
shareMessage = `Découvre "${title}"`;
if (artist) {
shareMessage += ` par ${artist}`;
}
shareMessage += " sur MusicLand.";
} else if (artist) {
shareMessage = `Découvre ce playback de ${artist} sur MusicLand.`;
}
return {
heading: "Partager le playback",
shareTitle: title ? `${title} - MusicLand` : "MusicLand",
shareMessage,
url: shareUrl,
qrUrl,
copyUrl: shareUrl,
linkLabel: shareUrl,
appLink: schemeDeepLink,
};
};
export const openShareSheet = (payload = {}) => {
SheetManager.show("Share", {
payload: {