fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.11k stars 1.4k forks source link

Add support for temporary notifications (like Android Toast) #2365

Open Maverobot opened 3 years ago

Maverobot commented 3 years ago

Is your feature request related to a problem? Please describe:

Toast is a standard way in Android to give feedback to the users.

Is it possible to construct a solution with the existing API?

I am not entirely sure because I just started to use this library and am generally also newbie in the Android Development. But after a long time search, I did not find any existing API which provides "toast".

Describe the solution you'd like to see:

An API which does the same as: https://developer.android.com/guide/topics/ui/notifiers/toasts.html

andydotxyz commented 3 years ago

Because we are focused on cross-platform UI, we can't really add platform-specific features. That said if there is a general use-case that toast provides we could consider adding a cross-platform solution.

Maverobot commented 3 years ago

I see your point. It makes sense to avoid platform-specific features.

For Windows

When I search for "toast" in the repo, I found

Windows.UI.Notifications.ToastNotificationManager

here. It seems to me that at least in Windows there is a kind of "toast notification".

For Linux

The "standard" notification (e.g. app.sendNotification) has very similar characteristics like a mobile "toast" message.

For IOS

I have no experience with IOS. But after a bit of googling, I found out IOS also has "toast message" support.

andydotxyz commented 3 years ago

Does this mean that App.SendNotification is a good enough replacement? That already works on all platforms.

Maverobot commented 3 years ago

I don't think so. On Android, App.SendNotification sends an notification instead of an "toast message". Probably same on IOS. "Notification" and "Toast message" have different use cases.

andydotxyz commented 3 years ago

OK, but can you expand on what this use-case is then? I got confused in the last message because you called things a notification.

Maverobot commented 3 years ago

Sorry. I will try to explain it.

I called "toast message" also a "notification" because it seems so in the world of Windows.

Windows.UI.Notifications.ToastNotificationManager

"Toast message" is a kind of notification which disappears automatically after a few seconds, while App.SendNotification sends a notification which stays persistent in the "Notification center" of Android until you manually dismiss it. For me, these two kinds of ways of delivering information are different and can not be replaced by each other. Are you asking what use cases toast messages can have? The most important feature is that it disappears after a timeout which AFAIK cannot be done with any of the existing fyne APIs. Please correct me if I am wrong.

andydotxyz commented 3 years ago

That makes sense. Perhaps ShowTemporaryNotification or adding Notification.Timeout would be a suitable solution?

Maverobot commented 3 years ago

Notification.Timeout sounds like a good option.