mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Prevent multiple file selection callbacks coming from the media upload pickers and generating incorrect transitions in the RoomFlowCoordinator state machine
This commit is contained in:
committed by
Stefan Ceriu
parent
1bbb077e3e
commit
ea91e371eb
@@ -29,9 +29,11 @@ enum CameraPickerError: Error {
|
||||
}
|
||||
|
||||
struct CameraPicker: UIViewControllerRepresentable {
|
||||
private weak var userIndicatorController: UserIndicatorControllerProtocol?
|
||||
private let callback: (CameraPickerAction) -> Void
|
||||
|
||||
init(callback: @escaping (CameraPickerAction) -> Void) {
|
||||
init(userIndicatorController: UserIndicatorControllerProtocol?, callback: @escaping (CameraPickerAction) -> Void) {
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.callback = callback
|
||||
}
|
||||
|
||||
@@ -61,7 +63,16 @@ struct CameraPicker: UIViewControllerRepresentable {
|
||||
self.cameraPicker = cameraPicker
|
||||
}
|
||||
|
||||
private static let loadingIndicatorIdentifier = "CameraPickerLoadingIndicator"
|
||||
|
||||
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
|
||||
picker.delegate = nil
|
||||
|
||||
cameraPicker.userIndicatorController?.submitIndicator(UserIndicator(id: Self.loadingIndicatorIdentifier, type: .modal, title: L10n.commonLoading))
|
||||
defer {
|
||||
cameraPicker.userIndicatorController?.retractIndicatorWithId(Self.loadingIndicatorIdentifier)
|
||||
}
|
||||
|
||||
if let videoURL = info[.mediaURL] as? URL {
|
||||
cameraPicker.callback(.selectFile(videoURL))
|
||||
} else if let image = info[.originalImage] as? UIImage {
|
||||
|
||||
Reference in New Issue
Block a user