-
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
Feature/ABW-1288 Actions for addresses #450
Conversation
Sources/Features/AccountListFeature/Coordinator/AccountList+Reducer.swift
Outdated
Show resolved
Hide resolved
Sources/Features/AuthorizedDAppsFeatures/DappDetails/DappDetails.swift
Outdated
Show resolved
Hide resolved
Sources/Features/FungibleTokenDetailsFeature/FungibleTokenDetails+Reducer.swift
Outdated
Show resolved
Hide resolved
Sources/Features/FungibleTokenDetailsFeature/FungibleTokenDetails+Reducer.swift
Outdated
Show resolved
Hide resolved
Sources/Features/FungibleTokenDetailsFeature/FungibleTokenDetails+View.swift
Outdated
Show resolved
Hide resolved
Sources/Features/NonFungibleTokenListFeature/Components/Detail/Detail+Reducer.swift
Outdated
Show resolved
Hide resolved
@@ -120,11 +124,9 @@ extension TransactionReviewGuarantee { | |||
} | |||
|
|||
public var body: some SwiftUI.View { | |||
WithViewStore(store, observe: \.viewState, send: { .view($0) }) { viewStore in | |||
WithViewStore(store, observe: \.viewState) { viewStore in |
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.
Perhaps it's even actionless now?
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.
Sure, you mean to add .actionless
to the store
? Is there some performance gain?
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 overall, lots of nice deletions. But I thought you said that it had to be a feature because in some cases the parent did need to know that you copied the address?
Also, since we will definitely want to show some kind of notification, do you have a plac for how to do that when it's just a standalone view? Using Preferences? Or some kind of in place notification?
|
||
private enum DashboardConstants { | ||
static let scheme = "https" | ||
static let host = "betanet-dashboard.radixdlt.com" |
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.
probably rcnet, not?
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.
We have existing address types that we should probably use here, rather than strings
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.
rcnet
was not working at the time, now it is. Also, since there was no existing type I've added Radix.Dashboard
.
5e12956
to
5d50ea4
Compare
} | ||
|
||
private var addressView: some View { | ||
Text((addressString ?? "").formatted(format)) |
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 still think that it should be addresses that we format, not strings
Image(asset: action == .copy ? AssetResource.copy : AssetResource.iconLinkOut) | ||
} | ||
|
||
private var addressString: String? { |
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.
And it shouldn't be done in the View, it's a model thing, that is quite general
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 also makes it clear it should not be a protocol, but an enum... if we need TXID
to be case, then I suggest this:
this view changes name ot LedgerIdentifiableView
and the enum will be LedgerIdentifiable
:
/// A globally unique and stable identifier to some data on the immutable ledger shared across the Radix decentralised network.
enum LedgerIdentifiable {
case transactionIdentifier(TXID)
case address(Address)
}
where Address
is an enum bridging all our addresses together
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.
Suffixes like able are used for protocols, but we can try for this as well.
|
||
// MARK: - AddressView | ||
public struct AddressView: SwiftUI.View, Sendable { | ||
let address: AddressType |
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'm not sure we want a new address protocol, but either way this should be any AddressType
, right?
@@ -7,3 +7,6 @@ extension TransactionIntent { | |||
} | |||
|
|||
public typealias TXID = TransactionIntent.TXID | |||
|
|||
// MARK: AddressType | |||
extension TXID: AddressType {} |
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.
A Transasction Identifier is not an Address, if TXID need conformance to some protocol, the name AddressType
is the wrong name.
Image(asset: action == .copy ? AssetResource.copy : AssetResource.iconLinkOut) | ||
} | ||
|
||
private var addressString: String? { |
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 also makes it clear it should not be a protocol, but an enum... if we need TXID
to be case, then I suggest this:
this view changes name ot LedgerIdentifiableView
and the enum will be LedgerIdentifiable
:
/// A globally unique and stable identifier to some data on the immutable ledger shared across the Radix decentralised network.
enum LedgerIdentifiable {
case transactionIdentifier(TXID)
case address(Address)
}
where Address
is an enum bridging all our addresses together
55a0fea
to
5fa8839
Compare
I updated the code with the new UI for context menu and added screenshots. |
public var addressPrefix: String { | ||
switch self { | ||
case .transaction: | ||
return "transaction" | ||
case .nonFungibleGlobalID: | ||
return "nft" | ||
} | ||
} | ||
} |
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 needed for constructing the correct URL.
public var addressPrefix: String { | ||
switch self { | ||
case .account: | ||
return "account" | ||
case .package: | ||
return "package" | ||
case .resource: | ||
return "resource" | ||
case .component: | ||
return "component" | ||
} | ||
} |
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 needed for constructing the correct URL.
Blocked by #459 |
a780d91
to
3ca7321
Compare
Use address component in home screen Use address component in new entity Use address component in fungible token details Use address component in nft details wip wip Replace AddressComponent with AddressView Fix tests Refactor Minor updates wip wip Move to enum Clean up Update context menu Use existing init
3ca7321
to
d3f77dc
Compare
Not blocked, ready for merging. After #459 is merged, it should be refactored so we keep the current functionality, but remove or simplify |
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.
Approved given we have a Jira ticket and plan for updating the code once RET/address improvments have been done
Jira ticket for the upcoming task: https://radixdlt.atlassian.net/browse/ABW-1458 |
Jira ticket: https://radixdlt.atlassian.net/browse/ABW-1288
Description
This PR includes:
AddressView
that is self contained and encapsulates copy address and view on dashboard functionalities; it can be used in anyView
orFeature
, and it doesn't require any special integrationAccountLabel
andAccountButton
componentsSmallAddressView
component, defined in the design guidepasteboardClient
from every feature, now it's only used inAddressView
Notes
I started implementing this by creating a
Feature
, but it turned out that using such feature would add some amount of boilerplate code and unnecessary complexity. Also, integrating it into other subviews which aren't Features themselves would introduce unnecessary work and complexity without gain.As previously agreed, this component is currently agnostic about the address input type, and contains functionalities similar to ones found here and here to perform internal logic. Let me know if you think this should change. Please keep in mind there should be a differentiation between account addresses, resource addresses, non-fungible global IDs, component addresses, and transaction IDs, with special case for viewing NFTs on dashboard (local vs global ID).
How to test
Copy address
View on Dashboard
Screenshots
Video
Simulator.Screen.Recording.-.iPhone.14.-.2023-04-20.at.13.49.01_480p.mov
PR submission checklist