Add manual legacy account import

This commit is contained in:
Arkadiusz Fal
2026-05-17 13:08:32 +02:00
parent 69cf616465
commit bde80bfef1
8 changed files with 787 additions and 247 deletions

View File

@@ -23,6 +23,7 @@ struct AddSourceView: View {
@State private var discoveredSMBServer: String?
@State private var discoveredName: String?
@State private var discoveredAllowInvalidCerts = false
@State private var hasLegacyAccountsToImport = false
var body: some View {
#if os(tvOS)
@@ -101,6 +102,30 @@ struct AddSourceView: View {
private var listContent: some View {
List {
if hasLegacyAccountsToImport {
Section {
NavigationLink {
#if os(tvOS)
TVSidebarDetailContainer(
systemImage: "person.badge.key",
title: String(localized: "migration.accounts.title")
) {
LegacyAccountsImportView(showsDoneButton: false)
}
#else
LegacyAccountsImportView(showsDoneButton: false)
#endif
} label: {
Label(String(localized: "migration.accounts.addSourcesLink"), systemImage: "person.badge.key")
#if os(tvOS)
.labelStyle(TVSourceRowLabelStyle())
#endif
}
} footer: {
Text(String(localized: "migration.accounts.addSourcesFooter"))
}
}
Section {
#if !os(tvOS)
NavigationLink {
@@ -213,6 +238,12 @@ struct AddSourceView: View {
Text(String(localized: "sources.footer.discovery"))
}
}
.task {
refreshLegacyAccountsVisibility()
}
.onChange(of: appEnvironment?.legacyMigrationService.legacyAccountsRevision ?? 0) {
refreshLegacyAccountsVisibility()
}
}
private func handleSelectedShare(_ share: DiscoveredShare) {
@@ -229,6 +260,10 @@ struct AddSourceView: View {
navigateToSMB = true
}
}
private func refreshLegacyAccountsVisibility() {
hasLegacyAccountsToImport = appEnvironment?.legacyMigrationService.hasLegacyAccountsToImport() == true
}
}
// MARK: - Preview