-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IOS >= 15] Issue with getting GetDefaultWindow() #8
Comments
what is the difference between current implementaion and your suggestion? |
@Alex-Dobrynin Sorry, it was not the only change that I've tried, so I believe that the actual problem is this part of code |
In case if it's needed for modal navigation - maybe here we can check if PresentedViewController is Microsoft.Maui.Platform.ModalWrapper(but it's internal, so maybe check by type name). And allow such assigning if that our modal navigation. |
I would like to propose something like this
|
From my point of view there is bug in MediaPicker, not in this lib. as they setting the result and then closing activity. protected override void OnActivityResult(int requestCode, Result resultCode, Intent? data)
{
base.OnActivityResult(requestCode, resultCode, data);
// we have a valid GUID, so handle the task
if (GetIntermediateTask(guid, true) is IntermediateTask task)
{
if (resultCode == Result.Canceled)
{
task.TaskCompletionSource.TrySetCanceled();
}
else
{
try
{
data ??= new Intent();
task.OnResult?.Invoke(data);
task.TaskCompletionSource.TrySetResult(data);
}
catch (Exception ex)
{
task.TaskCompletionSource.TrySetException(ex);
}
}
}
// close the intermediate activity
Finish();
} you may create an issue in MAUI's github and describe your case. or even PR, just change the order of calls. |
yeah, seems like that |
Same in ios picker.Delegate = new PhotoPickerDelegate
{
CompletedHandler = async info =>
{
GetFileResult(info, tcs);
await vc.DismissViewControllerAsync(true);
}
}; |
By using the current version of GetDefaultWindow() we have to add a delay after such call - await MediaPicker.PickPhotoAsync();
I believe that this can be fixed in such way:
for iOS>=15
UIApplication.SharedApplication.ConnectedScenes
.OfType()
.SelectMany(s => s.Windows)
.First(w => w.IsKeyWindow);
The text was updated successfully, but these errors were encountered: