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-3213] Address Details #1100

Merged
merged 48 commits into from
Jul 4, 2024
Merged

[ABW-3213] Address Details #1100

merged 48 commits into from
Jul 4, 2024

Conversation

matiasbzurovski
Copy link
Contributor

@matiasbzurovski matiasbzurovski commented Apr 26, 2024

Jira ticket: ABW-3213
Jira ticket: ABW-3256

Description

This PR adds a sheet presented every time the user taps on an AddressView with a LedgerIdentifiable.Address associated.

Video

demo.mov

@matiasbzurovski matiasbzurovski added the DO NOT MERGE Merging is blocked or prohibited due to missing specs or other higher priority PRs label Apr 26, 2024
@@ -31,6 +31,21 @@ extension Gradient {
]
}

extension LinearGradient.App {
public var brand1: LinearGradient {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ended up not being used on these designs but decided to keep it as we will probably need it somewhere else (it is part of the design system.

@matiasbzurovski matiasbzurovski removed the DO NOT MERGE Merging is blocked or prohibited due to missing specs or other higher priority PRs label Jun 25, 2024
}

private extension AddressDetails.ViewState {
static func colorised(address: LedgerIdentifiable.Address) -> AttributedString {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be either a local private function, or, if you might want to use it somewhere else, a var on LedgerIdentifiable.Address or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea was to computate it only once

Copy link
Contributor

Choose a reason for hiding this comment

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

The ViewState is actually re-computed every time anything changes, as is the entire SwiftUI View, so I don't think it makes any difference.

But either way, my idea was just to change the ergonomics to something like this:

let addressString = address.colorizedString

It might be that Observable is smart enough to only recompute it when the underlying address changes if you do it like that. When it's in the ViewState, any change to any property on the ViewState would recompute everything.

Seems like it could be useful more generally, btw.

Copy link
Contributor

@kugel3 kugel3 left a comment

Choose a reason for hiding this comment

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

Looks good, just some minor suggestions

@@ -1,18 +1,21 @@
// MARK: - AddressDetails
public struct AddressDetails: Sendable, FeatureReducer {
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 add @Reducer to this. Then you need to also put public typealias Action = FeatureAction<Self> explicitly, otherwise the compiler gets confused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and what's the benefit of doing so if we still need to implement every func reduce we currently have?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's usually good to stay up to date with the latest generation of TCA, so we can enjoy any future improvements coming to @Reducer they make.

@kugel3
Copy link
Contributor

kugel3 commented Jun 28, 2024

Now the dismiss doesn't actually work for me in your PR. But putting@Environment(\.dismiss) var dismiss in the View instead does work.

Copy link
Contributor

@GhenadieVP GhenadieVP left a comment

Choose a reason for hiding this comment

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

LGTM!

.presentationDetents([.large])
.presentationDragIndicator(.visible)
.task {
store.send(.view(.task))
Copy link
Contributor

Choose a reason for hiding this comment

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

should this rather be:

await store.send(.view(.task)).finish()

to allow proper cancellation

@matiasbzurovski matiasbzurovski merged commit 7bf4f70 into main Jul 4, 2024
6 checks passed
@matiasbzurovski matiasbzurovski deleted the ABW-3213 branch July 4, 2024 08:52
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