Skip to content
Snippets Groups Projects
Commit 900488a8 authored by Tormod Mork Müller's avatar Tormod Mork Müller :computer:
Browse files

Added sign out button to profileView

parent 46dacfa9
No related branches found
No related tags found
1 merge request!110Made changes for the Mobile application
...@@ -20,25 +20,12 @@ struct ContentView: View { ...@@ -20,25 +20,12 @@ struct ContentView: View {
@EnvironmentObject var viewModel: AppViewModel @EnvironmentObject var viewModel: AppViewModel
var body: some View { var body: some View {
NavigationView { ZStack {
if viewModel.signedIn { if viewModel.signedIn {
VStack { NavigationBarBottom()
Text("You are signed in!")
Button (action: {
viewModel.signOut()
}, label: {
Text("Sign out")
.frame(width: 150, height: 50)
.background(Color.gray)
.foregroundColor(Color.blue)
.padding()
})
}
} else { } else {
SignInView() SignInView()
} }
} }
.onAppear { .onAppear {
viewModel.signedIn = viewModel.isSignedIn viewModel.signedIn = viewModel.isSignedIn
......
...@@ -24,6 +24,7 @@ struct ProfileView: View { ...@@ -24,6 +24,7 @@ struct ProfileView: View {
*/ */
struct ProfileDetails: View { struct ProfileDetails: View {
@EnvironmentObject var modelData: ModelData @EnvironmentObject var modelData: ModelData
@EnvironmentObject var viewModel: AppViewModel
var user: User var user: User
...@@ -38,7 +39,6 @@ struct ProfileDetails: View { ...@@ -38,7 +39,6 @@ struct ProfileDetails: View {
MapView() MapView()
.ignoresSafeArea(edges: .top) .ignoresSafeArea(edges: .top)
.frame(height: 300) .frame(height: 300)
/// CircleImage responsible for displaying the user profile image /// CircleImage responsible for displaying the user profile image
CircleImage(image: user.image) CircleImage(image: user.image)
.offset(y: -130) .offset(y: -130)
...@@ -70,15 +70,27 @@ struct ProfileDetails: View { ...@@ -70,15 +70,27 @@ struct ProfileDetails: View {
Text("\(user.dateOfBirth)") Text("\(user.dateOfBirth)")
.foregroundColor(.secondary) .foregroundColor(.secondary)
} }
}
.padding()
Spacer() Spacer()
Button (action: {
viewModel.signOut()
}) {
Text("Sign out")
.frame(width: 150, height: 50, alignment: .center)
} }
.padding() .foregroundColor(.white)
.background(Color.blue)
.cornerRadius(10)
Spacer() Spacer()
.frame(height:50) // limit spacer size by applying a frame
} }
.navigationTitle(user.name) .navigationTitle(user.name)
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.ignoresSafeArea(edges: .top)
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment