From 88692a241a8e15a8678d652dd6e87a27c5218a29 Mon Sep 17 00:00:00 2001 From: Hariharan Mudaliar Date: Thu, 15 Jan 2026 23:50:22 +0530 Subject: [PATCH] Sneak peek is a bit issue --- DynamicIsland/ContentView.swift | 17 ++------- .../ExtensionLiveActivityViews.swift | 38 ++++++++++++++++--- .../ExtensionRenderingHelpers.swift | 10 ++++- 3 files changed, 44 insertions(+), 21 deletions(-) diff --git a/DynamicIsland/ContentView.swift b/DynamicIsland/ContentView.swift index fd633d8..5fe4560 100644 --- a/DynamicIsland/ContentView.swift +++ b/DynamicIsland/ContentView.swift @@ -1271,13 +1271,7 @@ struct ContentView: View { let outerHeight = notchHeight let contentHeight = max(0, notchHeight - (isHovering ? 0 : 12)) let leadingWidth = max(contentHeight, 44) - let centerWidth: CGFloat = { - 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 centerWidth: CGFloat = max(vm.closedNotchSize.width + (isHovering ? 8 : 0), 96) let trailingWidth = ExtensionLayoutMetrics.trailingWidth( for: payload, baseWidth: leadingWidth, @@ -1297,13 +1291,8 @@ struct ContentView: View { private func shouldSuppressExtensionCenter(for payload: ExtensionLiveActivityPayload) -> Bool { guard vm.notchState == .closed else { return false } - let descriptor = payload.descriptor - guard descriptor.sneakPeekConfig?.enabled ?? true else { return false } - 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 + let config = payload.descriptor.sneakPeekConfig ?? .default + return config.enabled } @MainActor diff --git a/DynamicIsland/components/Extensions/ExtensionLiveActivityViews.swift b/DynamicIsland/components/Extensions/ExtensionLiveActivityViews.swift index ffd6a7f..54b992a 100644 --- a/DynamicIsland/components/Extensions/ExtensionLiveActivityViews.swift +++ b/DynamicIsland/components/Extensions/ExtensionLiveActivityViews.swift @@ -344,12 +344,37 @@ struct ExtensionInlineSneakPeekView: View { @ViewBuilder private var trailingWing: some View { if let payload { - ExtensionMusicWingView( - payload: payload, - notchHeight: contentHeight, - trailingWidth: trailingWidth - ) + let descriptor = payload.descriptor + switch resolvedExtensionTrailingRenderable(for: descriptor) { + case let .content(content): + if case .none = content { + spectrumPlaceholder + } 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() .fill(resolvedAccent.gradient) .mask { @@ -358,5 +383,8 @@ struct ExtensionInlineSneakPeekView: View { .frame(maxWidth: .infinity, maxHeight: .infinity) } } + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) + .padding(.trailing, 8) + .padding(.vertical, 6) } } diff --git a/DynamicIsland/components/Extensions/ExtensionRenderingHelpers.swift b/DynamicIsland/components/Extensions/ExtensionRenderingHelpers.swift index e759128..82e4600 100644 --- a/DynamicIsland/components/Extensions/ExtensionRenderingHelpers.swift +++ b/DynamicIsland/components/Extensions/ExtensionRenderingHelpers.swift @@ -318,10 +318,13 @@ struct ExtensionProgressIndicatorView: View { .monospacedDigit() case let .countdown(font, color): let textColor = color?.swiftUIColor ?? accent - Text(countdownText) + let text = countdownText + Text(text) .font(font.swiftUIFont()) .foregroundStyle(textColor) .monospacedDigit() + .contentTransition(.numericText()) + .animation(.smooth(duration: 0.25), value: text) case .lottie: Image(systemName: "sparkles") .font(.system(size: 14, weight: .medium)) @@ -418,10 +421,13 @@ struct ExtensionCountdownTextView: View { var body: some View { TimelineView(.periodic(from: .now, by: 1)) { context in - Text(formattedRemaining(since: context.date)) + let remainingText = formattedRemaining(since: context.date) + Text(remainingText) .font(font.swiftUIFont()) .foregroundStyle(customColor ?? accent) .monospacedDigit() + .contentTransition(.numericText()) + .animation(.smooth(duration: 0.25), value: remainingText) } }