Skip to content
Merged
22 changes: 12 additions & 10 deletions app/src/main/assets/delegation_intro_flow_en_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@

<body>
<p>
There are two staking models that a delegator can choose: <br><br>

&nbsp;&nbsp;&nbsp;&nbsp;•&nbsp; Delegating to a specific pool of your choice<br>
&nbsp;&nbsp;&nbsp;&nbsp;•&nbsp; Passive delegation
A staking pool is managed by an individual validator.
</p>
<p>
Running a pool allows a validator to attract more stake and thus increase chances of being selected
to validate a block.
</p>
<p>
A validator pool is managed by an individual validator running a node, so the rewards depend on that
validator’s performance.
Validators also earn a commission from the delegators upon validating a block.
</p>
<p>
Since passive delegation doesn’t go to a specific pool, it mitigates the risk of a single validator
performing badly, however, rewards are lower.
Delegating to a staking pool is usually more profitable than passive delegation, but there is also
a risk of losing out on rewards if the validator is not running properly. It is therefore a good
idea to keep an eye on the validator’s performance.
</p>
<p>
For more info visit<br/><b><a
href="https://developer.concordium.software/en/mainnet/net/concepts/concepts-delegation.html">developer.concordium.software</a></b>
You can read more about how to investigate a validator’s performance on our <b><a
href="https://developer.concordium.software/en/mainnet/net/concepts/concepts-delegation.html">documentation
website</a></b>.
</p>
</body>

Expand Down
21 changes: 7 additions & 14 deletions app/src/main/assets/delegation_intro_flow_en_3.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,17 @@

<body>
<p>
A staking pool is managed by an individual validator.
For CCD holders who do not want to regularly check the performance of a chosen pool, but just
want a stable way of earning rewards, passive delegation offers a low-risk, low-reward
alternative.
</p>
<p>
Running a pool allows a validator to attract more stake and thus increase chances of being selected
to validate a block.
This staking strategy is not associated with a specific validator, so there is no risk of poor validator
health.
</p>
<p>
Validators also earn a commission from the delegators upon validating a block.
</p>
<p>
Delegating to a staking pool is usually more profitable than passive delegation, but there is also
a risk of losing out on rewards if the validator is not running properly. It is therefore a good
idea to keep an eye on the validator’s performance.
</p>
<p>
You can read more about how to investigate a validator’s performance on our <b><a
href="https://developer.concordium.software/en/mainnet/net/concepts/concepts-delegation.html">documentation
website</a></b>.
The trade off when choosing passive delegation is that the return on your stake will be less
than what you may receive, when delegating to a specific staking pool.
</p>
</body>

Expand Down
15 changes: 8 additions & 7 deletions app/src/main/assets/delegation_intro_flow_en_4.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@

<body>
<p>
For CCD holders who do not want to regularly check the performance of a chosen pool, but just
want a stable way of earning rewards, passive delegation offers a low-risk, low-reward
alternative.
Whether you choose an individual validating pool or passive delegation, rewards are paid out at what
is called the pay day. Rewards are distributed to everyone in the pool proportional to their
stake, and a commission is paid to the validator by all delegators.
</p>
<p>
This staking strategy is not associated with a specific validator, so there is no risk of poor validator
health.
If you make updates to your delegation at a later point, most of these will also take effect
from the next pay day.
</p>
<p>
The trade off when choosing passive delegation is that the return on your stake will be less
than what you may receive, when delegating to a specific staking pool.
To read more about the pay day, you can visit our <b><a
href="https://developer.concordium.software/en/mainnet/net/concepts/concepts-delegation.html">documentation
website</a></b>.
</p>
</body>

Expand Down
22 changes: 14 additions & 8 deletions app/src/main/assets/delegation_intro_flow_en_5.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@

<body>
<p>
Whether you choose an individual validating pool or passive delegation, rewards are paid out at what
is called the pay day. Rewards are distributed to everyone in the pool proportional to their
stake, and a commission is paid to the validator by all delegators.
When you make a delegation to either type of pool, your delegation amount will be locked on your
account.
</p>

<p>
If you make updates to your delegation at a later point, most of these will also take effect
from the next pay day.
This means that you cannot use the amount for anything while it is still locked in for
delegation.
</p>

<p>
If you decrease your delegation amount or stop the delegation altogether, the amount will
still be locked for a cool-down period.
</p>

<p>
To read more about the pay day, you can visit our <b><a
href="https://developer.concordium.software/en/mainnet/net/concepts/concepts-delegation.html">documentation
website</a></b>.
As transactions cost a fee, it is important to take into consideration, that you will need
some unlocked funds on your public balance to pay the fee for unlocking your delegation amount
again.
</p>
</body>

Expand Down
17 changes: 2 additions & 15 deletions app/src/main/assets/delegation_intro_flow_en_6.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,11 @@

<body>
<p>
When you make a delegation to either type of pool, your delegation amount will be locked on your
account.
After starting a delegation, you will be able to see it’s current status on the status screen.
</p>

<p>
This means that you cannot use the amount for anything while it is still locked in for
delegation.
</p>

<p>
If you decrease your delegation amount or stop the delegation altogether, the amount will
still be locked for a cool-down period.
</p>

<p>
As transactions cost a fee, it is important to take into consideration, that you will need
some unlocked funds on your public balance to pay the fee for unlocking your delegation amount
again.
From there, you can also make updates to your delegation, or stop it again.
</p>
</body>

Expand Down
21 changes: 0 additions & 21 deletions app/src/main/assets/delegation_intro_flow_en_7.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@ object CurrencyUtil {
val denominatorBigDecimal = BigDecimal(eurPerUnit.denominator)
val numeratorBigDecimal = BigDecimal(eurPerUnit.numerator)

return amountBigDecimal
.multiply(numeratorBigDecimal)
.divide(denominatorBigDecimal, 2, RoundingMode.HALF_UP)
.toString()
return formatGTUWithCommas(
amountBigDecimal
.multiply(numeratorBigDecimal)
.divide(denominatorBigDecimal, 2, RoundingMode.HALF_UP)
.toString()
)
}

private fun checkGTUString(stringValue: String): Boolean {
Expand All @@ -170,6 +172,8 @@ object CurrencyUtil {

private fun formatGTUWithCommas(value: String): String {
val bigDecimalValue = value.replace(separator, '.').toBigDecimal()
if (bigDecimalValue.compareTo(BigDecimal.ZERO) == 0)
return ZERO_AMOUNT
return formatter.format(bigDecimalValue)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.concordium.wallet.databinding.DialogEdittextBinding
import com.concordium.wallet.ui.base.BaseActivity
import com.concordium.wallet.ui.more.export.ExportAccountKeysActivity
import com.concordium.wallet.ui.more.export.ExportTransactionLogActivity
import com.concordium.wallet.uicore.toast.ToastType
import com.concordium.wallet.uicore.toast.showCustomToast
import com.concordium.wallet.util.ClipboardUtil
import com.concordium.wallet.util.getSerializable
Expand Down Expand Up @@ -145,6 +146,9 @@ class AccountSettingsActivity : BaseActivity(
context = this,
text = address
)
showCustomToast(title = getString(R.string.account_settings_address_copied))
showCustomToast(
title = getString(R.string.account_settings_address_copied),
toastType = ToastType.INFO
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
Expand Down Expand Up @@ -84,35 +85,33 @@ class AccountDetailsTransfersFragment : Fragment() {
}

transfersViewModel.transferListFlow.collectWhenStarted(viewLifecycleOwner) { transferList ->
transferList?.let {
val filteredList = transferList.filterIndexed { index, currentItem ->
var result = true
if (currentItem.getItemType() == AdapterItem.ItemType.Header)
result = showHeader(transferList, index)
else if (currentItem.getItemType() == AdapterItem.ItemType.Item)
result = showItem(currentItem)
result
}

if (filteredList.isNotEmpty()) {
transactionAdapter.setData(filteredList)
transactionAdapter.removeFooter()
if (transfersViewModel.hasMoreRemoteTransactionsToLoad) {
transactionAdapter.addFooter()
}
transactionAdapter.onDataSetChanged()
}
val filteredList = transferList.filterIndexed { index, currentItem ->
var result = true
if (currentItem.getItemType() == AdapterItem.ItemType.Header)
result = showHeader(transferList, index)
else if (currentItem.getItemType() == AdapterItem.ItemType.Item)
result = showItem(currentItem)
result
}

if (filteredList.isEmpty()) {
binding.recyclerview.visibility = View.GONE
binding.noTransfersTextview.visibility = View.VISIBLE
} else {
binding.noTransfersTextview.visibility = View.GONE
binding.recyclerview.visibility = View.VISIBLE
if (filteredList.isNotEmpty()) {
transactionAdapter.setData(filteredList)
transactionAdapter.removeFooter()
if (transfersViewModel.hasMoreRemoteTransactionsToLoad) {
transactionAdapter.addFooter()
}
transactionAdapter.onDataSetChanged()
}

transfersViewModel.allowScrollToLoadMore = true
if (filteredList.isEmpty()) {
binding.recyclerview.visibility = View.GONE
binding.noTransfersTextview.visibility = View.VISIBLE
} else {
binding.noTransfersTextview.visibility = View.GONE
binding.recyclerview.visibility = View.VISIBLE
}

transfersViewModel.allowScrollToLoadMore = true
}

transfersViewModel.showGTUDropFlow.collectWhenStarted(viewLifecycleOwner) { show ->
Expand All @@ -133,11 +132,7 @@ class AccountDetailsTransfersFragment : Fragment() {
}

private fun showWaiting(waiting: Boolean) {
if (waiting) {
binding.progress.progressLayout.visibility = View.VISIBLE
} else {
binding.progress.progressLayout.visibility = View.GONE
}
binding.progress.progressLayout.isVisible = waiting
}

private fun showHeader(transferList: List<AdapterItem>, currentIndex: Int): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class TransactionAdapter :
binding.costTextview,
binding.layoutMemo,
binding.memoTextview,
binding.statusImageview,
memoExpandButton = binding.memoExpandIcon,
isMemoExpanded = isMemoExpanded
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TransfersViewModel(

private lateinit var account: Account

private val _transferListFlow = MutableStateFlow<List<AdapterItem>?>(emptyList())
private val _transferListFlow = MutableStateFlow<List<AdapterItem>>(emptyList())
val transferListFlow = _transferListFlow.asStateFlow()

private val _showGTUDropFlow = MutableStateFlow(false)
Expand All @@ -69,6 +69,8 @@ class TransfersViewModel(
private val _errorFlow = MutableStateFlow(Event(-1))
val errorFlow = _errorFlow.asStateFlow()

private val tempList = mutableListOf<AdapterItem>()

init {
initializeAccountUpdater()

Expand Down Expand Up @@ -196,7 +198,7 @@ class TransfersViewModel(
}

private fun addToTransactionList(newTransactions: List<Transaction>) {
val adapterList = (_transferListFlow.value ?: emptyList()).toMutableList()
val adapterList = tempList.toMutableList()
for (ta in newTransactions) {
val isAfterHeader = checkToAddHeaderItem(adapterList, ta)
adapterList.add(
Expand All @@ -206,6 +208,9 @@ class TransfersViewModel(
)
)
}
tempList.clear()
tempList.addAll(adapterList)

_transferListFlow.value = adapterList
updateGTUDropState()
}
Expand Down Expand Up @@ -291,7 +296,7 @@ class TransfersViewModel(
if (!BuildConfig.SHOW_GTU_DROP) {
_showGTUDropFlow.value = false
} else {
_showGTUDropFlow.value = transferListFlow.value.isNullOrEmpty()
_showGTUDropFlow.value = transferListFlow.value.isEmpty()

}
}
Expand All @@ -302,7 +307,7 @@ class TransfersViewModel(
}

private fun clearTransactionListState() {
_transferListFlow.value = emptyList()
tempList.clear()
nonMergedLocalTransactions.clear()
hasMoreRemoteTransactionsToLoad = true
lastRemoteTransaction = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.concordium.wallet.data.room.Account
import com.concordium.wallet.databinding.FragmentReceiveBinding
import com.concordium.wallet.extension.collectWhenStarted
import com.concordium.wallet.ui.MainViewModel
import com.concordium.wallet.uicore.toast.ToastType
import com.concordium.wallet.uicore.toast.showCustomToast
import com.concordium.wallet.util.ClipboardUtil
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
Expand Down Expand Up @@ -91,6 +92,9 @@ class ReceiveFragment : Fragment() {
text = viewModel.getAccount()!!.address
)

requireActivity().showCustomToast(title = getString(R.string.account_qr_code_copied))
requireActivity().showCustomToast(
title = getString(R.string.account_qr_code_copied),
toastType = ToastType.INFO
)
}
}
Loading