Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ABW-3960] - Factor source card component #1268

Merged
merged 6 commits into from
Dec 9, 2024

Conversation

sergiupuhalschi-rdx
Copy link
Contributor

@sergiupuhalschi-rdx sergiupuhalschi-rdx commented Dec 4, 2024

ABW-3960

Description

Adds reusable and configurable factor source card component.

Video

Recorder_04122024_113702.mp4

@sergiupuhalschi-rdx sergiupuhalschi-rdx self-assigned this Dec 4, 2024
@Suppress("LongMethod")
override fun initialState(): State = State(
displayOnlyItems = persistentListOf(
newLedgerHardwareWalletFactorSourceSample().toCard(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used the Sargon global functions here to prevent cascading the @UsesSampleValues annotation throughout all the related components. I hope this is acceptable because this code is not meant to be used in production as it only serves as an example until we implement the actual feature.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also use @Opt-In(UsesSampleValues::class) and use the samples defined too. Perfectly acceptable in such view model.

Copy link
Contributor

@micbakos-rdx micbakos-rdx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice expand/collapse animations!

data class Instance(
val id: FactorSourceId.Hash,
val name: String,
val lastUsedOn: String?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be a string or a Sargon timestamp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the formatted time based on a Sargon Timestamp. It's a matter of deciding if we want to format it in the ViewModel or directly in the UI, now I'm formatting it in the ViewModel and let the UI display it as it is.

@@ -0,0 +1,27 @@
package com.babylon.wallet.android.domain.model.factors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should such model be kept in a ui.model package?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe start putting such models in that package now that we use them more?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point

@Suppress("LongMethod")
override fun initialState(): State = State(
displayOnlyItems = persistentListOf(
newLedgerHardwareWalletFactorSourceSample().toCard(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also use @Opt-In(UsesSampleValues::class) and use the samples defined too. Perfectly acceptable in such view model.

Copy link

sonarqubecloud bot commented Dec 5, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 40%)

See analysis details on SonarQube Cloud

Copy link
Contributor

@giannis-rdx giannis-rdx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful 💅🏽

@sergiupuhalschi-rdx sergiupuhalschi-rdx merged commit d9f01ee into main Dec 9, 2024
9 of 10 checks passed
@sergiupuhalschi-rdx sergiupuhalschi-rdx deleted the feature/ABW-3960-factor-instance-card branch December 9, 2024 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants