-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add background app refresh support #892
Conversation
32ebe7c
to
e583986
Compare
Generated by 🚫 Danger Swift against 8316038 |
@@ -84,6 +84,9 @@ final class AppSettings { | |||
/// that don't yet have an officially trusted proxy configured in their well-known. | |||
let slidingSyncProxyURL: URL? = nil | |||
|
|||
/// The task identifier used for background app refresh. Also used in main target's the Info.plist | |||
let backgroundAppRefreshTaskIdentifier = "io.element.elementx.background.refresh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we use the InfoPlistReader for this value here? So the string is always tied (don't think we are changing bundle name, but for for forks could be useful)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it but with multiple task identifiers in that plist array you wouldn't actually know which one's which
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wha if we make sure that the plist arrat is always ordered in a certain way?
I guess a comment in the .yml on the expected order could help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's finicky and can lead to pretty bad bugs. Better to be safe than sorry.
…tes and privates are ordered better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This PR add support for background app refreshes.
The app currently stops syncing after a background task that starts when the app resigns active expires. We will now also schedule a background refresh task to run 30 seconds after this happens (just a suggestion for the system). When that happens the sync is restarted. It will attempt to run for a maximum or 10 sync responses or 10 seconds and then shut down again.
How to test this amazing piece of kit:
Successfully scheduled background app refresh task
e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"io.element.elementx.background.refresh"]
(https://developer.apple.com/documentation/backgroundtasks/starting_and_terminating_tasks_during_development)