diff --git a/common/src/main/java/org/dash/wallet/common/ui/enter_amount/AmountView.kt b/common/src/main/java/org/dash/wallet/common/ui/enter_amount/AmountView.kt
index 494d07f24d..09d70e3164 100644
--- a/common/src/main/java/org/dash/wallet/common/ui/enter_amount/AmountView.kt
+++ b/common/src/main/java/org/dash/wallet/common/ui/enter_amount/AmountView.kt
@@ -60,7 +60,7 @@ class AmountView(context: Context, attrs: AttributeSet) : ConstraintLayout(conte
var input: String
get() = _input
set(value) {
- _input = value.ifEmpty { "0" }
+ _input = if (value.none { it.isDigit() } || value.trimStart().startsWith("-")) "0" else value
updateAmount()
}
@@ -96,8 +96,9 @@ class AmountView(context: Context, attrs: AttributeSet) : ConstraintLayout(conte
if (exchangeRate != null) {
fiatAmount = exchangeRate!!.coinToFiat(dashAmount)
- _input = fiatFormat.minDecimals(0)
+ val fiatStr = fiatFormat.minDecimals(0)
.optionalDecimals(0, 2).format(fiatAmount).toString()
+ _input = if (fiatStr.trimStart().startsWith("-")) "0" else fiatStr
binding.inputAmount.text = formatInputWithCurrency()
} else {
binding.inputAmount.text = resources.getString(R.string.rate_not_available)
diff --git a/wallet/res/layout/scan_activity.xml b/wallet/res/layout/scan_activity.xml
index b0b2b353c5..7b3f2ea74b 100644
--- a/wallet/res/layout/scan_activity.xml
+++ b/wallet/res/layout/scan_activity.xml
@@ -14,4 +14,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
+
+
\ No newline at end of file
diff --git a/wallet/res/values/strings-extra.xml b/wallet/res/values/strings-extra.xml
index 6713eac32a..13700eb6ad 100644
--- a/wallet/res/values/strings-extra.xml
+++ b/wallet/res/values/strings-extra.xml
@@ -444,11 +444,11 @@
by default all transactions to or from your linked accounts (exchanges, staking, etc) will be marked as transfers.
Choose any transaction from the homepage and change the category on the transaction details page.
- Masternode Keys
- Owner Keys
- Voting Keys
- Operator Keys
- EvoNode operator keys
+ Masternode keys
+ Owner keys
+ Voting keys
+ Operator keys
+ HPMN operator keys
%d keys
%d used
Keypair %d
diff --git a/wallet/src/de/schildbach/wallet/WalletApplication.java b/wallet/src/de/schildbach/wallet/WalletApplication.java
index 0afa146700..a033515351 100644
--- a/wallet/src/de/schildbach/wallet/WalletApplication.java
+++ b/wallet/src/de/schildbach/wallet/WalletApplication.java
@@ -547,7 +547,6 @@ private void initUphold() {
private void initPlatform() {
platformSyncService.init();
- //PlatformRepo.getInstance().initGlobal();
}
private void initCoinbase() {
diff --git a/wallet/src/de/schildbach/wallet/service/platform/IdentityRepository.kt b/wallet/src/de/schildbach/wallet/service/platform/IdentityRepository.kt
index d1c966669a..19f5574f78 100644
--- a/wallet/src/de/schildbach/wallet/service/platform/IdentityRepository.kt
+++ b/wallet/src/de/schildbach/wallet/service/platform/IdentityRepository.kt
@@ -26,6 +26,9 @@ import de.schildbach.wallet.ui.dashpay.utils.DashPayConfig.Companion.UPGRADE_IDE
import io.grpc.StatusRuntimeException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filter
@@ -66,6 +69,7 @@ import javax.inject.Inject
interface IdentityRepository {
val blockchainIdentity: BlockchainIdentity?
+ val blockchainIdentityFlow: StateFlow
//suspend fun addMissingKeys(keyParameter: KeyParameter?): Boolean
suspend fun getIdentityBalance(): CreditBalanceInfo?
val hasBlockchainIdentity: Boolean
@@ -102,6 +106,7 @@ interface IdentityRepository {
suspend fun shouldShowAlert(): Boolean
fun getNextContactAddress(userId: String, accountReference: Int): Address?
suspend fun clearDatabase(includeInvitations: Boolean)
+ fun updateIdentity()
}
class IdentityRepositoryImpl @Inject constructor(
@@ -120,7 +125,12 @@ class IdentityRepositoryImpl @Inject constructor(
val authenticationGroupExtension: AuthenticationGroupExtension?
get() = walletApplication.authenticationGroupExtension
- private var _blockchainIdentity: BlockchainIdentity? = null
+ private val _blockchainIdentityFlow = MutableStateFlow(null)
+ override val blockchainIdentityFlow: StateFlow = _blockchainIdentityFlow.asStateFlow()
+
+ private var _blockchainIdentity: BlockchainIdentity?
+ get() = _blockchainIdentityFlow.value
+ set(value) { _blockchainIdentityFlow.value = value }
override val blockchainIdentity: BlockchainIdentity?
get() = _blockchainIdentity
@@ -228,7 +238,6 @@ class IdentityRepositoryImpl @Inject constructor(
}
identity = blockchainIdentityData.identity
}
- blockchainIdentity.updateIdentity()
log.info("loading identity ${blockchainIdentityData.userId} == ${_blockchainIdentity?.uniqueIdString}: {}", watch)
} else {
log.info("loading identity: {}", watch)
@@ -815,6 +824,10 @@ class IdentityRepositoryImpl @Inject constructor(
}
}
+ override fun updateIdentity() {
+ _blockchainIdentity?.updateIdentity()
+ }
+
// current unused
private suspend fun getContactRequestReport(): String {
val report = StringBuilder()
diff --git a/wallet/src/de/schildbach/wallet/service/platform/PlatformSyncService.kt b/wallet/src/de/schildbach/wallet/service/platform/PlatformSyncService.kt
index f6688f04d4..e4faf024a4 100644
--- a/wallet/src/de/schildbach/wallet/service/platform/PlatformSyncService.kt
+++ b/wallet/src/de/schildbach/wallet/service/platform/PlatformSyncService.kt
@@ -377,6 +377,9 @@ class PlatformSynchronizationService @Inject constructor(
if (!initialSync) {
checkDatabaseIntegrity(userId)
updateSyncStatus(PreBlockStage.FixMissingProfiles)
+ } else {
+ // update the
+ identityRepository.updateIdentity()
}
// Get all out our contact requests
diff --git a/wallet/src/de/schildbach/wallet/ui/LockScreenActivity.kt b/wallet/src/de/schildbach/wallet/ui/LockScreenActivity.kt
index a6c7fcb719..0a443333e9 100644
--- a/wallet/src/de/schildbach/wallet/ui/LockScreenActivity.kt
+++ b/wallet/src/de/schildbach/wallet/ui/LockScreenActivity.kt
@@ -152,10 +152,12 @@ open class LockScreenActivity : SecureActivity() {
}
override fun setContentView(contentViewResId: Int) {
+ if (isFinishing) return
setContentView(layoutInflater.inflate(contentViewResId, null))
}
override fun setContentView(contentView: View?) {
+ if (isFinishing) return
binding.regularContent.removeAllViews()
binding.regularContent.addView(contentView)
}
diff --git a/wallet/src/de/schildbach/wallet/ui/main/MainViewModel.kt b/wallet/src/de/schildbach/wallet/ui/main/MainViewModel.kt
index 6966d0dbff..1f70f3d35c 100644
--- a/wallet/src/de/schildbach/wallet/ui/main/MainViewModel.kt
+++ b/wallet/src/de/schildbach/wallet/ui/main/MainViewModel.kt
@@ -336,6 +336,12 @@ class MainViewModel @Inject constructor(
refreshContactsForAllTransactions()
}.launchIn(viewModelWorkerScope)
+ identityRepository.blockchainIdentityFlow
+ .filterNotNull()
+ .distinctUntilChanged()
+ .onEach { refreshContactsForAllTransactions() }
+ .launchIn(viewModelWorkerScope)
+
walletData.observeWalletReset()
.onEach {
txByHash = mapOf()
@@ -697,10 +703,11 @@ class MainViewModel @Inject constructor(
}
viewModelWorkerScope.launch {
- val contactsMap = if (this@MainViewModel.contacts.isNotEmpty()) {
+ val blockchainIdentity = identityRepository.blockchainIdentity
+ val contactsMap = if (this@MainViewModel.contacts.isNotEmpty() && blockchainIdentity != null) {
txs.filterNot { it.isEntirelySelf(walletData.transactionBag) }
.mapNotNull { tx ->
- identityRepository.blockchainIdentity!!.getContactForTransaction(tx)?.let { contactId ->
+ blockchainIdentity.getContactForTransaction(tx)?.let { contactId ->
contacts[contactId]?.let { contact ->
tx.txId to contact
}
diff --git a/wallet/src/de/schildbach/wallet/ui/main/WalletFragment.kt b/wallet/src/de/schildbach/wallet/ui/main/WalletFragment.kt
index b7e164c058..7971291eb0 100644
--- a/wallet/src/de/schildbach/wallet/ui/main/WalletFragment.kt
+++ b/wallet/src/de/schildbach/wallet/ui/main/WalletFragment.kt
@@ -430,7 +430,11 @@ class WalletFragment : Fragment(R.layout.home_content) {
R.id.paymentsFragment,
bundleOf(
PaymentsFragment.ARG_ACTIVE_TAB to PaymentsFragment.ACTIVE_TAB_PAY
- )
+ ),
+ NavOptions.Builder()
+ .setLaunchSingleTop(true)
+ .setPopUpTo(R.id.walletFragment, false)
+ .build()
)
}
ShortcutOption.RECEIVE -> {
@@ -439,7 +443,11 @@ class WalletFragment : Fragment(R.layout.home_content) {
R.id.paymentsFragment,
bundleOf(
PaymentsFragment.ARG_ACTIVE_TAB to PaymentsFragment.ACTIVE_TAB_RECEIVE
- )
+ ),
+ NavOptions.Builder()
+ .setLaunchSingleTop(true)
+ .setPopUpTo(R.id.walletFragment, false)
+ .build()
)
}
ShortcutOption.EXPLORE -> {
diff --git a/wallet/src/de/schildbach/wallet/ui/scan/ScanActivity.java b/wallet/src/de/schildbach/wallet/ui/scan/ScanActivity.java
index faef9a6fec..93445b0ba9 100644
--- a/wallet/src/de/schildbach/wallet/ui/scan/ScanActivity.java
+++ b/wallet/src/de/schildbach/wallet/ui/scan/ScanActivity.java
@@ -191,6 +191,7 @@ public void onChanged(final Void v) {
scannerView = (ScannerView) findViewById(R.id.scan_activity_mask);
previewView = (TextureView) findViewById(R.id.scan_activity_preview);
previewView.setSurfaceTextureListener(this);
+ findViewById(R.id.scan_close_button).setOnClickListener(v -> onBackPressed());
cameraThread = new HandlerThread("cameraThread", Process.THREAD_PRIORITY_BACKGROUND);
cameraThread.start();