-
Notifications
You must be signed in to change notification settings - Fork 25
refactor(ui): migrate protected sheets to DashUIKit #1075
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -480,7 +480,10 @@ struct UsernameMarketplaceScreen: View { | |
| } | ||
| .sheet(item: $registerCandidate) { candidate in | ||
| if candidate.isContested { | ||
| DashUIKit.BottomSheet(showBackButton: .constant(false)) { | ||
| DashUIKit.BottomSheet( | ||
| showBackButton: .constant(false), | ||
| isDismissalEnabled: .constant(!viewModel.isPerformingAction) | ||
| ) { | ||
| RegisterNameSheet( | ||
| label: candidate.label, | ||
| isContested: candidate.isContested, | ||
|
|
@@ -490,6 +493,7 @@ struct UsernameMarketplaceScreen: View { | |
| } else { | ||
| DashUIKit.BottomSheet.selfSizing( | ||
| showBackButton: .constant(false), | ||
| isDismissalEnabled: .constant(!viewModel.isPerformingAction), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Concrete consequence of the missing Its The four transfer sheets take the same rebuild on every start and end of a transfer; this one is just the easiest to observe. |
||
| fallback: 340, | ||
| cornerRadius: 24 | ||
| ) { | ||
|
|
@@ -1842,7 +1846,6 @@ private struct RegisterNameSheet: View { | |
| } | ||
| } | ||
| .background(Color.dash.primaryBackground) | ||
| .interactiveDismissDisabled(viewModel.isPerformingAction) | ||
| .overlay { | ||
| if let activity = viewModel.activityMessage { | ||
| MarketplaceActivityOverlay(message: activity) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,16 +182,12 @@ struct CoinJoinMoveFundsSheet: View { | |
| } | ||
|
|
||
| var body: some View { | ||
| VStack(spacing: 0) { | ||
| dragHandle | ||
| .padding(.top, 8) | ||
|
|
||
| Text(NSLocalizedString("Move your mixed coins", comment: "CoinJoin")) | ||
| .font(.subheadline) | ||
| .fontWeight(.semibold) | ||
| .foregroundColor(.dash.primaryText) | ||
| .padding(.top, 20) | ||
|
|
||
| DashUIKit.BottomSheet( | ||
| title: NSLocalizedString("Move your mixed coins", comment: "CoinJoin"), | ||
| showBackButton: .constant(false), | ||
| isDismissalEnabled: .constant(!viewModel.isInFlight), | ||
| onClose: onDismiss | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only migrated sheet whose initial detent is The Worth either an explicit detent that accounts for the chrome, or making the body scrollable — |
||
| ) { | ||
| switch viewModel.stage { | ||
| case .choice: | ||
| choiceBody | ||
|
|
@@ -207,8 +203,6 @@ struct CoinJoinMoveFundsSheet: View { | |
| failedBody(message: message, destination: destination) | ||
| } | ||
| } | ||
| .background(Color.dash.primaryBackground) | ||
| .interactiveDismissDisabled(viewModel.isInFlight) | ||
| } | ||
|
|
||
| // MARK: Choice | ||
|
|
@@ -421,10 +415,4 @@ struct CoinJoinMoveFundsSheet: View { | |
|
|
||
| // MARK: Pieces | ||
|
|
||
| private var dragHandle: some View { | ||
| Rectangle() | ||
| .fill(Color.dash.grabberFill) | ||
| .frame(width: 36, height: 5) | ||
| .cornerRadius(2.5) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -348,19 +348,12 @@ struct EvonodeWithdrawalConfirmSheet: View { | |
| let onUnconfirmedAcknowledged: () -> Void | ||
|
|
||
| var body: some View { | ||
| VStack(spacing: 0) { | ||
| Rectangle() | ||
| .fill(Color.dash.grabberFill) | ||
| .frame(width: 36, height: 5) | ||
| .cornerRadius(2.5) | ||
| .padding(.top, 8) | ||
|
|
||
| Text(NSLocalizedString("Confirm withdrawal", comment: "Evonode withdrawal")) | ||
| .font(.subheadline) | ||
| .fontWeight(.semibold) | ||
| .foregroundColor(.dash.primaryText) | ||
| .padding(.top, 20) | ||
|
|
||
| DashUIKit.BottomSheet( | ||
| title: NSLocalizedString("Confirm withdrawal", comment: "Evonode withdrawal"), | ||
| showBackButton: .constant(false), | ||
| isDismissalEnabled: .constant(!(isInFlight || isUnconfirmed)), | ||
| onClose: onCancel | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same phase mismatch, and here the completion handler does more than dismiss: onCancel: { showConfirmation = false }
onCompleted: { remaining in showConfirmation = false; onWithdrawn(remaining); dismiss() }Tapping the X on the success screen runs |
||
| ) { | ||
| switch viewModel.phase { | ||
| case let .success(remaining): | ||
| successBody(remainingCredits: remaining) | ||
|
|
@@ -370,8 +363,6 @@ struct EvonodeWithdrawalConfirmSheet: View { | |
| detailsBody | ||
| } | ||
| } | ||
| .background(Color.dash.primaryBackground) | ||
| .interactiveDismissDisabled(isInFlight || isUnconfirmed) | ||
| } | ||
|
|
||
| private var isUnconfirmed: Bool { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ import SwiftDashSDK | |
| /// `ShieldedTransferCoordinator.phase`: | ||
| /// - `.idle` → summary card + Cancel/Confirm buttons. | ||
| /// - in-flight phases → step checklist (Signing / Locking / Proving / | ||
| /// Broadcasting). Drag-dismiss is disabled. | ||
| /// Broadcasting). Sheet dismissal is disabled. | ||
| /// - `.success` → green check + amount + Done. | ||
| /// - `.failed(msg)` → summary card with red error + Try again / Close. | ||
| /// | ||
|
|
@@ -51,16 +51,12 @@ struct InternalTransferConfirmSheet: View { | |
| @State private var handledPlatformShieldCapacityChange = false | ||
|
|
||
| var body: some View { | ||
| VStack(spacing: 0) { | ||
| dragHandle | ||
| .padding(.top, 8) | ||
|
|
||
| Text(NSLocalizedString("Confirm", comment: "")) | ||
| .font(.subheadline) | ||
| .fontWeight(.semibold) | ||
| .foregroundColor(.dash.primaryText) | ||
| .padding(.top, 20) | ||
|
|
||
| DashUIKit.BottomSheet( | ||
| title: NSLocalizedString("Confirm", comment: ""), | ||
| showBackButton: .constant(false), | ||
| isDismissalEnabled: .constant(!isInFlight), | ||
| onClose: onCancel | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same shape: in Lower impact than the other two because |
||
| ) { | ||
| switch coordinator.phase { | ||
| case .success: | ||
| successBody | ||
|
|
@@ -70,8 +66,6 @@ struct InternalTransferConfirmSheet: View { | |
| detailsBody | ||
| } | ||
| } | ||
| .background(Color.dash.primaryBackground) | ||
| .interactiveDismissDisabled(isInFlight) | ||
| .onChange(of: coordinator.phase) { phase in | ||
| handlePlatformShieldCapacityChange(phase) | ||
| } | ||
|
|
@@ -192,13 +186,6 @@ struct InternalTransferConfirmSheet: View { | |
|
|
||
| // MARK: - Pieces | ||
|
|
||
| private var dragHandle: some View { | ||
| Rectangle() | ||
| .fill(Color.dash.grabberFill) | ||
| .frame(width: 36, height: 5) | ||
| .cornerRadius(2.5) | ||
| } | ||
|
|
||
| private var secondaryLine: some View { | ||
| Text(fiatText) | ||
| .font(.subheadline) | ||
|
|
@@ -553,16 +540,12 @@ struct ShieldedRecoverySheet: View { | |
| @State private var alreadyComplete = false | ||
|
|
||
| var body: some View { | ||
| VStack(spacing: 0) { | ||
| dragHandle | ||
| .padding(.top, 8) | ||
|
|
||
| Text(NSLocalizedString("Finish shielded transfer", comment: "InternalTransfer recovery")) | ||
| .font(.subheadline) | ||
| .fontWeight(.semibold) | ||
| .foregroundColor(.dash.primaryText) | ||
| .padding(.top, 20) | ||
|
|
||
| DashUIKit.BottomSheet( | ||
| title: NSLocalizedString("Finish shielded transfer", comment: "InternalTransfer recovery"), | ||
| showBackButton: .constant(false), | ||
| isDismissalEnabled: .constant(!isInFlight), | ||
| onClose: onDismiss | ||
| ) { | ||
| switch coordinator.phase { | ||
| case .success: | ||
| successBody | ||
|
|
@@ -578,8 +561,6 @@ struct ShieldedRecoverySheet: View { | |
| } | ||
| } | ||
| } | ||
| .background(Color.dash.primaryBackground) | ||
| .interactiveDismissDisabled(isInFlight) | ||
| } | ||
|
|
||
| private var isInFlight: Bool { | ||
|
|
@@ -692,13 +673,6 @@ struct ShieldedRecoverySheet: View { | |
|
|
||
| // MARK: - Pieces | ||
|
|
||
| private var dragHandle: some View { | ||
| Rectangle() | ||
| .fill(Color.dash.grabberFill) | ||
| .frame(width: 36, height: 5) | ||
| .cornerRadius(2.5) | ||
| } | ||
|
|
||
| private var infoCard: some View { | ||
| HStack(alignment: .top, spacing: 12) { | ||
| ZStack { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -726,16 +726,12 @@ struct SendConfirmSheet: View { | |
| @StateObject private var coordinator = ShieldedTransferCoordinator() | ||
|
|
||
| var body: some View { | ||
| VStack(spacing: 0) { | ||
| dragHandle | ||
| .padding(.top, 8) | ||
|
|
||
| Text(NSLocalizedString("Confirm", comment: "")) | ||
| .font(.subheadline) | ||
| .fontWeight(.semibold) | ||
| .foregroundColor(.dash.primaryText) | ||
| .padding(.top, 20) | ||
|
|
||
| DashUIKit.BottomSheet( | ||
| title: NSLocalizedString("Confirm", comment: ""), | ||
| showBackButton: .constant(false), | ||
| isDismissalEnabled: .constant(!isInFlight), | ||
| onClose: onCancel | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In onCancel: { showConfirm = false }
onCompleted: { showConfirm = false; onSendCompleted() }So after a successful send, tapping the newly-added X closes the sheet without |
||
| ) { | ||
| switch coordinator.phase { | ||
| case .success: | ||
| successBody | ||
|
|
@@ -745,8 +741,6 @@ struct SendConfirmSheet: View { | |
| detailsBody | ||
| } | ||
| } | ||
| .background(Color.dash.primaryBackground) | ||
| .interactiveDismissDisabled(isInFlight) | ||
| } | ||
|
|
||
| private var isInFlight: Bool { | ||
|
|
@@ -850,13 +844,6 @@ struct SendConfirmSheet: View { | |
|
|
||
| // MARK: - Pieces | ||
|
|
||
| private var dragHandle: some View { | ||
| Rectangle() | ||
| .fill(Color.dash.grabberFill) | ||
| .frame(width: 36, height: 5) | ||
| .cornerRadius(2.5) | ||
| } | ||
|
|
||
| private var summaryCard: some View { | ||
| VStack(spacing: 0) { | ||
| summaryRow( | ||
|
|
||
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 an intermediate commit of DashUIKit#14, not its merged result —
b8f3159,ab9eac1and8097d16are all on that branch and all excluded.The one that matters most is
8097d16, whose message describes the exact failure this PR would ship:And lifting the pin to master is not a safe no-op either: the merge made
performcallonCloseunconditionally and introducedisCloseButtonEnabled, so the X would become live during the protected phases (see the review body).Please track master (
83cf65aafter DashUIKit#16) and addisCloseButtonEnabled: !isInFlightto each of the five call sites.