Merge remote-tracking branch 'origin/main' into feature/lunar-support

Trial merge
This commit is contained in:
Hariharan Mudaliar 2026-03-13 12:57:30 +05:30
commit f01d3d4b32
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E
7 changed files with 126 additions and 63 deletions

View file

@ -46,7 +46,7 @@ struct LockScreenTimerWidget: View {
}
private func displayFont(size: CGFloat) -> Font {
.custom("SF Pro Display", size: size)
.system(size: size, weight: .semibold, design: .rounded)
}
private var hasHoursComponent: Bool {
@ -58,20 +58,20 @@ struct LockScreenTimerWidget: View {
}
private var titleFrameWidth: CGFloat {
if hasDoubleDigitHours { return 78 }
if hasHoursComponent { return 90 }
return 130
if hasDoubleDigitHours { return 60 }
if hasHoursComponent { return 80 }
return 110
}
private var countdownFrameWidth: CGFloat {
if hasDoubleDigitHours { return 248 }
if hasHoursComponent { return 235 }
return 205
if hasDoubleDigitHours { return 200 }
if hasHoursComponent { return 185 }
return 160
}
private var countdownFont: Font {
let baseSize: CGFloat = hasDoubleDigitHours ? 52 : 56
return displayFont(size: baseSize)
let baseSize: CGFloat = hasDoubleDigitHours ? 42 : 46
return .system(size: baseSize, weight: .bold, design: .rounded)
}
private var timerLabel: String {
@ -191,17 +191,19 @@ struct LockScreenTimerWidget: View {
var body: some View {
VStack(spacing: 16) {
HStack(alignment: .center, spacing: 8) {
HStack(alignment: .center, spacing: 0) {
controlButtons
.padding(.trailing, 12)
titleSection
.frame(maxWidth: .infinity)
countdownSection
.padding(.leading, 12)
}
}
.padding(.horizontal, 12)
.padding(.vertical, 18)
.padding(.vertical, 12)
.frame(width: widgetSize.width, height: widgetSize.height)
.background(widgetBackground)
.clipShape(RoundedRectangle(cornerRadius: Self.cornerRadius, style: .continuous))
@ -260,18 +262,15 @@ struct LockScreenTimerWidget: View {
}
private var titleSection: some View {
VStack(alignment: .center, spacing: 0) {
MarqueeText(
.constant(timerLabel),
font: displayFont(size: 18),
nsFont: .title3,
textColor: accentColor,
minDuration: 0.16,
frameWidth: titleFrameWidth
)
.frame(maxWidth: titleFrameWidth)
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
MarqueeText(
.constant(timerLabel),
font: displayFont(size: 15),
nsFont: .title3,
textColor: accentColor,
minDuration: 0.16,
frameWidth: titleFrameWidth
)
.frame(maxWidth: .infinity, alignment: .center)
.layoutPriority(0)
}

View file

@ -207,7 +207,7 @@ struct TimerLiveActivity: View {
private var shouldShowControlWindow: Bool {
if !controlWindowEnabled { return false }
if shouldDisplayLabel { return false }
if showsLabel { return false }
let timerEligible = timerManager.isTimerActive && !timerManager.isExternalTimerActive
if !timerEligible { return false }
@ -253,9 +253,6 @@ struct TimerLiveActivity: View {
}
.onAppear {
requestControlWindowSync(forceRefresh: true)
if timerManager.isTimerActive && !timerManager.isFinished && !timerManager.isOvertime {
triggerTransientLabel()
}
}
.onDisappear {
hideControlWindow()
@ -528,23 +525,24 @@ struct TimerLiveActivity: View {
let syncDelay = max(0, delay)
pendingControlWindowTask = Task.detached(priority: .userInitiated) { [syncDelay, forceRefresh] in
if syncDelay > 0 {
let nanoseconds = UInt64(syncDelay * 1_000_000_000)
try? await Task.sleep(nanoseconds: nanoseconds)
}
if syncDelay <= 0 {
syncControlWindow(forceRefresh: forceRefresh)
return
}
pendingControlWindowTask = Task { @MainActor [forceRefresh] in
let nanoseconds = UInt64(syncDelay * 1_000_000_000)
try? await Task.sleep(nanoseconds: nanoseconds)
guard !Task.isCancelled else { return }
await MainActor.run {
if shouldShowControlWindow {
syncControlWindow(forceRefresh: forceRefresh)
} else {
hideControlWindow()
}
pendingControlWindowTask = nil
if shouldShowControlWindow {
syncControlWindow(forceRefresh: forceRefresh)
} else {
hideControlWindow()
}
pendingControlWindowTask = nil
}
}