Skip to content

Commit

Permalink
add source address receipt area
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-dydx committed Nov 28, 2023
1 parent b51814c commit 066b4a5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class dydxProfileHeaderViewPresenter: HostedViewPresenter<dydxProfileHeaderViewM
AbacusStateManager.shared.state.walletState
.sink { [weak self] walletState in
self?.viewModel?.dydxAddress = walletState.currentWallet?.cosmoAddress
self?.viewModel?.sourceAddress = walletState.currentWallet?.ethereumAddress
if let address = walletState.currentWallet?.cosmoAddress {
self?.viewModel?.copyAction = {
UIPasteboard.general.string = address
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Utilities
public class dydxProfileHeaderViewModel: PlatformViewModel {
@Published public var dydxChainLogoUrl: URL?
@Published public var dydxAddress: String?
@Published public var sourceAddress: String?
@Published public var copyAction: (() -> Void)?
@Published public var openInEtherscanAction: (() -> Void)?
@Published public var manageWalletAction: (() -> Void)?
Expand Down Expand Up @@ -83,26 +84,43 @@ public class dydxProfileHeaderViewModel: PlatformViewModel {
.createView()
}

let content = VStack(spacing: 16) {
HStack(alignment: .top) {
chainIcon
.createView(parentStyle: parentStyle)
Spacer()
if self.dydxAddress?.isEmpty == false {
manageWalletButton
let content = VStack(spacing: 0) {
VStack(spacing: 16) {
HStack(alignment: .top) {
chainIcon
.createView(parentStyle: parentStyle)
Spacer()
if self.dydxAddress?.isEmpty == false {
manageWalletButton
}
}
HStack(spacing: 0) {
addressInfoView
Spacer(minLength: 12)
HStack(spacing: 12) {
copyButton
openInEtherscanAction
}
}
}
.padding(.all, 20)
.themeColor(background: .layer4)
.cornerRadius(12, corners: .allCorners)
HStack(spacing: 0) {
addressInfoView
Spacer(minLength: 12)
HStack(spacing: 12) {
copyButton
openInEtherscanAction
}
Text(DataLocalizer.shared?.localize(path: "APP.GENERAL.SOURCE_ADDRESS", params: nil) ?? "")
.themeFont(fontType: .text, fontSize: .small)
.themeColor(foreground: .textTertiary)
Spacer(minLength: 64)
Text(self.sourceAddress ?? "")
.truncationMode(.middle)
.lineLimit(1)
.themeFont(fontType: .text, fontSize: .small)
.themeColor(foreground: .textSecondary)
}
.padding(.horizontal, 20)
.padding(.vertical, 12)
}
.padding(.all, 20)
.themeColor(background: .layer4)
.themeColor(background: .layer1)
.cornerRadius(12, corners: .allCorners)
return AnyView(content)
}
Expand Down

0 comments on commit 066b4a5

Please sign in to comment.