mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Working multiple sneak peeks
This commit is contained in:
parent
929b15ba45
commit
4e4623532f
2 changed files with 17 additions and 8 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue