Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ class ImagePickerService : IImagePickerService {
private var continuation: Continuation<List<ByteArray>>? = null

private val selectedImages = mutableStateListOf<PHPickerResult>()
private val pickerController = PickerController(selectedImages)
private val pickerController = PickerController(selectedImages) {
continuation?.resume(getSelectedImageAsByteArrays())
continuation = null
cont = null
}
private val config = PHPickerConfiguration().apply {
selectionLimit = 0
filter = PHPickerFilter.imagesFilter
Expand Down Expand Up @@ -145,7 +149,8 @@ class ImagePickerService : IImagePickerService {

@OptIn(BetaInteropApi::class)
class PickerController(
val selectedUris: MutableList<PHPickerResult>
val selectedUris: MutableList<PHPickerResult>,
val onFinish: () -> Unit
) : NSObject(),
PHPickerViewControllerDelegateProtocol {

Expand All @@ -160,7 +165,10 @@ class PickerController(
}
selectedUris.clear()
selectedUris.addAll(itemsToAdd)
picker.dismissViewControllerAnimated(true,null)

picker.dismissViewControllerAnimated(true) {
onFinish()
}
}
}

Expand Down