Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Dismissing Gallery Select Issues Introduced By Multi-Select Feature #666

Open
Trevonious opened this issue Feb 28, 2019 · 5 comments
Open

Comments

@Trevonious
Copy link

Trevonious commented Feb 28, 2019

Make sure you follow all of the setup directions before posting an issue: https://github.com/jamesmontemagno/MediaPlugin#important-permission-information

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: Latest prerelease 4.2.0-beta
Device Tested On: Galaxy Tab 3, iPad Gen 6
Simulator Tested On:
Version of VS: VS Enterprise 2017 (2) - 15.9.4
Version of Xamarin: 4.12.3.77
Versions of other things you are using:

Steps to reproduce the Behavior

Android:

  1. Click button to launch the Gallery Select window
  2. Click the onscreen or hardware back button

iOS:

  1. Click button to launch the Gallery Select popup
  2. Tap outside the popup, to dismiss it
  3. Click the button to launch the Gallery Select popup, again

Expected Behavior

Android:
Tapping the onscreen or hardware back buttons should close the Gallery Select window, without throwing exceptions.

iOS:
Tapping outside the Gallery Select popup should dismiss the popup, similarly to clicking the "Cancel" button. When clicking "Cancel" on the Gallery Select popup, PickPhotosAsync() returns an empty list. This would be the ideal behavior when clicking outside the dialog. Tapping the button again to launch the Gallery Select should launch the popup, as normal.

Actual Behavior

Android:
A null exception is thrown, from PickPhotosAsync.

iOS:
Get a popup that says "Only one operation can be active at at time." PickPhotosAsync() never returns anything.

Code snippet

PickMediaOptions mediaOptions = new PickMediaOptions
{
    PhotoSize = PhotoSize.Large,
    CompressionQuality = 92
};

Photos = new List<ImageSource>();

try
{
    files = await CrossMedia.Current.PickPhotosAsync(mediaOptions);
}
catch (Exception ex)
{
    await ParentView.ShowAlert("", ex.Message, "Okay");
}

if (files == null || files.Count == 0)
    return;

foreach (MediaFile image in files)
{
    imageSource = ImageSource.FromStream(() =>
    {
        var stream = image.GetStream();

        return stream;
    });

    Photos.Add(imageSource);
}

Screenshots

Android:
android

iOS:
ios

@Trevonious
Copy link
Author

Trevonious commented Feb 28, 2019

This is related/similar to #598 and #649. Also, got really unlucky with the ticket number...

@Trevonious Trevonious changed the title Dismissing Gallery Select Issues Only one operation Dismissing Gallery Select Issues Feb 28, 2019
@Trevonious Trevonious changed the title Dismissing Gallery Select Issues Dismissing Gallery Select Issues Introduced By Multi-Select Feature Jun 10, 2019
@Trevonious
Copy link
Author

Android part of this bug may have been fixed by #649.

The iOS error looks like it is coming from this line. From my very limited understanding of how this stuff works, it looks like the "pickerDelegate" needs to be nullified when the popup is closed. This is done in the Dispose method. My guess is that Dispose is not being triggered, when dismissing the popup by clicking outside of it.

@hussainmorbi
Copy link

has this issue been resolved yet when using PickPhotosAsync on iOS?. I have not seen any updates made on the master branch to rectify this as I am still seeing the issue occur when click outside of the popup? It works just fine when using PickPhotoAsync, just not when using PickPhotosAsync

@tgriggs-4tell
Copy link

@hussainmorbi It has not been fixed for iOS, as far as I know

@vibhatt
Copy link

vibhatt commented Nov 4, 2019

Any update on this? We are experiencing this in our iOS app when the user presses home button in the middle of taking a picture. The next time the TakePhotoAsync(StoreCameraMediaOptions options) is called the picker object is not dismissed before hand and creates "Only one operation can be active at at time." error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants