-
Notifications
You must be signed in to change notification settings - Fork 37
[Sust] Refactor IPC Handlers and move them from main.ts #1256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
flavioislima
wants to merge
11
commits into
main
Choose a base branch
from
tech/sust_ipc_refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…desktop-client into tech/sust_ipc_refactor
biliesilva
approved these changes
Mar 12, 2025
BrettCleary
approved these changes
Mar 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. we should probably do some regression testing on this one
…client into tech/sust_ipc_refactor
…desktop-client into tech/sust_ipc_refactor
…desktop-client into tech/sust_ipc_refactor
nyghtstalker
approved these changes
Apr 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed regression tests on all platforms and no issues were found. Great job!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This sustainability/tech PR moves most of ipcMain.on and all ipcMain.handle requests from
main.ts
to theipcHandlers
folder in specifc filesasyncIpcHandlers
andsyncIpcHandlers
, leading to a cleanermain.ts
file with only important stuff and better redability and organization of the app files. I noticed some improvement in performance while in dev mode as well, but I cannot meassure by numbers (maybe placebo, maybe not 👀)main.ts
before => 2127 linesmain.ts
after => 640 linesDifference: 1487 lines
AI Summary
This pull request includes several changes to improve the backend functionality and correct a typo in the codebase. The most important changes include the addition of new IPC handlers, the correction of a typo in function names, and the implementation of a new function to check for game updates.
Backend Improvements:
src/backend/ipcHandlers/index.ts
: Added imports forsyncIpcHandlers
andasyncIpcHandlers
to handle synchronous and asynchronous IPC events.src/backend/ipcHandlers/syncIpcHandlers.ts
: Introduced a new file with multiple IPC event handlers to manage various backend operations such as focusing the main window, locking/unlocking the machine, opening URLs, setting zoom factors, and more.src/backend/utils.ts
: Added a new functioncheckGameUpdates
to handle game updates and send notifications.Typo Corrections:
src/backend/api/misc.ts
: Corrected the function name fromgetLocalPeloadPath
togetLocalPreloadPath
.src/frontend/screens/WebView/index.tsx
: Updated the function call to use the corrected function namegetLocalPreloadPath
.How to Test
Use the following Checklist if you have changed something on the Backend or Frontend: