Update Extension Live Activity for positioning

This commit is contained in:
Hariharan Mudaliar 2026-01-28 21:13:39 +05:30
commit 1bfce0c19a
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E
2 changed files with 61 additions and 13 deletions

View file

@ -202,6 +202,63 @@ struct ExtensionCompositeIconView: View {
}
}
struct ExtensionBadgeIconView: View {
let descriptor: AtollIconDescriptor
let accent: Color
let size: CGFloat
private var symbolSize: CGFloat { size * 0.5 }
private var imageSize: CGFloat { size * 0.62 }
private var imageCornerRadius: CGFloat { size * 0.18 }
var body: some View {
Group {
switch descriptor {
case let .symbol(name, _, weight):
Image(systemName: name)
.font(.system(size: symbolSize, weight: weight.swiftUI))
.foregroundStyle(accent)
case let .image(data, _, _):
if let image = NSImage(data: data) {
Image(nsImage: image)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: imageSize, height: imageSize)
.clipShape(RoundedRectangle(cornerRadius: imageCornerRadius, style: .continuous))
} else {
fallbackSymbol
}
case let .appIcon(bundleIdentifier, _, _):
if let icon = AppIconAsNSImage(for: bundleIdentifier) {
Image(nsImage: icon)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: imageSize, height: imageSize)
.clipShape(RoundedRectangle(cornerRadius: imageCornerRadius, style: .continuous))
} else {
fallbackSymbol
}
case let .lottie(animationData, _):
ExtensionLottieView(data: animationData, size: CGSize(width: imageSize, height: imageSize))
case .none:
fallbackSymbol
}
}
.frame(width: size, height: size)
}
private var fallbackSymbol: some View {
Image(systemName: "app.dashed")
.font(.system(size: symbolSize, weight: .medium))
.foregroundStyle(accent)
.frame(width: imageSize, height: imageSize)
.background(
RoundedRectangle(cornerRadius: imageCornerRadius, style: .continuous)
.fill(accent.opacity(0.15))
)
}
}
// MARK: - Lottie Rendering
struct ExtensionLottieView: View {