diff --git a/wallet/src/de/schildbach/wallet/WalletApplication.java b/wallet/src/de/schildbach/wallet/WalletApplication.java index ad32777352..54c6784b06 100644 --- a/wallet/src/de/schildbach/wallet/WalletApplication.java +++ b/wallet/src/de/schildbach/wallet/WalletApplication.java @@ -729,8 +729,10 @@ public void startBlockchainService(final boolean cancelCoinsReceived) { List runningAppProcesses = activityManager != null ? activityManager.getRunningAppProcesses() : null; if (runningAppProcesses != null) { int importance = runningAppProcesses.get(0).importance; - if (importance <= ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) - + if (importance <= ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { + if (wallet == null) { + log.warn("wallet does not exist, but starting blockchain service"); + } if (cancelCoinsReceived) { Intent blockchainServiceCancelCoinsReceivedIntent = new Intent(BlockchainService.ACTION_CANCEL_COINS_RECEIVED, null, this, BlockchainServiceImpl.class); @@ -738,6 +740,7 @@ public void startBlockchainService(final boolean cancelCoinsReceived) { } else { startService(blockchainServiceIntent); } + } } } diff --git a/wallet/src/de/schildbach/wallet/service/BlockchainServiceImpl.java b/wallet/src/de/schildbach/wallet/service/BlockchainServiceImpl.java index 273edcf240..74ab08fdba 100644 --- a/wallet/src/de/schildbach/wallet/service/BlockchainServiceImpl.java +++ b/wallet/src/de/schildbach/wallet/service/BlockchainServiceImpl.java @@ -208,7 +208,6 @@ public class BlockchainServiceImpl extends LifecycleService implements Blockchai public static final String START_AS_FOREGROUND_EXTRA = "start_as_foreground"; - private Executor executor = Executors.newSingleThreadExecutor(); private int syncPercentage = 0; // 0 to 100% // Risk Analyser for Transactions that is PeerGroup Aware diff --git a/wallet/src/de/schildbach/wallet/ui/CheckPinDialog.kt b/wallet/src/de/schildbach/wallet/ui/CheckPinDialog.kt index affc8c65f4..b1534c4741 100644 --- a/wallet/src/de/schildbach/wallet/ui/CheckPinDialog.kt +++ b/wallet/src/de/schildbach/wallet/ui/CheckPinDialog.kt @@ -207,6 +207,10 @@ open class CheckPinDialog( } protected fun setState(newState: State) { + if (view == null) { + log.warn("Attempted to set state when the view is not available.") + return + } when (newState) { State.ENTER_PIN -> { if (viewModel.pinLength != PinPreviewView.DEFAULT_PIN_LENGTH) { diff --git a/wallet/src/de/schildbach/wallet/ui/TransactionResultViewModel.kt b/wallet/src/de/schildbach/wallet/ui/TransactionResultViewModel.kt index cec999b047..3275f459f0 100644 --- a/wallet/src/de/schildbach/wallet/ui/TransactionResultViewModel.kt +++ b/wallet/src/de/schildbach/wallet/ui/TransactionResultViewModel.kt @@ -45,7 +45,6 @@ class TransactionResultViewModel @Inject constructor( private val analytics: AnalyticsService, val walletApplication: WalletApplication ) : ViewModel() { - val dashFormat: MonetaryFormat = configuration.format.noCode() val wallet: Wallet? @@ -56,7 +55,7 @@ class TransactionResultViewModel @Inject constructor( private val _transactionMetadata: MutableStateFlow = MutableStateFlow(null) val transactionMetadata - get() = _transactionMetadata.filterNotNull().asLiveData() + get() = _transactionMetadata.filterNotNull() val transactionIcon = _transactionMetadata .filterNotNull() diff --git a/wallet/src/de/schildbach/wallet/ui/transactions/TransactionDetailsDialogFragment.kt b/wallet/src/de/schildbach/wallet/ui/transactions/TransactionDetailsDialogFragment.kt index 7785a97e1b..cc1f859c7b 100644 --- a/wallet/src/de/schildbach/wallet/ui/transactions/TransactionDetailsDialogFragment.kt +++ b/wallet/src/de/schildbach/wallet/ui/transactions/TransactionDetailsDialogFragment.kt @@ -35,6 +35,7 @@ import org.dash.wallet.common.services.analytics.AnalyticsConstants import org.dash.wallet.common.ui.dialogs.AdaptiveDialog import org.dash.wallet.common.ui.dialogs.OffsetDialogFragment import org.dash.wallet.common.ui.viewBinding +import org.dash.wallet.common.util.observe import org.slf4j.LoggerFactory import javax.inject.Inject diff --git a/wallet/src/de/schildbach/wallet/ui/transactions/TransactionResultActivity.kt b/wallet/src/de/schildbach/wallet/ui/transactions/TransactionResultActivity.kt index a011aa5ad3..fc749f3b96 100644 --- a/wallet/src/de/schildbach/wallet/ui/transactions/TransactionResultActivity.kt +++ b/wallet/src/de/schildbach/wallet/ui/transactions/TransactionResultActivity.kt @@ -36,6 +36,7 @@ import org.bitcoinj.core.Sha256Hash import org.bitcoinj.core.Transaction import org.dash.wallet.common.services.analytics.AnalyticsConstants import org.dash.wallet.common.ui.dialogs.AdaptiveDialog +import org.dash.wallet.common.util.observe import org.slf4j.LoggerFactory /** @@ -43,7 +44,6 @@ import org.slf4j.LoggerFactory */ @AndroidEntryPoint class TransactionResultActivity : LockScreenActivity() { - private val log = LoggerFactory.getLogger(javaClass.simpleName) companion object { @@ -161,6 +161,11 @@ class TransactionResultActivity : LockScreenActivity() { } private fun onTransactionDetailsDismiss() { + if (isFinishing || isDestroyed) { + log.warn("Activity is finishing or destroyed. Skipping dismiss actions.") + return + } + when { intent.action == Intent.ACTION_VIEW || intent.action == SendCoinsActivity.ACTION_SEND_FROM_WALLET_URI -> { finish()