Questify: Fix patches and add setting to hide the sponsored Quest banner. (#540)

* Fix patches.

* Better.

* Add new setting to hide the sponsored Quest banner.

* Revert some patches.
This commit is contained in:
Etorix 2025-12-05 22:13:34 -08:00 • committed by GitHub
parent 5825c01ed1
commit 06e7222547
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 38 additions and 5 deletions

View file

@ -175,6 +175,18 @@ function shouldHideDirectMessagesTab(): boolean {
return disableQuestsDirectMessagesTab || disableQuestsEverything;
}
function shouldHideSponsoredQuestBanner(): boolean {
const {
disableQuestsPageSponsoredBanner,
disableQuestsEverything
} = settings.use([
"disableQuestsPageSponsoredBanner",
"disableQuestsEverything"
]);
return disableQuestsPageSponsoredBanner || disableQuestsEverything;
}
function shouldHideBadgeOnUserProfiles(): boolean {
const {
disableQuestsBadgeOnUserProfiles,
@ -816,7 +828,7 @@ function getQuestPanelOverride(): Quest | null {
const timeRemaining = interval.duration - interval.progress;
// 3 second buffer to account for per-second rerendering
// which could cause flickering if multiple quests were
// which could cause flickering if multiple Quests were
// started at the same time.
if (timeRemaining < (closestTimeRemaining - 3)) {
closestTimeRemaining = timeRemaining;
@ -908,6 +920,7 @@ export default definePlugin({
shouldHideDirectMessagesTab,
shouldPreventFetchingQuests,
shouldHideBadgeOnUserProfiles,
shouldHideSponsoredQuestBanner,
shouldHideGiftInventoryRelocationNotice,
shouldHideFriendsListActiveNowPromotion,
shouldHideMembersListActivelyPlayingIcon,
@ -952,6 +965,14 @@ export default definePlugin({
}
]
},
{
// Hides the sponsored banner on the Quests page.
find: "assetSponsorImage.url,",
replacement: {
match: /(?<=campaignId]\),)/,
replace: "$self.shouldHideSponsoredQuestBanner()?null:"
}
},
{
// Hides the Quest icon from members list items when
// a user is playing a game tied to an active Quest.
@ -1150,7 +1171,7 @@ export default definePlugin({
{
// Run Questify's sort function every time due to hook requirements but return
// early if not applicable. If the sort method is set to "Questify", replace the
// quests with the sorted ones. Also, setup a trigger to rerender the memo.
// Quests with the sorted ones. Also, setup a trigger to rerender the memo.
match: /(?<=function \i\((\i),\i\){let \i=\i.useRef.{0,100}?;)(return \i.useMemo\(\(\)=>{)/,
replace: "const questRerenderTrigger=$self.useQuestRerender();const questifySorted=$self.sortQuests($1,arguments[1].sortMethod!==\"questify\");$2if(arguments[1].sortMethod===\"questify\"){$1=questifySorted;};"
},
@ -1278,7 +1299,7 @@ export default definePlugin({
replacement: [
{
// Initial and subsequent select drop down for picking or changing a platform.
match: /(#{intl::QUEST_MULTIPLATFORM_SELECT_SUBTITLE}.{0,50}select:)(\i)(,serialize:\i=>{)/g,
match: /(select:)(\i)(,serialize:\i=>{)/g,
replace: "$1(platform)=>{$self.processQuestForAutoComplete(arguments[0].quest),$2(platform)}$3"
},
{
@ -1287,7 +1308,7 @@ export default definePlugin({
// The "Quest Accepted" text is changed to "Resume" if the Quest is in progress but not active.
// Then, when the Quest Accepted button is clicked, resume the automatic completion of the
// Quest and disable the button again.
match: /(?<=fullWidth:!0}\)}\):.{0,200}?secondary",)disabled:!0,text:(.{0,30}?#{intl::QUEST_ACCEPTED}\)),/,
match: /(?<=secondary",)disabled:!0,text:(\i\.intl\.string\(\i\.\i#{intl::QUEST_ACCEPTED}\)),/,
replace: "...$self.getQuestAcceptedButtonProps(arguments[0].quest,$1),"
},
{

View file

@ -368,6 +368,7 @@ function validateDisableQuestSetting() {
disableQuestsDiscoveryTab,
disableQuestsFetchingQuests,
disableQuestsDirectMessagesTab,
disableQuestsPageSponsoredBanner,
disableQuestsPopupAboveAccountPanel,
disableQuestsBadgeOnUserProfiles,
disableQuestsGiftInventoryRelocationNotice,
@ -378,6 +379,7 @@ function validateDisableQuestSetting() {
"disableQuestsDiscoveryTab",
"disableQuestsFetchingQuests",
"disableQuestsDirectMessagesTab",
"disableQuestsPageSponsoredBanner",
"disableQuestsPopupAboveAccountPanel",
"disableQuestsBadgeOnUserProfiles",
"disableQuestsGiftInventoryRelocationNotice",
@ -385,7 +387,7 @@ function validateDisableQuestSetting() {
"disableMembersListActivelyPlayingIcon"
]);
if (disableQuestsDiscoveryTab || disableQuestsDirectMessagesTab || disableQuestsFetchingQuests || disableQuestsPopupAboveAccountPanel || disableQuestsBadgeOnUserProfiles || disableQuestsGiftInventoryRelocationNotice || disableFriendsListActiveNowPromotion || disableMembersListActivelyPlayingIcon) {
if (disableQuestsDiscoveryTab || disableQuestsDirectMessagesTab || disableQuestsPageSponsoredBanner || disableQuestsFetchingQuests || disableQuestsPopupAboveAccountPanel || disableQuestsBadgeOnUserProfiles || disableQuestsGiftInventoryRelocationNotice || disableFriendsListActiveNowPromotion || disableMembersListActivelyPlayingIcon) {
settings.store.disableQuestsEverything = false;
}
}
@ -673,6 +675,7 @@ function DisableQuestsSetting(): JSX.Element {
disableQuestsDiscoveryTab,
disableQuestsFetchingQuests,
disableQuestsDirectMessagesTab,
disableQuestsPageSponsoredBanner,
disableQuestsPopupAboveAccountPanel,
disableQuestsBadgeOnUserProfiles,
disableQuestsGiftInventoryRelocationNotice,
@ -687,6 +690,7 @@ function DisableQuestsSetting(): JSX.Element {
"disableQuestsDiscoveryTab",
"disableQuestsFetchingQuests",
"disableQuestsDirectMessagesTab",
"disableQuestsPageSponsoredBanner",
"disableQuestsPopupAboveAccountPanel",
"disableQuestsBadgeOnUserProfiles",
"disableQuestsGiftInventoryRelocationNotice",
@ -706,6 +710,7 @@ function DisableQuestsSetting(): JSX.Element {
{ label: "Disable Popup Above User Panel", value: "popup", selected: disableQuestsPopupAboveAccountPanel, type: "disable" },
{ label: "Disable Discovery Tab Relocation Notice", value: "discovery", selected: disableQuestsDiscoveryTab, type: "disable" },
{ label: "Disable Gift Inventory Relocation Notice", value: "inventory", selected: disableQuestsGiftInventoryRelocationNotice, type: "disable" },
{ label: "Disable Sponsored Banner on Quests Page", value: "sponsored-banner", selected: disableQuestsPageSponsoredBanner, type: "disable" },
{ label: "Disable Friends List Active Now Promotion", value: "friends-list", selected: disableFriendsListActiveNowPromotion, type: "disable" },
{ label: "Disable Members List Actively Playing Icon", value: "members-list", selected: disableMembersListActivelyPlayingIcon, type: "disable" },
{ label: "Make Mobile Quests Desktop Compatible", value: "mobile-desktop-compatible", selected: makeMobileQuestsDesktopCompatible, type: "modification" },
@ -735,6 +740,7 @@ function DisableQuestsSetting(): JSX.Element {
settings.store.disableQuestsDiscoveryTab = enabledValues.includes("discovery");
settings.store.disableQuestsFetchingQuests = enabledValues.includes("fetching");
settings.store.disableQuestsDirectMessagesTab = enabledValues.includes("dms");
settings.store.disableQuestsPageSponsoredBanner = enabledValues.includes("sponsored-banner");
settings.store.disableQuestsPopupAboveAccountPanel = enabledValues.includes("popup");
settings.store.disableQuestsBadgeOnUserProfiles = enabledValues.includes("badge");
settings.store.disableQuestsGiftInventoryRelocationNotice = enabledValues.includes("inventory");
@ -1622,6 +1628,12 @@ export const settings = definePluginSettings({
default: false,
hidden: true
},
disableQuestsPageSponsoredBanner: {
type: OptionType.BOOLEAN,
description: "Disable the sponsored banner on the Quest page.",
default: false,
hidden: true
},
disableQuestsPopupAboveAccountPanel: {
type: OptionType.BOOLEAN,
description: "Disable the Quest popup above your account panel.",