mirror of
https://github.com/wu736139669/hapi.git
synced 2026-12-05 07:07:04 +00:00
feat(ios): machines panel and app icon badge
Settings gains a Machines screen: health, CLI version, capability and binary skew, rename, and the supervised runner restart the web banner exposes. Skew derivation lives in HapiProtocol so it is testable without a hub. The icon badge counts unread sessions on the active hub, with a notification-settings toggle that clears it immediately. The Japanese app-language option is dropped (no shipped catalog). via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run>
This commit is contained in:
@@ -48,7 +48,6 @@ public enum AppLanguage: String, CaseIterable, Sendable {
|
||||
case english = "en"
|
||||
case simplifiedChinese = "zh-Hans"
|
||||
case russian = "ru"
|
||||
case japanese = "ja"
|
||||
|
||||
/// Unknown/corrupt/absent stored values degrade to ``system``.
|
||||
public init(storageKey: String?) {
|
||||
@@ -66,7 +65,6 @@ public enum AppLanguage: String, CaseIterable, Sendable {
|
||||
case .english: return "English"
|
||||
case .simplifiedChinese: return "简体中文"
|
||||
case .russian: return "Русский"
|
||||
case .japanese: return "日本語"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,3 +111,24 @@ public final class LanguagePrefs {
|
||||
defaults.set(language.storageKey, forKey: Self.languageKey)
|
||||
}
|
||||
}
|
||||
|
||||
/// App icon badge preference (web `useAppBadgePreference` twin). Defaults to
|
||||
/// on; the system permission still decides whether the badge is painted.
|
||||
@MainActor @Observable
|
||||
public final class AppBadgePrefs {
|
||||
public static let enabledKey = "settings.appIconBadge"
|
||||
|
||||
public private(set) var enabled: Bool
|
||||
|
||||
private let defaults: UserDefaults
|
||||
|
||||
public init(defaults: UserDefaults = .standard) {
|
||||
self.defaults = defaults
|
||||
self.enabled = defaults.object(forKey: Self.enabledKey) as? Bool ?? true
|
||||
}
|
||||
|
||||
public func setEnabled(_ enabled: Bool) {
|
||||
self.enabled = enabled
|
||||
defaults.set(enabled, forKey: Self.enabledKey)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user