mirror of
https://github.com/yattee/yattee.git
synced 2026-11-01 01:17:20 +00:00
Let accounts be set inactive without signing them out
An inactive account keeps its credential and syncs like a rename, but drops out of every picker and cannot be used until activated again. Deactivating the selected account switches to the local context as a published choice, so other devices follow instead of falling back.
This commit is contained in:
@@ -29,6 +29,7 @@ struct AccountStatusBadge: View {
|
||||
case .credentialMissing: String(localized: "accounts.status.credentialMissing")
|
||||
case .credentialRejected: String(localized: "accounts.status.credentialRejected")
|
||||
case .instanceDisabled: String(localized: "accounts.status.instanceDisabled")
|
||||
case .inactive: String(localized: "accounts.status.inactive")
|
||||
case .unreachable: String(localized: "accounts.status.unreachable")
|
||||
}
|
||||
}
|
||||
@@ -45,6 +46,7 @@ struct AccountStatusBadge: View {
|
||||
case .credentialMissing: .secondary
|
||||
case .credentialRejected: .red
|
||||
case .instanceDisabled: .secondary
|
||||
case .inactive: .secondary
|
||||
case .unreachable: .orange
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ enum DataContextSwitcherGlyph {
|
||||
return true
|
||||
case let .temporarilyUnavailable(reason):
|
||||
switch reason {
|
||||
case .instanceDisabled, .credentialRejected, .unreachable: return true
|
||||
case .instanceDisabled, .accountInactive, .credentialRejected, .unreachable: return true
|
||||
case .checking, .instancePending, .credentialMissing: return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ struct DataContextUnavailableBanner: View {
|
||||
case .checking: "clock"
|
||||
case .instancePending: "clock"
|
||||
case .instanceDisabled: "server.rack"
|
||||
case .accountInactive: "person.crop.circle.badge.minus"
|
||||
case .credentialMissing: "person.badge.key"
|
||||
case .credentialRejected: "exclamationmark.triangle.fill"
|
||||
case .unreachable: "wifi.exclamationmark"
|
||||
@@ -50,6 +51,7 @@ struct DataContextUnavailableBanner: View {
|
||||
switch reason {
|
||||
case .checking, .instancePending: .secondary
|
||||
case .instanceDisabled: .secondary
|
||||
case .accountInactive: .secondary
|
||||
case .credentialMissing: .secondary
|
||||
case .credentialRejected: .red
|
||||
case .unreachable: .orange
|
||||
@@ -61,6 +63,7 @@ struct DataContextUnavailableBanner: View {
|
||||
case .checking: String(localized: "subscriptions.banner.checking")
|
||||
case .instancePending: String(localized: "subscriptions.banner.instancePending")
|
||||
case .instanceDisabled: String(localized: "subscriptions.banner.instanceDisabled")
|
||||
case .accountInactive: String(localized: "subscriptions.banner.accountInactive")
|
||||
case .credentialMissing: String(localized: "subscriptions.banner.credentialMissing")
|
||||
case .credentialRejected: String(localized: "subscriptions.banner.credentialRejected")
|
||||
case .unreachable: String(localized: "subscriptions.banner.unreachable")
|
||||
|
||||
@@ -359,6 +359,21 @@ struct AccountsListView: View {
|
||||
Label(String(localized: "accounts.rename"), systemImage: "pencil")
|
||||
}
|
||||
|
||||
// Not offered on an orphan: with no source there is nothing an active
|
||||
// account could do that an inactive one cannot.
|
||||
if instance != nil {
|
||||
Button {
|
||||
appEnvironment?.accountsManager.updateIsActive(!account.isActive, for: account.id)
|
||||
} label: {
|
||||
Label(
|
||||
String(localized: account.isActive ? "accounts.deactivate" : "accounts.activate"),
|
||||
systemImage: account.isActive
|
||||
? "person.crop.circle.badge.minus"
|
||||
: "person.crop.circle.badge.checkmark"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Button(role: .destructive) {
|
||||
pendingRemoval = PendingAccountRemoval(
|
||||
id: account.id,
|
||||
|
||||
Reference in New Issue
Block a user