Skip to content

Commit eead657

Browse files
authored
Merge pull request #714 from Syn-McJ/feat/piggycard-terms
feat(dashspend): piggycards terms and conditions
2 parents 8b4aa99 + 5247801 commit eead657

17 files changed

Lines changed: 217 additions & 71 deletions

File tree

DashWallet.xcodeproj/project.pbxproj

Lines changed: 30 additions & 24 deletions
Large diffs are not rendered by default.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "PiggyCards.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "PiggyCards@2x.png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "PiggyCards@3x.png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
2.66 KB
Loading
5.09 KB
Loading
7.6 KB
Loading

DashWallet/Sources/Models/Explore Dash/Model/CTXConstants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717

1818
class CTXConstants {
1919
static let baseURI = "https://spend.ctx.com/"
20-
static let ctxGiftCardAgreementUrl = "https://ctx.com/gift-card-agreement/"
20+
static let termsAndConditionsUrl = "https://ctx.com/gift-card-agreement/"
2121
static let supportEmail = "support@ctx.com"
2222
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
//
2+
// Created by Andrei Ashikhmin
3+
// Copyright © 2025 Dash Core Group. All rights reserved.
4+
//
5+
// Licensed under the MIT License (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// https://opensource.org/licenses/MIT
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
//
17+
18+
import Foundation
19+
20+
enum GiftCardProvider: CaseIterable {
21+
case ctx
22+
case piggyCards
23+
24+
var displayName: String {
25+
switch self {
26+
case .ctx:
27+
return "CTXSpend"
28+
case .piggyCards:
29+
return "PiggyCards"
30+
}
31+
}
32+
33+
var logoName: String {
34+
switch self {
35+
case .ctx:
36+
return "ctx.logo"
37+
case .piggyCards:
38+
return "piggycards.logo"
39+
}
40+
}
41+
42+
var termsUrl: String {
43+
switch self {
44+
case .ctx:
45+
return CTXConstants.termsAndConditionsUrl
46+
case .piggyCards:
47+
return "https://piggy.cards/index.php?route=information/information&information_id=5"
48+
}
49+
}
50+
51+
var supportEmail: String {
52+
switch self {
53+
case .ctx:
54+
return CTXConstants.supportEmail
55+
case .piggyCards:
56+
return "" // TODO: Confirm correct support email
57+
}
58+
}
59+
60+
func isUserSignedIn() -> Bool {
61+
switch self {
62+
case .ctx:
63+
return CTXSpendService.shared.isUserSignedIn
64+
case .piggyCards:
65+
// TODO: Implement PiggyCards authentication
66+
return false
67+
}
68+
}
69+
}

DashWallet/Sources/Models/Uphold/DWUpholdMainnetConstants.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ + (NSString *)transactionURLFormat {
4747

4848
+ (NSString *)logoutURLString {
4949
return @"https://uphold.com/";
50+
5051
}
5152

5253
@end

DashWallet/Sources/UI/DashPay/Voting/UsernameVoting.storyboard

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@
646646
<color red="0.45882352941176469" green="0.50196078431372548" blue="0.54117647058823526" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
647647
</namedColor>
648648
<systemColor name="systemPinkColor">
649-
<color red="1" green="0.17647058823529413" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
649+
<color red="1" green="0.1764705882" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
650650
</systemColor>
651651
</resources>
652652
</document>

DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/PointOfUseDetailsViewController.swift

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ extension PointOfUseDetailsViewController {
139139
vc.sellDashHandler = wSelf.sellDashHandler
140140
wSelf.navigationController?.pushViewController(vc, animated: true)
141141
}
142-
detailsView.buyGiftCardHandler = { [weak self] in
143-
self?.showDashSpendPayScreen()
142+
detailsView.buyGiftCardHandler = { [weak self] provider in
143+
self?.showDashSpendPayScreen(provider: provider)
144144
}
145-
detailsView.dashSpendAuthHandler = { [weak self] in
146-
self?.showCTXSpendLoginInfo()
145+
detailsView.dashSpendAuthHandler = { [weak self] provider in
146+
self?.showDashSpendLoginInfo(provider: provider)
147147
}
148148

149149
detailsView.translatesAutoresizingMaskIntoConstraints = false
@@ -181,52 +181,55 @@ extension PointOfUseDetailsViewController {
181181
// Mark: DashSpend
182182

183183
extension PointOfUseDetailsViewController {
184-
private func showCTXSpendLoginInfo() {
185-
let swiftUIView = CTXSpendLoginInfoView(
184+
// TODO: This is a temporary UI element for testing/selecting between services
185+
// Will be removed once service selection is finalized
186+
private func showDashSpendLoginInfo(provider: GiftCardProvider) {
187+
let swiftUIView = DashSpendLoginInfoView(
188+
provider: provider,
186189
onCreateNewAccount: { [weak self] in
187190
self?.dismiss(animated: true) {
188-
self?.showCTXSpendTerms()
191+
self?.showDashSpendTerms(provider: provider)
189192
}
190193
},
191194
onLogIn: { [weak self] in
192195
self?.dismiss(animated: true) {
193-
self?.showCTXSpendAuth(authType: .signIn)
196+
self?.showDashSpendAuth(authType: .signIn, provider: provider)
194197
}
195198
},
196199
onTermsAndConditions: {
197-
UIApplication.shared.open(URL(string: CTXConstants.ctxGiftCardAgreementUrl)!, options: [:], completionHandler: nil)
200+
UIApplication.shared.open(URL(string: provider.termsUrl)!, options: [:], completionHandler: nil)
198201
}
199202
)
200203
let hostingController = UIHostingController(rootView: swiftUIView)
201204
hostingController.setDetent(450)
202205
self.present(hostingController, animated: true)
203206
}
204207

205-
private func showCTXSpendTerms() {
208+
private func showDashSpendTerms(provider: GiftCardProvider) {
206209
let hostingController = UIHostingController(
207-
rootView: CTXSpendTermsScreen {
210+
rootView: DashSpendTermsScreen(provider: provider) {
208211
self.navigationController?.popToViewController(ofType: PointOfUseDetailsViewController.self, animated: false)
209-
self.showDashSpendPayScreen(justAuthenticated: true)
212+
self.showDashSpendPayScreen(provider: provider, justAuthenticated: true)
210213
}
211214
)
212215
hostingController.modalPresentationStyle = .fullScreen
213216
self.navigationController?.pushViewController(hostingController, animated: true)
214217
}
215218

216-
private func showCTXSpendAuth(authType: CTXSpendUserAuthType) {
219+
private func showDashSpendAuth(authType: DashSpendUserAuthType, provider: GiftCardProvider) {
217220
let hostingController = UIHostingController(
218-
rootView: CTXSpendUserAuthScreen(authType: authType) {
221+
rootView: DashSpendUserAuthScreen(authType: authType) {
219222
self.navigationController?.popViewController(animated: false)
220-
self.showDashSpendPayScreen(justAuthenticated: true)
223+
self.showDashSpendPayScreen(provider: provider, justAuthenticated: true)
221224
}
222225
)
223226

224227
self.navigationController?.pushViewController(hostingController, animated: true)
225228
}
226229

227-
private func showDashSpendPayScreen(justAuthenticated: Bool = false) {
230+
private func showDashSpendPayScreen(provider: GiftCardProvider, justAuthenticated: Bool = false) {
228231
let hostingController = UIHostingController(
229-
rootView: DashSpendPayScreen(merchant: self.pointOfUse, justAuthenticated: justAuthenticated) { [weak self] txId in
232+
rootView: DashSpendPayScreen(merchant: self.pointOfUse, provider: provider, justAuthenticated: justAuthenticated) { [weak self] txId in
230233
// Navigate back to home and show gift card details
231234
self?.onGiftCardPurchased?(txId)
232235
}

0 commit comments

Comments
 (0)