Conversation
The BGTaskScheduler is unavailable in HybridApp because the OldDot host app's Info.plist lacks the required BGTaskSchedulerPermittedIdentifiers configuration. Guard the defineTask call with CONFIG.IS_HYBRID_APP check and add .catch() to handle promise rejections gracefully. Co-authored-by: Mykhailo <mkhutornyi@users.noreply.github.com>
Co-authored-by: Mykhailo <mkhutornyi@users.noreply.github.com>
|
Fixed the failing typecheck: |
@MelvinBot this is false alarm. Hybrid app also defines |
|
Thanks for the correction, Looking more closely at the Apple SDK, Error code 1 typically fires when:
One thing worth checking: Given this, there are two options:
Which approach would you prefer? I can update the PR accordingly. |
…n test env Co-authored-by: Mykhailo <mkhutornyi@users.noreply.github.com>
|
Fixed the failing test checks: |
|
@MelvinBot implement option 1 |
The HybridApp does have BGTaskSchedulerPermittedIdentifiers configured, so the IS_HYBRID_APP guard was based on an incorrect premise. The error (BGTaskSchedulerErrorDomain error 1 = unavailable) can occur on iOS Simulator or when Background App Refresh is disabled. Adding .catch() handles these cases gracefully without suppressing background tasks in HybridApp mode. Co-authored-by: Mykhailo <mkhutornyi@users.noreply.github.com>
|
Implemented option 1. Changes made:
Updated the PR title and description to reflect the corrected understanding. |
|
@MelvinBot mark as ready for review |
|
@mkhutornyi Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Done — this PR has been marked as ready for review. 👍 |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppbefore.movafter.moviOS: mWeb SafariMacOS: Chrome / Safari |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #85986 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
The failing check is unrelated to this PR. Analysis: The Evidence: This PR only modifies |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required.
…ulerErrorInHybridApp Co-authored-by: Mykhailo <mkhutornyi@users.noreply.github.com>
|
@mkhutornyi Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Fixed the failing iOS build by merging |
|
🚧 @MariaHCD has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
@MariaHCD @mkhutornyi We can't validate this step |
|
This is dev only console error. Please feel free to check off. |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.3.43-3 🚀
|
Explanation of Change
On iOS HybridApp launch, a console error appears:
Uncaught (in promise, id: 0): "Error: The operation couldn't be completed. (BGTaskSchedulerErrorDomain error 1.)". This isBGTaskSchedulerErrorCodeUnavailable, which fires when BGTaskScheduler is not available (e.g., iOS Simulator, Background App Refresh disabled).The
TaskManager.defineTask()call at startup does not handle promise rejections, so when BGTaskScheduler returns this error, it surfaces as an unhandled promise rejection in the console.This PR adds
.catch()to thedefineTask()call to handle the rejection gracefully by logging a warning instead of surfacing a console error.Fixed Issues
$ #85986
PROPOSAL: #85986 (comment)
Tests
BGTaskSchedulerErrorDomainconsole error appearsOffline tests
N/A — This change only affects background task registration at app startup and does not involve network operations.
QA Steps
BGTaskSchedulerErrorDomainconsole error appearsPR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A — JS-only change, no UI modifications
Android: mWeb Chrome
N/A — Native-only change (
.native.ts)iOS: Native
N/A — Requires HybridApp build to verify (console error no longer appears)
iOS: mWeb Safari
N/A — Native-only change (
.native.ts)MacOS: Chrome / Safari
N/A — Native-only change (
.native.ts)