Skip to content

Commit

Permalink
Fixed runaway coroutine for canceled capture on iOS and fixed onClick…
Browse files Browse the repository at this point in the history
… events being consumed by DesiredSizeView on Android
  • Loading branch information
byerlyb20 committed Jul 10, 2024
1 parent 3ec283a commit a5f2596
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,20 @@ class DesiredSizeView(context: Context) : ViewGroup(context) {
requestLayout()
}

private var clickListenerForChild: OnClickListener? = null
override fun setOnClickListener(l: OnClickListener?) {
clickListenerForChild = l
getChildAt(0)?.let {
it.setOnClickListener(l)
clickListenerForChild = null
}
}

override fun onViewAdded(child: View?) {
super.onViewAdded(child)
setOnClickListener(clickListenerForChild)
}

override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
getChildAt(0).measure(
MeasureSpec.makeMeasureSpec(r - l, MeasureSpec.EXACTLY),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,14 @@ actual object ExternalServices {
})
}
}

override fun imagePickerControllerDidCancel(picker: UIImagePickerController) {
picker.dismissViewControllerAnimated(true) {
dispatch_async(queue = dispatch_get_main_queue(), block = {
cont.resume(null)
})
}
}
}
controller.delegate = delegate
controller.extensionStrongRef = delegate
Expand Down

0 comments on commit a5f2596

Please sign in to comment.