Skip to content

Commit

Permalink
feat: what is voting info screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Syn-McJ committed Oct 21, 2024
1 parent a9bae3c commit b2783c5
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 38 deletions.
16 changes: 10 additions & 6 deletions DashWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@
759ADD572BF3447400767ACD /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 759ADD562BF3447400767ACD /* Button.swift */; };
759ADD582BF3447400767ACD /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 759ADD562BF3447400767ACD /* Button.swift */; };
759AFDE02CC63571007072D2 /* JoinDashPayScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 759AFDDF2CC6356D007072D2 /* JoinDashPayScreen.swift */; };
759AFDE32CC67E8E007072D2 /* VotingInfoScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 759AFDE22CC67E89007072D2 /* VotingInfoScreen.swift */; };
759C8F9F2B593589004B1305 /* CrowdNodeAPYView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 759C8F9E2B593589004B1305 /* CrowdNodeAPYView.swift */; };
759C8FA02B593589004B1305 /* CrowdNodeAPYView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 759C8F9E2B593589004B1305 /* CrowdNodeAPYView.swift */; };
75A0A3F32CA7DBCF003ED48B /* TimeUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75A0A3F22CA7DBCF003ED48B /* TimeUtils.swift */; };
Expand Down Expand Up @@ -1077,7 +1078,7 @@
C9D2C7222A320AA000D15901 /* DWPreviewSeedPhraseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A4431DA22D675CD009BAF7F /* DWPreviewSeedPhraseViewController.m */; };
C9D2C7242A320AA000D15901 /* WKWebView+CrowdNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 110D1780298BA9AF005BEB30 /* WKWebView+CrowdNode.swift */; };
C9D2C7252A320AA000D15901 /* SyncingActivityMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47FA3AFE29350929008D58DC /* SyncingActivityMonitor.swift */; };
C9D2C7262A320AA000D15901 /* EmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9F42FAF29DC27F4001BC549 /* EmptyView.swift */; };
C9D2C7262A320AA000D15901 /* EmptyUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9F42FAF29DC27F4001BC549 /* EmptyUIView.swift */; };
C9D2C7272A320AA000D15901 /* (null) in Sources */ = {isa = PBXBuildFile; };
C9D2C7282A320AA000D15901 /* DWQRScanModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AC92C891FEB0B8B008CAEE0 /* DWQRScanModel.m */; };
C9D2C72A2A320AA000D15901 /* SyncView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9F451F62A0CAE1300825057 /* SyncView.swift */; };
Expand Down Expand Up @@ -1531,7 +1532,7 @@
C9F42FA929DC09CF001BC549 /* Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9F42FA829DC09CF001BC549 /* Style.swift */; };
C9F42FAB29DC1098001BC549 /* ReceiveContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9F42FAA29DC1098001BC549 /* ReceiveContentView.swift */; };
C9F42FAD29DC115A001BC549 /* ReceiveContentView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C9F42FAC29DC115A001BC549 /* ReceiveContentView.xib */; };
C9F42FB029DC27F4001BC549 /* EmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9F42FAF29DC27F4001BC549 /* EmptyView.swift */; };
C9F42FB029DC27F4001BC549 /* EmptyUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9F42FAF29DC27F4001BC549 /* EmptyUIView.swift */; };
C9F42FB229DD5141001BC549 /* BackupInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9F42FB129DD5141001BC549 /* BackupInfoViewController.swift */; };
C9F42FB429DD86FB001BC549 /* BackupInfoItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9F42FB329DD86FB001BC549 /* BackupInfoItemView.swift */; };
C9F42FB629DD8702001BC549 /* BackupInfoItemView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C9F42FB529DD8702001BC549 /* BackupInfoItemView.xib */; };
Expand Down Expand Up @@ -2497,6 +2498,7 @@
759816E619357D6F005060EA /* BRBubbleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BRBubbleView.m; sourceTree = "<group>"; };
759ADD562BF3447400767ACD /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; };
759AFDDF2CC6356D007072D2 /* JoinDashPayScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinDashPayScreen.swift; sourceTree = "<group>"; };
759AFDE22CC67E89007072D2 /* VotingInfoScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VotingInfoScreen.swift; sourceTree = "<group>"; };
759C8F9E2B593589004B1305 /* CrowdNodeAPYView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrowdNodeAPYView.swift; sourceTree = "<group>"; };
75A0A3F22CA7DBCF003ED48B /* TimeUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimeUtils.swift; sourceTree = "<group>"; };
75A664D72B09F1EA007EFD16 /* VotingInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VotingInfoViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3035,7 +3037,7 @@
C9F42FA829DC09CF001BC549 /* Style.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Style.swift; sourceTree = "<group>"; };
C9F42FAA29DC1098001BC549 /* ReceiveContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiveContentView.swift; sourceTree = "<group>"; };
C9F42FAC29DC115A001BC549 /* ReceiveContentView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ReceiveContentView.xib; sourceTree = "<group>"; };
C9F42FAF29DC27F4001BC549 /* EmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyView.swift; sourceTree = "<group>"; };
C9F42FAF29DC27F4001BC549 /* EmptyUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyUIView.swift; sourceTree = "<group>"; };
C9F42FB129DD5141001BC549 /* BackupInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackupInfoViewController.swift; sourceTree = "<group>"; };
C9F42FB329DD86FB001BC549 /* BackupInfoItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackupInfoItemView.swift; sourceTree = "<group>"; };
C9F42FB529DD8702001BC549 /* BackupInfoItemView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BackupInfoItemView.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3813,7 +3815,7 @@
2ADC9D1A24603C4F001D7C0D /* UISearchBar+DWAdditions.h */,
2ADC9D1B24603C4F001D7C0D /* UISearchBar+DWAdditions.m */,
47AE8C1428C6378E00490F5E /* HairlineView.swift */,
C9F42FAF29DC27F4001BC549 /* EmptyView.swift */,
C9F42FAF29DC27F4001BC549 /* EmptyUIView.swift */,
C9F451F82A0CB08900825057 /* ProgressView.swift */,
C9F451FC2A0CC4A300825057 /* BadgeView.swift */,
C94D98202A4CC78F00F3BEE1 /* DashInputField.swift */,
Expand Down Expand Up @@ -6149,6 +6151,7 @@
759AFDE12CC64776007072D2 /* CreateUsername */ = {
isa = PBXGroup;
children = (
759AFDE22CC67E89007072D2 /* VotingInfoScreen.swift */,
759AFDDF2CC6356D007072D2 /* JoinDashPayScreen.swift */,
754C27D02CC3C82300BA7B9F /* JoinDashPayInfoDialog.swift */,
754C27CE2CC3C7AB00BA7B9F /* MixDashDialog.swift */,
Expand Down Expand Up @@ -8625,7 +8628,7 @@
C956AF2F2A5D5F6B002FAB75 /* UpholdConfirmViewController.swift in Sources */,
110D1781298BA9AF005BEB30 /* WKWebView+CrowdNode.swift in Sources */,
47FA3AFF29350929008D58DC /* SyncingActivityMonitor.swift in Sources */,
C9F42FB029DC27F4001BC549 /* EmptyView.swift in Sources */,
C9F42FB029DC27F4001BC549 /* EmptyUIView.swift in Sources */,
757514E32B15DF7C0026AD8E /* ShadowView.swift in Sources */,
2AC92C8A1FEB0B8B008CAEE0 /* DWQRScanModel.m in Sources */,
C9F451F72A0CAE1300825057 /* SyncView.swift in Sources */,
Expand Down Expand Up @@ -9215,6 +9218,7 @@
C9D2C6E82A320AA000D15901 /* ExploreDash.swift in Sources */,
C9D2C6EB2A320AA000D15901 /* UpholdAmountModel.swift in Sources */,
C943B4DF2A40A54600AF23C5 /* DWGetStartedContentViewController.m in Sources */,
759AFDE32CC67E8E007072D2 /* VotingInfoScreen.swift in Sources */,
C943B4F42A40A54600AF23C5 /* DWDPUserObject.m in Sources */,
C9D2C6EC2A320AA000D15901 /* DWModalInteractiveTransition.m in Sources */,
C943B31D2A408CED00AF23C5 /* DWUserProfileContainerView.m in Sources */,
Expand Down Expand Up @@ -9297,7 +9301,7 @@
C9D2C7242A320AA000D15901 /* WKWebView+CrowdNode.swift in Sources */,
C9D2C7252A320AA000D15901 /* SyncingActivityMonitor.swift in Sources */,
75EE38D82CBFE52E00845FFF /* ContactsPlaceholderViewController.swift in Sources */,
C9D2C7262A320AA000D15901 /* EmptyView.swift in Sources */,
C9D2C7262A320AA000D15901 /* EmptyUIView.swift in Sources */,
C9D2C7272A320AA000D15901 /* (null) in Sources */,
C9D2C7282A320AA000D15901 /* DWQRScanModel.m in Sources */,
C943B3292A408CED00AF23C5 /* DWExternalSourceViewController.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,36 @@ import SwiftUI

public struct JoinDashPayScreen: View {
@StateObject private var viewModel = RequestUsernameViewModel.shared
@State private var navigateToVotingInfo = false

public var body: some View {
TextIntro(
buttonLabel: NSLocalizedString("Continue", comment: ""),
action: { }, // TODO: navlink
isActionEnabled: viewModel.hasMinimumRequiredBalance,
inProgress: .constant(false),
topText: {
FeatureTopText(
title: NSLocalizedString("Join DashPay", comment: ""),
text: NSLocalizedString("Forget about long crypto addresses, create the username, find friends and add them to your contacts", comment: "")
)
},
features: {[
FeatureSingleItem(iconName: .custom("username.letter"), title: NSLocalizedString("Create a username", comment: ""), description: NSLocalizedString("Pay to usernames. No more alphanumeric addresses.", comment: "")),
FeatureSingleItem(iconName: .custom("friends.add"), title: NSLocalizedString("Add your friends & family", comment: ""), description: NSLocalizedString("Invite your family, find your friends by searching their usernames.", comment: "")),
FeatureSingleItem(iconName: .custom("profile.personalized"), title: NSLocalizedString("Personalise profile", comment: ""), description: NSLocalizedString("Upload your picture, personalize your identity.", comment: ""))
]},
info: getInfo()
)
ZStack {
TextIntro(
buttonLabel: NSLocalizedString("Continue", comment: ""),
action: { navigateToVotingInfo = true },
isActionEnabled: viewModel.hasMinimumRequiredBalance,
inProgress: .constant(false),
topText: {
FeatureTopText(
title: NSLocalizedString("Join DashPay", comment: ""),
text: NSLocalizedString("Forget about long crypto addresses, create the username, find friends and add them to your contacts", comment: "")
)
},
features: {[
FeatureSingleItem(iconName: .custom("username.letter"), title: NSLocalizedString("Create a username", comment: ""), description: NSLocalizedString("Pay to usernames. No more alphanumeric addresses.", comment: "")),
FeatureSingleItem(iconName: .custom("friends.add"), title: NSLocalizedString("Add your friends & family", comment: ""), description: NSLocalizedString("Invite your family, find your friends by searching their usernames.", comment: "")),
FeatureSingleItem(iconName: .custom("profile.personalized"), title: NSLocalizedString("Personalise profile", comment: ""), description: NSLocalizedString("Upload your picture, personalize your identity.", comment: ""))
]},
info: getInfo()
)

NavigationLink(
destination: VotingInfoScreen().navigationBarHidden(true),
isActive: $navigateToVotingInfo
) {
EmptyView()
}
}
}

private func getInfo() -> String? {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// Created by Andrei Ashikhmin
// Copyright © 2024 Dash Core Group. All rights reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import SwiftUI

public struct VotingInfoScreen: View {
public var body: some View {
TextIntro(
buttonLabel: NSLocalizedString("Continue", comment: ""),
action: { }, // TODO: navlink
inProgress: .constant(false),
topText: {
FeatureTopText(
title: NSLocalizedString("What is username voting?", comment: "Usernames"),
text: NSLocalizedString("The Dash network has to vote to approve some usernames before they are created", comment: "Usernames")
)
},
features: {[
FeatureSingleItem(iconName: .custom("username.letter"), title: NSLocalizedString("Voting is only required in some cases", comment: "Usernames"), description: NSLocalizedString("Any username that has a number 2-9, is more than 20 characters or that has a hyphen will be automatically approved", comment: "Usernames")),
FeatureSingleItem(iconName: .custom("friends.add"), title: NSLocalizedString("Some usernames can be blocked", comment: "Usernames"), description: NSLocalizedString("If enough of the network feels that a username is inappropriate, they can block it", comment: "Usernames")),
FeatureSingleItem(iconName: .custom("profile.personalized"), title: NSLocalizedString("In case your request is not approved", comment: "Usernames"), description: NSLocalizedString("Pay now and if not approved, you can create a different name without paying again", comment: "Usernames")),
FeatureSingleItem(iconName: .custom("profile.personalized"), title: NSLocalizedString("Keep your passphrase safe", comment: "Usernames"), description: NSLocalizedString("In case you lose your passphrase you will lose your right to your requested username.", comment: "Usernames"))
]}
)
}
}
2 changes: 1 addition & 1 deletion DashWallet/Sources/UI/Home/Views/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ struct HomeViewContent<Content: View>: View {
let joinDashPayDialog = JoinDashPayInfoDialog()

if #available(iOS 16.0, *) {
joinDashPayDialog.presentationDetents([.height(600)])
joinDashPayDialog.presentationDetents([.height(660)])
} else {
joinDashPayDialog
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ final class ProvideAmountViewController: SendAmountViewController {
destination: destination,
balanceLabel: balanceLabel,
model: self.model as! SendAmountModel,
avatarView: { UIViewWrapper(uiView: avatarView ?? EmptyView()) }
avatarView: { UIViewWrapper(uiView: avatarView ?? EmptyUIView()) }
)
let swiftUIController = UIHostingController(rootView: intro)
swiftUIController.view.backgroundColor = UIColor.dw_secondaryBackground()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ extension ConfirmPaymentViewController {
tableView.dataSource = self
tableView.layoutMargins = view.layoutMargins
tableView.registerClass(for: TitleValueCell.self)
tableView.tableHeaderView = EmptyView(frame: .init(x: 0, y: 0, width: 1, height: CGFloat.leastNonzeroMagnitude))
tableView.tableFooterView = EmptyView(frame: .init(x: 0, y: 0, width: 1, height: CGFloat.leastNonzeroMagnitude))
tableView.tableHeaderView = EmptyUIView(frame: .init(x: 0, y: 0, width: 1, height: CGFloat.leastNonzeroMagnitude))
tableView.tableFooterView = EmptyUIView(frame: .init(x: 0, y: 0, width: 1, height: CGFloat.leastNonzeroMagnitude))
view.addSubview(tableView)

let bottomButtonsStack = UIStackView()
Expand Down
2 changes: 1 addition & 1 deletion DashWallet/Sources/UI/Payments/Pay/PayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ extension PayViewController {
tableView.rowHeight = 59
tableView.delegate = self
tableView.dataSource = self
tableView.tableFooterView = EmptyView()
tableView.tableFooterView = EmptyUIView()
tableView.tableHeaderView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 0.0, height: CGFloat.leastNormalMagnitude))
tableView.isScrollEnabled = false
tableView.separatorStyle = .none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ extension ReceiveViewController {
importPrivateKeyButton.isHidden = !allowedToImportPrivateKey
mainStackView.addArrangedSubview(importPrivateKeyButton)

mainStackView.addArrangedSubview(EmptyView())
mainStackView.addArrangedSubview(EmptyUIView())

NSLayoutConstraint.activate([
mainStackView.topAnchor.constraint(equalTo: view.topAnchor),
Expand Down
15 changes: 8 additions & 7 deletions DashWallet/Sources/UI/SwiftUI Components/TextIntro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@ struct TextIntro: View {
.frame(maxWidth: .infinity, alignment: .top)

if !features().isEmpty {
VStack(spacing: 0) {
ForEach(0..<features().count, id: \.self) { index in
features()[index]
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.top, 16)
ScrollView {
VStack(spacing: 0) {
ForEach(0..<features().count, id: \.self) { index in
features()[index]
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.top, 16)
}
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
.padding(.top, -40)
.padding(.top, 20)
}

Spacer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import UIKit

final class EmptyView: UIView {
final class EmptyUIView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)

Expand Down

0 comments on commit b2783c5

Please sign in to comment.