Skip to content

Win32 scheduled notification and Setting fixes #3567

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

Merged
merged 13 commits into from
Jan 22, 2021

Conversation

andrewleader
Copy link
Contributor

@andrewleader andrewleader commented Nov 16, 2020

Fixes #3626

Identity-less Win32 apps had the following problems...

  • If AUMID was longer than 129 characters, exception was thrown when using scheduled toast APIs
  • If app has never shown a toast notification yet, scheduled toast notifications won't appear
  • If app has never shown a toast notification yet, accessing the Setting property threw an exception
  • Removing toast by just tag throw an exception (overload with AUMID requires group to be specified too)

To fix each of these (all fixes specific only to identity-less Win32 apps)...

  • Hashed auto-generated AUMID if it was too long
  • When AddToSchedule or Setting is called, first checks if has sent a toast before, and if not sends a silent toast and then immediately removes it, so that scheduled toasts and accessing setting value "just work" to the developer
  • When sending toasts, if tag is specified but group isn't, assigns a default "empty group" value so that later when removing by only tag, can remove by only tag

This required introducing ToastNotifierCompat (in order to intercept the Show/AddToSchedule API calls). It's merely a copy of ToastNotifier just so that we can add in additional code before/after some specific methods are called.

Additionally, added a code sample to the Win32 sample app for using progress bar within toasts!

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Sample app changes

What is the current behavior?

See above

What is the new behavior?

See above

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Pull Request has been submitted to the documentation repository instructions. Link:
  • Sample in sample app has been added / updated (for bug fixes / features)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

Note that this is NOT a breaking change... while we've changed ToastNotificationManagerCompat.CreateToastNotifier()'s return type, ToastNotificationManagerCompat is only in the 7.0 preview right now (and the first version with that class was only introduced 4 days ago).

Other information

@ghost
Copy link

ghost commented Nov 16, 2020

Thanks andrewleader for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost requested review from michael-hawker, azchohfi and Kyaa-dost November 16, 2020 22:11
@andrewleader andrewleader added this to the 7.0 milestone Nov 16, 2020
@andrewleader
Copy link
Contributor Author

Hey @michael-hawker, this bug fix (plus some more sample app code) is ready for review whenever you get a chance!

@ghost
Copy link

ghost commented Dec 3, 2020

Hello @michael-hawker!

Because this pull request has the auto merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost added the in progress 🚧 label Dec 3, 2020
@michael-hawker
Copy link
Member

@msftbot merge if @azchohfi approves.

@ghost
Copy link

ghost commented Dec 3, 2020

Hello @michael-hawker!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I'll only merge this pull request if it's approved by @azchohfi

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@andrewleader andrewleader changed the title Win32 scheduled notification fixes Win32 scheduled notification and Setting fixes Dec 15, 2020
@ghost ghost added the bug 🐛 An unexpected issue that highlights incorrect behavior label Dec 15, 2020
@andrewleader
Copy link
Contributor Author

@azchohfi this is ready to be reviewed!

Copy link
Contributor

@Kyaa-dost Kyaa-dost left a comment

Choose a reason for hiding this comment

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

@andrewleader Nice work on the PR. Changes in the sample app looking great 🚀🚀

@Kyaa-dost
Copy link
Contributor

@msftbot only merge this PR when approved by @azchohfi

@ghost
Copy link

ghost commented Jan 13, 2021

Hello @Kyaa-dost!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I'll only merge this pull request if it's approved by @azchohfi

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@michael-hawker michael-hawker merged commit f2301cf into master Jan 22, 2021
@delete-merged-branch delete-merged-branch bot deleted the aleader/win32-scheduled-notif-fix branch January 22, 2021 08:55
@ghost ghost added Completed 🔥 and removed in progress 🚧 labels Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merge ⚡ bug 🐛 An unexpected issue that highlights incorrect behavior Completed 🔥 notifications 🔔
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug][Notifications] Notification Setting throws exception for unpackaged apps
4 participants