Skip to content
Merged

v1.1 #38

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
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"color-space" : "extended-srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.300",
"green" : "0.411",
"red" : "0.573"
"blue" : "0x39",
"green" : "0x55",
"red" : "0x7F"
}
},
"idiom" : "universal"
Expand All @@ -23,9 +23,9 @@
"color-space" : "extended-srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xCE",
"green" : "0xE7",
"red" : "0xFF"
"blue" : "0xD4",
"green" : "0xE0",
"red" : "0xED"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.757",
"green" : "0.816",
"red" : "0.847"
"blue" : "0xD4",
"green" : "0xE0",
"red" : "0xED"
}
},
"idiom" : "universal"
Expand All @@ -23,9 +23,9 @@
"color-space" : "extended-srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x5E",
"green" : "0x81",
"red" : "0xAB"
"blue" : "0x39",
"green" : "0x55",
"red" : "0x7F"
}
},
"idiom" : "universal"
Expand Down
2 changes: 1 addition & 1 deletion CoffeeTracker/CoffeeTracker/Fixtures/BeanFixtures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var testRoast = BeanModel(name: "Swiftly Brewed",
roaster: "Apple Inc",
roastedOn: Date.now,
boughtOn: Date.now,
notes: "Sold in Maegan's hopes and dreams",
notes: "Sold in Maegan's hopes and dreams. Single origin \n- Costa Rica",
beanType: "pods",
image: UIImage(systemName: SFSymbols.photo)!)

Expand Down
4 changes: 2 additions & 2 deletions CoffeeTracker/CoffeeTracker/Helpers/SFSymbolHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ enum SFSymbols {
static let list = "list.dash.header.rectangle"
static let info = "info.circle"
static let rectRoundedBottom = "rectangle.roundedbottom"
static let star = "star.fill"
static let ladybug = "ladybug.fill"
static let star = "star"
static let ladybug = "ladybug"
}
148 changes: 79 additions & 69 deletions CoffeeTracker/CoffeeTracker/Navigation/CoffeeTrackerMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,81 +21,91 @@ struct CoffeeTrackerMain: View {
var plusRotation: Double {
return navRouter.currentPage == .newBeans ? 45 : 0
}

var addButtonColor: Color {
return navRouter.currentPage == .newBeans ? Color.red : Color.accentColor
}

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
}
if currentVersion != version {
showNewView = true
version = currentVersion
} else {
showNewView = false
version = currentVersion
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
}
}
}
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)
.background(Circle()
.fill(navRouter.currentPage == .newBeans ? Color.red : Color.sage)
.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
6 changes: 4 additions & 2 deletions CoffeeTracker/CoffeeTracker/Navigation/TabBarIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ struct TabBarIcon: View {
Text(tabName)
.font(.footnote)
Spacer()
}.foregroundColor(colorScheme == .light ? lightFGColor : darkFGColor)
}.foregroundColor(assignedPage == navRouter.currentPage ? .accentColor : .secondary)
.onTapGesture {
navRouter.currentPage = assignedPage
withAnimation {
navRouter.currentPage = assignedPage
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion CoffeeTracker/CoffeeTracker/Styles/View+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension View {
}

func asImage() -> UIImage {
let controller = UIHostingController(rootView: self)
let controller = UIHostingController(rootView: self.edgesIgnoringSafeArea(.all))
// locate far out of screen
controller.view.frame = CGRect(x: 0, y: CGFloat(Int.max), width: 1, height: 1)
UIApplication.shared.windows.first!.rootViewController?.view.addSubview(controller.view)
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
Loading