Skip to content

Commit

Permalink
fix(Twitch): privacy setting doesn't clear buttons (PreMiD#6745)
Browse files Browse the repository at this point in the history
fix(Twitch): fix privacy doesn't clear buttons
  • Loading branch information
RisingSunLight42 authored Sep 3, 2022
1 parent 7a80617 commit 370788c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion websites/T/Twitch/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"devstatus.twitch.tv",
"status.twitch.tv"
],
"version": "3.2.0",
"version": "3.2.1",
"logo": "https://i.imgur.com/So7h3G0.png",
"thumbnail": "https://i.imgur.com/OAcBmwW.png",
"color": "#9146FF",
Expand Down
42 changes: 19 additions & 23 deletions websites/T/Twitch/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,12 @@ presence.on("UpdateData", async () => {
presenceData.largeImageKey =
profilePic ?? (logoArr[logo] || "twitch");
}
if (buttons) {
presenceData.buttons = [
{
label: strings.watchStream,
url: document.URL.split("?")[0],
},
];
}
presenceData.buttons = [
{
label: strings.watchStream,
url: document.URL.split("?")[0],
},
];
}

if (showVideo && !live) {
Expand Down Expand Up @@ -513,14 +511,12 @@ presence.on("UpdateData", async () => {
presenceData.startTimestamp = startTimestamp;
presenceData.endTimestamp = endTimestamp;

if (buttons) {
presenceData.buttons = [
{
label: strings.watchVideo,
url: document.URL.split("?")[0],
},
];
}
presenceData.buttons = [
{
label: strings.watchVideo,
url: document.URL.split("?")[0],
},
];
}

if (((showLive && live) || (showVideo && !live)) && video.paused) {
Expand Down Expand Up @@ -908,12 +904,12 @@ presence.on("UpdateData", async () => {
// No default
}

if (presenceData.details) {
if (!showTimestamps) {
delete presenceData.startTimestamp;
delete presenceData.endTimestamp;
}
if (!showTimestamps) {
delete presenceData.startTimestamp;
delete presenceData.endTimestamp;
}
if (privacy || !buttons) delete presenceData.buttons;

presence.setActivity(presenceData);
} else presence.setActivity();
if (presenceData.details) presence.setActivity(presenceData);
else presence.setActivity();
});

0 comments on commit 370788c

Please sign in to comment.