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 Foundation
|
|
|
|
|
|
|
|
|
|
enum ConnectField { case host, username, password, folder }
|
|
|
|
|
enum FieldState { case idle, valid, invalid }
|
|
|
|
|
|
|
|
|
|
@MainActor
|
|
|
|
|
final class ConnectViewModel: ObservableObject {
|
|
|
|
|
@Published var host = ""
|
|
|
|
|
@Published var username = ""
|
|
|
|
|
@Published var password = ""
|
|
|
|
|
@Published var remotePath = "/"
|
2026-05-16 11:17:17 +03:00
|
|
|
@Published var selectedProtocol: NASProtocol = .smb
|
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
|
|
|
@Published var isVerifying = false
|
|
|
|
|
@Published var isConnected = false
|
|
|
|
|
@Published var verifyError: String? = nil
|
|
|
|
|
@Published var showFolderBrowser = false
|
|
|
|
|
|
|
|
|
|
var fieldState: FieldState {
|
|
|
|
|
isConnected ? .valid : (verifyError != nil ? .invalid : .idle)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var canConnect: Bool {
|
|
|
|
|
!host.isEmpty && !username.isEmpty && !password.isEmpty && !isVerifying
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func verify() async {
|
feat: Kisani rebrand, step-based onboarding flow, dark mode fixes
- Rename app to Kisani in all UI text and Face ID prompt
- Replace flat 2-state RootView with 5-step flow: ConnectView →
LoginView → FolderSetupView → PhotoPermissionView → MainTabView
- Remove NavigationStack from LoginView (was causing nested-stack crash);
drive navigation via ConnectionStore.isSessionActive
- Add FolderSetupView and PhotoPermissionView onboarding screens with
step indicator (2/3, 3/3), spring entrance animations, and UGreen
connection chip
- Fix dark mode button invisibility: PrimaryButtonStyle and PillButtonStyle
now use AppTheme.inkInverse; GhostButtonStyle border uses ink.opacity(0.25)
- Add AppTheme.inkInverse adaptive token (dark bg ink on dark, white on light)
- Add ConnectionStore.isSessionActive (non-persisted) and
onboardingPhotoShown (UserDefaults-persisted)
- Add os_log logging in LoginViewModel at auth start/success/failure
- Remove dead Help button from ConnectView
- UGreenCompatibilityBadge, KeychainStore, SavedConnections, extensions,
PrivacyInfo.xcprivacy, unit test target and test stubs
- AppTheme: full UIColor dynamic provider tokens for dark/light adaptive color
- AppearanceMode enum + segmented picker in SettingsView
- BackupView: enlarged ring, removed options card and linear progress bar
- HistoryView: duration and bytes formatting, improved typography hierarchy
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 16:20:53 +03:00
|
|
|
let service: any NASTransferProtocol = selectedProtocol == .smb ? SMBService() : SFTPService()
|
|
|
|
|
await verifyWith(transfer: service)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func verifyWith(transfer: any NASTransferProtocol) async {
|
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
|
|
|
isVerifying = true
|
|
|
|
|
isConnected = false
|
|
|
|
|
verifyError = nil
|
|
|
|
|
|
|
|
|
|
let connection = NASConnection(
|
|
|
|
|
host: host,
|
|
|
|
|
nasProtocol: selectedProtocol,
|
|
|
|
|
username: username,
|
|
|
|
|
password: password,
|
|
|
|
|
remotePath: remotePath
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
do {
|
feat: Kisani rebrand, step-based onboarding flow, dark mode fixes
- Rename app to Kisani in all UI text and Face ID prompt
- Replace flat 2-state RootView with 5-step flow: ConnectView →
LoginView → FolderSetupView → PhotoPermissionView → MainTabView
- Remove NavigationStack from LoginView (was causing nested-stack crash);
drive navigation via ConnectionStore.isSessionActive
- Add FolderSetupView and PhotoPermissionView onboarding screens with
step indicator (2/3, 3/3), spring entrance animations, and UGreen
connection chip
- Fix dark mode button invisibility: PrimaryButtonStyle and PillButtonStyle
now use AppTheme.inkInverse; GhostButtonStyle border uses ink.opacity(0.25)
- Add AppTheme.inkInverse adaptive token (dark bg ink on dark, white on light)
- Add ConnectionStore.isSessionActive (non-persisted) and
onboardingPhotoShown (UserDefaults-persisted)
- Add os_log logging in LoginViewModel at auth start/success/failure
- Remove dead Help button from ConnectView
- UGreenCompatibilityBadge, KeychainStore, SavedConnections, extensions,
PrivacyInfo.xcprivacy, unit test target and test stubs
- AppTheme: full UIColor dynamic provider tokens for dark/light adaptive color
- AppearanceMode enum + segmented picker in SettingsView
- BackupView: enlarged ring, removed options card and linear progress bar
- HistoryView: duration and bytes formatting, improved typography hierarchy
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 16:20:53 +03:00
|
|
|
try await transfer.connect(to: connection.host, port: connection.port,
|
|
|
|
|
username: connection.username, password: connection.password)
|
|
|
|
|
transfer.disconnect()
|
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
|
|
|
isConnected = true
|
|
|
|
|
ConnectionStore.shared.savedConnection = connection
|
|
|
|
|
} catch let e as BackupError {
|
|
|
|
|
verifyError = e.errorDescription
|
|
|
|
|
} catch {
|
|
|
|
|
verifyError = error.localizedDescription
|
|
|
|
|
}
|
|
|
|
|
isVerifying = false
|
|
|
|
|
}
|
|
|
|
|
}
|