diff --git a/gui-patches/online-shop/defer-explicit-browser-update-to-close/patch.json b/gui-patches/online-shop/defer-explicit-browser-update-to-close/patch.json new file mode 100644 index 0000000..b157861 --- /dev/null +++ b/gui-patches/online-shop/defer-explicit-browser-update-to-close/patch.json @@ -0,0 +1,30 @@ +{ + "id": "online-shop/defer-explicit-browser-update-to-close", + "title": "Refresh local commerce once from the browser close handler", + "file": "scripts/onlineshop/browserwnd.nut", + "program_behaviour": { + "stock": "The browser close-and-update control issues a refresh before closing the window.", + "patched": "For local commerce, the control closes the window and leaves the refresh to its close handler." + }, + "derivation": { + "requirement": "Perform the same profile refresh for the close-and-update control and other close paths.", + "cause": "The control already requests an update. A second update before the first completes could add a redundant task.", + "lighter_options_ruled_out": [ + "The local service observes requests and grants. The window lifecycle is managed by the client.", + "Keep two refresh paths for local commerce. This can send two native tasks for one close." + ], + "if_not_applied": "The explicit close-and-update control can request an extra refresh." + }, + "features": [ + "G-Store", + "G-Marketplace" + ], + "evidence": [ + "2.61.0.37 scripts/onlineshop/browserwnd.nut: BrowserModalHandler.browserCloseAndUpdateEntitlements.", + "gui-patches/online-shop/refresh-profile-after-browser-close: local commerce close detection." + ], + "edit": { + "find": " function browserCloseAndUpdateEntitlements() {\r\n addTask(updateEntitlementsLimited(),", + "replace": " function browserCloseAndUpdateEntitlements() {\r\n if (this.isLocalCommercePage())\r\n return this.goBack()\r\n\r\n addTask(updateEntitlementsLimited()," + } +} diff --git a/gui-patches/online-shop/refresh-profile-after-browser-close/patch.json b/gui-patches/online-shop/refresh-profile-after-browser-close/patch.json new file mode 100644 index 0000000..413fddf --- /dev/null +++ b/gui-patches/online-shop/refresh-profile-after-browser-close/patch.json @@ -0,0 +1,31 @@ +{ + "id": "online-shop/refresh-profile-after-browser-close", + "title": "Refresh the current profile when the embedded commerce browser closes", + "file": "scripts/onlineshop/browserwnd.nut", + "program_behaviour": { + "stock": "Destroying the browser broadcasts its normal close event. Only the dedicated update button requests the profile, subject to the shared cooldown.", + "patched": "Closing a local store or marketplace page through any browser close path requests an immediate profile update." + }, + "derivation": { + "requirement": "Refresh the hangar after the local store or marketplace is closed, including when no purchase was made.", + "cause": "The local web request cannot observe the browser close. The existing update command can also omit a quick repeat close within its 20-second cooldown.", + "lighter_options_ruled_out": [ + "The local service observes requests and grants. The window lifecycle is managed by the client.", + "Keep the refetch on the dedicated button. Ordinary close paths still omit the refresh, and rapid repeats hit its cooldown." + ], + "if_not_applied": "A local browser window can close with stale purchase information in the hangar." + }, + "features": [ + "G-Store", + "G-Marketplace" + ], + "evidence": [ + "2.61.0.37 scripts/onlineshop/browserwnd.nut: BrowserModalHandler.onDestroy and browserCloseAndUpdateEntitlements.", + "2.61.0.37 scripts/onlineshop/entitlementsupdate.nut: updateEntitlementsLimited(true) forces a refresh when the char service is available.", + "packages/build/src/network/redirect-network-config.ts and scripts/inventory/inventoryclient.nut: local storefront and marketplace entry paths." + ], + "edit": { + "find": " function onDestroy() {\r\n broadcastEvent(\"DestroyEmbeddedBrowser\")\r\n }", + "replace": " function isLocalCommercePage() {\r\n let queryStart = this.url.indexof(\"?\")\r\n let page = queryStart == null ? this.url : this.url.slice(0, queryStart)\r\n return page == \"http://{{LOCAL_ENDPOINT}}/store\"\r\n || page == \"http://{{LOCAL_ENDPOINT}}/store/\"\r\n || page == \"http://{{LOCAL_ENDPOINT}}/trade.gaijin.net\"\r\n || page == \"http://{{LOCAL_ENDPOINT}}/trade.gaijin.net/\"\r\n }\r\n\r\n function onDestroy() {\r\n broadcastEvent(\"DestroyEmbeddedBrowser\")\r\n if (this.isLocalCommercePage())\r\n addTask(updateEntitlementsLimited(true), null, @() updateGamercards())\r\n }" + } +} diff --git a/gui-patches/online-shop/refresh-profile-after-currency-shop-close/patch.json b/gui-patches/online-shop/refresh-profile-after-currency-shop-close/patch.json new file mode 100644 index 0000000..2a96021 --- /dev/null +++ b/gui-patches/online-shop/refresh-profile-after-currency-shop-close/patch.json @@ -0,0 +1,30 @@ +{ + "id": "online-shop/refresh-profile-after-currency-shop-close", + "title": "Refresh the current profile after the currency shop closes", + "file": "scripts/onlineshop/onlineshop.nut", + "program_behaviour": { + "stock": "The close handler invokes its registered close callback. Automatic updates while open depend on overlay or application activity.", + "patched": "The close handler also schedules a full profile update through the existing entitlement task." + }, + "derivation": { + "requirement": "Refresh the hangar after leaving the currency shop, including when no purchase was made.", + "cause": "The native shop can close without transitioning through the focus or overlay state that starts the existing refresh.", + "lighter_options_ruled_out": [ + "The local service observes requests and grants. The window lifecycle is managed by the client.", + "Rely on the existing overlay activity check. A native currency shop can close without opening an overlay." + ], + "if_not_applied": "Closing the native currency shop does not always request a fresh profile." + }, + "features": [ + "G-Store", + "G-Premium Account" + ], + "evidence": [ + "2.61.0.37 scripts/onlineshop/onlineshop.nut: onDestroy, popCloseFunc, and the existing entitlement refresh task.", + "2.61.0.37 scripts/onlineshop/entitlementsupdate.nut: updateEntitlementsLimited(true)." + ], + "edit": { + "find": " function onDestroy() {\r\n this.popCloseFunc()\r\n }", + "replace": " function onDestroy() {\r\n this.popCloseFunc()\r\n addTask(updateEntitlementsLimited(true), null, @() updateGamercards())\r\n }" + } +} diff --git a/gui-patches/online-shop/refresh-profile-after-premium-shop-close/patch.json b/gui-patches/online-shop/refresh-profile-after-premium-shop-close/patch.json new file mode 100644 index 0000000..c3d5850 --- /dev/null +++ b/gui-patches/online-shop/refresh-profile-after-premium-shop-close/patch.json @@ -0,0 +1,30 @@ +{ + "id": "online-shop/refresh-profile-after-premium-shop-close", + "title": "Refresh the current profile after the Premium Account shop closes", + "file": "scripts/onlineshop/buypremiumhandler.nut", + "program_behaviour": { + "stock": "The close handler invokes its registered close callback. Automatic updates while open depend on overlay or application activity.", + "patched": "The close handler also schedules a full profile update through the existing entitlement task." + }, + "derivation": { + "requirement": "Refresh the hangar after leaving the Premium Account shop, including when no purchase was made.", + "cause": "The native shop can close without transitioning through the focus or overlay state that starts the existing refresh.", + "lighter_options_ruled_out": [ + "The local service observes requests and grants. The window lifecycle is managed by the client.", + "Rely on the existing overlay activity check. The Premium Account shop can close without opening an overlay." + ], + "if_not_applied": "Closing the Premium Account shop does not always request a fresh profile." + }, + "features": [ + "G-Store", + "G-Premium Account" + ], + "evidence": [ + "2.61.0.37 scripts/onlineshop/buypremiumhandler.nut: onDestroy, popCloseFunc, and the existing entitlement refresh task.", + "2.61.0.37 scripts/onlineshop/entitlementsupdate.nut: updateEntitlementsLimited(true)." + ], + "edit": { + "find": " function onDestroy() {\r\n this.popCloseFunc()\r\n }", + "replace": " function onDestroy() {\r\n this.popCloseFunc()\r\n addTask(updateEntitlementsLimited(true), null, @() updateGamercards())\r\n }" + } +}