move window method patches to be more generic (patch the wrapper module)

This commit is contained in:
Sqaaakoi 2025-02-19 04:26:05 +13:00
parent fa610acb0d
commit 13aa97c0a5
No known key found for this signature in database
3 changed files with 9 additions and 9 deletions

View file

@ -13,5 +13,5 @@ import "./screenShareFixes";
import "./spellCheck";
import "./windowsTitleBar";
import "./streamerMode";
import "./nativeFocus";
import "./windowMethods";
import "./hideDownloadAppsButton";

View file

@ -9,13 +9,17 @@ import { addPatch } from "./shared";
addPatch({
patches: [
{
find: ".DEEP_LINK]:{",
find: ",setSystemTrayApplications",
replacement: [
...["close", "minimize", "maximize"].map(op => ({
match: new RegExp(String.raw`\i\.window\.${op}`),
replace: `VesktopNative.win.${op}`
})),
{
// TODO: Fix eslint rule
// eslint-disable-next-line no-useless-escape
match: /(?<=\.DEEP_LINK.{0,200}?)\i\.\i\.focus\(\)/,
replace: "VesktopNative.win.focus()"
match: /(focus(\(\i\)){).{0,150}?\.focus\(\i,\i\)/,
replace: "$1VesktopNative.win.focus$2"
}
]
}

View file

@ -19,11 +19,7 @@ if (Settings.store.customTitleBar)
// eslint-disable-next-line no-useless-escape
match: /case \i\.\i\.WINDOWS:/,
replace: 'case "WEB":'
},
...["close", "minimize", "maximize"].map(op => ({
match: new RegExp(String.raw`\i\.\i\.${op}\b`),
replace: `VesktopNative.win.${op}`
}))
}
]
}
]