Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class ChildAccountList(
} else {
localAccount.pinTime = System.currentTimeMillis()
}

cache().cache(ChildAccountCache().apply { addAll(accountList) })
cache().cache(ArrayList(accountList))
}

fun refresh() {
Expand All @@ -45,7 +44,7 @@ class ChildAccountList(
accounts.forEach { account -> account.pinTime = (oldAccounts.firstOrNull { it.address == account.address }?.pinTime ?: 0) }
accountList.clear()
accountList.addAll(accounts)
cache().cache(ChildAccountCache().apply { addAll(accountList) })
cache().cache(ArrayList(accountList))
dispatchAccountUpdateListener(address, accountList.toList())

logd(TAG, "refresh: $address, ${accountList.size}")
Expand All @@ -62,10 +61,11 @@ class ChildAccountList(
return result?.encode()?.parseAccountMetas()
}

private fun cache(): CacheManager<ChildAccountCache> {
private fun cache(): CacheManager<List<ChildAccount>> {
@Suppress("UNCHECKED_CAST")
return CacheManager(
"${address}.child_account_list".cacheFile(),
ChildAccountCache::class.java,
ArrayList::class.java as Class<List<ChildAccount>>,
)
}

Expand Down Expand Up @@ -101,5 +101,3 @@ data class ChildAccount(
@SerializedName("description")
val description: String? = null,
) : Parcelable

private class ChildAccountCache : ArrayList<ChildAccount>()
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ class MoveNFTDialog : BottomSheetDialogFragment() {
addressList.add(0, evmAddress)
needMoveFee = true
layoutToAccount.setAccountInfo(evmAddress)

} else {
val childAccount = WalletManager.childAccount(addressList[0]) ?: return@with
needMoveFee = false
layoutToAccount.setAccountInfo(childAccount.address)
} else if (addressList.isNotEmpty()) {
WalletManager.childAccount(addressList[0])?.let { child ->
needMoveFee = false
layoutToAccount.setAccountInfo(child.address)
}
Comment thread
jaymengxy marked this conversation as resolved.
}
configureToLayoutAction(addressList)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ class SendAmountPresenter(
private fun getAmountConvert(): String {
val amount = binding.transferAmountInput.text.ifBlank { "0" }.toString().toSafeDecimal()
val rate = (balance()?.coinRate ?: BigDecimal.ZERO) * CurrencyManager.currencyDecimalPrice()
val convert =
if (viewModel.convertCoin() == selectedCurrency().flag) amount * rate else amount / rate
val convert = if (viewModel.convertCoin() == selectedCurrency().flag) amount * rate else {
if (rate <= BigDecimal.ZERO) BigDecimal.ZERO else amount / rate
}
Comment thread
jaymengxy marked this conversation as resolved.
return convert.format()
}

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ android.injected.testOnly=false
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
vCode=271
vName=r2.8.3
vCode=275
vName=r2.8.4