andrius-k / Toast

Toast messages library for Xamarin.iOS
MIT License
41 stars 9 forks source link

Add callback for Dismiss #6

Open nosmirck opened 5 years ago

nosmirck commented 5 years ago

I'd like to add a callback method for when the toast is dismissed.

Let's say I want to trigger something right after the Toast is dismissed (manually or automatically) I think having something like:

//Somehwere:
...
Toast.MakeToast("message")
  .SetDismissCallback(MyCallback)
  .Show();
...

//Somewhere else
MyCallback(){
  Debug.WriteLine("Toast Dismissed!");
}

There are multiple reasons, for instance, trigger an analytics call that reports the toast was fully shown and dismissed, or to show multiple toasts in chain, or to keep track of the messages being shown (like having a list of strings that store the current shown messages, I want to remove the string that is dismissed, so I know exactly which toasts are shown), etc

andrius-k commented 5 years ago

Hi Luis, Thanks for the suggestion and sorry for the long delay! The suggested feature is indeed useful and I might implement it in the near future as soon as I get a bit of time. Cheers

eman1986 commented 5 years ago

would you take a pull request on this feature? I'd be willing to add it if so.

eman1986 commented 5 years ago

made a pull request for this feature

andrius-k commented 4 years ago

Thanks a lot for the PR!!! Made some comments about it, have a look once you have some time :)

brodyshiba commented 3 years ago

@andrius-k Has the Nuget package been updated with this feature or am I doing something wrong?