Skip to content

Commit 70d266d

Browse files
authored
Merge pull request #27 from Qase/FIX/HIPMC-2783
Fix/hipmc 2783
2 parents ef747ed + 45ad0a8 commit 70d266d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

kotlinlog/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ android {
1010
minSdkVersion 16
1111
targetSdkVersion 28
1212
versionCode 3
13-
versionName "2.2.7"
13+
versionName "2.2.8"
1414
buildConfigField 'int', 'VERSION_CODE', "$versionCode"
1515
buildConfigField 'String', 'VERSION_NAME', "\"$versionName\""
1616
consumerProguardFile('proguard-rules.pro')

kotlinlog/src/main/kotlin/quanti/com/kotlinlog/file/SendLogDialogFragment.kt

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import android.os.Bundle
88
import android.widget.Toast
99
import androidx.fragment.app.DialogFragment
1010
import java.io.File
11-
import kotlinx.coroutines.*
11+
import kotlinx.coroutines.CoroutineScope
12+
import kotlinx.coroutines.Deferred
13+
import kotlinx.coroutines.Dispatchers
14+
import kotlinx.coroutines.async
15+
import kotlinx.coroutines.runBlocking
1216
import quanti.com.kotlinlog.R
1317
import quanti.com.kotlinlog.utils.copyLogsTOSDCard
1418
import quanti.com.kotlinlog.utils.getFormattedFileNameDayNow
@@ -121,19 +125,16 @@ class SendLogDialogFragment : DialogFragment() {
121125
*/
122126
@Suppress("UNUSED_PARAMETER")
123127
private fun positiveButtonClick(dialog: DialogInterface, which: Int) =
124-
CoroutineScope(Dispatchers.Main).launch {
128+
runBlocking {
125129
val appContext = this@SendLogDialogFragment.requireContext().applicationContext
126130

127131
val addresses = requireArguments().getStringArray(SEND_EMAIL_ADDRESSES)
128132
val subject =
129133
getString(R.string.logs_email_subject) + " " + getFormattedFileNameDayNow()
130134
val bodyText = getString(R.string.logs_email_text)
131-
132-
// await non block's current thread
133135
val zipFileUri = zipFile?.await()?.getUriForFile(appContext)
134136

135137
val intent = Intent(Intent.ACTION_SEND).apply {
136-
type = "message/rfc822" // email
137138
type = "message/rfc822" // email
138139
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
139140
putExtra(Intent.EXTRA_EMAIL, addresses)
@@ -159,7 +160,7 @@ class SendLogDialogFragment : DialogFragment() {
159160
*/
160161
@Suppress("UNUSED_PARAMETER")
161162
private fun neutralButtonClick(dialog: DialogInterface, which: Int) =
162-
CoroutineScope(Dispatchers.Main).launch {
163+
runBlocking {
163164
val appContext = this@SendLogDialogFragment.requireContext().applicationContext
164165

165166
val file = zipFile?.await()?.copyLogsTOSDCard(requireContext())

0 commit comments

Comments
 (0)