Skip to content

Add window/application lifecycle delegation for desktop shells #30735

Closed

Description

@stuartmorgan-g

Example use case: A document-based Flutter application should be able to prevent a window from being closed (e.g., with an alert) if the document corresponding to that window is unsaved.

At the very least plugins need to be able to register for application and window lifecycle events (as they can for application lifecycle on iOS), but we may want to consider making system channels for the most common cases.

Activity

  1. added
    engineflutter/engine related. See also e: labels.
    and removed on Jul 26, 2019
  2. added this to the milestone on Aug 13, 2019
  3. dschuyler commented on Oct 1, 2019

    @dschuyler

    Would this use the AppLifecycleState and State<LifecycleWatcher> or would it be some other mechanism (just asking to understand better)?

  4. stuartmorgan-g commented on Oct 1, 2019

    @stuartmorgan-g
    ContributorAuthor

    The specific case that this was originally filed for was delegation, not just observation, so at least some new mechanism would be needed. Supporting the existing lifecycle structure might be part of it though.

  5. stuartmorgan-g commented on Jan 23, 2020

    @stuartmorgan-g
    ContributorAuthor

    Capturing from a Discord discussion about autoupdate on Windows:

    Squirrel supports customizing installation and post-update by running your app with a special command-line flag --squirrel-install, --squirrel-updated, etc etc - your Flutter app needs to do what it wants for that customization (set up shortcuts, file associations, whatever), then immediately exit without opening a Window

    Autoupdate is something that we want to facilitate building plugins for, so we should make sure there's a lifecycle hook that's before the window is displayed.

  6. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  7. hpoul commented on Aug 12, 2020

    @hpoul
    Contributor

    Implementation of AppLifecycleState would be great. My use-case: auto-close/lock of open files when the app is in the background/idle for some time. Would be the easiest way to detect when the user hasn't interacted with the app for some time. (ie. inactive vs resumed)

  8. stuartmorgan-g commented on Aug 12, 2020

    @stuartmorgan-g
    ContributorAuthor

    Implementation of AppLifecycleState would be great. My use-case: auto-close/lock of open files when the app is in the background/idle for some time. Would be the easiest way to detect when the user hasn't interacted with the app for some time. (ie. inactive vs resumed)

    "Idle" isn't a clear, OS-defined application state, and would not be part of this. If you want to do something based on the user not interacting with the app for a while, that is something you would need to implement yourself based on what "idle" means to your use case.

  9. 16 remaining items

  10. gspencergoog commented on Oct 19, 2023

    @gspencergoog
    Contributor

    This has been completed. See AppLifecycleListener and the related classes.

  11. github-actions commented on Nov 2, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Nov 2, 2023
  13. added
    team-macosOwned by the macOS platform team
    and removed on Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: desktopRunning on desktopc: new featureNothing broken; request for a new capabilitycustomer: crowdAffects or could affect many people, though not necessarily a specific customer.customer: octopodengineflutter/engine related. See also e: labels.platform-linuxBuilding on or for Linux specificallyplatform-macosBuilding on or for macOS specificallyplatform-windowsBuilding on or for Windows specificallyteam-macosOwned by the macOS platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions