Questify: Temp intl fix. (#459)

* Temp fix.

* Temp fix.
This commit is contained in:
Etorix 2025-10-16 15:52:22 -07:00 • committed by GitHub
parent b1b0c48edd
commit c042350765
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View file

@ -17,7 +17,7 @@ import { JSX } from "react";
import { addIgnoredQuest, addRerenderCallback, autoFetchCompatible, fetchAndAlertQuests, maximumAutoFetchIntervalValue, minimumAutoFetchIntervalValue, questIsIgnored, removeIgnoredQuest, rerenderQuests, settings, startAutoFetchingQuests, stopAutoFetchingQuests, validateAndOverwriteIgnoredQuests } from "./settings";
import { ExcludedQuestMap, GuildlessServerListItem, Quest, QuestIcon, QuestMap, QuestStatus, RGB } from "./utils/components";
import { adjustRGB, decimalToRGB, fetchAndDispatchQuests, formatLowerBadge, getFormattedNow, getIgnoredQuestIDs, getQuestStatus, isDarkish, leftClick, middleClick, normalizeQuestName, q, QuestifyLogger, questPath, QuestsStore, refreshQuest, reportPlayGameQuestProgress, reportVideoQuestProgress, rightClick, setIgnoredQuestIDs, waitUntilEnrolled } from "./utils/misc";
import { adjustRGB, decimalToRGB, fetchAndDispatchQuests, formatLowerBadge, getFormattedNow, getIgnoredQuestIDs, getIntlMessageQuestify, getQuestStatus, isDarkish, leftClick, middleClick, normalizeQuestName, q, QuestifyLogger, questPath, QuestsStore, refreshQuest, reportPlayGameQuestProgress, reportVideoQuestProgress, rightClick, setIgnoredQuestIDs, waitUntilEnrolled } from "./utils/misc";
const patchedMobileQuests = new Set<string>();
export const activeQuestIntervals = new Map<string, { progressTimeout: NodeJS.Timeout; rerenderTimeout: NodeJS.Timeout; progress: number; duration: number, type: string; }>();
@ -741,11 +741,12 @@ function getQuestAcceptedButtonText(quest: Quest): string | null {
const timeRemaining = Math.max(0, duration - progress);
const progressFormatted = `${String(Math.floor(timeRemaining / 60)).padStart(2, "0")}:${String(timeRemaining % 60).padStart(2, "0")}`;
// TODO: Revert to using the built-in getIntlMessage once Discord has properly deployed the new system.
if (questEnrolledAt && ((playType && completeGameQuestsInBackground) || (watchType && completeVideoQuestsInBackground))) {
if (!!intervalData) {
return getIntlMessage("QUESTS_VIDEO_WATCH_RESUME_WITH_TIME_CTA", { remainTime: progressFormatted }, true)[0].replace(getIntlMessage("GAME_LIBRARY_UPDATES_ACTION_RESUME"), getIntlMessage(playType ? "USER_ACTIVITY_PLAYING" : "USER_ACTIVITY_WATCHING"));
return getIntlMessageQuestify("QUESTS_VIDEO_WATCH_RESUME_WITH_TIME_CTA", { remainTime: progressFormatted })[0].replace(getIntlMessage("GAME_LIBRARY_UPDATES_ACTION_RESUME"), getIntlMessage(playType ? "USER_ACTIVITY_PLAYING" : "USER_ACTIVITY_WATCHING"));
} else if (watchType || (playType && IS_DISCORD_DESKTOP)) {
return getIntlMessage("QUESTS_VIDEO_WATCH_RESUME_WITH_TIME_CTA", { remainTime: progressFormatted }, true)[0];
return getIntlMessageQuestify("QUESTS_VIDEO_WATCH_RESUME_WITH_TIME_CTA", { remainTime: progressFormatted })[0];
}
}

View file

@ -5,6 +5,7 @@
*/
import { classNameFactory } from "@api/Styles";
import { getIntlMessageFromHash, runtimeHashMessageKey, runtimeHashMessageKeyLegacy } from "@utils/index";
import { Logger } from "@utils/Logger";
import { findStoreLazy } from "@webpack";
import { FluxDispatcher, RestAPI, UserStore } from "@webpack/common";
@ -20,6 +21,14 @@ export const leftClick = 0;
export const middleClick = 1;
export const rightClick = 2;
// TODO: Remove this once Discord has properly deployed the new system.
export function getIntlMessageQuestify(key: string, values?: Record<PropertyKey, any>): string[] {
const remake = getIntlMessageFromHash(runtimeHashMessageKey(key), values, key);
const legacy = getIntlMessageFromHash(runtimeHashMessageKeyLegacy(key), values, key);
return remake.length ? remake : legacy.length ? legacy : [""];
}
export function setIgnoredQuestIDs(questIDs: string[], userId?: string): void {
const currentUserID = userId ?? UserStore.getCurrentUser()?.id;
if (!currentUserID) return;