Open ramack opened 4 years ago
think a good place would be the NotificationHelper to put there some method that takes a String or just the resource id and a throwable as argument...
This could show the text in a snackbar and with the details action show the dialog which then allows to send the throwable via ACRA to us.
Or maybe DialogHelper instead of NotificationHelper... Or we combine the two: I would probably go for one helper class to do both so it is more a "AsyncUserInteraction" Helper because if we have a specific need for a dialog it would anyhow be specific to that case. And whether a "message" should be in a snackbar, a notification or dialog (or several of them) is more a question of priority and whether it could occur in background or not.
Everything that happens in background (e.g. during Upload) should be shown in a notification. while the app is in foreground that doesn't seem good, so maybe this is the critera to decide between notification and snackbar and the dialog is then maybe more for "further details" so maybe we have "normal messages" and messages that have a Throwable parameter, that has more (technical) details, and allows to report the issue via ACRA
Alert messages to be displayed with Snackbar maybe ? (Like telling the user some messages like « You are now logged to
Which is again the same: in foreground-> snackbar in background->notification It doesn't seem easy. Maybe in a first we provide a View parameter to the "showMessage" method
if View is null we create a notification if non-null we use it to show the snackbar
and if we are in a fragment or activity while we want to show the message (like in LoginFailed stuff) we pass the root view of the activity
if we are in the background asynctask for the uploader we pass null and it will become a notification "show details" in the notification will open the dialog
while show details in the notification will create an intent to the mainactivity which opens the dialog with the same details
but with this we have one interface in the MessageHelper (which could be a name for the "merged" DialogHelper and NotificationHelper) that allows from everywhere to show messages, including thowables for details of available.
in #114 and 9538caf11217623cf1503712f6cc33d88580c5d8 we added some details for login failure reasons. We should generalize this concept and also use it for upload failure and others.