Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
|
|
struct LoginView: View {
|
|
|
|
|
@StateObject private var vm = LoginViewModel()
|
|
|
|
|
@State private var navigateToDashboard = false
|
2026-05-16 00:43:31 +03:00
|
|
|
@State private var logoAppeared = false
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
|
NavigationStack {
|
|
|
|
|
ZStack {
|
|
|
|
|
Color.white.ignoresSafeArea()
|
|
|
|
|
|
|
|
|
|
VStack(spacing: 0) {
|
|
|
|
|
Spacer()
|
|
|
|
|
|
2026-05-16 00:43:31 +03:00
|
|
|
// Logo
|
|
|
|
|
Image("nas_logo_clean")
|
|
|
|
|
.resizable()
|
|
|
|
|
.scaledToFit()
|
|
|
|
|
.frame(width: 72, height: 72)
|
|
|
|
|
.clipShape(RoundedRectangle(cornerRadius: 18, style: .continuous))
|
|
|
|
|
.shadow(color: .black.opacity(0.08), radius: 16, x: 0, y: 4)
|
|
|
|
|
.scaleEffect(logoAppeared ? 1 : 0.8)
|
|
|
|
|
.opacity(logoAppeared ? 1 : 0)
|
|
|
|
|
.animation(.spring(response: 0.5, dampingFraction: 0.7).delay(0.1), value: logoAppeared)
|
|
|
|
|
|
|
|
|
|
Spacer().frame(height: 32)
|
|
|
|
|
|
|
|
|
|
// Device + account
|
|
|
|
|
VStack(spacing: 6) {
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
Text("Forge")
|
2026-05-16 00:43:31 +03:00
|
|
|
.font(.system(size: 22, weight: .semibold))
|
|
|
|
|
.foregroundStyle(AppTheme.ink)
|
|
|
|
|
|
|
|
|
|
HStack(spacing: 8) {
|
|
|
|
|
ZStack {
|
|
|
|
|
Circle()
|
|
|
|
|
.fill(AppTheme.surfaceSunken)
|
|
|
|
|
.frame(width: 28, height: 28)
|
|
|
|
|
Text("AB")
|
|
|
|
|
.font(.system(size: 10, weight: .semibold))
|
|
|
|
|
.foregroundStyle(AppTheme.inkSecondary)
|
|
|
|
|
}
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
Text("Albert")
|
2026-05-16 00:43:31 +03:00
|
|
|
.font(AppTheme.caption())
|
|
|
|
|
.foregroundStyle(AppTheme.inkSecondary)
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-16 00:43:31 +03:00
|
|
|
.opacity(logoAppeared ? 1 : 0)
|
|
|
|
|
.animation(.spring(response: 0.5, dampingFraction: 0.7).delay(0.2), value: logoAppeared)
|
|
|
|
|
|
|
|
|
|
Spacer().frame(height: 40)
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
|
|
|
|
|
// Face ID button
|
|
|
|
|
Button(action: { vm.authenticateWithFaceID() }) {
|
2026-05-16 00:43:31 +03:00
|
|
|
HStack(spacing: 8) {
|
|
|
|
|
if vm.isAuthenticating {
|
|
|
|
|
ProgressView()
|
|
|
|
|
.tint(.white)
|
|
|
|
|
.scaleEffect(0.8)
|
|
|
|
|
} else {
|
|
|
|
|
Image(systemName: "faceid")
|
|
|
|
|
.font(.system(size: 16, weight: .medium))
|
|
|
|
|
Text("Sign in with Face ID")
|
|
|
|
|
}
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-16 00:43:31 +03:00
|
|
|
.buttonStyle(PrimaryButtonStyle())
|
|
|
|
|
.padding(.horizontal, AppTheme.hPad)
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
.disabled(vm.isAuthenticating)
|
2026-05-16 00:43:31 +03:00
|
|
|
.opacity(logoAppeared ? 1 : 0)
|
|
|
|
|
.animation(.spring(response: 0.5, dampingFraction: 0.7).delay(0.3), value: logoAppeared)
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
|
|
|
|
|
if let error = vm.authError {
|
|
|
|
|
Text(error)
|
2026-05-16 00:43:31 +03:00
|
|
|
.font(AppTheme.caption())
|
|
|
|
|
.foregroundStyle(AppTheme.destructive)
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
.padding(.top, 12)
|
2026-05-16 00:43:31 +03:00
|
|
|
.transition(.opacity.combined(with: .move(edge: .top)))
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Spacer()
|
|
|
|
|
|
2026-05-16 00:43:31 +03:00
|
|
|
// More
|
|
|
|
|
Button("More options") { vm.showMoreSheet = true }
|
|
|
|
|
.font(.system(size: 13, weight: .regular))
|
|
|
|
|
.foregroundStyle(AppTheme.inkTertiary)
|
|
|
|
|
.padding(.bottom, 44)
|
|
|
|
|
.opacity(logoAppeared ? 1 : 0)
|
|
|
|
|
.animation(.spring(response: 0.5, dampingFraction: 0.7).delay(0.4), value: logoAppeared)
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-16 00:43:31 +03:00
|
|
|
.navigationDestination(isPresented: $navigateToDashboard) { MainTabView() }
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
.sheet(isPresented: $vm.showMoreSheet) {
|
2026-05-16 00:43:31 +03:00
|
|
|
MoreOptionsSheet(isPresented: $vm.showMoreSheet) {
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
vm.showMoreSheet = false
|
|
|
|
|
navigateToDashboard = true
|
2026-05-16 00:43:31 +03:00
|
|
|
}
|
|
|
|
|
.presentationDetents([.height(200)])
|
2026-05-16 10:58:26 +03:00
|
|
|
.modifier(SheetCornerRadius(20))
|
2026-05-16 00:43:31 +03:00
|
|
|
}
|
|
|
|
|
.onAppear {
|
|
|
|
|
vm.onAuthenticated = { navigateToDashboard = true }
|
|
|
|
|
logoAppeared = true
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct MoreOptionsSheet: View {
|
|
|
|
|
@Binding var isPresented: Bool
|
|
|
|
|
var onAuthenticated: (() -> Void)?
|
|
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
|
VStack(spacing: 0) {
|
|
|
|
|
Capsule()
|
2026-05-16 00:43:31 +03:00
|
|
|
.fill(AppTheme.inkQuaternary)
|
|
|
|
|
.frame(width: 32, height: 4)
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
.padding(.top, 12)
|
|
|
|
|
.padding(.bottom, 20)
|
|
|
|
|
|
2026-05-16 00:43:31 +03:00
|
|
|
VStack(spacing: 0) {
|
|
|
|
|
sheetRow("Password", weight: .medium) { }
|
|
|
|
|
Divider().padding(.leading, 16)
|
|
|
|
|
sheetRow("Another account") {
|
|
|
|
|
isPresented = false
|
|
|
|
|
onAuthenticated?()
|
|
|
|
|
}
|
|
|
|
|
Divider().padding(.leading, 16)
|
|
|
|
|
sheetRow("Cancel", color: AppTheme.inkTertiary) { isPresented = false }
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
}
|
2026-05-16 00:43:31 +03:00
|
|
|
.background(AppTheme.surfaceRaised)
|
|
|
|
|
.clipShape(RoundedRectangle(cornerRadius: AppTheme.radius, style: .continuous))
|
|
|
|
|
.overlay(
|
|
|
|
|
RoundedRectangle(cornerRadius: AppTheme.radius, style: .continuous)
|
|
|
|
|
.stroke(AppTheme.cardBorderColor, lineWidth: 0.5)
|
|
|
|
|
)
|
|
|
|
|
.padding(.horizontal, AppTheme.hPad)
|
|
|
|
|
.padding(.bottom, 16)
|
|
|
|
|
}
|
|
|
|
|
.background(Color.white)
|
|
|
|
|
}
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
|
2026-05-16 00:43:31 +03:00
|
|
|
private func sheetRow(
|
|
|
|
|
_ title: String,
|
|
|
|
|
weight: Font.Weight = .regular,
|
|
|
|
|
color: Color = AppTheme.ink,
|
|
|
|
|
action: @escaping () -> Void
|
|
|
|
|
) -> some View {
|
|
|
|
|
Button(action: action) {
|
|
|
|
|
Text(title)
|
|
|
|
|
.font(.system(size: 15, weight: weight))
|
|
|
|
|
.foregroundStyle(color)
|
|
|
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
|
|
|
.padding(.horizontal, 16)
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
.padding(.vertical, 14)
|
|
|
|
|
}
|
2026-05-16 00:43:31 +03:00
|
|
|
.buttonStyle(ScaleButtonStyle())
|
Initial scaffold — NASBackup iOS app
Full project scaffold: XcodeGen project.yml, Core models/protocols/errors,
SMBService (kishikawakatsumi/SMBClient), SFTPService (Citadel 0.9.2),
PhotoLibraryService, LANMonitor, BackupEngine, BackgroundTaskManager,
all feature UIs (Login, Connect, Browse, Backup, History, Settings),
Shared components and theme. Builds clean with zero errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 17:05:04 +03:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-16 10:58:26 +03:00
|
|
|
|
|
|
|
|
private struct SheetCornerRadius: ViewModifier {
|
|
|
|
|
let radius: CGFloat
|
|
|
|
|
init(_ radius: CGFloat) { self.radius = radius }
|
|
|
|
|
func body(content: Content) -> some View {
|
|
|
|
|
if #available(iOS 16.4, *) {
|
|
|
|
|
content.presentationCornerRadius(radius)
|
|
|
|
|
} else {
|
|
|
|
|
content
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|