Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 75 additions & 70 deletions CoffeeTracker/CoffeeTracker/Navigation/CoffeeTrackerMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,79 +28,84 @@ struct CoffeeTrackerMain: View {

var body: some View {
GeometryReader { geometry in
ZStack(alignment: .bottom) {
Image("Background")
.resizable()
.ignoresSafeArea()
VStack {
switch navRouter.currentPage {
case .coffees:
CoffeeListView()
.popover(isPresented: $showNewView) {
WhatsNewView()
.onDisappear {
showNewView = false
}
}
case .info:
AboutView()
case .newBeans:
NewBeansView(navRouter: navRouter)
.environmentObject(beanOO)
}
}.onAppear {
let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
guard let currentVersion = currentVersion else {
return
NavigationView {
ZStack(alignment: .bottom) {
Image("Background")
.resizable()
.opacity(0.9)
.ignoresSafeArea()
VStack {
switch navRouter.currentPage {
case .coffees:
CoffeeListView()
.popover(isPresented: $showNewView) {
WhatsNewView()
.onDisappear {
showNewView = false
}
}
case .info:
AboutView()
case .newBeans:
NewBeansView(navRouter: navRouter)
.environmentObject(beanOO)
}
}.onAppear {
let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
guard let currentVersion = currentVersion else {
return
}
if currentVersion != version {
showNewView = true
version = currentVersion
} else {
showNewView = false
version = currentVersion
}
}
if currentVersion != version {
showNewView = true
version = currentVersion
} else {
showNewView = false
version = currentVersion
}
}
HStack(alignment: .bottom) {
TabBarIcon(navRouter: navRouter,
assignedPage: .coffees,
width: geometry.size.width/5,
height: geometry.size.height/28,
systemIcon: SFSymbols.list,
tabName: "Coffee")
ZStack {
Button {
if navRouter.currentPage == .newBeans {
navRouter.currentPage = .coffees
} else {
navRouter.currentPage = .newBeans
}
} label: {
Image(systemName: SFSymbols.plus)
.font(.largeTitle)
.foregroundColor(.bone)
.background(Circle()
.fill(addButtonColor)
.frame(width: geometry.size.width/7, height: geometry.size.width/7))
.padding(12)
.shadow(radius: 8, x: 4, y: 4)
.rotationEffect(Angle.degrees(plusRotation))
}.padding(20)
.tint(.white)
}
.offset(y: -geometry.size.height/8/2)
TabBarIcon(navRouter: navRouter,
assignedPage: .info,
width: geometry.size.width/5,
height: geometry.size.height/28,
systemIcon: SFSymbols.info,
tabName: "About")
HStack(alignment: .bottom) {
TabBarIcon(navRouter: navRouter,
assignedPage: .coffees,
width: geometry.size.width/5,
height: geometry.size.height/28,
systemIcon: SFSymbols.list,
tabName: "Coffee")
ZStack {
Button {
withAnimation {
if navRouter.currentPage == .newBeans {
navRouter.currentPage = .coffees
} else {
navRouter.currentPage = .newBeans
}
}
} label: {
Image(systemName: SFSymbols.plus)
.font(.largeTitle)
.foregroundColor(.bone)
.background(Circle()
.fill(addButtonColor)
.frame(width: geometry.size.width/7, height: geometry.size.width/7))
.padding(12)
.shadow(radius: 8, x: 4, y: 4)
.rotationEffect(Angle.degrees(plusRotation))
}.padding(20)
.tint(.white)
}
.offset(y: -geometry.size.height/8/2)
TabBarIcon(navRouter: navRouter,
assignedPage: .info,
width: geometry.size.width/5,
height: geometry.size.height/28,
systemIcon: SFSymbols.info,
tabName: "About")

}.frame(width: geometry.size.width, height: geometry.size.height/8)
.background(.ultraThinMaterial)
}.frame(width: geometry.size.width, height: geometry.size.height/8)
.background(.ultraThinMaterial)
}
.edgesIgnoringSafeArea(.bottom)
.padding(.horizontal, -4)
}
.edgesIgnoringSafeArea(.bottom)
.padding(.horizontal, -4)
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion CoffeeTracker/CoffeeTracker/Navigation/TabBarIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ struct TabBarIcon: View {
Spacer()
}.foregroundColor(assignedPage == navRouter.currentPage ? .accentColor : .secondary)
.onTapGesture {
navRouter.currentPage = assignedPage
withAnimation {
navRouter.currentPage = assignedPage
}
}
}
}
Expand Down
106 changes: 44 additions & 62 deletions CoffeeTracker/CoffeeTracker/Views/About/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,73 +15,55 @@ struct AboutView: View {
@State private var showingWhatsNew = false

var body: some View {
ZStack {
Image("Background")
.resizable()
.ignoresSafeArea()
VStack {
HStack {
Spacer()
.frame(height: 70)
}
ScrollView {
BuyDevCoffeeSection().padding()
ShareApp().padding()
Button {
showFeedback = true
} label: {
HStack(spacing: 15) {
Image(systemName: SFSymbols.plane)
.foregroundColor(.pink)
.font(.system(size: 36))
Text("Send feedback")
.foregroundColor(.primary)
}.frame(maxWidth: .infinity, alignment: .leading)
.row().padding()
ScrollView {
BuyDevCoffeeSection().padding()
ShareApp().padding()
Button {
showFeedback = true
} label: {
HStack(spacing: 15) {
Image(systemName: SFSymbols.plane)
.foregroundColor(.pink)
.font(.system(size: 36))
Text("Send feedback")
.foregroundColor(.primary)
}.frame(maxWidth: .infinity, alignment: .leading)
.row().padding()

}.sheet(isPresented: $showFeedback) {
UserFeedbackView()
}
Button {
showingWhatsNew = true
} label: {
HStack(spacing: 15) {
Image(systemName: SFSymbols.star)
.foregroundColor(.pink)
.font(.system(size: 36))
Text("Release Notes")
.foregroundColor(.primary)
}.frame(maxWidth: .infinity, alignment: .leading)
.row().padding()
}.sheet(isPresented: $showFeedback) {
UserFeedbackView()
}
Button {
showingWhatsNew = true
} label: {
HStack(spacing: 15) {
Image(systemName: SFSymbols.star)
.foregroundColor(.pink)
.font(.system(size: 36))
Text("Release Notes")
.foregroundColor(.primary)
}.frame(maxWidth: .infinity, alignment: .leading)
.row().padding()

}.sheet(isPresented: $showingWhatsNew) {
WhatsNewView()
}
}.sheet(isPresented: $showingWhatsNew) {
WhatsNewView()
}

HStack {
Spacer()
.frame(height: 120)
}
}
HStack {
Spacer()
.frame(height: 120)
}
Group {
GeometryReader { geometry in
HStack(alignment: .bottom) {
Text("About")
.font(.largeTitle)
.bold()
.padding(.top, 10)
.padding(.leading)
Spacer()
}
.frame(height: geometry.safeAreaInsets.top+80)
.background(.ultraThinMaterial)
.cornerRadius(10, corners: .bottomLeft)
.cornerRadius(10, corners: .bottomRight)
.edgesIgnoringSafeArea(.top)
}.safeAreaInset(edge: .top) {
VStack(alignment: .center, spacing: 8) {
HStack {
Text("About")
.font(.largeTitle.weight(.bold))
Spacer()
}
}.shadow(radius: 2)
}
}
.padding()
.background(.ultraThinMaterial)
}.navigationBarHidden(true)
}
}

Expand Down
29 changes: 11 additions & 18 deletions CoffeeTracker/CoffeeTracker/Views/About/BuyDevCoffeeSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,28 @@ struct BuyDevCoffeeSection: View {
let darkBlue = Color(red: 97.0/255.0, green: 176.0/255.0, blue: 1.0)
let formatter = FloatingPointFormatStyle<Double>.Currency.currency(code: Locale.current.currencyCode ?? "USD")

let purchaseText = "If you're enjoying coffee_ and want to buy a cup of coffee for the developer, "
let purchaseText2 = "then it is definitely appreciated. The app is free to use, so any additional "
let purchaseText3 = "contributions are always welcome."

var body: some View {
VStack(alignment: .center, spacing: 20) {
HStack {
HStack(alignment: .top) {
Image(systemName: SFSymbols.coffee)
.font(.largeTitle)
.foregroundColor(colorScheme == .light ? .blue : darkBlue)
Text("Support future development with a cup of coffee")
.font(.title3)
}.padding(.trailing)
Text(purchaseText + purchaseText2 + purchaseText3)
.foregroundColor(.secondary)
.font(.headline)
}
Button {
Purchases.shared.purchase(package: package!) { transaction, _, _, _ in
if transaction != nil {
cupsPurchased += 1
}
}
} label: {
Text("Buy the dev a cup of coffee")
.foregroundColor(.black)
Text("Buy a cup of coffee")
.font(.body)
.bold()
.padding(15)
.background(Color.green)
.frame(maxWidth: .infinity)
.background(Color.green.opacity(0.60))
.cornerRadius(10)
}
Text("Coffee is \(getPackagePrice(package)) a cup")
Expand All @@ -68,12 +64,9 @@ struct BuyDevCoffeeSection: View {
Spacer()
Text(amount, format: formatter)
}

Group {
Text("The amount should automatically update and keep updated with each launch of the app.")
.font(.caption2)
}.foregroundColor(.secondary)
}.row()
}.background(Color.clear)
.padding()
.row()
.onAppear {
Purchases.shared.getOfferings { (offerings, _) in
if let packages = offerings?.current?.availablePackages {
Expand Down
Loading