mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-29 08:04:32 +00:00
Sneak peek is a bit issue
This commit is contained in:
parent
27b16a3d15
commit
88692a241a
3 changed files with 44 additions and 21 deletions
|
|
@ -1271,13 +1271,7 @@ struct ContentView: View {
|
||||||
let outerHeight = notchHeight
|
let outerHeight = notchHeight
|
||||||
let contentHeight = max(0, notchHeight - (isHovering ? 0 : 12))
|
let contentHeight = max(0, notchHeight - (isHovering ? 0 : 12))
|
||||||
let leadingWidth = max(contentHeight, 44)
|
let leadingWidth = max(contentHeight, 44)
|
||||||
let centerWidth: CGFloat = {
|
let centerWidth: CGFloat = max(vm.closedNotchSize.width + (isHovering ? 8 : 0), 96)
|
||||||
if suppressingCenterText {
|
|
||||||
let base = vm.closedNotchSize.width * 0.35
|
|
||||||
return max(64, min(base, 96))
|
|
||||||
}
|
|
||||||
return max(vm.closedNotchSize.width + (isHovering ? 8 : 0), 96)
|
|
||||||
}()
|
|
||||||
let trailingWidth = ExtensionLayoutMetrics.trailingWidth(
|
let trailingWidth = ExtensionLayoutMetrics.trailingWidth(
|
||||||
for: payload,
|
for: payload,
|
||||||
baseWidth: leadingWidth,
|
baseWidth: leadingWidth,
|
||||||
|
|
@ -1297,13 +1291,8 @@ struct ContentView: View {
|
||||||
|
|
||||||
private func shouldSuppressExtensionCenter(for payload: ExtensionLiveActivityPayload) -> Bool {
|
private func shouldSuppressExtensionCenter(for payload: ExtensionLiveActivityPayload) -> Bool {
|
||||||
guard vm.notchState == .closed else { return false }
|
guard vm.notchState == .closed else { return false }
|
||||||
let descriptor = payload.descriptor
|
let config = payload.descriptor.sneakPeekConfig ?? .default
|
||||||
guard descriptor.sneakPeekConfig?.enabled ?? true else { return false }
|
return config.enabled
|
||||||
guard coordinator.sneakPeek.show else { return false }
|
|
||||||
guard case let .extensionLiveActivity(bundleID, activityID) = coordinator.sneakPeek.type else { return false }
|
|
||||||
guard bundleID == payload.bundleIdentifier && activityID == descriptor.id else { return false }
|
|
||||||
let style = coordinator.sneakPeek.styleOverride ?? Defaults[.sneakPeekStyles]
|
|
||||||
return style == .inline
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
|
|
|
||||||
|
|
@ -344,12 +344,37 @@ struct ExtensionInlineSneakPeekView: View {
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private var trailingWing: some View {
|
private var trailingWing: some View {
|
||||||
if let payload {
|
if let payload {
|
||||||
ExtensionMusicWingView(
|
let descriptor = payload.descriptor
|
||||||
payload: payload,
|
switch resolvedExtensionTrailingRenderable(for: descriptor) {
|
||||||
notchHeight: contentHeight,
|
case let .content(content):
|
||||||
trailingWidth: trailingWidth
|
if case .none = content {
|
||||||
)
|
spectrumPlaceholder
|
||||||
} else {
|
} else {
|
||||||
|
VStack(alignment: .trailing, spacing: 6) {
|
||||||
|
ExtensionEdgeContentView(
|
||||||
|
content: content,
|
||||||
|
accent: resolvedAccent,
|
||||||
|
availableWidth: trailingWidth,
|
||||||
|
alignment: .trailing
|
||||||
|
)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||||
|
|
||||||
|
Spacer(minLength: 0)
|
||||||
|
}
|
||||||
|
.padding(.trailing, 8)
|
||||||
|
.padding(.vertical, 6)
|
||||||
|
}
|
||||||
|
case .indicator:
|
||||||
|
spectrumPlaceholder
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
spectrumPlaceholder
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private var spectrumPlaceholder: some View {
|
||||||
|
VStack {
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.fill(resolvedAccent.gradient)
|
.fill(resolvedAccent.gradient)
|
||||||
.mask {
|
.mask {
|
||||||
|
|
@ -358,5 +383,8 @@ struct ExtensionInlineSneakPeekView: View {
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
|
||||||
|
.padding(.trailing, 8)
|
||||||
|
.padding(.vertical, 6)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -318,10 +318,13 @@ struct ExtensionProgressIndicatorView: View {
|
||||||
.monospacedDigit()
|
.monospacedDigit()
|
||||||
case let .countdown(font, color):
|
case let .countdown(font, color):
|
||||||
let textColor = color?.swiftUIColor ?? accent
|
let textColor = color?.swiftUIColor ?? accent
|
||||||
Text(countdownText)
|
let text = countdownText
|
||||||
|
Text(text)
|
||||||
.font(font.swiftUIFont())
|
.font(font.swiftUIFont())
|
||||||
.foregroundStyle(textColor)
|
.foregroundStyle(textColor)
|
||||||
.monospacedDigit()
|
.monospacedDigit()
|
||||||
|
.contentTransition(.numericText())
|
||||||
|
.animation(.smooth(duration: 0.25), value: text)
|
||||||
case .lottie:
|
case .lottie:
|
||||||
Image(systemName: "sparkles")
|
Image(systemName: "sparkles")
|
||||||
.font(.system(size: 14, weight: .medium))
|
.font(.system(size: 14, weight: .medium))
|
||||||
|
|
@ -418,10 +421,13 @@ struct ExtensionCountdownTextView: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
TimelineView(.periodic(from: .now, by: 1)) { context in
|
TimelineView(.periodic(from: .now, by: 1)) { context in
|
||||||
Text(formattedRemaining(since: context.date))
|
let remainingText = formattedRemaining(since: context.date)
|
||||||
|
Text(remainingText)
|
||||||
.font(font.swiftUIFont())
|
.font(font.swiftUIFont())
|
||||||
.foregroundStyle(customColor ?? accent)
|
.foregroundStyle(customColor ?? accent)
|
||||||
.monospacedDigit()
|
.monospacedDigit()
|
||||||
|
.contentTransition(.numericText())
|
||||||
|
.animation(.smooth(duration: 0.25), value: remainingText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue