-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[HOLD App#51475] feat: setup background task from scratch on iOS #53834
base: main
Are you sure you want to change the base?
[HOLD App#51475] feat: setup background task from scratch on iOS #53834
Conversation
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
2ee195e
to
240573a
Compare
🚧 @mountiny has triggered a test build. You can view the workflow run here. |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
@mananjadhav any updates? |
Will be checking in next 10 mins. I did check this yesterday and the messages didn't arrive in like 5-8 mins. I couldn't check after that. But I'll be doing another test today. |
@szymonrybczak I tried to test this and it didn't work for me. I sent a message at 21:55 my time and it's 22:13 my time right now. No messages. I sent 10-13. I tried different variations and I checked on two iPhones by the way - iPhone X and iPhone 16 plus. ios-background-to-foreground.MP4 |
Explanation of Change
Warning
This Pull Request is rebased on top of the Upgrade to React Native 0.76 Pull Request because it's using a new type-safe way of creating EventEmitters available only in 0.76.
Adds an implementation of background task on iOS. This implemenation leverages BGTaskScheduler API, which is iOS specific API available from iOS 13 responsible for scheduling and executing background tasks. For our specific use case we're using BGProcessingTask which is designed for executing longer tasks e.g. syncing requests as in our case that can take longer.
From the more technical perspective it's a C++ TurboModule that was bootstrapped as a Local Library so it's linked inside
package.json
.For now, we're scheduling new tasks in 15-minute intervals after the execution of the previous one.
How to test it?
To force execution of the background task can use Xcode debugger attached to physical iPhone device:
Here's a video presenting this behaviour:
CleanShot.2024-12-10.at.11.59.35.mp4
Fixed Issues
$ #50140
PROPOSAL: #50140
Tests
Offline tests
QA Steps
Note: take into account that could some time for the first time, this times will be improved and vary depending on the app usage on the device. We set the interval between tasks to 15 minutes but at the end of the day iOS decides when to execute it.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop