-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Concordium/identity-proofs-ui
Identity proofs
- Loading branch information
Showing
31 changed files
with
1,548 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ on: | |
workflow_dispatch: | ||
|
||
env: | ||
java_version: "11" | ||
java_version: "17" | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
app/src/main/java/com/concordium/wallet/ui/walletconnect/CredentialStatementAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.concordium.wallet.ui.walletconnect | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.concordium.sdk.crypto.wallet.web3Id.Statement.RequestStatement | ||
import com.concordium.wallet.data.room.Account | ||
import com.concordium.wallet.data.room.Identity | ||
import com.concordium.wallet.databinding.IdentityProofContainerBinding | ||
import com.concordium.wallet.util.Log | ||
|
||
class CredentialStatementAdapter( | ||
private val requests: List<RequestStatement>, | ||
private val accounts: List<Account>, | ||
private val getIdentity: (account: Account) -> Identity?, | ||
private val onChangeAccount: (index: Int) -> Unit | ||
): RecyclerView.Adapter<CredentialStatementAdapter.ViewHolder>() { | ||
class ViewHolder(val containerBinding: IdentityProofContainerBinding): RecyclerView.ViewHolder(containerBinding.root) | ||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | ||
val binding = IdentityProofContainerBinding.inflate(LayoutInflater.from(parent.context)) | ||
binding.root.layoutParams = RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT,RecyclerView.LayoutParams.MATCH_PARENT) | ||
return ViewHolder(binding) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return requests.size | ||
} | ||
|
||
override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
val account = accounts[position] | ||
val identity = getIdentity(account) | ||
|
||
if (identity == null) { | ||
Log.e("Identity is not available for account ${account.address}") | ||
return | ||
} | ||
|
||
holder.containerBinding.statements.setStatement(requests[position], identity) | ||
with(holder.containerBinding.selectedAccountInclude) { | ||
accAddress.text = account.getAccountName() | ||
// TODO do we want to show amount here or identity? | ||
accBalance.text = root.context.getString( | ||
com.concordium.wallet.R.string.acc_balance_placeholder, | ||
com.concordium.wallet.data.util.CurrencyUtil.formatGTU( | ||
account.getAtDisposalWithoutStakedOrScheduled( | ||
account.totalUnshieldedBalance | ||
), true | ||
) | ||
) | ||
} | ||
holder.containerBinding.selectedAccountIncludeContainer.setOnClickListener { | ||
onChangeAccount(position) | ||
} | ||
} | ||
} |
Oops, something went wrong.