Skip to content
Open
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
2 changes: 2 additions & 0 deletions BuildTinder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"BuildTinder/Preview Content\"";
DEVELOPMENT_TEAM = 5Z3UL2PDB7;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand Down Expand Up @@ -523,6 +524,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"BuildTinder/Preview Content\"";
DEVELOPMENT_TEAM = 5Z3UL2PDB7;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand Down
2 changes: 2 additions & 0 deletions BuildTinder/Home/CardViews/CardImageScroller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ struct CardImageScroller: View {
})
}
.padding(16)
// space for horizontal Tab
.padding(.bottom, 85)
}
}
.foregroundColor(Color.white)
Expand Down
12 changes: 7 additions & 5 deletions BuildTinder/Home/CardViews/CardStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ struct CardStack: View {
var screen = UIScreen.main.bounds

var body: some View {

ZStack {
ForEach(people) { person in
CardView(person: person, fullScreenMode: $fullScreenMode)
GeometryReader { geo in
ZStack {
ForEach(people) { person in
CardView(person: person, fullScreenMode: $fullScreenMode)
}
}
// Height to 100% of the screen
.frame(width: screen.width, height: fullScreenMode ? screen.height : geo.size.height * 1.0)
}
.frame(width: screen.width, height: fullScreenMode ? screen.height : 550)
}
}

Expand Down
92 changes: 49 additions & 43 deletions BuildTinder/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,12 @@ struct HomeView: View {

var body: some View {
VStack{
CardStack(people: userMng.cardPeople)

Spacer()

HStack{
CircleButtonView(type: .back) {
appState.showPurchaseScreen()
}
Spacer()

CircleButtonView(type: .no) {
if let person = userMng.cardPeople.last {
userMng.swipe(person, .nope)
}
}
Spacer()

CircleButtonView(type: .star) {
if let person = userMng.cardPeople.last {
if userMng.currentUser.goldSubscriber {
userMng.superLike(person)
} else {
appState.showPurchaseScreen()
}
}
}
Spacer()

CircleButtonView(type: .heart) {
if let person = userMng.cardPeople.last {
userMng.swipe(person, .like)
}
}
Spacer()

CircleButtonView(type: .lightning) {
appState.showPurchaseScreen()
}
GeometryReader { geo in
CardStack(people: userMng.cardPeople)
.frame(height: geo.size.height * 1.15)
}
.frame(height: 50)
.padding(.horizontal)
.padding(.vertical, 25)

Spacer()
CircleHorizontalTab
.offset(y: -6.5)
}
}
}
Expand All @@ -70,3 +32,47 @@ struct HomeView_Previews: PreviewProvider {
.environmentObject(AppStateManager())
}
}

private extension HomeView {
// Circle button View
var CircleHorizontalTab: some View {
HStack {
CircleButtonView(type: .back) {
appState.showPurchaseScreen()
}
Spacer()

CircleButtonView(type: .no) {
if let person = userMng.cardPeople.last {
userMng.swipe(person, .nope)
}
}
Spacer()

CircleButtonView(type: .star) {
if let person = userMng.cardPeople.last {
if userMng.currentUser.goldSubscriber {
userMng.superLike(person)
} else {
appState.showPurchaseScreen()
}
}
}
Spacer()

CircleButtonView(type: .heart) {
if let person = userMng.cardPeople.last {
userMng.swipe(person, .like)
}
}
Spacer()

CircleButtonView(type: .lightning) {
appState.showPurchaseScreen()
}
}
.frame(height: 50)
.padding(.horizontal)
.padding(.vertical, 25)
}
}
159 changes: 104 additions & 55 deletions BuildTinder/MainTabBar/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,79 +7,128 @@

import SwiftUI



struct MainView: View {

@EnvironmentObject var appState: AppStateManager

func correctViewForState() -> some View{
switch appState.selectedTab {

case .fire:
let view = HomeView()
return AnyView(view)
case .star:
let view = MatchesView()
return AnyView(view)
case .message:
let view = MessageListView()
return AnyView(view)
case .profile:
let view = ProfileView()
return AnyView(view)
}
}
var body: some View {
NavigationView {
ZStack{
Color(.systemGray6)
.opacity(0.35)
.edgesIgnoringSafeArea(.vertical)
VStack{
HStack {
Spacer()

TabBarButtonView(type: .fire)

Spacer()

TabBarButtonView(type: .star)

Spacer()

TabBarButtonView(type: .message)

Spacer()

TabBarButtonView(type: .profile)

Spacer()
}
.frame( height: 100)
.padding(.top, 30)
correctViewForState()

Spacer()
NavigationView {
// Bottom tab view
ZStack {
TabView {
HomeView()
.tabItem {
Image(systemName: "flame.fill")
}
MatchesView()
.tabItem {
Image(systemName: "star.fill")
}
MessageListView()
.tabItem {
Image(systemName: "message.fill")
}
ProfileView()
.tabItem {
Image(systemName: "person.fill")
}
}
.edgesIgnoringSafeArea(.vertical)

if appState.showPurchasePopup {
PurchasePopup(isVisible: $appState.showPurchasePopup)
.animation(.spring(response: 0.3, dampingFraction: 0.75, blendDuration: 0.5))
.transition(.offset(y: 800))
}
}
.modifier(HideNavigationView())
}

}
}


struct MainView_Previews: PreviewProvider {
static var previews: some View {
MainView()
.environmentObject(AppStateManager())
.environmentObject(UserManager())
}
}

//struct MainView: View {
//
// @EnvironmentObject var appState: AppStateManager
//
// func correctViewForState() -> some View{
// switch appState.selectedTab {
//
// case .fire:
// let view = HomeView()
// return AnyView(view)
// case .star:
// let view = MatchesView()
// return AnyView(view)
// case .message:
// let view = MessageListView()
// return AnyView(view)
// case .profile:
// let view = ProfileView()
// return AnyView(view)
// }
// }
// var body: some View {
// NavigationView {
// ZStack{
// Color(.systemGray6)
// .opacity(0.35)
// .edgesIgnoringSafeArea(.vertical)
// VStack{
// HStack {
// Spacer()
//
// TabBarButtonView(type: .fire)
//
// Spacer()
//
// TabBarButtonView(type: .star)
//
// Spacer()
//
// TabBarButtonView(type: .message)
//
// Spacer()
//
// TabBarButtonView(type: .profile)
//
// Spacer()
// }
// .frame( height: 100)
// .padding(.top, 30)
// correctViewForState()
//
// Spacer()
// }
// .edgesIgnoringSafeArea(.vertical)
//
// if appState.showPurchasePopup {
// PurchasePopup(isVisible: $appState.showPurchasePopup)
// .animation(.spring(response: 0.3, dampingFraction: 0.75, blendDuration: 0.5))
// .transition(.offset(y: 800))
// }
// }
// .modifier(HideNavigationView())
// }
//
// }
//}
//
//struct MainView_Previews: PreviewProvider {
// static var previews: some View {
// MainView()
// .environmentObject(AppStateManager())
// .environmentObject(UserManager())
// }
//}
//
//private extension MainView {
//// var tabview: some View {
////
//// }
//
//
//}