mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 19:02:03 +00:00
Revert "Rewrite toaster hook to not re-create the window (#217)"
This reverts commit 3ac0abc82b.
This commit is contained in:
@@ -32,7 +32,7 @@ const Toast: FunctionComponent<ToastProps> = ({ toast }) => {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{ '--toast-duration': `${toast.nToastDurationMS}ms` } as React.CSSProperties}
|
style={{ '--toast-duration': `${toast.nToastDurationMS}ms` } as React.CSSProperties}
|
||||||
className={toastClasses.toastEnter}
|
className={joinClassNames(toastClasses.ToastPopup, toastClasses.toastEnter)}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
onClick={toast.data.onClick}
|
onClick={toast.data.onClick}
|
||||||
|
|||||||
+24
-13
@@ -38,23 +38,34 @@ class Toaster extends Logger {
|
|||||||
await sleep(2000);
|
await sleep(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.node = instance.sibling.child;
|
this.node = instance.return.return;
|
||||||
let toast: any;
|
let toast: any;
|
||||||
let renderedToast: ReactNode = null;
|
let renderedToast: ReactNode = null;
|
||||||
afterPatch(this.node, 'type', (args: any[], ret: any) => {
|
this.node.stateNode.render = (...args: any[]) => {
|
||||||
const currentToast = args[0].notification;
|
const ret = this.node.stateNode.__proto__.render.call(this.node.stateNode, ...args);
|
||||||
if (currentToast?.decky) {
|
if (ret) {
|
||||||
if (currentToast !== toast) {
|
this.instanceRetPatch = afterPatch(ret, 'type', (_: any, ret: any) => {
|
||||||
toast = currentToast;
|
if (ret?.props?.children[1]?.children?.props) {
|
||||||
renderedToast = <Toast toast={toast} />;
|
const currentToast = ret.props.children[1].children.props.notification;
|
||||||
}
|
if (currentToast?.decky) {
|
||||||
ret.props.children = renderedToast;
|
if (currentToast == toast) {
|
||||||
} else {
|
ret.props.children[1].children = renderedToast;
|
||||||
toast = null;
|
} else {
|
||||||
renderedToast = null;
|
toast = currentToast;
|
||||||
|
renderedToast = <Toast toast={toast} />;
|
||||||
|
ret.props.children[1].children = renderedToast;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
toast = null;
|
||||||
|
renderedToast = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
});
|
};
|
||||||
|
this.node.stateNode.forceUpdate();
|
||||||
this.settingsModule = findModuleChild((m) => {
|
this.settingsModule = findModuleChild((m) => {
|
||||||
if (typeof m !== 'object') return undefined;
|
if (typeof m !== 'object') return undefined;
|
||||||
for (let prop in m) {
|
for (let prop in m) {
|
||||||
|
|||||||
Reference in New Issue
Block a user