-
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 all commits
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 |
|---|---|---|
|
|
@@ -182,16 +182,15 @@ 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), | ||
| // Supplying `onClose` makes the close button live regardless of | ||
| // `isDismissalEnabled`, so the in-flight stages have to gate it here. | ||
| isCloseButtonEnabled: !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,49 +206,55 @@ struct CoinJoinMoveFundsSheet: View { | |
| failedBody(message: message, destination: destination) | ||
| } | ||
| } | ||
| .background(Color.dash.primaryBackground) | ||
| .interactiveDismissDisabled(viewModel.isInFlight) | ||
| } | ||
|
|
||
| // MARK: Choice | ||
|
|
||
| private var choiceBody: some View { | ||
| VStack(spacing: 0) { | ||
| DashAmount( | ||
| amount: Int64(viewModel.amountDuffs), | ||
| font: .largeTitle, | ||
| dashSymbolFactor: 0.7, | ||
| showDirection: false) | ||
| .padding(.top, 14) | ||
|
|
||
| Text(NSLocalizedString( | ||
| "CoinJoin is no longer supported — choose where to move your mixed coins.", | ||
| comment: "CoinJoin")) | ||
| .font(.system(size: 14)) | ||
| .foregroundColor(.dash.secondaryText) | ||
| .multilineTextAlignment(.center) | ||
| .padding(.horizontal, 24) | ||
| .padding(.top, 12) | ||
|
|
||
| VStack(spacing: 10) { | ||
| destinationCard( | ||
| icon: "wallet.pass.fill", | ||
| title: NSLocalizedString("Dash Wallet balance", comment: "CoinJoin"), | ||
| subtitle: NSLocalizedString( | ||
| "Move to your regular spendable balance.", comment: "CoinJoin"), | ||
| action: { Task { await viewModel.moveToWallet() } }) | ||
| destinationCard( | ||
| icon: "shield.fill", | ||
| title: NSLocalizedString("Shielded balance", comment: "CoinJoin"), | ||
| subtitle: NSLocalizedString( | ||
| "Keep these coins private. Network and privacy fees apply.", | ||
| comment: "CoinJoin"), | ||
| action: { Task { await viewModel.moveToShielded() } }) | ||
| // Scrollable: this is the only migrated sheet whose initial detent is | ||
| // `.medium`, and the BottomSheet chrome takes 82pt of it. Letting the | ||
| // choices scroll keeps "Later" — the only way out that records the | ||
| // deferral — reachable on a short screen or a long translation. | ||
| ScrollView { | ||
| VStack(spacing: 0) { | ||
| DashAmount( | ||
| amount: Int64(viewModel.amountDuffs), | ||
| font: .largeTitle, | ||
| dashSymbolFactor: 0.7, | ||
| showDirection: false) | ||
| .padding(.top, 14) | ||
|
|
||
| Text(NSLocalizedString( | ||
| "CoinJoin is no longer supported — choose where to move your mixed coins.", | ||
| comment: "CoinJoin")) | ||
| .font(.system(size: 14)) | ||
| .foregroundColor(.dash.secondaryText) | ||
| .multilineTextAlignment(.center) | ||
| .padding(.horizontal, 24) | ||
| .padding(.top, 12) | ||
|
|
||
| VStack(spacing: 10) { | ||
| destinationCard( | ||
| icon: "wallet.pass.fill", | ||
| title: NSLocalizedString("Dash Wallet balance", comment: "CoinJoin"), | ||
| subtitle: NSLocalizedString( | ||
| "Move to your regular spendable balance.", comment: "CoinJoin"), | ||
| action: { Task { await viewModel.moveToWallet() } }) | ||
| destinationCard( | ||
| icon: "shield.fill", | ||
| title: NSLocalizedString("Shielded balance", comment: "CoinJoin"), | ||
| subtitle: NSLocalizedString( | ||
| "Keep these coins private. Network and privacy fees apply.", | ||
| comment: "CoinJoin"), | ||
| action: { Task { await viewModel.moveToShielded() } }) | ||
| } | ||
| .padding(.horizontal, 16) | ||
| .padding(.top, 20) | ||
| .padding(.bottom, 12) | ||
| } | ||
| } | ||
| .padding(.horizontal, 16) | ||
| .padding(.top, 20) | ||
|
|
||
| Spacer(minLength: 12) | ||
| .scrollBounceBehavior(.basedOnSize) | ||
|
|
||
| DashButton( | ||
| text: NSLocalizedString("Later", comment: "CoinJoin"), | ||
|
|
@@ -421,10 +426,4 @@ struct CoinJoinMoveFundsSheet: View { | |
|
|
||
| // MARK: Pieces | ||
|
|
||
| private var dragHandle: some View { | ||
| Rectangle() | ||
| .fill(Color.dash.grabberFill) | ||
| .frame(width: 36, height: 5) | ||
| .cornerRadius(2.5) | ||
| } | ||
| } | ||
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.
Concrete consequence of the missing
8097d16on the pinned revision: tapping Register/Request setsisPerformingAction = true, which flipsisDismissalEnabledand — ate8d9243— swaps_ConditionalContentbranches, so SwiftUI rebuildsRegisterNameSheetfrom scratch.Its
@Stategoes with it:precheckandvoteStatereset to nil, the.taskre-firescontestPrecheck/contestState, and the contest cards blank back to loading exactly while the action is running — then rebuild again when it finishes.The four transfer sheets take the same rebuild on every start and end of a transfer; this one is just the easiest to observe.