Maui icon indicating copy to clipboard operation
Maui copied to clipboard

Provide the ability to show popups without having to subclass Popup

Open bijington opened this issue 1 year ago • 3 comments

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) or Championed (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 main at time of PR
  • [x] Changes adhere to coding standard
  • [ ] Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

bijington avatar Nov 29 '23 21:11 bijington

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.

ne0rrmatrix avatar Dec 01 '23 02:12 ne0rrmatrix

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 avatar Feb 11 '24 14:02 bijington

@bijington FYI - we now have a few merge conflicts on this PR after merging a bunch of Popup PRs today

TheCodeTraveler avatar Mar 26 '24 00:03 TheCodeTraveler