Skip to content

Commit

Permalink
fix(coinjoin): fix ANR when coinjoin system starts (#1313)
Browse files Browse the repository at this point in the history
* fix: change context to IO for time queries

* fix: use dashj 21.1.1-SNAPSHOT to resolve one ANR
  • Loading branch information
HashEngineering authored Oct 8, 2024
1 parent 92e74a5 commit 3bb0fbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
kotlin_version = '1.9.23'
coroutinesVersion = '1.6.4'
ok_http_version = '4.9.1'
dashjVersion = '21.1.0'
dashjVersion = '21.1.1-SNAPSHOT'
hiltVersion = '2.51'
hiltCompilerVersion = '1.2.0'
hiltWorkVersion = '1.0.0'
Expand Down
4 changes: 3 additions & 1 deletion wallet/src/de/schildbach/wallet/ui/main/WalletActivityExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ import de.schildbach.wallet.WalletBalanceWidgetProvider
import de.schildbach.wallet.service.CoinJoinMode
import de.schildbach.wallet.ui.more.MoreFragment
import de.schildbach.wallet_test.R
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.dash.wallet.common.services.analytics.AnalyticsConstants
import org.dash.wallet.common.ui.components.ComposeHostFrameLayout
import org.dash.wallet.common.ui.components.Toast
Expand Down Expand Up @@ -143,7 +145,7 @@ object WalletActivityExt {

fun MainActivity.checkTimeSkew(viewModel: MainViewModel, force: Boolean = false) {
lifecycleScope.launch {
val (isTimeSkewed, timeSkew) = viewModel.getDeviceTimeSkew(force)
val (isTimeSkewed, timeSkew) = withContext(Dispatchers.IO) { viewModel.getDeviceTimeSkew(force) }
val coinJoinOn = viewModel.getCoinJoinMode() != CoinJoinMode.NONE
if (isTimeSkewed && (!timeSkewDialogShown || force)) {
timeSkewDialogShown = true
Expand Down

0 comments on commit 3bb0fbb

Please sign in to comment.