From e1af9b811551405c3819df90c6376d6d442e8075 Mon Sep 17 00:00:00 2001 From: Cassio Souza Dantas Date: Wed, 18 Dec 2019 09:29:16 -0300 Subject: [PATCH] bugfix #640 clicking multiple times on a picture in iOS causing back too many times, bug caused by loop on event FinishedPickingMedia in every click, and calling dismiss event in consequence --- src/Media.Plugin/iOS/MediaPickerDelegate.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Media.Plugin/iOS/MediaPickerDelegate.cs b/src/Media.Plugin/iOS/MediaPickerDelegate.cs index 0028bd19..1e9ed4d8 100644 --- a/src/Media.Plugin/iOS/MediaPickerDelegate.cs +++ b/src/Media.Plugin/iOS/MediaPickerDelegate.cs @@ -47,8 +47,12 @@ public UIPopoverController Popover public Task> Task => tcs.Task; + private bool isFinished; public override async void FinishedPickingMedia(UIImagePickerController picker, NSDictionary info) { + if (isFinished) + return; + isFinished = true; RemoveOrientationChangeObserverAndNotifications(); MediaFile mediaFile; @@ -77,6 +81,7 @@ public override async void FinishedPickingMedia(UIImagePickerController picker, tcs.SetException(new FileNotFoundException()); else tcs.TrySetResult(new List { mediaFile }); + isFinished = false; }); }