[mob][photos] add grace window plugin for ios#9755
[mob][photos] add grace window plugin for ios#9755prateekmedia wants to merge 43 commits intoente-io:mainfrom
Conversation
# Conflicts: # mobile/apps/photos/lib/main.dart # mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart
Both onAppForeground and _waitForGraceWindowExpiration now snapshot DateTime.now() before yielding to the event loop, ensuring concurrent sync() lock acquisitions are never accidentally released.
344745c to
f29508f
Compare
f29508f to
c71eea4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 344745c90d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (nextSchedule != null) { | ||
| await scheduleIOSBackgroundProcessingTask( | ||
| source: "$source:${reason ?? nextSchedule.reason}", | ||
| initialDelay: nextSchedule.delay, | ||
| reason: nextSchedule.reason, |
There was a problem hiding this comment.
Skip rescheduling processing task while app is foregrounded
handleIOSBackgroundProcessingTaskCompletion always re-schedules a processing task when nextSchedule is non-null, but UploadBackgroundCoordinator.onAppForeground() explicitly cancels this task when the app returns to foreground. If a background processing callback finishes after that foreground transition, this code re-creates the canceled task, leading to unnecessary background wakeups and defeating the foreground cancellation path. Add a foreground-state guard before scheduling.
Useful? React with 👍 / 👎.
Merge ios_background_handoff.dart into BgTaskUtils (removes 8 delegation methods and a separate module). Inline BackgroundRunHelper lease logic into main.dart as flat functions. Replace IOSBackgroundProcessingSchedule class with a Dart record. Remove BackgroundSkipReason enum in favor of inline log messages. Deletes: background_run_helper.dart, ios_background_handoff.dart, background_run_helper_test.dart (tested a now-deleted class).
Description
Allow operations to run for a short interval in background using grace window.
Tests