Maui
Maui copied to clipboard
Provide the ability to show popups without having to subclass Popup
Description of Change
This is primarily aimed at playing around but also with the aim of exposing the implementation to see what everything thinks.
Linked Issues
- Fixes #
PR Checklist
- [ ] Has a linked Issue, and the Issue has been
approved(bug) orChampioned(feature/proposal) - [x] Has tests (if omitted, state reason in description)
- [x] Has samples (if omitted, state reason in description)
- [x] Rebased on top of
mainat time of PR - [x] Changes adhere to coding standard
- [ ] Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls
Additional information
I have ended up rewriting at least 3 or 4 samples submitted as bugs using standard DI pattern because the code would crash in IOS 17.x. I wanted to verify the issues that were being reported. If I see a bunch of different reports I put extra effort in.
Simplifying implementation would be great. I am all for that.
There are currently a couple of breaking changes to the IPopupService that I think are still good but we should consider documenting them to aid developers upgrading:
await popupService.ShowPopupAsync<MockPageViewModel>(CancellationToken.None);
becomes
await popupService.ShowPopupAsync<MockPageViewModel>(token: CancellationToken.None);
await Assert.ThrowsAsync<TaskCanceledException>(() => popupService.ShowPopupAsync<MockPageViewModel>(viewModel => viewModel.HasLoaded = true, cts.Token));
becomes
await Assert.ThrowsAsync<TaskCanceledException>(() => popupService.ShowPopupAsync<MockPageViewModel>(viewModel => viewModel.HasLoaded = true, token: cts.Token));
It also involves removing the ability to supply a viewModel instance to the Show methods to remove the confusion we have seen around developers expecting the BindingContext to automatically be set. I am happy to move this into a separate PR if we think it if worthwhile?
@bijington FYI - we now have a few merge conflicts on this PR after merging a bunch of Popup PRs today