Skip to content

Commit

Permalink
fix: disable auto logout when creating report
Browse files Browse the repository at this point in the history
  • Loading branch information
HashEngineering committed Dec 20, 2024
1 parent 50ba7fa commit 27bc4a8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import de.schildbach.wallet.Constants
import de.schildbach.wallet.ui.LockScreenActivity
import de.schildbach.wallet_test.R
import de.schildbach.wallet_test.databinding.DialogContactSupportBinding
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.dash.wallet.common.SecureActivity
import org.dash.wallet.common.ui.dialogs.OffsetDialogFragment
import org.dash.wallet.common.ui.viewBinding
import org.slf4j.LoggerFactory
Expand Down Expand Up @@ -110,6 +112,7 @@ class ContactSupportDialogFragment : OffsetDialogFragment(R.layout.dialog_contac
private fun sendReport() {
lifecycleScope.launch {
binding.reportGenerationProgressContainer.isVisible = true
(requireActivity() as? SecureActivity)?.turnOffAutoLogout()
val (reportText, attachments) = withContext(Dispatchers.IO) {
viewModel.createReport(
binding.reportIssueDialogDescription.text.toString(),
Expand All @@ -125,6 +128,11 @@ class ContactSupportDialogFragment : OffsetDialogFragment(R.layout.dialog_contac
}
}

override fun dismiss() {
(requireActivity() as? SecureActivity)?.turnOnAutoLogout()
super.dismiss()
}

private fun startSend(subject: CharSequence?, text: CharSequence, attachments: ArrayList<Uri>) {
val intent: Intent
if (attachments.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import android.os.PowerManager
import androidx.core.content.FileProvider
import androidx.lifecycle.ViewModel
import com.google.common.base.Charsets
import com.google.common.base.Stopwatch
import dagger.hilt.android.lifecycle.HiltViewModel
import de.schildbach.wallet.Constants
import de.schildbach.wallet.WalletApplication
Expand Down Expand Up @@ -58,14 +59,14 @@ class ContactSupportViewModel @Inject constructor(
companion object {
private val log = LoggerFactory.getLogger(ContactSupportViewModel::class.java)
private const val MAX_LOGS_SIZE = 20 * 1024 * 1024
private const val MAX_WALLET_DUMP_SIZE = 4// * 1024 * 1024

private const val MAX_WALLET_DUMP_SIZE = 4 * 1024 * 1024
}

var isCrash: Boolean = false
val wallet: Wallet? = walletDataProvider.wallet
var contextualData: String? = null
var stackTrace: String? = null
var isCrash: Boolean = false

suspend fun createReport(
userIssueDescription: String,
collectDeviceInfo: Boolean,
Expand All @@ -78,7 +79,7 @@ class ContactSupportViewModel @Inject constructor(
val cacheDir = application.cacheDir
val reportDir = File(cacheDir, "report")
reportDir.mkdir()

val watch = Stopwatch.createStarted()
text.append(userIssueDescription).append('\n')

try {
Expand Down Expand Up @@ -204,7 +205,7 @@ class ContactSupportViewModel @Inject constructor(
}

text.append("\n\nPUT ADDITIONAL COMMENTS TO THE TOP. DOWN HERE NOBODY WILL NOTICE.")

log.info("create report: {}", watch)
return@withContext Pair(text.toString(), attachments)
}

Expand Down

0 comments on commit 27bc4a8

Please sign in to comment.