File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
app/src/main/java/com/junkfood/seal Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -416,7 +416,7 @@ class DownloadViewModel @Inject constructor() : ViewModel() {
416
416
}
417
417
MainActivity .stopService()
418
418
if (! stateFlow.value.isDownloadError)
419
- TextUtil .makeToast (context.getString(R .string.download_success_msg))
419
+ TextUtil .makeToastSuspend (context.getString(R .string.download_success_msg))
420
420
}
421
421
422
422
private suspend fun showErrorReport (s : String ) {
Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ package com.junkfood.seal.util
2
2
3
3
import android.widget.Toast
4
4
import androidx.core.text.isDigitsOnly
5
+ import com.junkfood.seal.BaseApplication.Companion.applicationScope
5
6
import com.junkfood.seal.BaseApplication.Companion.context
6
7
import com.junkfood.seal.R
7
8
import kotlinx.coroutines.Dispatchers
8
- import kotlinx.coroutines.withContext
9
+ import kotlinx.coroutines.launch
9
10
import java.util.regex.Pattern
10
11
11
12
object TextUtil {
@@ -57,8 +58,8 @@ object TextUtil {
57
58
Toast .makeText(context, text, Toast .LENGTH_SHORT ).show()
58
59
}
59
60
60
- suspend fun makeToastSuspend (text : String ) {
61
- withContext (Dispatchers .Main ) {
61
+ fun makeToastSuspend (text : String ) {
62
+ applicationScope.launch (Dispatchers .Main ) {
62
63
makeToast(text)
63
64
}
64
65
}
You can’t perform that action at this time.
0 commit comments