-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release v4.0. Merge branch 'develop'
Ui refactoring, fix some issue
- Loading branch information
Showing
85 changed files
with
1,183 additions
and
793 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
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
20 changes: 0 additions & 20 deletions
20
...a/by/alexandr7035/affinidi_id/presentation/common/credentials/CredentialDetailsUiModel.kt
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
...entials/CredentialToDetailsModelMapper.kt → ...s/credential_card/CredentialCardMapper.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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package by.alexandr7035.affinidi_id.presentation.common.credentials | ||
package by.alexandr7035.affinidi_id.presentation.common.credentials.credential_card | ||
|
||
import by.alexandr7035.affinidi_id.domain.model.credentials.stored_credentials.Credential | ||
|
||
interface CredentialToDetailsModelMapper { | ||
fun map(credential: Credential): CredentialDetailsUiModel.Success | ||
interface CredentialCardMapper { | ||
fun map(credential: Credential): CredentialCardUi | ||
} |
69 changes: 69 additions & 0 deletions
69
...5/affinidi_id/presentation/common/credentials/credential_card/CredentialCardMapperImpl.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,69 @@ | ||
package by.alexandr7035.affinidi_id.presentation.common.credentials.credential_card | ||
|
||
import by.alexandr7035.affinidi_id.R | ||
import by.alexandr7035.affinidi_id.core.extensions.getStringDateFromLong | ||
import by.alexandr7035.affinidi_id.core.extensions.getPrettifiedDid | ||
import by.alexandr7035.affinidi_id.domain.model.credentials.stored_credentials.Credential | ||
import by.alexandr7035.affinidi_id.domain.model.credentials.stored_credentials.CredentialStatus | ||
import by.alexandr7035.affinidi_id.presentation.common.credentials.credential_status.CredentialStatusMapper | ||
import by.alexandr7035.affinidi_id.presentation.common.resources.ResourceProvider | ||
import javax.inject.Inject | ||
|
||
class CredentialCardMapperImpl @Inject constructor( | ||
private val resourceProvider: ResourceProvider, | ||
private val credentialStatusMapper: CredentialStatusMapper | ||
) : CredentialCardMapper { | ||
override fun map(credential: Credential): CredentialCardUi { | ||
|
||
val credentialExpirationText = if (credential.expirationDate != null) { | ||
|
||
when (credential.credentialStatus) { | ||
CredentialStatus.ACTIVE -> { | ||
resourceProvider.getString( | ||
R.string.credential_active_until_template, | ||
credential.expirationDate!!.getStringDateFromLong(CARD_DATE_FORMAT) | ||
) | ||
} | ||
|
||
CredentialStatus.EXPIRED -> { | ||
resourceProvider.getString( | ||
R.string.credential_expired_at_template, | ||
credential.expirationDate!!.getStringDateFromLong(CARD_DATE_FORMAT) | ||
) | ||
} | ||
} | ||
|
||
} else { | ||
resourceProvider.getString( | ||
R.string.no_expiration | ||
) | ||
} | ||
|
||
val issuanceDate = resourceProvider.getString( | ||
R.string.credential_issued_on_template, | ||
credential.issuanceDate.getStringDateFromLong(CARD_DATE_FORMAT) | ||
) | ||
|
||
val formattedIssuerDid = credential.issuerDid.split(";").first() | ||
val prettifiedIssuerDid = formattedIssuerDid.getPrettifiedDid() | ||
|
||
val formattedHolderDid = credential.holderDid.split(";").first() | ||
val prettifiedHolderDid = formattedHolderDid.getPrettifiedDid() | ||
|
||
val credentialStatusUi = credentialStatusMapper.map(credential.credentialStatus) | ||
|
||
return CredentialCardUi( | ||
id = credential.id, | ||
issuerDid = prettifiedHolderDid, | ||
holderDid = prettifiedHolderDid, | ||
issuanceDateText = issuanceDate, | ||
credentialStatusUi = credentialStatusUi, | ||
credentialExpirationText = credentialExpirationText, | ||
credentialTypeText = credential.vcType, | ||
) | ||
} | ||
|
||
companion object { | ||
private const val CARD_DATE_FORMAT = "dd/MMM/YYYY" | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...xandr7035/affinidi_id/presentation/common/credentials/credential_card/CredentialCardUi.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,13 @@ | ||
package by.alexandr7035.affinidi_id.presentation.common.credentials.credential_card | ||
|
||
import by.alexandr7035.affinidi_id.presentation.common.credentials.credential_status.CredentialStatusUi | ||
|
||
data class CredentialCardUi( | ||
val id: String, | ||
val holderDid: String, | ||
val issuerDid: String, | ||
val issuanceDateText: String, | ||
val credentialStatusUi: CredentialStatusUi, | ||
val credentialTypeText: String, | ||
val credentialExpirationText: String, | ||
) |
8 changes: 0 additions & 8 deletions
8
...d/presentation/common/credentials/credential_metadata/CredentialMetadataToFieldsMapper.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.