fix(barcode-scanner): resolve scan() after cleanup in windowed mode on iOS#3349
Open
afadil wants to merge 4 commits intotauri-apps:v2from
Open
fix(barcode-scanner): resolve scan() after cleanup in windowed mode on iOS#3349afadil wants to merge 4 commits intotauri-apps:v2from
afadil wants to merge 4 commits intotauri-apps:v2from
Conversation
…e on iOS When scanning in windowed mode (`windowed: true`) on iOS, the `metadataOutput` delegate calls `invoke?.resolve(jsObject)` followed immediately by `destroy()`. The `destroy()` method restores `webView.isOpaque = true` and resets `webView.backgroundColor`, which interferes with the pending IPC callback delivery. As a result, the JavaScript promise returned by `scan()` never resolves, even though the native side successfully detects and returns the barcode content. This commit delays the `destroy()` call by 300ms using `DispatchQueue.main.asyncAfter`, giving the IPC response enough time to reach the JavaScript layer before the webview properties are restored. Fixes windowed mode scanning on iOS where scan() promise hangs indefinitely after a successful barcode detection.
Set isScanning = false immediately after resolve() to prevent metadataOutput from firing multiple times during the 300ms window before destroy() runs.
…n iOS Reorder operations in metadataOutput so that dismantleCamera() and webview restoration run before invoke.resolve(). Previously, resolve() was called first and destroy() immediately after, which restored webView.isOpaque before the IPC response reached JavaScript — causing the scan() promise to never settle in windowed mode.
Contributor
Package Changes Through 044e2c3There are 14 changes which include sql with minor, sql-js with minor, deep-link with patch, deep-link-js with patch, fs with minor, fs-js with minor, http with patch, http-js with patch, updater with patch, updater-js with patch, nfc with patch, nfc-js with patch, dialog with minor, dialog-js with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3348
Summary
metadataOutputso that camera cleanup and webview restoration run beforeinvoke.resolve(), not afterresolve()is called first, thendestroy()immediately restoreswebView.isOpaque = trueon the same main queue — this prevents the IPC response from reaching JavaScript in windowed moderesolve()works in non-windowed modeTest plan
scan({ windowed: true })on iOS resolves correctly after scanning a QR codescan({ windowed: false })on iOS still works as beforecancel()still works correctly during an active scanmetadataOutputcalls are guarded byisScanning = false)