mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Port Feedbin credential update too SwfitUI.
This commit is contained in:
@@ -9,10 +9,12 @@
|
||||
import SwiftUI
|
||||
import Combine
|
||||
import Account
|
||||
import RSWeb
|
||||
|
||||
struct SettingsDetailAccountView : View {
|
||||
@ObjectBinding var viewModel: ViewModel
|
||||
@State private var verifyDelete = false
|
||||
@State private var showFeedbinCredentials = false
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
@@ -26,15 +28,19 @@ struct SettingsDetailAccountView : View {
|
||||
Text("Active")
|
||||
}
|
||||
}
|
||||
Section {
|
||||
HStack {
|
||||
Spacer()
|
||||
Button(action: {
|
||||
|
||||
}) {
|
||||
Text("Credentials")
|
||||
if viewModel.isCreditialsAvailable {
|
||||
Section {
|
||||
HStack {
|
||||
Spacer()
|
||||
Button(action: {
|
||||
self.showFeedbinCredentials = true
|
||||
}) {
|
||||
Text("Credentials")
|
||||
}
|
||||
.presentation(showFeedbinCredentials ? feedbinCredentialsModal : nil)
|
||||
.onDisappear() { self.showFeedbinCredentials = false }
|
||||
Spacer()
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
if viewModel.isDeletable {
|
||||
@@ -62,6 +68,11 @@ struct SettingsDetailAccountView : View {
|
||||
|
||||
}
|
||||
|
||||
var feedbinCredentialsModal: Modal {
|
||||
let feedbinViewModel = SettingsFeedbinAccountView.ViewModel(account: viewModel.account)
|
||||
return Modal(SettingsFeedbinAccountView(viewModel: feedbinViewModel))
|
||||
}
|
||||
|
||||
class ViewModel: BindableObject {
|
||||
let didChange = PassthroughSubject<ViewModel, Never>()
|
||||
let account: Account
|
||||
@@ -94,6 +105,10 @@ struct SettingsDetailAccountView : View {
|
||||
}
|
||||
}
|
||||
|
||||
var isCreditialsAvailable: Bool {
|
||||
return account.type != .onMyMac
|
||||
}
|
||||
|
||||
var isDeletable: Bool {
|
||||
return AccountManager.shared.defaultAccount != account
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user