-
Notifications
You must be signed in to change notification settings - Fork 9
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
Asset transfer choose asset #520
Asset transfer choose asset #520
Conversation
let heights = subviews.map { $0.sizeThatFits(.init(width: container.width, height: nil)).height } | ||
let height: CGFloat = { | ||
if !isExpanded { | ||
return heights[0] + CGFloat(collapsedViewsCount - 1) * collapsedSpacing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we be sure that heights is nonEmpty here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, if subviews is nonEmpty, for which we guard above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could i miss that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could i miss that
Sources/Features/AccountDetailsFeature/Coordinator/AccountDetails+View.swift
Outdated
Show resolved
Hide resolved
/// Number of visible views in Collapsed state | ||
var collapsedViewsCount: Int | ||
|
||
public init(isExpanded: Bool, spacing: CGFloat = 10, collapsedSpacing: CGFloat = 10, collapsedViewsCount: Int = 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose collapsedSpacing
is more like an offset? Btw, it looked like there was space between the subrows when expanded, I don't think that's the original design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at implementation level, yes, it is offset actually, used spacing to be aligned in terminology.
There is spacing between subrows though, but maybe not that much, will double-check,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's an offset also visually, right? Isn't this the amount that stacked cards extend below the one above? A spacing is an empty space between two things.
...atures/AssetTransferFeature/Components/TransferAccountList/TransferAccountList+Reducer.swift
Outdated
Show resolved
Hide resolved
...atures/AssetTransferFeature/Components/TransferAccountList/TransferAccountList+Reducer.swift
Outdated
Show resolved
Hide resolved
...atures/AssetTransferFeature/Components/TransferAccountList/TransferAccountList+Reducer.swift
Outdated
Show resolved
Hide resolved
...atures/AssetTransferFeature/Components/TransferAccountList/TransferAccountList+Reducer.swift
Outdated
Show resolved
Hide resolved
if let isSelected = state.isSelected { | ||
state.isSelected?.toggle() | ||
return .none | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you're not using isSelected
. And why do we only send the delegate action if isSelected
is nil`? Rather than say false or nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it using the same logic as in my recent PR? If isSelected is nil it means that it can't be toggled, only selected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the same logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright, but then here it's enough to check if it's nil i guess
...setsFeature/Components/NonFungibleAssetList/Components/Row/NonFungbileAssetRow+Reducer.swift
Show resolved
Hide resolved
if selectedAssets.contains(token) { | ||
selectedAssets.remove(token) | ||
} else { | ||
selectedAssets.append(token) | ||
} | ||
state.selectedAssets = selectedAssets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is such a common pattern, swift should have a .toggle(Element)
method on Set or even Collection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added as extension on IdentifiedArray for this particular case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to get rid of the old asset list!
LGTM! Good job! |
Asset selection for Asset Transfer.