2020-11-04 10:35:53 +08:00
|
|
|
//
|
|
|
|
|
// AddAccountHelpView.swift
|
|
|
|
|
// NetNewsWire
|
|
|
|
|
//
|
|
|
|
|
// Created by Stuart Breckenridge on 4/11/20.
|
|
|
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
import Account
|
|
|
|
|
|
|
|
|
|
struct AddAccountHelpView: View {
|
2025-11-05 11:22:10 -08:00
|
|
|
|
2020-11-04 10:35:53 +08:00
|
|
|
let accountTypes: [AccountType] = AddAccountSections.allOrdered.sectionContent
|
|
|
|
|
var delegate: AccountsPreferencesAddAccountDelegate?
|
|
|
|
|
var helpText: String
|
2025-09-16 14:01:05 -07:00
|
|
|
|
|
|
|
|
var hasiCloudAccount: Bool {
|
2026-03-21 13:35:56 -07:00
|
|
|
AccountManager.shared.hasiCloudAccount
|
2025-09-16 14:01:05 -07:00
|
|
|
}
|
|
|
|
|
|
2020-11-04 10:35:53 +08:00
|
|
|
var body: some View {
|
|
|
|
|
VStack {
|
|
|
|
|
HStack {
|
2020-12-10 14:21:22 -06:00
|
|
|
ForEach(accountTypes, id: \.self) { accountType in
|
2025-09-16 14:01:05 -07:00
|
|
|
if accountType == .cloudKit && hasiCloudAccount {
|
|
|
|
|
EmptyView()
|
2026-10-22 13:46:32 -07:00
|
|
|
} else if !(AppDefaults.isDeveloperBuild && accountType.isDeveloperRestricted) {
|
2020-12-10 14:21:22 -06:00
|
|
|
Button(action: {
|
2025-09-16 14:01:05 -07:00
|
|
|
delegate?.presentSheetForAccount(accountType)
|
2020-12-10 14:21:22 -06:00
|
|
|
}, label: {
|
|
|
|
|
accountType.image()
|
|
|
|
|
.resizable()
|
|
|
|
|
.frame(width: 20, height: 20, alignment: .center)
|
|
|
|
|
})
|
|
|
|
|
.buttonStyle(PlainButtonStyle())
|
|
|
|
|
}
|
2020-11-04 10:35:53 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-11-05 11:22:10 -08:00
|
|
|
|
2020-11-04 10:35:53 +08:00
|
|
|
Text(helpText)
|
|
|
|
|
.multilineTextAlignment(.center)
|
|
|
|
|
.padding(.top, 8)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|