From 12e4144409def665f005e31a1bc58b3de1df370a Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Thu, 18 Jul 2024 15:25:29 +0200 Subject: [PATCH 01/10] Change padding --- .../AccountPreferencesFeature/Common/PreferenceList.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift b/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift index 5348346605..975a76a2a3 100644 --- a/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift +++ b/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift @@ -71,7 +71,7 @@ struct PreferenceSection: View { .padding(.top, .medium3) } } - .padding(.vertical, .small1) + .padding(.vertical, .medium1) .frame(minHeight: .plainListRowMinHeight) Spacer(minLength: 0) From 5e66aca6461d7a41e509c2cc6b51099c7e534189 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Thu, 18 Jul 2024 17:59:17 +0200 Subject: [PATCH 02/10] Remove PlainListRowCore.Context.general and use .settings by default --- .../DesignSystem/Components/PlainListRow.swift | 17 ++++++++--------- .../Features/SettingsFeature/SettingsRow.swift | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift b/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift index 88e3b9c9f5..469b2987a5 100644 --- a/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift +++ b/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift @@ -120,7 +120,7 @@ struct PlainListRowCore: View { let detail: String? init( - context: Context = .general, + context: Context = .settings, title: String?, subtitle: String? = nil, detail: String? = nil @@ -140,7 +140,7 @@ struct PlainListRowCore: View { self.viewState = viewState } - init(context: ViewState.Context = .general, title: String?, subtitle: String?) { + init(context: ViewState.Context = .settings, title: String?, subtitle: String?) { self.viewState = ViewState(context: context, title: title, subtitle: subtitle) } @@ -178,7 +178,7 @@ struct PlainListRowCore: View { private extension PlainListRowCore.ViewState { var titleTextStyle: TextStyle { switch context { - case .general, .toggle: + case .toggle: .secondaryHeader case .settings: .body1Header @@ -187,7 +187,7 @@ private extension PlainListRowCore.ViewState { var subtitleTextStyle: TextStyle { switch context { - case .general, .toggle: + case .toggle: .body2Regular case .settings: detail == nil ? .body1Regular : .body2Regular @@ -196,7 +196,7 @@ private extension PlainListRowCore.ViewState { var subtitleForegroundColor: Color { switch context { - case .general, .toggle: + case .toggle: .app.gray2 case .settings: .app.gray1 @@ -205,7 +205,7 @@ private extension PlainListRowCore.ViewState { var titleLineLimit: Int? { switch context { - case .general, .settings: + case .settings: 1 case .toggle: nil @@ -214,7 +214,7 @@ private extension PlainListRowCore.ViewState { var subtitleLineLimit: Int { switch context { - case .general, .toggle: + case .toggle: 2 case .settings: 3 @@ -223,7 +223,7 @@ private extension PlainListRowCore.ViewState { var verticalPadding: CGFloat { switch context { - case .general, .toggle: + case .toggle: .zero case .settings: .medium1 @@ -234,7 +234,6 @@ private extension PlainListRowCore.ViewState { // MARK: - PlainListRowCore.ViewState.Context extension PlainListRowCore.ViewState { enum Context { - case general case settings case toggle } diff --git a/RadixWallet/Features/SettingsFeature/SettingsRow.swift b/RadixWallet/Features/SettingsFeature/SettingsRow.swift index bb795eb2b9..ff264b50a6 100644 --- a/RadixWallet/Features/SettingsFeature/SettingsRow.swift +++ b/RadixWallet/Features/SettingsFeature/SettingsRow.swift @@ -65,7 +65,7 @@ extension SettingsRow.Kind { self.id = title self.rowViewState = .init( icon, - rowCoreViewState: .init(context: .settings, title: title, subtitle: subtitle, detail: detail), + rowCoreViewState: .init(title: title, subtitle: subtitle, detail: detail), accessory: accessory, hints: hints ) From 0ca6280f1debb77832e817cff57f188047decaa6 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Thu, 18 Jul 2024 18:57:55 +0200 Subject: [PATCH 03/10] WIP --- .../ResourcesList+View.swift | 72 +++++++++---------- 1 file changed, 32 insertions(+), 40 deletions(-) diff --git a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift index c1b1416553..38289ca9d4 100644 --- a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift +++ b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift @@ -50,10 +50,7 @@ extension ResourcesList { WithViewStore(store, observe: \.viewState, send: { .view($0) }) { viewStore in VStack(spacing: .medium1) { headerView(viewStore) - if !viewStore.resources.isEmpty { - listView(viewStore) - } - Spacer(minLength: 0) + items(resources: viewStore.resources) } .onFirstTask { @MainActor in await viewStore.send(.task).finish() @@ -93,6 +90,7 @@ extension ResourcesList.View { } } .pickerStyle(.segmented) + .padding(.horizontal, .small3) } Text(viewStore.info) @@ -107,50 +105,44 @@ extension ResourcesList.View { .multilineTextAlignment(.center) } } - .padding(.horizontal, .medium1) + .padding(.horizontal, .medium3) } - @ViewBuilder - func listView(_ viewStore: ViewStoreOf) -> some SwiftUI.View { - List { - ForEach(viewStore.resources) { row in - resourceRowView(row, viewStore) + private func items(resources: IdentifiedArrayOf) -> some SwiftUI.View { + ScrollView { + VStack(spacing: .zero) { + ForEach(resources) { resource in + PlainListRow(viewState: resource.rowViewState) + .background(Color.app.white) + .withSeparator + } } } - .scrollContentBackground(.hidden) - .listStyle(.grouped) } +} - @ViewBuilder - func resourceRowView(_ viewState: ResourceViewState, _ viewStore: ViewStoreOf) -> some SwiftUI.View { - HStack(spacing: .zero) { - if viewState.address.resourceAddress.isNonFungible { - Thumbnail(.nft, url: viewState.iconURL) - } else { - Thumbnail(token: .other(viewState.iconURL)) - } - - VStack(alignment: .leading, spacing: .zero) { - Text(viewState.name ?? "-") - .textStyle(.body1HighImportance) - .foregroundColor(.app.gray1) - AddressView( - viewState.address.ledgerIdentifiable, - isTappable: false, - isImageHidden: true - ) - .foregroundColor(.app.gray2) - } - .padding(.leading, .medium3) - - Spacer(minLength: 0) +private extension ResourceViewState { + var rowViewState: PlainListRow.ViewState { + .init(rowCoreViewState: rowCoreViewState, accessory: .trash) { + Thumbnail(thumbnailType, url: iconURL) + } + } - AssetIcon(.asset(AssetResource.trash)) - .onTapGesture { - viewStore.send(.assetRemove(viewState.address)) - } + private var thumbnailType: Thumbnail.ContentType { + if address.resourceAddress.isNonFungible { + .nft + } else if address.resourceAddress.isXRD { + .token(.xrd) + } else { + .token(.other) } - .frame(minHeight: .largeButtonHeight) + } + + private var rowCoreViewState: PlainListRowCore.ViewState { + .init( + title: name ?? "-", + subtitle: address.resourceAddress.formatted() + ) } } From cc8b61ced79d58b9ff4602366cef9dbc3670a03e Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Thu, 18 Jul 2024 19:33:30 +0200 Subject: [PATCH 04/10] Allow to send AnyView as accessory for a row --- .../Components/PlainListRow.swift | 19 ++++++++--- .../ResourcesList+View.swift | 32 ++++++++++++------- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift b/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift index 469b2987a5..30feea5977 100644 --- a/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift +++ b/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift @@ -1,14 +1,14 @@ // MARK: - PlainListRow struct PlainListRow: View { struct ViewState { - let accessory: ImageResource? + let accessory: AnyView? let rowCoreViewState: PlainListRowCore.ViewState let icon: Icon? let hints: [Hint.ViewState] init( rowCoreViewState: PlainListRowCore.ViewState, - accessory: ImageResource? = .chevronRight, + accessory: AnyView?, @ViewBuilder icon: () -> Icon ) { self.accessory = accessory @@ -17,13 +17,24 @@ struct PlainListRow: View { self.hints = [] } + init( + rowCoreViewState: PlainListRowCore.ViewState, + accessory: ImageResource? = .chevronRight, + @ViewBuilder icon: () -> Icon + ) { + self.accessory = accessory.map { Image($0) }.eraseToAnyView() + self.rowCoreViewState = rowCoreViewState + self.icon = icon() + self.hints = [] + } + init( _ content: AssetIcon.Content?, rowCoreViewState: PlainListRowCore.ViewState, accessory: ImageResource? = .chevronRight, hints: [Hint.ViewState] ) where Icon == AssetIcon { - self.accessory = accessory + self.accessory = accessory.map { Image($0) }.eraseToAnyView() self.rowCoreViewState = rowCoreViewState self.icon = content.map { AssetIcon($0) } self.hints = hints @@ -106,7 +117,7 @@ struct PlainListRow: View { @ViewBuilder private var accessoryView: some View { if let accessory = viewState.accessory { - Image(accessory) + accessory } } } diff --git a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift index 38289ca9d4..58fe88b8f3 100644 --- a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift +++ b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift @@ -112,23 +112,33 @@ extension ResourcesList.View { ScrollView { VStack(spacing: .zero) { ForEach(resources) { resource in - PlainListRow(viewState: resource.rowViewState) - .background(Color.app.white) - .withSeparator + PlainListRow(viewState: .init( + rowCoreViewState: resource.rowCoreViewState, + accessory: accesoryView(resource: resource), + icon: { iconView(resource: resource) } + )) + .background(Color.app.white) + .withSeparator } } } } -} -private extension ResourceViewState { - var rowViewState: PlainListRow.ViewState { - .init(rowCoreViewState: rowCoreViewState, accessory: .trash) { - Thumbnail(thumbnailType, url: iconURL) - } + private func accesoryView(resource: ResourceViewState) -> AnyView { + Image(.trash) + .onTapGesture { + store.send(.view(.assetRemove(resource.address))) + } + .eraseToAnyView() } - private var thumbnailType: Thumbnail.ContentType { + private func iconView(resource: ResourceViewState) -> some SwiftUI.View { + Thumbnail(resource.thumbnailType, url: resource.iconURL).eraseToAnyView() + } +} + +private extension ResourceViewState { + var thumbnailType: Thumbnail.ContentType { if address.resourceAddress.isNonFungible { .nft } else if address.resourceAddress.isXRD { @@ -138,7 +148,7 @@ private extension ResourceViewState { } } - private var rowCoreViewState: PlainListRowCore.ViewState { + var rowCoreViewState: PlainListRowCore.ViewState { .init( title: name ?? "-", subtitle: address.resourceAddress.formatted() From ec3f2fbcef7f498ddaa8dfc6b8dcceda58e28571 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Thu, 18 Jul 2024 20:11:21 +0200 Subject: [PATCH 05/10] Use PlainListRow on PreferenceList --- .../Core/DesignSystem/Components/Hint.swift | 10 ++- .../Components/PlainListRow.swift | 6 +- .../Common/PreferenceList.swift | 66 +++++++++---------- 3 files changed, 43 insertions(+), 39 deletions(-) diff --git a/RadixWallet/Core/DesignSystem/Components/Hint.swift b/RadixWallet/Core/DesignSystem/Components/Hint.swift index df2b4f4854..50f06963ad 100644 --- a/RadixWallet/Core/DesignSystem/Components/Hint.swift +++ b/RadixWallet/Core/DesignSystem/Components/Hint.swift @@ -19,7 +19,11 @@ public struct Hint: View, Equatable { public enum Kind: Equatable { case info case error - case warning + case warning(showIcon: Bool) + + static var warning: Self { + .warning(showIcon: true) + } } public let viewState: ViewState @@ -83,9 +87,9 @@ public struct Hint: View, Equatable { private var iconResource: ImageResource? { switch viewState.kind { - case .info: + case .info, .warning(showIcon: false): nil - case .error, .warning: + case .error, .warning(showIcon: true): .error } } diff --git a/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift b/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift index 30feea5977..958eb08e26 100644 --- a/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift +++ b/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift @@ -9,23 +9,25 @@ struct PlainListRow: View { init( rowCoreViewState: PlainListRowCore.ViewState, accessory: AnyView?, + hints: [Hint.ViewState] = [], @ViewBuilder icon: () -> Icon ) { self.accessory = accessory self.rowCoreViewState = rowCoreViewState self.icon = icon() - self.hints = [] + self.hints = hints } init( rowCoreViewState: PlainListRowCore.ViewState, accessory: ImageResource? = .chevronRight, + hints: [Hint.ViewState] = [], @ViewBuilder icon: () -> Icon ) { self.accessory = accessory.map { Image($0) }.eraseToAnyView() self.rowCoreViewState = rowCoreViewState self.icon = icon() - self.hints = [] + self.hints = hints } init( diff --git a/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift b/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift index 975a76a2a3..cf0268f651 100644 --- a/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift +++ b/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift @@ -52,42 +52,17 @@ struct PreferenceSection: View { var body: some View { SwiftUI.Section { ForEach(viewState.rows, id: \.id) { row in - HStack { - VStack(alignment: .leading) { - HStack(spacing: .medium3) { - if let icon = row.icon { - AssetIcon(icon) - } - PlainListRowCore(title: row.title, subtitle: row.subtitle) + PlainListRow(viewState: .init( + rowCoreViewState: .init(title: row.title, subtitle: row.subtitle), + accessory: accesory(for: row), + hints: hints(for: row), + icon: { + if let icon = row.icon { + AssetIcon(icon) } - - if let hint = row.hint { - // Align hint with the PlainListRowCore - Text(hint) - .textStyle(.body2Regular) - .foregroundColor(.app.alert) - .lineSpacing(-4) - .padding(.leading, HitTargetSize.verySmall.frame.width + .medium3) - .padding(.top, .medium3) - } - } - .padding(.vertical, .medium1) - .frame(minHeight: .plainListRowMinHeight) - - Spacer(minLength: 0) - - if case let .selection(selection) = viewState.mode { - if row.id == selection { - Image(asset: AssetResource.check) - } else { - /// Put a placeholder for unselected items. - FixedSpacer(width: .medium1) - } - } else { - Image(asset: AssetResource.chevronRight) } - } - .padding(.horizontal, .medium3) + ) + ) .contentShape(Rectangle()) .tappable { onRowSelected(viewState.id, row.id) @@ -108,6 +83,29 @@ struct PreferenceSection: View { .listSectionSeparator(.hidden) .textCase(nil) } + + private func accesory(for row: Row) -> AnyView { + Group { + if case let .selection(selection) = viewState.mode { + if row.id == selection { + Image(asset: AssetResource.check) + } else { + /// Put a placeholder for unselected items. + FixedSpacer(width: .medium1) + } + } else { + Image(asset: AssetResource.chevronRight) + } + } + .eraseToAnyView() + } + + private func hints(for row: Row) -> [Hint.ViewState] { + guard let hint = row.hint else { + return [] + } + return [.init(kind: .warning(showIcon: false), text: Text(hint))] + } } // MARK: - PreferencesList From 699d224b8763f5cce2b389395c12ad722010b67f Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Thu, 18 Jul 2024 20:18:08 +0200 Subject: [PATCH 06/10] Move from AnyView to closure in PlainListRow --- .../Components/PlainListRow.swift | 22 +++++++++---------- .../ResourcesList+View.swift | 5 ++--- .../Common/PreferenceList.swift | 8 +++---- .../SettingsFeature/SettingsRow.swift | 2 +- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift b/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift index 958eb08e26..0928ceadd8 100644 --- a/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift +++ b/RadixWallet/Core/DesignSystem/Components/PlainListRow.swift @@ -1,21 +1,21 @@ // MARK: - PlainListRow -struct PlainListRow: View { +struct PlainListRow: View { struct ViewState { - let accessory: AnyView? + let accessory: Accessory? let rowCoreViewState: PlainListRowCore.ViewState let icon: Icon? let hints: [Hint.ViewState] init( rowCoreViewState: PlainListRowCore.ViewState, - accessory: AnyView?, hints: [Hint.ViewState] = [], + @ViewBuilder accessory: () -> Accessory, @ViewBuilder icon: () -> Icon ) { - self.accessory = accessory self.rowCoreViewState = rowCoreViewState - self.icon = icon() self.hints = hints + self.accessory = accessory() + self.icon = icon() } init( @@ -23,8 +23,8 @@ struct PlainListRow: View { accessory: ImageResource? = .chevronRight, hints: [Hint.ViewState] = [], @ViewBuilder icon: () -> Icon - ) { - self.accessory = accessory.map { Image($0) }.eraseToAnyView() + ) where Accessory == Image { + self.accessory = accessory.map { Image($0) } self.rowCoreViewState = rowCoreViewState self.icon = icon() self.hints = hints @@ -35,8 +35,8 @@ struct PlainListRow: View { rowCoreViewState: PlainListRowCore.ViewState, accessory: ImageResource? = .chevronRight, hints: [Hint.ViewState] - ) where Icon == AssetIcon { - self.accessory = accessory.map { Image($0) }.eraseToAnyView() + ) where Icon == AssetIcon, Accessory == Image { + self.accessory = accessory.map { Image($0) } self.rowCoreViewState = rowCoreViewState self.icon = content.map { AssetIcon($0) } self.hints = hints @@ -56,7 +56,7 @@ struct PlainListRow: View { subtitle: String? = nil, accessory: ImageResource? = .chevronRight, @ViewBuilder icon: () -> Icon - ) { + ) where Accessory == Image { self.viewState = ViewState(rowCoreViewState: .init(title: title, subtitle: subtitle), accessory: accessory, icon: icon) } @@ -65,7 +65,7 @@ struct PlainListRow: View { title: String?, subtitle: String? = nil, accessory: ImageResource? = .chevronRight - ) where Icon == AssetIcon { + ) where Icon == AssetIcon, Accessory == Image { self.viewState = ViewState(content, rowCoreViewState: .init(title: title, subtitle: subtitle), accessory: accessory, hints: []) } diff --git a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift index 58fe88b8f3..b7d4a4cb3d 100644 --- a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift +++ b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ResourcesList+View.swift @@ -114,7 +114,7 @@ extension ResourcesList.View { ForEach(resources) { resource in PlainListRow(viewState: .init( rowCoreViewState: resource.rowCoreViewState, - accessory: accesoryView(resource: resource), + accessory: { accesoryView(resource: resource) }, icon: { iconView(resource: resource) } )) .background(Color.app.white) @@ -124,12 +124,11 @@ extension ResourcesList.View { } } - private func accesoryView(resource: ResourceViewState) -> AnyView { + private func accesoryView(resource: ResourceViewState) -> some SwiftUI.View { Image(.trash) .onTapGesture { store.send(.view(.assetRemove(resource.address))) } - .eraseToAnyView() } private func iconView(resource: ResourceViewState) -> some SwiftUI.View { diff --git a/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift b/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift index cf0268f651..bb49ec1bd9 100644 --- a/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift +++ b/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift @@ -54,15 +54,14 @@ struct PreferenceSection: View { ForEach(viewState.rows, id: \.id) { row in PlainListRow(viewState: .init( rowCoreViewState: .init(title: row.title, subtitle: row.subtitle), - accessory: accesory(for: row), hints: hints(for: row), + accessory: { accesory(for: row) }, icon: { if let icon = row.icon { AssetIcon(icon) } } - ) - ) + )) .contentShape(Rectangle()) .tappable { onRowSelected(viewState.id, row.id) @@ -84,7 +83,7 @@ struct PreferenceSection: View { .textCase(nil) } - private func accesory(for row: Row) -> AnyView { + private func accesory(for row: Row) -> some SwiftUI.View { Group { if case let .selection(selection) = viewState.mode { if row.id == selection { @@ -97,7 +96,6 @@ struct PreferenceSection: View { Image(asset: AssetResource.chevronRight) } } - .eraseToAnyView() } private func hints(for row: Row) -> [Hint.ViewState] { diff --git a/RadixWallet/Features/SettingsFeature/SettingsRow.swift b/RadixWallet/Features/SettingsFeature/SettingsRow.swift index ff264b50a6..6020444cc9 100644 --- a/RadixWallet/Features/SettingsFeature/SettingsRow.swift +++ b/RadixWallet/Features/SettingsFeature/SettingsRow.swift @@ -50,7 +50,7 @@ extension SettingsRow { extension SettingsRow.Kind { struct Model: Identifiable { let id: String - let rowViewState: PlainListRow.ViewState + let rowViewState: PlainListRow.ViewState let action: Feature.ViewAction public init( From d57556a65d4cde3ae3726270e86f383aee63271e Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Thu, 18 Jul 2024 20:38:46 +0200 Subject: [PATCH 07/10] Fix Add Assets View --- .../ThirdPartyDeposits/AddAssets+View.swift | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/AddAssets+View.swift b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/AddAssets+View.swift index 8825a6b920..3840c7bdf0 100644 --- a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/AddAssets+View.swift +++ b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/AddAssets+View.swift @@ -50,26 +50,25 @@ extension AddAsset { public var body: some SwiftUI.View { WithViewStore(store, observe: \.viewState, send: Action.view) { viewStore in VStack { - CloseButton { viewStore.send(.closeTapped) } - .flushedLeft - - ScrollView { - VStack(spacing: .medium1) { - titleView(viewStore.mode.title) - instructionsView(viewStore.mode.instructions) - - resourceAddressView(viewStore) - if case .allowDenyAssets = viewStore.mode { - depositListSelectionView(viewStore) - } - addAssetButton(viewStore) + VStack(spacing: .medium3) { + titleView(viewStore.mode.title) + instructionsView(viewStore.mode.instructions) + + resourceAddressView(viewStore) + if case .allowDenyAssets = viewStore.mode { + depositListSelectionView(viewStore) } - .padding([.horizontal, .bottom], .medium1) + addAssetButton(viewStore) + .frame(maxHeight: .infinity, alignment: .bottom) } - .scrollIndicators(.hidden) + .padding(.horizontal, .medium3) + .padding(.bottom, .medium2) + } + .withNavigationBar { + viewStore.send(.closeTapped) } } - .presentationDetents([.fraction(0.75)]) + .presentationDetents([.fraction(0.55)]) .presentationDragIndicator(.visible) .presentationBackground(.blur) } @@ -126,7 +125,7 @@ extension AddAsset.View { @ViewBuilder func depositExceptionSelectionView(_ exception: ResourcesListMode.ExceptionRule, _ viewStore: ViewStoreOf) -> some SwiftUI.View { - HStack { + HStack(spacing: .small3) { RadioButton( appearance: .dark, state: viewStore.mode.allowDenyAssets == exception ? .selected : .unselected From 1fc9c2a6b8ca273ba97c2a1237cf1f598abe1648 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Fri, 19 Jul 2024 18:40:29 +0200 Subject: [PATCH 08/10] UI Updates --- .../Components/AppTextField.swift | 2 +- .../Core/DesignSystem/Components/Hint.swift | 32 ++++++++++++------- .../Components/PlainListRow.swift | 2 +- .../ThirdPartyDeposits+View.swift | 3 +- .../Common/PreferenceList.swift | 2 +- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/RadixWallet/Core/DesignSystem/Components/AppTextField.swift b/RadixWallet/Core/DesignSystem/Components/AppTextField.swift index 9cd307dc28..0a095cf1d2 100644 --- a/RadixWallet/Core/DesignSystem/Components/AppTextField.swift +++ b/RadixWallet/Core/DesignSystem/Components/AppTextField.swift @@ -192,7 +192,7 @@ public struct AppTextField: View { } var body: some View { - VStack(alignment: .leading) { + VStack(alignment: .leading, spacing: .small1) { top hints } diff --git a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ThirdPartyDeposits+View.swift b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ThirdPartyDeposits+View.swift index f4040b9278..0a67336e83 100644 --- a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ThirdPartyDeposits+View.swift +++ b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/ThirdPartyDeposits+View.swift @@ -18,9 +18,8 @@ extension ManageThirdPartyDeposits.State { .init( id: .allowDenyAssets, title: "", - rows: [.allowDenyAssets()] + rows: [.allowDenyAssets(), .allowDepositors()] ), - .init(id: .allowDepositors, title: nil, rows: [.allowDepositors()]), ], updateButtonControlState: account.onLedgerSettings.thirdPartyDeposits == thirdPartyDeposits ? .disabled : .enabled) } diff --git a/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift b/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift index bb49ec1bd9..4686d456f8 100644 --- a/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift +++ b/RadixWallet/Features/AccountPreferencesFeature/Common/PreferenceList.swift @@ -102,7 +102,7 @@ struct PreferenceSection: View { guard let hint = row.hint else { return [] } - return [.init(kind: .warning(showIcon: false), text: Text(hint))] + return [.init(kind: .detail, text: Text(hint))] } } From 6614f9450c187941c7ca6d0b00cd44f84727e21f Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Mon, 29 Jul 2024 13:01:02 +0200 Subject: [PATCH 09/10] feedback changes --- .../xcshareddata/swiftpm/Package.resolved | 4 +-- .../ThirdPartyDeposits/AddAssets+View.swift | 28 +++++++++++++------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/RadixWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/RadixWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 6bd89cb1d5..1ce8ceb155 100644 --- a/RadixWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/RadixWallet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -114,8 +114,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/radixdlt/sargon", "state" : { - "revision" : "b6342f791da0b29ca639b37abccdad04465501a1", - "version" : "1.0.29" + "revision" : "5b6d946221837aa6bed3b5ff725eb5fe4f844c6c", + "version" : "1.0.31" } }, { diff --git a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/AddAssets+View.swift b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/AddAssets+View.swift index 3840c7bdf0..3c3c05dca5 100644 --- a/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/AddAssets+View.swift +++ b/RadixWallet/Features/AccountPreferencesFeature/Children/ThirdPartyDeposits/AddAssets+View.swift @@ -49,7 +49,7 @@ extension AddAsset { public var body: some SwiftUI.View { WithViewStore(store, observe: \.viewState, send: Action.view) { viewStore in - VStack { + VStack(spacing: .zero) { VStack(spacing: .medium3) { titleView(viewStore.mode.title) instructionsView(viewStore.mode.instructions) @@ -58,19 +58,20 @@ extension AddAsset { if case .allowDenyAssets = viewStore.mode { depositListSelectionView(viewStore) } - addAssetButton(viewStore) - .frame(maxHeight: .infinity, alignment: .bottom) } - .padding(.horizontal, .medium3) - .padding(.bottom, .medium2) + Spacer() + } + .padding(.horizontal, .medium3) + .footer { + addAssetButton(viewStore) } .withNavigationBar { viewStore.send(.closeTapped) } + .presentationDetents([.fraction(viewStore.mode.detentsFraction)]) + .presentationDragIndicator(.visible) + .presentationBackground(.blur) } - .presentationDetents([.fraction(0.55)]) - .presentationDragIndicator(.visible) - .presentationBackground(.blur) } } } @@ -163,7 +164,7 @@ extension ResourcesListMode.ExceptionRule { } } -extension ResourcesListMode { +private extension ResourcesListMode { var allowDenyAssets: ResourcesListMode.ExceptionRule? { guard case let .allowDenyAssets(type) = self else { return nil @@ -188,4 +189,13 @@ extension ResourcesListMode { L10n.AccountSettings.ThirdPartyDeposits.addDepositorSubtitle } } + + var detentsFraction: CGFloat { + switch self { + case .allowDenyAssets: + 0.6 + case .allowDepositors: + 0.55 + } + } } From 1d87e17a3bdbb45dd4c067f080352f671accda92 Mon Sep 17 00:00:00 2001 From: Matias Bzurovski Date: Mon, 29 Jul 2024 13:13:40 +0200 Subject: [PATCH 10/10] Update hint font --- RadixWallet/Core/DesignSystem/Components/Hint.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RadixWallet/Core/DesignSystem/Components/Hint.swift b/RadixWallet/Core/DesignSystem/Components/Hint.swift index 97ac9ac6f1..640b758534 100644 --- a/RadixWallet/Core/DesignSystem/Components/Hint.swift +++ b/RadixWallet/Core/DesignSystem/Components/Hint.swift @@ -95,7 +95,7 @@ private extension Hint { var textStyle: TextStyle { switch viewState.kind { case .info, .error, .warning: - .body2HighImportance + .body2Regular case .detail: .body1Regular }