Working multiple sneak peeks

This commit is contained in:
Hariharan Mudaliar 2025-11-11 00:17:40 +05:30
commit 4e4623532f
2 changed files with 17 additions and 8 deletions

View file

@ -472,13 +472,19 @@ struct ContentView: View {
else if coordinator.sneakPeek.type == .reminder {
if !vm.hideOnClosed && Defaults[.sneakPeekStyles] == .standard, let reminder = reminderManager.activeReminder {
GeometryReader { geo in
let chipColor = Color(nsColor: reminder.event.calendar.color).ensureMinimumBrightness(factor: 0.7)
HStack(spacing: 6) {
RoundedRectangle(cornerRadius: 2)
.fill(chipColor)
.frame(width: 8, height: 12)
MarqueeText(
.constant(reminderSneakPeekText(for: reminder)),
textColor: reminderColor(for: reminder, now: reminderManager.currentDate),
minDuration: 1,
frameWidth: geo.size.width
frameWidth: max(0, geo.size.width - 18)
)
}
}
.padding(.bottom, 10)
}
}

View file

@ -349,15 +349,18 @@ final class ReminderLiveActivityManager: ObservableObject {
if criticalWindow > 0 && timeRemaining > 0 {
if timeRemaining <= criticalWindow {
if !hasShownCriticalSneakPeek {
let displayDuration = min(criticalWindow, max(timeRemaining - 2, 0))
if displayDuration > 0 {
DynamicIslandViewCoordinator.shared.toggleSneakPeek(
status: true,
type: .reminder,
duration: Defaults[.reminderSneakPeekDuration],
duration: displayDuration,
value: 0,
icon: ReminderLiveActivityManager.criticalIconName
)
hasShownCriticalSneakPeek = true
}
}
} else {
hasShownCriticalSneakPeek = false
}