-
Notifications
You must be signed in to change notification settings - Fork 447
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
Window destroy on android and iOS #3733
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis pull request introduces a new feature that allows the application to destroy the window (exit the app) on Android and iOS platforms. The implementation checks the platform and calls the appropriate method to exit the app. Significant changes include importing necessary libraries and modifying the 'destroyWindow' function to handle mobile platforms. File-Level Changes
Tips
|
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.
Hey @bl1nch - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider using a more graceful shutdown method for iOS instead of
exit(0)
, which may not allow for proper cleanup. - The logic could be simplified by removing the redundant
isDesktop()
check and potentially adding a default case for unknown platforms.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
if (isDesktop()) { | ||
if (isDesktop() || isMobile()) { | ||
debugPrint("destroyWindow()"); |
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.
suggestion: Remove redundant platform check as all cases are handled specifically.
The isDesktop() || isMobile()
check is no longer necessary since all platforms are handled in the subsequent conditions. Consider removing this check and keeping only the debug print statement outside of any condition.
if (isDesktop()) { | |
if (isDesktop() || isMobile()) { | |
debugPrint("destroyWindow()"); | |
debugPrint("destroyWindow()"); |
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.
Hey @bl1nch - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding unit tests to ensure the window destroy functionality works correctly across all platforms.
- Using
exit(0)
for iOS might be too abrupt. Consider implementing a more graceful shutdown process that allows for proper cleanup. - Research and implement platform-specific best practices for app termination on mobile platforms to improve user experience.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
Future destroyWindow() async { | ||
if (isDesktop()) { | ||
if (isDesktop() || isMobile()) { | ||
debugPrint("destroyWindow()"); | ||
} |
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.
suggestion: Consider renaming the function to reflect its expanded functionality
The destroyWindow()
function now handles application exit for both desktop and mobile platforms. Consider renaming it to something more general like exitApplication()
or terminateApp()
to accurately reflect its broader purpose.
Future destroyWindow() async { | |
if (isDesktop()) { | |
if (isDesktop() || isMobile()) { | |
debugPrint("destroyWindow()"); | |
} | |
Future terminateApp() async { | |
if (isDesktop() || isMobile()) { | |
debugPrint("terminateApp()"); | |
} |
Description
This PR should provide window destroy (app exit) function for Android and IOS platforms
Type of change
Checklist:
Summary by Sourcery
This pull request introduces a new feature that allows the application to destroy the window (exit the app) on Android and iOS platforms. The implementation checks the platform and performs the appropriate action to close the app.