mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Update ddc control toggle
This commit is contained in:
parent
9c044237c1
commit
8abd21de31
7 changed files with 305 additions and 261 deletions
|
|
@ -316,6 +316,22 @@ enum ColorPickerDisplayMode: String, CaseIterable, Codable, Defaults.Serializabl
|
|||
}
|
||||
}
|
||||
|
||||
enum ThirdPartyDDCProvider: String, CaseIterable, Codable, Defaults.Serializable, Identifiable {
|
||||
case betterDisplay
|
||||
case lunar
|
||||
|
||||
var id: String { rawValue }
|
||||
|
||||
var displayName: String {
|
||||
switch self {
|
||||
case .betterDisplay:
|
||||
return "BetterDisplay"
|
||||
case .lunar:
|
||||
return "Lunar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum HideNotchOption: String, Defaults.Serializable {
|
||||
case always
|
||||
case nowPlayingOnly
|
||||
|
|
@ -1029,10 +1045,13 @@ extension Defaults.Keys {
|
|||
static let circularHUDStrokeWidth = Key<CGFloat>("circularHUDStrokeWidth", default: 4)
|
||||
static let circularHUDUseAccentColor = Key<Bool>("circularHUDUseAccentColor", default: true)
|
||||
|
||||
// MARK: BetterDisplay Integration
|
||||
static let enableBetterDisplayIntegration = Key<Bool>("enableBetterDisplayIntegration", default: false)
|
||||
// MARK: Third-Party DDC Integration
|
||||
static let enableThirdPartyDDCIntegration = Key<Bool>("enableThirdPartyDDCIntegration", default: false)
|
||||
static let thirdPartyDDCProvider = Key<ThirdPartyDDCProvider>("thirdPartyDDCProvider", default: .betterDisplay)
|
||||
static let didMigrateThirdPartyDDCIntegration = Key<Bool>("didMigrateThirdPartyDDCIntegration", default: false)
|
||||
|
||||
// MARK: Lunar Integration
|
||||
// Legacy keys retained for migration/backward compatibility
|
||||
static let enableBetterDisplayIntegration = Key<Bool>("enableBetterDisplayIntegration", default: false)
|
||||
static let enableLunarIntegration = Key<Bool>("enableLunarIntegration", default: false)
|
||||
|
||||
static let hasSeenOSDAlphaWarning = Key<Bool>("hasSeenOSDAlphaWarning", default: false)
|
||||
|
|
@ -1157,6 +1176,29 @@ extension Defaults.Keys {
|
|||
Defaults[.didMigrateMusicControlSlots] = true
|
||||
}
|
||||
|
||||
static func migrateThirdPartyDDCIntegration() {
|
||||
if Defaults[.didMigrateThirdPartyDDCIntegration] == false {
|
||||
let legacyBetterDisplayEnabled = Defaults[.enableBetterDisplayIntegration]
|
||||
let legacyLunarEnabled = Defaults[.enableLunarIntegration]
|
||||
|
||||
if legacyBetterDisplayEnabled || legacyLunarEnabled {
|
||||
Defaults[.enableThirdPartyDDCIntegration] = true
|
||||
Defaults[.thirdPartyDDCProvider] = (legacyLunarEnabled && !legacyBetterDisplayEnabled) ? .lunar : .betterDisplay
|
||||
}
|
||||
|
||||
Defaults[.didMigrateThirdPartyDDCIntegration] = true
|
||||
}
|
||||
|
||||
syncLegacyThirdPartyDDCKeys()
|
||||
}
|
||||
|
||||
static func syncLegacyThirdPartyDDCKeys() {
|
||||
let isIntegrationEnabled = Defaults[.enableThirdPartyDDCIntegration]
|
||||
let selectedProvider = Defaults[.thirdPartyDDCProvider]
|
||||
Defaults[.enableBetterDisplayIntegration] = isIntegrationEnabled && selectedProvider == .betterDisplay
|
||||
Defaults[.enableLunarIntegration] = isIntegrationEnabled && selectedProvider == .lunar
|
||||
}
|
||||
|
||||
private static func normalizeMusicAuxControls() {
|
||||
guard Defaults[.musicAuxLeftControl] == Defaults[.musicAuxRightControl] else { return }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue