Skip to content
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

darwin: add event ApplicationShouldHandleReopen #2991

Merged
merged 7 commits into from
Oct 22, 2023

Conversation

5aaee9
Copy link
Contributor

@5aaee9 5aaee9 commented Oct 17, 2023

Description

This pull request add new Event ApplicationShouldHandleReopen to handle dock click in macOS.

This is useful to app which use close button to hide itself (Example in examples/hide-window).

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested in darwin in the example

  • Windows
  • macOS
  • Linux

Test Configuration

# System
┌─────────────────────────┐
| OS           | MacOS    |
| Version      | 12.6.7   |
| ID           | 21G651   |
| Go Version   | go1.20.7 |
| Platform     | darwin   |
| Architecture | amd64    |
└─────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────────────┐
| Dependency                | Package Name | Status    | Version |
| Xcode command line tools  | N/A          | Installed | 2395    |
| Nodejs                    | N/A          | Installed | 20.7.0  |
| npm                       | N/A          | Installed | 10.1.0  |
| *Xcode                    | N/A          | Available |         |
| *upx                      | N/A          | Available |         |
| *nsis                     | N/A          | Available |         |
└─────────────────── * - Optional Dependency ────────────────────┘

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@netlify
Copy link

netlify bot commented Oct 17, 2023

👷 Deploy request for dapper-pastelito-9b5e5b pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 917c752

@leaanthony
Copy link
Member

Thanks for this! If you run wails3 task generate:events from the v3 directory then it will generate the correct IDs 🙏

@5aaee9
Copy link
Contributor Author

5aaee9 commented Oct 19, 2023

@leaanthony Generated new ID list. It correct now?

- (BOOL)applicationShouldHandleReopen:(NSNotification *)notification
hasVisibleWindows:(BOOL)flag {
if( hasListeners(EventApplicationShouldHandleReopen) ) {
processApplicationEvent(EventApplicationShouldHandleReopen, NULL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be useful to pass the flag with the event?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. The processApplicationEvent now accept NSDirectory and will save to the ApplicationEventContext

Copy link
Member

@leaanthony leaanthony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants