mirror of
https://github.com/yattee/yattee.git
synced 2026-11-04 10:57:18 +00:00
Label the local context by where its data actually lives
"Yattee (iCloud)" was hardcoded for the local data context even with iCloud sync disabled, when the data is purely on-device. The name now comes from DataContextValidator.localContextName, which checks iCloudSyncEnabled and falls back to "Yattee (This Device)".
This commit is contained in:
@@ -259,16 +259,25 @@ final class DataContextValidator {
|
||||
func displayName(for context: DataContext) -> String {
|
||||
switch context {
|
||||
case .local:
|
||||
return String(localized: "subscriptions.account.local")
|
||||
return localContextName
|
||||
|
||||
case let .account(id):
|
||||
guard let account = accountsManager.account(id: id) else {
|
||||
return String(localized: "subscriptions.account.local")
|
||||
return localContextName
|
||||
}
|
||||
return displayName(for: account)
|
||||
}
|
||||
}
|
||||
|
||||
/// "(iCloud)" only when the data actually syncs; otherwise it lives on
|
||||
/// this device alone and the label says so.
|
||||
var localContextName: String {
|
||||
if appEnvironment?.settingsManager.iCloudSyncEnabled == true {
|
||||
return String(localized: "subscriptions.account.local")
|
||||
}
|
||||
return String(localized: "subscriptions.account.local.device")
|
||||
}
|
||||
|
||||
/// User-set label, else whatever the account falls back to.
|
||||
func displayName(for account: Account) -> String {
|
||||
if let name = account.displayName, !name.isEmpty { return name }
|
||||
|
||||
Reference in New Issue
Block a user