Skip to content

Changed order of calls to properly close MediaPicker Activity / ViewController and set the picker result#21998

Merged
mattleibow merged 1 commit into
dotnet:mainfrom
Alex-Dobrynin:MediaPicker_fix_closing_Activity_ViewController
Sep 9, 2024
Merged

Changed order of calls to properly close MediaPicker Activity / ViewController and set the picker result#21998
mattleibow merged 1 commit into
dotnet:mainfrom
Alex-Dobrynin:MediaPicker_fix_closing_Activity_ViewController

Conversation

@Alex-Dobrynin

@Alex-Dobrynin Alex-Dobrynin commented Apr 23, 2024

Copy link
Copy Markdown
Contributor

Fixes this issue Alex-Dobrynin/Xamarin.Controls.ImageCropper#8

Shortly, at the moment of getting the result of mediapicker, the activity or viewcontroller remains opened. And if open another activity or viewcontroller right after the result of mediapicker you will not see any new activity/viewcontroller opened. So to fix this we need to change the order of calls:

  1. we need to close activity/viewcontroller
  2. we need to set the result of mediapicker

Actual result: we need to put some Task.Delay after mediapicker result to be able open new activity/viewcontroller
Expected result: we able to open new activity/viewcontroller right after getting the picker result.

To reproduce it, you can try open new activity or viewcontroller from the topmost one (which is still mediapicker's activity/viewcontrolelr) right after the mediapicker result.

Affects only android/ios

@Alex-Dobrynin Alex-Dobrynin requested a review from a team as a code owner April 23, 2024 09:39
@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Apr 23, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @Alex-Dobrynin! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@jsuarezruiz jsuarezruiz added the area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info label Apr 23, 2024
@jsuarezruiz jsuarezruiz requested a review from mattleibow April 23, 2024 09:43
@Alex-Dobrynin

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

@jsuarezruiz

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@Alex-Dobrynin

Copy link
Copy Markdown
Contributor Author

will this be reviewed some day?

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 21998 in repo dotnet/maui

@Alex-Dobrynin

Copy link
Copy Markdown
Contributor Author

Somebody will review this?

@Axemasta

Axemasta commented Sep 9, 2024

Copy link
Copy Markdown
Contributor

I've just run into this issue, its really painful since you have to wait out the result with a Task.Delay and have to set that delay to be high to prevent the race condition kicking in....

Would love to see this in soon!

@Alex-Dobrynin

Alex-Dobrynin commented Sep 9, 2024

Copy link
Copy Markdown
Contributor Author

@Axemasta for now you may use this package MPowerKit.MediaPlugin, you will not have this issue there. It is a port of James Montemagno's MediaPlugin, but with some fixes

@mattleibow mattleibow merged commit 79bef03 into dotnet:main Sep 9, 2024
@samhouts samhouts added the fixed-in-net9.0-nightly This may be available in a nightly release! label Oct 1, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info community ✨ Community Contribution fixed-in-net9.0-nightly This may be available in a nightly release! platform/android platform/ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants