Skip to content

Commit e15feca

Browse files
committed
Purchase cell improvements and more ping bug fixes
1 parent 042081a commit e15feca

File tree

3 files changed

+63
-40
lines changed

3 files changed

+63
-40
lines changed

ec3730.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@
10531053
CODE_SIGN_ENTITLEMENTS = ec3730/ec3730.entitlements;
10541054
CODE_SIGN_IDENTITY = "Apple Development";
10551055
CODE_SIGN_STYLE = Automatic;
1056-
CURRENT_PROJECT_VERSION = 3;
1056+
CURRENT_PROJECT_VERSION = 4;
10571057
DEVELOPMENT_TEAM = C6L3992RFB;
10581058
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
10591059
INFOPLIST_FILE = ec3730/Info.plist;
@@ -1081,7 +1081,7 @@
10811081
CODE_SIGN_ENTITLEMENTS = ec3730/ec3730.entitlements;
10821082
CODE_SIGN_IDENTITY = "Apple Development";
10831083
CODE_SIGN_STYLE = Automatic;
1084-
CURRENT_PROJECT_VERSION = 3;
1084+
CURRENT_PROJECT_VERSION = 4;
10851085
DEVELOPMENT_TEAM = C6L3992RFB;
10861086
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
10871087
INFOPLIST_FILE = ec3730/Info.plist;

ec3730/Controllers/PingViewController.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ struct PingNumberSettings: View {
4040
}
4141
}
4242

43-
Picker("Number of pings", selection: Binding(get: { self.numberOfPings - 1 }, set: { newValue in
44-
self.numberOfPings = (newValue + 1)
45-
}), content: {
46-
ForEach(1 ..< 1000) { i in
47-
Text("\(i)").tag(i)
43+
Picker("Number of pings", selection: $numberOfPings, content: {
44+
ForEach(1 ..< 1000, id: \.self) { i in
45+
Text("\(i)")
46+
.tag(i)
47+
.id(i)
4848
}
4949
}).pickerStyle(WheelPickerStyle())
5050
}

ec3730/Views/PurchaseCellView.swift

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,40 @@ struct PurchaseCellView: View {
1919

2020
@State var imageSize: CGFloat = 64.0
2121

22+
enum Style {
23+
static let termsOpacity: CGFloat = 0.8
24+
}
25+
2226
var body: some View {
2327
let isOneTime = (self.model.defaultProduct?.type == .nonConsumable)
2428

2529
VStack(alignment: .leading) {
2630
HStack(alignment: .center) {
27-
// GeometryReader { geometry in
28-
Image(systemName: "lock.shield.fill").renderingMode(.template).resizable().foregroundColor(.accentColor).aspectRatio(contentMode: .fit).frame(width: imageSize)
29-
// }.frame(width: imageSize)
31+
Image(systemName: "lock.shield.fill")
32+
.renderingMode(.template)
33+
.resizable()
34+
.foregroundColor(.accentColor)
35+
.aspectRatio(contentMode: .fit)
36+
.frame(width: imageSize)
3037
VStack(alignment: .leading) {
31-
Text(self.heading).font(.headline)
32-
Text(self.subheading).font(.subheadline)
38+
Text(self.heading)
39+
.font(.headline)
40+
Text(self.subheading)
41+
.font(.subheadline)
3342
}
43+
.foregroundColor(Color(uiColor: UIColor.label))
3444
}
3545

46+
Button(action: {
47+
showDemoData.toggle()
48+
}, label: {
49+
Text("See an example query result!")
50+
.multilineTextAlignment(.center)
51+
.foregroundColor(.accentColor)
52+
})
53+
.frame(maxWidth: .infinity)
54+
.padding(.bottom)
55+
3656
if !isOneTime {
3757
// we don't know what kind of product this is so let's just assume it is a trial so Apple doesn't yell at us
3858
let promoUnitType = self.model.defaultProduct?.subscription?.introductoryOffer?.period.unit ?? Product.SubscriptionPeriod.Unit.day
@@ -41,7 +61,8 @@ struct PurchaseCellView: View {
4161

4262
(Text("Start your free \(self.model.defaultProduct?.subscription?.introductoryOffer?.period.value ?? 3)-\(promoUnitType.debugDescription.lowercased()) trial").bold() + Text(" then all \(self.heading) Data is available for \(self.model.defaultProduct?.displayPrice ?? "-")/\(unitType.debugDescription.lowercased()) automatically"))
4363
.font(.footnote)
44-
.multilineTextAlignment(.center)
64+
.foregroundColor(Color(uiColor: UIColor.secondaryLabel))
65+
.multilineTextAlignment(.leading)
4566
}
4667

4768
VStack {
@@ -68,39 +89,37 @@ struct PurchaseCellView: View {
6889
} else {
6990
Text("Subscibe Now for only \(self.model.defaultProduct?.displayPrice ?? "-")").bold()
7091
}
71-
}).padding().frame(maxWidth: .infinity).background(Color.accentColor).foregroundColor(.white).cornerRadius(16.0)
92+
})
93+
.padding()
94+
.frame(maxWidth: .infinity)
95+
.background(Color.accentColor)
96+
.foregroundColor(.white)
97+
.cornerRadius(16.0)
7298
}
7399
}
74100
.padding(.vertical, 4)
75-
76-
Button(action: {
77-
showDemoData.toggle()
78-
}, label: {
79-
Text("See an example query result!")
80-
.multilineTextAlignment(.center)
81-
.foregroundColor(.accentColor)
82-
})
83-
.frame(maxWidth: .infinity)
84-
.padding(.bottom, 4)
85101
}
86102

87-
if isOneTime {
88-
Text("Payment will be charged to your Apple ID account at the confirmation of purchase.").font(.caption2).foregroundColor(Color(UIColor.systemGray2))
89-
} else {
90-
Text("Payment will be charged to your Apple ID account at the confirmation of purchase. The subscription automatically renews unless it is canceled at least 24 hours before the end of the current period. Your account will be charged for renewal within 24 hours prior to the end of the current period. You can manage and cancel your subscriptions by going to your App Store account settings after purchase.").font(.caption2).foregroundColor(Color(UIColor.systemGray2))
91-
}
103+
Group {
104+
if isOneTime {
105+
Text("Payment will be charged to your Apple ID account at the confirmation of purchase.")
106+
} else {
107+
Text("Payment will be charged to your Apple ID account at the confirmation of purchase. The subscription automatically renews unless it is canceled at least 24 hours before the end of the current period. Your account will be charged for renewal within 24 hours prior to the end of the current period. You can manage and cancel your subscriptions by going to your App Store account settings after purchase.")
108+
}
92109

93-
HStack {
94-
Spacer()
95-
Link(destination: URL(string: "https://zac.gorak.us/ios/privacy")!, label: {
96-
Text("Privacy Policy").underline().foregroundColor(Color(UIColor.systemGray))
97-
})
98-
Text("&")
99-
Link(destination: URL(string: "https://zac.gorak.us/ios/terms")!, label: {
100-
Text("Terms of Use").underline().foregroundColor(Color(UIColor.systemGray))
101-
})
102-
Spacer()
103-
}.font(.caption2).foregroundColor(Color(UIColor.systemGray2))
110+
HStack {
111+
Spacer()
112+
Text("[Privacy Policy](https://zac.gorak.us/ios/privacy)")
113+
.underline() +
114+
Text(" & ") +
115+
Text("[Terms of Use](https://zac.gorak.us/ios/terms)")
116+
.underline()
117+
Spacer()
118+
}
119+
}
120+
.font(.caption2)
121+
.foregroundColor(Color(UIColor.systemGray2).opacity(Style.termsOpacity))
122+
.tint(Color(UIColor.systemGray).opacity(Style.termsOpacity))
104123
}
105124
.padding()
106125
.background(Color(UIColor.systemBackground))
@@ -142,5 +161,9 @@ struct LockedCellView_Previews: PreviewProvider {
142161
Group {
143162
PurchaseCellView(model: StoreKitModel.whois, sectionModel: WhoisXmlDnsSectionModel())
144163
}
164+
165+
Group {
166+
PurchaseCellView(model: StoreKitModel.whois, sectionModel: WhoisXmlDnsSectionModel())
167+
}.preferredColorScheme(.dark)
145168
}
146169
}

0 commit comments

Comments
 (0)