Skip to content

fix: properly await when allowEdit=true#1

Merged
andredestro merged 7 commits intomainfrom
fix/take-picture-allow-edit-move-task-upwards
Mar 27, 2026
Merged

fix: properly await when allowEdit=true#1
andredestro merged 7 commits intomainfrom
fix/take-picture-allow-edit-move-task-upwards

Conversation

@OS-pedrogustavobilro
Copy link
Copy Markdown
Contributor

@OS-pedrogustavobilro OS-pedrogustavobilro commented Mar 26, 2026

I was getting an issue on iOS when using TakePhoto with allowEdit=true, where the MediaResult wasn't being returned correctly.

The root cause was on 08b7436 for Sources/IONCameraLib/IONCAMRFlowBehaviour.swift, that was creating a Task to asynchronously process image to edit, which was causing the defer to be called, clearing the TakePhoto options, and therefore losing the state needed to return MediaResult.

I change the code to not launch a Task from those methods, mark them as async-await, and move the asynchronous Task creation further up the call hierarchy.

Had to update Sources/IONCameraLib/IONCAMRCoordinator.swift to switch to main thread when dismissing, because otherwise due to the other changes it would crash stating that dismiss was being called outside main thread.

@OS-pedrogustavobilro OS-pedrogustavobilro changed the title fix: move task creation to outside of async await fix: properly await when allowEdit=true Mar 27, 2026
@OS-pedrogustavobilro OS-pedrogustavobilro marked this pull request as ready for review March 27, 2026 12:39
@andredestro andredestro force-pushed the fix/take-picture-allow-edit-move-task-upwards branch from cbd0856 to f4ee061 Compare March 27, 2026 16:33
@andredestro andredestro merged commit e1f37e2 into main Mar 27, 2026
4 checks passed
@andredestro andredestro deleted the fix/take-picture-allow-edit-move-task-upwards branch March 27, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants