mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 23:02:04 +00:00
Add manual legacy account import
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user