-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: join dashpay bottom sheet dialog
- Loading branch information
Showing
26 changed files
with
512 additions
and
171 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
DashWallet/Resources/AppAssets.xcassets/Usernames/username.letter.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "username.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+646 Bytes
...et/Resources/AppAssets.xcassets/Usernames/username.letter.imageset/username.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.13 KB
...Resources/AppAssets.xcassets/Usernames/username.letter.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.64 KB
...Resources/AppAssets.xcassets/Usernames/username.letter.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Created by Andrei Ashikhmin | ||
// Copyright © 2023 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 Foundation | ||
|
||
private let kCoinJoinMixDashShown = "coinJoinMixDashShownKey" | ||
private let kJoinDashPayInfoShown = "joinDashPayInfoShownKey" | ||
|
||
// MARK: - UsernamePrefs | ||
|
||
class UsernamePrefs { | ||
public static let shared: UsernamePrefs = .init() | ||
|
||
private var _mixDashShown: Bool? = nil | ||
var mixDashShown: Bool { | ||
get { _mixDashShown ?? UserDefaults.standard.bool(forKey: kCoinJoinMixDashShown) } | ||
set(value) { | ||
_mixDashShown = value | ||
UserDefaults.standard.set(value, forKey: kCoinJoinMixDashShown) | ||
} | ||
} | ||
|
||
private var _joinDashPayInfoShown: Bool? = nil | ||
var joinDashPayInfoShown: Bool { | ||
get { _joinDashPayInfoShown ?? UserDefaults.standard.bool(forKey: kJoinDashPayInfoShown) } | ||
set(value) { | ||
_joinDashPayInfoShown = value | ||
UserDefaults.standard.set(value, forKey: kJoinDashPayInfoShown) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Created by Andrei Ashikhmin | ||
// Copyright © 2023 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 Foundation | ||
|
||
private let kCoinJoinMixDashShown = "coinJoinMixDashShownKey" | ||
private let kJoinDashPayInfoShown = "joinDashPayInfoShownKey" | ||
|
||
// MARK: - UsernamePrefs | ||
|
||
class UsernamePrefs { | ||
public static let shared: UsernamePrefs = .init() | ||
|
||
private var _mixDashShown: Bool? = nil | ||
var mixDashShown: Bool { | ||
get { _mixDashShown ?? UserDefaults.standard.bool(forKey: kCoinJoinMixDashShown) } | ||
set(value) { | ||
_mixDashShown = value | ||
UserDefaults.standard.set(value, forKey: kCoinJoinMixDashShown) | ||
} | ||
} | ||
|
||
private var _joinDashPayInfoShown: Bool? = nil | ||
var joinDashPayInfoShown: Bool { | ||
get { _joinDashPayInfoShown ?? UserDefaults.standard.bool(forKey: kJoinDashPayInfoShown) } | ||
set(value) { | ||
_joinDashPayInfoShown = value | ||
UserDefaults.standard.set(value, forKey: kJoinDashPayInfoShown) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
DashWallet/Sources/UI/DashPay/Setup/CreateUsername/JoinDashPayInfoDialog.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// 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 JoinDashPayInfoDialog: View { | ||
@Environment(\.presentationMode) private var presentationMode | ||
|
||
public var body: some View { | ||
BottomSheet(showBackButton: Binding<Bool>.constant(false)) { | ||
JoinDashPayScreen() | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
DashWallet/Sources/UI/DashPay/Setup/CreateUsername/JoinDashPayScreen.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// 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 JoinDashPayScreen: View { | ||
@StateObject private var viewModel = RequestUsernameViewModel.shared | ||
|
||
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() | ||
) | ||
} | ||
|
||
private func getInfo() -> String? { | ||
if viewModel.hasRecommendedBalance { | ||
return nil | ||
} | ||
|
||
if viewModel.hasMinimumRequiredBalance { | ||
return String.localizedStringWithFormat(NSLocalizedString("You have %@ Dash.\nSome usernames cost up to %@ Dash.", comment: "Usernames"), viewModel.balance, viewModel.recommendedBalance) | ||
} | ||
|
||
return String.localizedStringWithFormat(NSLocalizedString("You need to have more than %@ Dash to create a username", comment: "Usernames"), viewModel.minimumRequiredBalance) | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
DashWallet/Sources/UI/DashPay/Setup/CreateUsername/MixDashDialog.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// 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 MixDashDialog: View { | ||
@Environment(\.presentationMode) private var presentationMode | ||
var positiveAction: () -> Void | ||
var negativeAction: () -> Void | ||
|
||
public var body: some View { | ||
BottomSheet(showBackButton: Binding<Bool>.constant(false)) { | ||
VStack(spacing: 0) { | ||
FeatureTopText( | ||
title: NSLocalizedString("Mix your Dash Coins", comment: "CoinJoin"), | ||
text: NSLocalizedString("To help prevent other people from seeing who you make payments to, it is recommended to mix your balance before you create your username.", comment: "CoinJoin"), | ||
alignment: .leading | ||
) | ||
|
||
Spacer() | ||
|
||
ButtonsGroup( | ||
orientation: .horizontal, | ||
style: .regular, | ||
size: .large, | ||
positiveButtonText: NSLocalizedString("Mix coins", comment: "CoinJoin"), | ||
positiveButtonAction: { | ||
presentationMode.wrappedValue.dismiss() | ||
positiveAction() | ||
}, | ||
negativeButtonText: NSLocalizedString("Skip", comment: ""), | ||
negativeButtonAction: { | ||
presentationMode.wrappedValue.dismiss() | ||
negativeAction() | ||
} | ||
) | ||
.padding(.top, 20) | ||
.padding(.bottom, 10) | ||
} | ||
.padding(.horizontal, 20) | ||
.frame(maxHeight: .infinity) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.