Skip to content

Conversation

@Odonno
Copy link
Contributor

@Odonno Odonno commented Aug 25, 2017

fix #1415

@bkaankose I tried to use CancellationToken but it added so much code and it is seemed a little messy to me. The unique id do the trick but yes the Task.Delay is not cancelled immediately...

@Odonno Odonno added bug 🐛 An unexpected issue that highlights incorrect behavior controls 🎛️ reviewers wanted labels Aug 25, 2017
@nmetulev
Copy link
Contributor

Wondering if it would make sense to do this with a timer instead that you simply cancel when it's dismissed before the timer runs out?

@michael-hawker
Copy link
Member

@nmetulev yeah, that's what I had suggested too.

@Odonno
Copy link
Contributor Author

Odonno commented Aug 25, 2017

@michael-hawker Sorry, I forgot your comment on this. It is a better solution indeed. Thanks.

@nmetulev
Copy link
Contributor

I like this better too. Could you also update the documentation with the change of the method?

@Odonno
Copy link
Contributor Author

Odonno commented Aug 25, 2017

@nmetulev Sorry. Good catch.

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

This is great! Just one small code ordering/timing issue + doc updates like @nmetulev said.

{
await Task.Delay(duration);
Dismiss();
_timer.Stop();
Copy link
Member

Choose a reason for hiding this comment

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

You should move all this timer stop code to be first to ensure the timer doesn't fire between when you call the make visible state and stopping the timer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even better.

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

You left the 'await's at the start everywhere...

if (isTemplatePresent && inAppNotificationWithButtonsTemplate is DataTemplate)
{
await ExampleInAppNotification.ShowAsync(inAppNotificationWithButtonsTemplate as DataTemplate);
await ExampleInAppNotification.Show(inAppNotificationWithButtonsTemplate as DataTemplate);
Copy link
Member

Choose a reason for hiding this comment

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

Don't forget to remove the await here.


```c#
await ExampleInAppNotification.ShowAsync("Some text.", 2000); // the notification will appear for 2 seconds
await ExampleInAppNotification.Show("Some text.", 2000); // the notification will appear for 2 seconds
Copy link
Member

Choose a reason for hiding this comment

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

and here.

@Odonno Odonno changed the title fix(InAppNotifications): use id to detect notification dismiss event after timeout fix(InAppNotifications): use timer to detect notification dismiss event after timeout Aug 25, 2017
Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

Thanks for the quick turnarounds on this!

@nmetulev nmetulev merged commit 645ce29 into CommunityToolkit:dev Aug 25, 2017
@Odonno Odonno deleted the fixInAppNotificiationDismiss branch August 25, 2017 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐛 An unexpected issue that highlights incorrect behavior controls 🎛️

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants