Skip to content
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

Add Platform-Specific Option to Enable Snackbar on Windows #1780

Merged
merged 11 commits into from
Mar 29, 2024

Conversation

brminnick
Copy link
Collaborator

Snackbar now requires additional code to be added on Windows to the Package.appxmanifest file: MicrosoftDocs/CommunityToolkit#374

Currently, without adding this additional code to Package.appxmanifest, CommunityToolkit.Maui causes all Windows apps to crash on launch.

This PR adds Options.ShouldEnableSnackbarOnWidows to allow users to opt-in to enabling Snackbar on Windows, ensuring that they have added the additional required code to Package.appxmanifest.

var builder = MauiApp.CreateBuilder()
  .UseMauiCommunityToolkit(options =>
  {
    options.SetShouldEnableSnackbarOnWindows(true);
  })

Copy link
Contributor

@bijington bijington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work @brminnick I think we should either use the value parameter or remove it though.

Co-authored-by: Shaun Lawrence <shaunrlawrence@gmail.com>
@brminnick
Copy link
Collaborator Author

Thanks Shaun! Good catch. Updated ✅

Copy link
Collaborator Author

@brminnick brminnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Shaun + Vlad! I think I'm happy with the implementation now.

We've added enough fail-safes to the code to assist future devs who haven't yet seen the platform-specific implementation docs for Snackbar on Windows. Hopefully throwing these exceptions at runtime will help folks find the docs instead of opening a new Issue on the repo.

And if they do open an issue for one of these InvalidOperationExceptions, we can just copy/paste the link from the stack trace, point them to the docs and close the issue.

pictos
pictos previously approved these changes Mar 28, 2024
@brminnick brminnick merged commit 51dc63a into main Mar 29, 2024
8 checks passed
@brminnick brminnick deleted the Move-Snackbar-Initializion-Logic-to-Sample-App branch March 29, 2024 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants