AppleMusicRichPresence: add option to disable large/small image (#2562)

This commit is contained in:
Lumap 2024-06-07 23:04:40 +02:00 committed by GitHub
parent c54650b29a
commit 40db2f5078
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -68,6 +68,7 @@ export interface TrackData {
const enum AssetImageType { const enum AssetImageType {
Album = "Album", Album = "Album",
Artist = "Artist", Artist = "Artist",
Disabled = "Disabled"
} }
const applicationId = "1239490006054207550"; const applicationId = "1239490006054207550";
@ -126,7 +127,8 @@ const settings = definePluginSettings({
description: "Activity assets large image type", description: "Activity assets large image type",
options: [ options: [
{ label: "Album artwork", value: AssetImageType.Album, default: true }, { label: "Album artwork", value: AssetImageType.Album, default: true },
{ label: "Artist artwork", value: AssetImageType.Artist } { label: "Artist artwork", value: AssetImageType.Artist },
{ label: "Disabled", value: AssetImageType.Disabled }
], ],
}, },
largeTextString: { largeTextString: {
@ -139,7 +141,8 @@ const settings = definePluginSettings({
description: "Activity assets small image type", description: "Activity assets small image type",
options: [ options: [
{ label: "Album artwork", value: AssetImageType.Album }, { label: "Album artwork", value: AssetImageType.Album },
{ label: "Artist artwork", value: AssetImageType.Artist, default: true } { label: "Artist artwork", value: AssetImageType.Artist, default: true },
{ label: "Disabled", value: AssetImageType.Disabled }
], ],
}, },
smallTextString: { smallTextString: {
@ -207,12 +210,17 @@ export default definePlugin({
getImageAsset(settings.store.smallImageType, trackData) getImageAsset(settings.store.smallImageType, trackData)
]); ]);
const assets: ActivityAssets = { const assets: ActivityAssets = {};
large_image: largeImageAsset,
large_text: customFormat(settings.store.largeTextString, trackData), if (settings.store.largeImageType !== AssetImageType.Disabled) {
small_image: smallImageAsset, assets.large_image = largeImageAsset;
small_text: customFormat(settings.store.smallTextString, trackData), assets.large_text = customFormat(settings.store.largeTextString, trackData);
}; }
if (settings.store.smallImageType !== AssetImageType.Disabled) {
assets.small_image = smallImageAsset;
assets.small_text = customFormat(settings.store.smallTextString, trackData);
}
const buttons: ActivityButton[] = []; const buttons: ActivityButton[] = [];