Skip to content

Commit

Permalink
Purchase cell improvements and more ping bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
twodayslate committed Jun 5, 2022
1 parent 042081a commit e15feca
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 40 deletions.
4 changes: 2 additions & 2 deletions ec3730.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@
CODE_SIGN_ENTITLEMENTS = ec3730/ec3730.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = C6L3992RFB;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
INFOPLIST_FILE = ec3730/Info.plist;
Expand Down Expand Up @@ -1081,7 +1081,7 @@
CODE_SIGN_ENTITLEMENTS = ec3730/ec3730.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = C6L3992RFB;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
INFOPLIST_FILE = ec3730/Info.plist;
Expand Down
10 changes: 5 additions & 5 deletions ec3730/Controllers/PingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ struct PingNumberSettings: View {
}
}

Picker("Number of pings", selection: Binding(get: { self.numberOfPings - 1 }, set: { newValue in
self.numberOfPings = (newValue + 1)
}), content: {
ForEach(1 ..< 1000) { i in
Text("\(i)").tag(i)
Picker("Number of pings", selection: $numberOfPings, content: {
ForEach(1 ..< 1000, id: \.self) { i in
Text("\(i)")
.tag(i)
.id(i)
}
}).pickerStyle(WheelPickerStyle())
}
Expand Down
89 changes: 56 additions & 33 deletions ec3730/Views/PurchaseCellView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,40 @@ struct PurchaseCellView: View {

@State var imageSize: CGFloat = 64.0

enum Style {
static let termsOpacity: CGFloat = 0.8
}

var body: some View {
let isOneTime = (self.model.defaultProduct?.type == .nonConsumable)

VStack(alignment: .leading) {
HStack(alignment: .center) {
// GeometryReader { geometry in
Image(systemName: "lock.shield.fill").renderingMode(.template).resizable().foregroundColor(.accentColor).aspectRatio(contentMode: .fit).frame(width: imageSize)
// }.frame(width: imageSize)
Image(systemName: "lock.shield.fill")
.renderingMode(.template)
.resizable()
.foregroundColor(.accentColor)
.aspectRatio(contentMode: .fit)
.frame(width: imageSize)
VStack(alignment: .leading) {
Text(self.heading).font(.headline)
Text(self.subheading).font(.subheadline)
Text(self.heading)
.font(.headline)
Text(self.subheading)
.font(.subheadline)
}
.foregroundColor(Color(uiColor: UIColor.label))
}

Button(action: {
showDemoData.toggle()
}, label: {
Text("See an example query result!")
.multilineTextAlignment(.center)
.foregroundColor(.accentColor)
})
.frame(maxWidth: .infinity)
.padding(.bottom)

if !isOneTime {
// 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
let promoUnitType = self.model.defaultProduct?.subscription?.introductoryOffer?.period.unit ?? Product.SubscriptionPeriod.Unit.day
Expand All @@ -41,7 +61,8 @@ struct PurchaseCellView: View {

(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"))
.font(.footnote)
.multilineTextAlignment(.center)
.foregroundColor(Color(uiColor: UIColor.secondaryLabel))
.multilineTextAlignment(.leading)
}

VStack {
Expand All @@ -68,39 +89,37 @@ struct PurchaseCellView: View {
} else {
Text("Subscibe Now for only \(self.model.defaultProduct?.displayPrice ?? "-")").bold()
}
}).padding().frame(maxWidth: .infinity).background(Color.accentColor).foregroundColor(.white).cornerRadius(16.0)
})
.padding()
.frame(maxWidth: .infinity)
.background(Color.accentColor)
.foregroundColor(.white)
.cornerRadius(16.0)
}
}
.padding(.vertical, 4)

Button(action: {
showDemoData.toggle()
}, label: {
Text("See an example query result!")
.multilineTextAlignment(.center)
.foregroundColor(.accentColor)
})
.frame(maxWidth: .infinity)
.padding(.bottom, 4)
}

if isOneTime {
Text("Payment will be charged to your Apple ID account at the confirmation of purchase.").font(.caption2).foregroundColor(Color(UIColor.systemGray2))
} else {
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))
}
Group {
if isOneTime {
Text("Payment will be charged to your Apple ID account at the confirmation of purchase.")
} else {
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.")
}

HStack {
Spacer()
Link(destination: URL(string: "https://zac.gorak.us/ios/privacy")!, label: {
Text("Privacy Policy").underline().foregroundColor(Color(UIColor.systemGray))
})
Text("&")
Link(destination: URL(string: "https://zac.gorak.us/ios/terms")!, label: {
Text("Terms of Use").underline().foregroundColor(Color(UIColor.systemGray))
})
Spacer()
}.font(.caption2).foregroundColor(Color(UIColor.systemGray2))
HStack {
Spacer()
Text("[Privacy Policy](https://zac.gorak.us/ios/privacy)")
.underline() +
Text(" & ") +
Text("[Terms of Use](https://zac.gorak.us/ios/terms)")
.underline()
Spacer()
}
}
.font(.caption2)
.foregroundColor(Color(UIColor.systemGray2).opacity(Style.termsOpacity))
.tint(Color(UIColor.systemGray).opacity(Style.termsOpacity))
}
.padding()
.background(Color(UIColor.systemBackground))
Expand Down Expand Up @@ -142,5 +161,9 @@ struct LockedCellView_Previews: PreviewProvider {
Group {
PurchaseCellView(model: StoreKitModel.whois, sectionModel: WhoisXmlDnsSectionModel())
}

Group {
PurchaseCellView(model: StoreKitModel.whois, sectionModel: WhoisXmlDnsSectionModel())
}.preferredColorScheme(.dark)
}
}

0 comments on commit e15feca

Please sign in to comment.