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

[v2/Mac] Handle application terminate #3157

Merged
merged 3 commits into from
Jan 7, 2024
Merged

[v2/Mac] Handle application terminate #3157

merged 3 commits into from
Jan 7, 2024

Conversation

almas1992
Copy link
Contributor

@almas1992 almas1992 commented Dec 26, 2023

Description

Intercept processing dock icon right-click exit.

Fixes #3095

Type of change

Please delete options that are not relevant.

  • 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?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • Windows
  • macOS
  • Linux

Test Configuration

Please paste the output of wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.

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

Summary by CodeRabbit

  • New Features

    • Implemented a new check before the application exits to ensure safe termination.
  • Refactor

    • Integrated new message processing method to enhance application shutdown procedures.

Copy link
Contributor

coderabbitai bot commented Dec 26, 2023

Walkthrough

The recent update to the desktop application for Darwin systems involves enhancing the AppDelegate class. A new import for a message handler was added, and a method to determine the app's termination behavior was implemented. This method intercepts the termination request, processes a specific message, and then cancels the termination.

Changes

File Path Change Summary
v2/internal/frontend/desktop/darwin/... Added import for "message.h", implemented applicationShouldTerminate: method.

🐰🌟
In the code where bits align,
A rabbit hopped and left a sign.
"No quitting now," it softly said,
"Keep running loops, with no thread shed." 🥕✨

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid.
    • @coderabbitai read the files in the src/scheduler package and generate README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 3c7a218 and 991422a.
Files selected for processing (1)
  • v2/internal/frontend/desktop/darwin/AppDelegate.m (2 hunks)
Additional comments: 2
v2/internal/frontend/desktop/darwin/AppDelegate.m (2)
  • 12-12: The import statement for "message.h" has been added correctly and is necessary for the invocation of processMessage in the new method applicationShouldTerminate:. Ensure that "message.h" is located in the project's include paths.

  • 26-29: The implementation of applicationShouldTerminate: correctly intercepts the termination process. The call to processMessage("Q") should be reviewed to ensure it properly handles the termination signal. Returning NSTerminateCancel is appropriate to cancel the default termination so the application can perform its own cleanup.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 991422a and 83278ba.
Files selected for processing (1)
  • website/src/pages/changelog.mdx (1 hunks)
Additional comments: 1
website/src/pages/changelog.mdx (1)
  • 23-23: The changelog entry for the dock icon right-click exit handling feature is correctly added under the "Unreleased" section, categorized as "Added", and includes the contributor's handle and PR link for traceability.

@almas1992
Copy link
Contributor Author

@leaanthony Should I close this PR?

@leaanthony
Copy link
Member

No, not at all! I've just not had chance to test it yet.

Copy link
Collaborator

@stffabi stffabi left a comment

Choose a reason for hiding this comment

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

Worked perfectly in our app. Was also going to put up a PR for this 😄

Thanks for your time 🙏

@leaanthony leaanthony merged commit bf389e3 into wailsapp:master Jan 7, 2024
8 checks passed
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.

macOS cannot receive shutdown signal
3 participants