mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 21:02:00 +00:00
fix(toaster): remove critical toast logic as ProcessNotification handles it for us
This commit is contained in:
@@ -49,7 +49,6 @@ class TabsHook extends Logger {
|
|||||||
const patchHandler = createReactTreePatcher(
|
const patchHandler = createReactTreePatcher(
|
||||||
[(tree) => findInReactTree(tree, (node) => node?.props?.onFocusNavDeactivated)],
|
[(tree) => findInReactTree(tree, (node) => node?.props?.onFocusNavDeactivated)],
|
||||||
(args, ret) => {
|
(args, ret) => {
|
||||||
this.log('qam render', args, ret);
|
|
||||||
const tabs = findInReactTree(ret, (x) => x?.props?.tabs);
|
const tabs = findInReactTree(ret, (x) => x?.props?.tabs);
|
||||||
this.render(tabs.props.tabs, args[0].visible);
|
this.render(tabs.props.tabs, args[0].visible);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -63,7 +62,6 @@ class TabsHook extends Logger {
|
|||||||
const root = getReactRoot(document.getElementById('root') as any);
|
const root = getReactRoot(document.getElementById('root') as any);
|
||||||
const qamNode = root && findInReactTree(root, (n: any) => n.elementType == qamRenderer); // need elementType, because type is actually mobx wrapper
|
const qamNode = root && findInReactTree(root, (n: any) => n.elementType == qamRenderer); // need elementType, because type is actually mobx wrapper
|
||||||
if (qamNode) {
|
if (qamNode) {
|
||||||
this.debug('qamNode', qamNode);
|
|
||||||
// Only affects this fiber node so we don't need to unpatch here
|
// Only affects this fiber node so we don't need to unpatch here
|
||||||
qamNode.type = qamNode.elementType.type;
|
qamNode.type = qamNode.elementType.type;
|
||||||
if (qamNode?.alternate) {
|
if (qamNode?.alternate) {
|
||||||
|
|||||||
@@ -67,32 +67,24 @@ class Toaster extends Logger {
|
|||||||
if (toast.playSound === undefined) toast.playSound = true;
|
if (toast.playSound === undefined) toast.playSound = true;
|
||||||
if (toast.showToast === undefined) toast.showToast = true;
|
if (toast.showToast === undefined) toast.showToast = true;
|
||||||
if (toast.timestamp === undefined) toast.timestamp = new Date();
|
if (toast.timestamp === undefined) toast.timestamp = new Date();
|
||||||
if (
|
|
||||||
(window.settingsStore.settings.bDisableAllToasts && !toast.critical) ||
|
|
||||||
(window.settingsStore.settings.bDisableToastsInGame &&
|
|
||||||
!toast.critical &&
|
|
||||||
window.NotificationStore.BIsUserInGame())
|
|
||||||
)
|
|
||||||
return;
|
|
||||||
if (toast.showToast) {
|
|
||||||
function fnTray(toast: any, tray: any) {
|
function fnTray(toast: any, tray: any) {
|
||||||
let group = {
|
let group = {
|
||||||
eType: toast.eType,
|
eType: toast.eType,
|
||||||
notifications: [toast],
|
notifications: [toast],
|
||||||
};
|
};
|
||||||
tray.unshift(group);
|
tray.unshift(group);
|
||||||
// TODO do we need to handle expiration?
|
// TODO do we need to handle expiration? how do we do that?
|
||||||
}
|
}
|
||||||
const info = {
|
const info = {
|
||||||
showToast: toast.showToast,
|
showToast: toast.showToast,
|
||||||
sound: toast.sound,
|
sound: toast.sound,
|
||||||
eFeature: 0,
|
eFeature: 0,
|
||||||
toastDurationMS: toastData.nToastDurationMS,
|
toastDurationMS: toastData.nToastDurationMS,
|
||||||
|
bCritical: toast.critical,
|
||||||
fnTray,
|
fnTray,
|
||||||
};
|
};
|
||||||
window.NotificationStore.ProcessNotification(info, toastData, ToastType.New);
|
window.NotificationStore.ProcessNotification(info, toastData, ToastType.New);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
deinit() {
|
deinit() {
|
||||||
this.toastPatch?.unpatch();
|
this.toastPatch?.unpatch();
|
||||||
|
|||||||
Reference in New Issue
Block a user