diff --git a/DynamicIsland/components/Focus/DoNotDisturbLiveActivity.swift b/DynamicIsland/components/Focus/DoNotDisturbLiveActivity.swift index c01aca0..962111e 100644 --- a/DynamicIsland/components/Focus/DoNotDisturbLiveActivity.swift +++ b/DynamicIsland/components/Focus/DoNotDisturbLiveActivity.swift @@ -110,13 +110,13 @@ struct DoNotDisturbLiveActivity: View { } } - private var currentIconName: String { + private var currentIcon: Image { if manager.isDoNotDisturbActive { - return focusMode.sfSymbol + return focusMode.activeIcon } else if showInactiveIcon { - return focusMode.inactiveSymbol + return Image(systemName: focusMode.inactiveSymbol) } else { - return focusMode.sfSymbol + return focusMode.activeIcon } } @@ -136,7 +136,7 @@ struct DoNotDisturbLiveActivity: View { Color.clear .overlay(alignment: .center) { if iconWingWidth > 0 { - Image(systemName: currentIconName) + currentIcon .font(.system(size: 13, weight: .semibold)) .foregroundColor(currentIconColor) .contentTransition(.opacity) diff --git a/DynamicIsland/components/UI/FocusIndicator.swift b/DynamicIsland/components/UI/FocusIndicator.swift index f887d13..0430cb9 100644 --- a/DynamicIsland/components/UI/FocusIndicator.swift +++ b/DynamicIsland/components/UI/FocusIndicator.swift @@ -14,7 +14,7 @@ struct FocusIndicator: View { Capsule() .fill(Color.black) .overlay { - Image(systemName: focusSymbol) + focusIcon .font(.system(size: 12, weight: .semibold)) .foregroundStyle(accentColor) .frame(width: 24, height: 24) @@ -30,8 +30,8 @@ struct FocusIndicator: View { ) } - private var focusSymbol: String { - focusMode.sfSymbol + private var focusIcon: Image { + focusMode.activeIcon } private var accentColor: Color { diff --git a/DynamicIsland/extensions/Image+InternalSystemName.swift b/DynamicIsland/extensions/Image+InternalSystemName.swift new file mode 100644 index 0000000..1fccf44 --- /dev/null +++ b/DynamicIsland/extensions/Image+InternalSystemName.swift @@ -0,0 +1,14 @@ +import SwiftUI + +@_silgen_name("$s7SwiftUI5ImageV19_internalSystemNameACSS_tcfC") +private func _swiftUI_image(internalSystemName: String) -> Image? + +extension Image { + init?(internalSystemName systemName: String) { + guard let systemImage = _swiftUI_image(internalSystemName: systemName) else { + return nil + } + + self = systemImage + } +} diff --git a/DynamicIsland/managers/DoNotDisturbManager.swift b/DynamicIsland/managers/DoNotDisturbManager.swift index 135a845..e323fed 100644 --- a/DynamicIsland/managers/DoNotDisturbManager.swift +++ b/DynamicIsland/managers/DoNotDisturbManager.swift @@ -342,6 +342,24 @@ enum FocusModeType: String, CaseIterable { } } + var internalSymbolName: String? { + switch self { + case .work: return "person.lanyardcard.fill" + case .mindfulness: return "apple.mindfulness" + case .gaming: return "rocket.fill" + default: return nil + } + } + + var activeIcon: Image { + if let internalSymbolName, + let image = Image(internalSystemName: internalSymbolName) { + return image + } + + return Image(systemName: sfSymbol) + } + var accentColor: Color { switch self { case .doNotDisturb: