Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@maRci002
Copy link
Contributor

@maRci002 maRci002 commented Aug 15, 2023

closes flutter/flutter#53107

This PR introduces support for AppLifecycleState on Web, aligning the web's lifecycle events with those of the mobile platforms. This ensures a more consistent developer experience and better lifecycle management across all platforms.

PR includes:

  • Page Visibility Handling: Integrated the visibilitychange DOM event to determine if the app is in a resumed or paused state based on the visibility state of the document.
  • Page Transition Handling: Used beforeunload events to better manage the detached state.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Aug 15, 2023
@maRci002 maRci002 marked this pull request as ready for review August 15, 2023 11:04
@maRci002
Copy link
Contributor Author

@yjbanov @ditman, can you please add a reviewer?

@flutter-dashboard
Copy link

This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again.

@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

@gspencergoog
Copy link
Contributor

Where are we on this? I'd like to land it soon if possible. @maRci002 if you aren't able to, or don't have time to address the remaining issues, please let us know.

@maRci002
Copy link
Contributor Author

Hey @gspencergoog, I was able to resolve the earlier timeout issue.

However, I've now come across a new challenge while working with the flutter_test package, specifically the lifecycle_test.dart file. The code expects expect(ServicesBinding.instance.lifecycleState, isNull), but in my implementation, an initial 'resumed' state is being sent right at the start, which seems to be causing conflicts.

I'm not sure how to best handle this in lifecycle_test.dart. Do you have any suggestions or workarounds for managing the lifecycle state in this scenario?

@gspencergoog
Copy link
Contributor

However, I've now come across a new challenge while working with the flutter_test package, specifically the lifecycle_test.dart file. The code expects expect(ServicesBinding.instance.lifecycleState, isNull), but in my implementation, an initial 'resumed' state is being sent right at the start, which seems to be causing conflicts.

I don't think that expectation is needed anyhow. I'm going to remove it, see this PR: flutter/flutter#141822

auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 22, 2024
## Description

This removes an unneeded expectation in the test for the AppLifecycleListener.  It's unneeded because the test immediately resets the state anyhow.  I'm removing it because the web implementation sets the value when initializing, so it's never initially null there.

## Related PR
 - flutter/engine#44720 (comment)
@maRci002
Copy link
Contributor Author

I don't think that expectation is needed anyhow. I'm going to remove it, see this PR: flutter/flutter#141822

Thanks for the fast pull request; now every check passes.

@gspencergoog gspencergoog added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 25, 2024
@auto-submit auto-submit bot merged commit 6559258 into flutter:main Jan 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 25, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 25, 2024
…142245)

flutter/engine@3b47793...55eefd5

2024-01-25 [email protected] Roll Skia from bcc2e8b6105a to de46a989e0ca (1 revision) (flutter/engine#50046)
2024-01-25 [email protected] [Impeller] turned on vulkan validation for all but one golden test (flutter/engine#50045)
2024-01-25 [email protected] Roll Skia from 56c06ee7a252 to bcc2e8b6105a (2 revisions) (flutter/engine#50042)
2024-01-25 [email protected] [Impeller] call shutdown method in Android context. (flutter/engine#49992)
2024-01-25 [email protected] [web] add support for AppLifecycleState changes (flutter/engine#44720)
2024-01-25 [email protected] Roll Skia from 416d7b0e5ba1 to 56c06ee7a252 (1 revision) (flutter/engine#50040)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Chralu added a commit to archethic-foundation/archethic-wallet that referenced this pull request Jun 12, 2024
Chralu added a commit to archethic-foundation/archethic-wallet that referenced this pull request Jun 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support didChangeAppLifecycleState for web

5 participants