-
-
Notifications
You must be signed in to change notification settings - Fork 16
First iteration of AddSubscriptionScreen
cleanup
#727
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
base: main
Are you sure you want to change the base?
Changes from all commits
a41982b
d8fb0dd
7702ddd
69b1f11
85fbcb2
6ebf7e9
f56ae4e
c38f012
97762ff
62f8860
367e8a7
a54a718
0441c30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package at.bitfire.icsdroid.model | ||
|
||
import android.content.Context | ||
import android.widget.Toast | ||
import androidx.annotation.IntDef | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.withContext | ||
|
||
@Retention(AnnotationRetention.SOURCE) | ||
@IntDef(Toast.LENGTH_SHORT, Toast.LENGTH_LONG) | ||
annotation class ToastDuration | ||
|
||
suspend fun toastAsync( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems unnecessarily confusing to me. I am sorry, that I said we could extract it to utils. It does not make sense. I think it's much better to simply trigger and handle cancelation in place when needed. Either in the screens (preferably) or the view model if you think that's much cleaner. |
||
context: Context, | ||
message: String?, | ||
cancelToast: Toast? = null, | ||
@ToastDuration duration: Int = Toast.LENGTH_LONG, | ||
): Toast? = withContext(Dispatchers.Main) { | ||
cancelToast?.cancel() | ||
|
||
Toast.makeText(context, message, duration).also { it.show() } | ||
} |
Uh oh!
There was an error while loading. Please reload this page.