mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Update stuff
This commit is contained in:
parent
a4e58b9e70
commit
5b41f2c364
3 changed files with 39 additions and 10 deletions
|
|
@ -834,7 +834,9 @@ struct ContentView: View {
|
||||||
)
|
)
|
||||||
let effectiveCenterWidth = inlineSneakPeekActive ? 380 : centerBaseWidth
|
let effectiveCenterWidth = inlineSneakPeekActive ? 380 : centerBaseWidth
|
||||||
let notchWidth = wingBaseWidth + effectiveCenterWidth + rightWingWidth
|
let notchWidth = wingBaseWidth + effectiveCenterWidth + rightWingWidth
|
||||||
let badgeSize = max(16, notchContentHeight * 0.45)
|
let badgeBaseSize = max(13, notchContentHeight * 0.36)
|
||||||
|
let badgeDisplaySize = badgeDisplaySize(for: secondary, baseSize: badgeBaseSize)
|
||||||
|
let badgeOffset = badgeOverlayOffset(for: secondary, badgeSize: badgeDisplaySize)
|
||||||
|
|
||||||
HStack(spacing: 0) {
|
HStack(spacing: 0) {
|
||||||
ZStack(alignment: .bottomTrailing) {
|
ZStack(alignment: .bottomTrailing) {
|
||||||
|
|
@ -849,8 +851,8 @@ struct ContentView: View {
|
||||||
.clipShape(RoundedRectangle(cornerRadius: MusicPlayerImageSizes.cornerRadiusInset.closed))
|
.clipShape(RoundedRectangle(cornerRadius: MusicPlayerImageSizes.cornerRadiusInset.closed))
|
||||||
.matchedGeometryEffect(id: "albumArt", in: albumArtNamespace)
|
.matchedGeometryEffect(id: "albumArt", in: albumArtNamespace)
|
||||||
.albumArtFlip(angle: musicManager.flipAngle)
|
.albumArtFlip(angle: musicManager.flipAngle)
|
||||||
albumArtBadge(for: secondary, badgeSize: badgeSize)
|
albumArtBadge(for: secondary, badgeSize: badgeDisplaySize)
|
||||||
.offset(x: badgeSize * 0.2, y: badgeSize * 0.25)
|
.offset(x: badgeOffset.width, y: badgeOffset.height)
|
||||||
.id(secondary?.id ?? "music-badge")
|
.id(secondary?.id ?? "music-badge")
|
||||||
.contentTransition(.symbolEffect(.replace))
|
.contentTransition(.symbolEffect(.replace))
|
||||||
}
|
}
|
||||||
|
|
@ -1066,6 +1068,26 @@ struct ContentView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func badgeDisplaySize(for secondary: MusicSecondaryLiveActivity?, baseSize: CGFloat) -> CGFloat {
|
||||||
|
guard let secondary else { return baseSize }
|
||||||
|
switch secondary {
|
||||||
|
case .extensionPayload:
|
||||||
|
return max(11, baseSize * 0.86)
|
||||||
|
default:
|
||||||
|
return baseSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func badgeOverlayOffset(for secondary: MusicSecondaryLiveActivity?, badgeSize: CGFloat) -> CGSize {
|
||||||
|
guard let secondary else { return CGSize(width: badgeSize * 0.2, height: badgeSize * 0.25) }
|
||||||
|
switch secondary {
|
||||||
|
case .extensionPayload:
|
||||||
|
return CGSize(width: badgeSize * 0.14, height: badgeSize * 0.12)
|
||||||
|
default:
|
||||||
|
return CGSize(width: badgeSize * 0.2, height: badgeSize * 0.25)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func musicRightWing(for secondary: MusicSecondaryLiveActivity?, notchHeight: CGFloat, trailingWidth: CGFloat) -> some View {
|
private func musicRightWing(for secondary: MusicSecondaryLiveActivity?, notchHeight: CGFloat, trailingWidth: CGFloat) -> some View {
|
||||||
switch secondary {
|
switch secondary {
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,10 @@ struct ExtensionInlineSneakPeekView: View {
|
||||||
private let wingPadding: CGFloat = 16
|
private let wingPadding: CGFloat = 16
|
||||||
|
|
||||||
private var descriptor: AtollLiveActivityDescriptor? { payload?.descriptor }
|
private var descriptor: AtollLiveActivityDescriptor? { payload?.descriptor }
|
||||||
private var resolvedAccent: Color { descriptor?.accentColor.swiftUIColor ?? accentColor }
|
private var resolvedAccent: Color {
|
||||||
|
guard let descriptor else { return accentColor }
|
||||||
|
return descriptor.accentColor.resolvedColor(fallback: accentColor)
|
||||||
|
}
|
||||||
private var trailingRenderable: ExtensionTrailingRenderable? {
|
private var trailingRenderable: ExtensionTrailingRenderable? {
|
||||||
descriptor.map { resolvedExtensionTrailingRenderable(for: $0) }
|
descriptor.map { resolvedExtensionTrailingRenderable(for: $0) }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@ extension AtollColorDescriptor {
|
||||||
}
|
}
|
||||||
return NSColor(red: red, green: green, blue: blue, alpha: alpha)
|
return NSColor(red: red, green: green, blue: blue, alpha: alpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func resolvedColor(fallback accent: Color) -> Color {
|
||||||
|
isAccent ? accent : swiftUIColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Font Conversion
|
// MARK: - Font Conversion
|
||||||
|
|
@ -287,7 +291,7 @@ struct ExtensionProgressIndicatorView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
switch indicator {
|
switch indicator {
|
||||||
case let .ring(diameter, strokeWidth, color):
|
case let .ring(diameter, strokeWidth, color):
|
||||||
let ringColor = color?.swiftUIColor ?? accent
|
let ringColor = color?.resolvedColor(fallback: accent) ?? accent
|
||||||
let resolvedDiameter = resolvedRingDiameter(requested: diameter)
|
let resolvedDiameter = resolvedRingDiameter(requested: diameter)
|
||||||
ZStack {
|
ZStack {
|
||||||
Circle()
|
Circle()
|
||||||
|
|
@ -300,7 +304,7 @@ struct ExtensionProgressIndicatorView: View {
|
||||||
}
|
}
|
||||||
.frame(width: resolvedDiameter, height: resolvedDiameter)
|
.frame(width: resolvedDiameter, height: resolvedDiameter)
|
||||||
case let .bar(width, height, cornerRadius, color):
|
case let .bar(width, height, cornerRadius, color):
|
||||||
let barColor = color?.swiftUIColor ?? accent
|
let barColor = color?.resolvedColor(fallback: accent) ?? accent
|
||||||
Capsule()
|
Capsule()
|
||||||
.fill(Color.white.opacity(0.18))
|
.fill(Color.white.opacity(0.18))
|
||||||
.frame(width: width ?? 80, height: height)
|
.frame(width: width ?? 80, height: height)
|
||||||
|
|
@ -311,13 +315,13 @@ struct ExtensionProgressIndicatorView: View {
|
||||||
.animation(.smooth(duration: 0.25), value: progress)
|
.animation(.smooth(duration: 0.25), value: progress)
|
||||||
}
|
}
|
||||||
case let .percentage(font, color):
|
case let .percentage(font, color):
|
||||||
let textColor = color?.swiftUIColor ?? accent
|
let textColor = color?.resolvedColor(fallback: accent) ?? accent
|
||||||
Text("\(Int(progress * 100))%")
|
Text("\(Int(progress * 100))%")
|
||||||
.font(font.swiftUIFont())
|
.font(font.swiftUIFont())
|
||||||
.foregroundStyle(textColor)
|
.foregroundStyle(textColor)
|
||||||
.monospacedDigit()
|
.monospacedDigit()
|
||||||
case let .countdown(font, color):
|
case let .countdown(font, color):
|
||||||
let textColor = color?.swiftUIColor ?? accent
|
let textColor = color?.resolvedColor(fallback: accent) ?? accent
|
||||||
let text = countdownText
|
let text = countdownText
|
||||||
Text(text)
|
Text(text)
|
||||||
.font(font.swiftUIFont())
|
.font(font.swiftUIFont())
|
||||||
|
|
@ -383,7 +387,7 @@ struct ExtensionEdgeContentView: View {
|
||||||
frameWidth: max(24, availableWidth - 12)
|
frameWidth: max(24, availableWidth - 12)
|
||||||
)
|
)
|
||||||
case let .countdownText(targetDate, font: font, color: color):
|
case let .countdownText(targetDate, font: font, color: color):
|
||||||
ExtensionCountdownTextView(targetDate: targetDate, font: font, accent: accent, customColor: color?.swiftUIColor)
|
ExtensionCountdownTextView(targetDate: targetDate, font: font, accent: accent, customColor: color?.resolvedColor(fallback: accent))
|
||||||
.frame(maxWidth: .infinity, alignment: alignment)
|
.frame(maxWidth: .infinity, alignment: alignment)
|
||||||
case let .icon(descriptor):
|
case let .icon(descriptor):
|
||||||
ExtensionIconView(
|
ExtensionIconView(
|
||||||
|
|
@ -409,7 +413,7 @@ struct ExtensionEdgeContentView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func resolvedColor(_ descriptorColor: AtollColorDescriptor?) -> Color {
|
private func resolvedColor(_ descriptorColor: AtollColorDescriptor?) -> Color {
|
||||||
descriptorColor?.swiftUIColor ?? accent
|
descriptorColor?.resolvedColor(fallback: accent) ?? accent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue