Skip to content

Remove lock statements from InAppNotification control #3368

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
8 commits merged into from
Jul 21, 2020

Conversation

vgromfeld
Copy link
Contributor

@vgromfeld vgromfeld commented Jun 29, 2020

Fixes

Remove the lock statements used in InAppNotification as well as all the timers used to detect when the animation ends.

PR Type

What kind of change does this PR introduce?

  • Feature
  • Code style update (formatting)
  • Refactoring (no functional changes, no api changes)
  • Sample app changes

What is the current behavior?

The current InAppNotification implementation is using a lot of lock which are not needed since all the code lives in the UI thread.

What is the new behavior?

The control is no longer using any lock. All the notifications are now pushed to _stackedNotificationOptions which will control when the notification is displayed. This change allow us to set the appropriate content on the ContentPresenter when the control template is applied.
WE can also now push directly an object content as the notification payload. To make it always work, I've simplified the logic between the InAppNotification and its template. This is introducing a breaking change in the notification template.

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. Link: #365
  • 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

The ContentPresenter of the InAppNotification template must now be named PART_Presenter.

Other information

The XAML files have been updated by XAML styler and contains a lot of changes unrelated to this PR.

@ghost
Copy link

ghost commented Jun 29, 2020

Thanks vgromfeld 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 assigned michael-hawker Jun 29, 2020
@Odonno
Copy link
Contributor

Odonno commented Jun 29, 2020

Sweet. Indeed, lock are really annoying and I didn't find another way to make it. I am glad you found a way to simplify that.

Anyway, I am not able to test that for the moment but the code seems OK.

@Kyaa-dost
Copy link
Contributor

@vgromfeld seems like there is a conflict being detected. If you can resolve the conflict then it should do the Job 🚀

@ghost
Copy link

ghost commented Jul 21, 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.

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.

🚀 🚀 🚀

@ghost ghost merged commit a21a44f into CommunityToolkit:master Jul 21, 2020
@vgromfeld vgromfeld deleted the inAppNotification.removeLock branch July 22, 2020 06:20
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants