Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4224563b authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

fix: lifecycleScope issue

parent eb38cfba
Loading
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import com.fsck.k9.ui.share.ShareIntentBuilder
import com.fsck.k9.ui.withArguments
import foundation.e.murenagenie.IAidlMurenaGenieInterface
import java.util.Locale
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.koin.android.ext.android.inject
import timber.log.Timber
@@ -369,11 +370,14 @@ class MessageViewFragment :
    }

    private fun showAISummarizedText() {
        lifecycleScope.launch {
        Toast.makeText(context, "Please wait!!!", Toast.LENGTH_SHORT).show()

        lifecycleScope.launch(Dispatchers.IO) {
            val result = iAidlMurenaGenieInterface?.generate("Summarize", messageText)

            launch(Dispatchers.Main) {
                AlertDialog.Builder(requireContext())
                    .setCancelable(false)
                    .setTitle("Summary of the message")
                    .setMessage(result)
                    .setPositiveButton("Done") { dialog, _ ->
@@ -382,6 +386,7 @@ class MessageViewFragment :
                    .show()
            }
        }
    }

    private fun onShowHeaders() {
        val launchIntent = MessageSourceActivity.createLaunchIntent(requireActivity(), messageReference)