Files
Nearfield_Friends/Proximity/Views/SignInView.swift

61 lines
2.1 KiB
Swift

import SwiftUI
/// The sign-in screen.
///
/// Auth here is about **account identity** who you are to the app not
/// about what you reveal to others. The copy makes clear that signing in
/// never makes you discoverable; you must separately choose to be present.
struct SignInView: View {
@EnvironmentObject private var authService: AuthService
var body: some View {
VStack(spacing: 32) {
Spacer()
VStack(spacing: 12) {
Image(systemName: "dot.radiowaves.left.and.right")
.font(.system(size: 64))
.foregroundColor(.green)
Text("Proximity")
.font(.largeTitle.bold())
Text("A social network you can only enter\nby being physically present.")
.multilineTextAlignment(.center)
.foregroundColor(.secondary)
}
Spacer()
VStack(spacing: 12) {
SignInWithAppleButton { request in
request.requestedScopes = [.fullName, .email]
} onCompletion: { result in
// Handled via AppleAuthProvider in AuthService.
}
.frame(height: 50)
.signInWithAppleButtonStyle(.black)
Button {
Task { try? await authService.signIn(with: .google) }
} label: {
HStack {
Image(systemName: "g.circle.fill")
Text("Continue with Google")
}
.frame(maxWidth: .infinity)
.padding()
.background(Color(.secondarySystemBackground))
.clipShape(RoundedRectangle(cornerRadius: 12))
}
.buttonStyle(.plain)
}
.padding(.horizontal)
Text("Signing in never makes you discoverable.\nYou choose to be present separately.")
.font(.caption)
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
.padding(.bottom, 24)
}
}
}