Add iOS app with Node.js/TypeScript backend for BeMyEars project. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
44 lines
1.3 KiB
Swift
44 lines
1.3 KiB
Swift
import SwiftUI
|
|
|
|
struct ContentView: View {
|
|
@EnvironmentObject var viewModel: CallViewModel
|
|
|
|
var body: some View {
|
|
Group {
|
|
if viewModel.currentUser == nil {
|
|
LoginView()
|
|
} else {
|
|
switch viewModel.callState.status {
|
|
case .incoming:
|
|
IncomingCallView()
|
|
case .inCall, .connecting:
|
|
CallView()
|
|
default:
|
|
DashboardView()
|
|
}
|
|
}
|
|
}
|
|
.overlay(
|
|
Group {
|
|
if let error = viewModel.errorMessage {
|
|
VStack {
|
|
Text(error)
|
|
.foregroundColor(.red)
|
|
.padding()
|
|
.background(Color(UIColor.systemBackground))
|
|
.cornerRadius(10)
|
|
.shadow(radius: 5)
|
|
}
|
|
.padding()
|
|
.transition(.move(edge: .top))
|
|
.onAppear {
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
|
|
viewModel.errorMessage = nil
|
|
}
|
|
}
|
|
}
|
|
}, alignment: .top
|
|
)
|
|
}
|
|
}
|