mirror of
https://github.com/yattee/yattee.git
synced 2026-05-13 19:05:03 +00:00
Replace onboarding flow with silent v1 import and iCloud alert
Delete the multi-page onboarding sheet. On first launch the app now silently imports any v1 instances from UserDefaults (splitting embedded basic-auth credentials out of the URL and into the Keychain) and then, if the device is signed in to iCloud, shows a single alert offering to enable sync. Accepting shows a blocking progress overlay until the initial upload completes.
This commit is contained in:
@@ -176,15 +176,6 @@ struct DeveloperSettingsView: View {
|
||||
#if !os(tvOS)
|
||||
notificationTestingSection
|
||||
#endif
|
||||
|
||||
Section {
|
||||
Button {
|
||||
NotificationCenter.default.post(name: .showOnboarding, object: nil)
|
||||
appEnvironment?.navigationCoordinator.dismissSettings()
|
||||
} label: {
|
||||
Label(String(localized: "settings.advanced.showOnboarding"), systemImage: "hand.wave")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
|
||||
126
Yattee/Views/Settings/MigrationImportRow.swift
Normal file
126
Yattee/Views/Settings/MigrationImportRow.swift
Normal file
@@ -0,0 +1,126 @@
|
||||
//
|
||||
// MigrationImportRow.swift
|
||||
// Yattee
|
||||
//
|
||||
// Reusable row component for displaying a legacy import item.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct MigrationImportRow: View {
|
||||
let item: LegacyImportItem
|
||||
let onToggle: () -> Void
|
||||
|
||||
var body: some View {
|
||||
Button(action: onToggle) {
|
||||
HStack(spacing: 12) {
|
||||
// Checkbox
|
||||
Image(systemName: item.isSelected ? "checkmark.circle.fill" : "circle")
|
||||
.font(.title2)
|
||||
.foregroundStyle(item.isSelected ? Color.accentColor : .secondary)
|
||||
|
||||
// Instance type icon
|
||||
instanceIcon
|
||||
.font(.title2)
|
||||
.foregroundStyle(.secondary)
|
||||
.frame(width: 28)
|
||||
|
||||
// Instance details
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(item.displayName)
|
||||
.font(.body)
|
||||
.foregroundStyle(.primary)
|
||||
|
||||
Text(item.url.host ?? item.url.absoluteString)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
.lineLimit(1)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
// Reachability indicator
|
||||
reachabilityIndicator
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
|
||||
// MARK: - Subviews
|
||||
|
||||
@ViewBuilder
|
||||
private var instanceIcon: some View {
|
||||
switch item.instanceType {
|
||||
case .invidious:
|
||||
Image(systemName: "server.rack")
|
||||
case .piped:
|
||||
Image(systemName: "cloud")
|
||||
default:
|
||||
Image(systemName: "globe")
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var reachabilityIndicator: some View {
|
||||
switch item.reachabilityStatus {
|
||||
case .unknown:
|
||||
EmptyView()
|
||||
case .checking:
|
||||
ProgressView()
|
||||
.controlSize(.small)
|
||||
case .reachable:
|
||||
Image(systemName: "checkmark.circle.fill")
|
||||
.foregroundStyle(.green)
|
||||
case .unreachable:
|
||||
Image(systemName: "exclamationmark.triangle.fill")
|
||||
.foregroundStyle(.orange)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Preview
|
||||
|
||||
#Preview {
|
||||
List {
|
||||
MigrationImportRow(
|
||||
item: LegacyImportItem(
|
||||
id: UUID(),
|
||||
legacyInstanceID: "test",
|
||||
instanceType: .invidious,
|
||||
url: URL(string: "https://invidious.example.com")!,
|
||||
name: "My Invidious",
|
||||
isSelected: true,
|
||||
reachabilityStatus: .reachable
|
||||
),
|
||||
onToggle: {}
|
||||
)
|
||||
|
||||
MigrationImportRow(
|
||||
item: LegacyImportItem(
|
||||
id: UUID(),
|
||||
legacyInstanceID: "test2",
|
||||
instanceType: .piped,
|
||||
url: URL(string: "https://piped.example.com")!,
|
||||
name: nil,
|
||||
isSelected: false,
|
||||
reachabilityStatus: .unreachable
|
||||
),
|
||||
onToggle: {}
|
||||
)
|
||||
|
||||
MigrationImportRow(
|
||||
item: LegacyImportItem(
|
||||
id: UUID(),
|
||||
legacyInstanceID: "test3",
|
||||
instanceType: .invidious,
|
||||
url: URL(string: "https://another.invidious.com")!,
|
||||
name: "Another Instance",
|
||||
isSelected: true,
|
||||
reachabilityStatus: .checking
|
||||
),
|
||||
onToggle: {}
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user