Files
multica/apps/ios/Multica/Views/ContentView.swift
Jiayuan 31c2476a7b feat(ios): add MVP iOS app with issue management and agent log viewing
SwiftUI app (iOS 17+) with zero third-party dependencies:
- Passwordless email authentication with Keychain token storage
- Workspace selection and multi-workspace support
- Issue list grouped by status with search and filtering
- Issue detail with inline status/priority/assignee editing
- Comments with threaded display and compose
- Agent task runs history and real-time execution log streaming
- WebSocket integration for live updates
2026-04-02 23:50:28 +08:00

39 lines
1.2 KiB
Swift

import SwiftUI
struct ContentView: View {
@State private var authVM = AuthViewModel()
@State private var workspaceVM = WorkspaceViewModel()
@State private var issueListVM = IssueListViewModel()
var body: some View {
Group {
if !authVM.isAuthenticated {
LoginView(viewModel: authVM)
} else if !workspaceVM.hasSelectedWorkspace {
WorkspacePickerView(viewModel: workspaceVM)
} else {
IssueListView(viewModel: issueListVM, workspaceVM: workspaceVM)
}
}
.onReceive(NotificationCenter.default.publisher(for: .logout)) { _ in
authVM.logout()
workspaceVM.selectedWorkspace = nil
issueListVM.issues = []
}
.onChange(of: workspaceVM.hasSelectedWorkspace) { _, hasWorkspace in
if hasWorkspace {
Task { await issueListVM.loadIssues() }
setupRealtimeSync()
}
}
}
private func setupRealtimeSync() {
WebSocketClient.shared.onPrefix("issue") { _ in
Task { @MainActor in
await issueListVM.refresh()
}
}
}
}