|
|
|
|
@ -56,19 +56,35 @@ struct LockScreenCountdownView: View { |
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
|
VStack { |
|
|
|
|
Text(timer.displayName.uppercased()) |
|
|
|
|
if let countdown = timer as? Countdown { |
|
|
|
|
Text(activityName.uppercased()) |
|
|
|
|
if let countdown = self.timer as? Countdown { |
|
|
|
|
Text(countdown.duration.minuteSecond) |
|
|
|
|
.monospaced() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.monospaced() |
|
|
|
|
.multilineTextAlignment(.center) |
|
|
|
|
.foregroundColor(Color.white) |
|
|
|
|
.font(self.font) |
|
|
|
|
.widgetURL(timer.url) |
|
|
|
|
.widgetURL(self.timer.url) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private var activityName: String { |
|
|
|
|
switch self.family { |
|
|
|
|
case .accessoryCircular: |
|
|
|
|
let reduced = self.timer.displayName |
|
|
|
|
if reduced.contains(" ") { |
|
|
|
|
let initials = reduced.components(separatedBy: " ").compactMap { $0.first }.map { String($0) } |
|
|
|
|
return initials.joined(separator: "") |
|
|
|
|
} else { |
|
|
|
|
return String(reduced.prefix(5)) |
|
|
|
|
} |
|
|
|
|
default: |
|
|
|
|
return self.timer.displayName |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private var font: Font { |
|
|
|
|
switch family { |
|
|
|
|
switch self.family { |
|
|
|
|
case .systemSmall, .systemMedium, .systemLarge, .systemExtraLarge: |
|
|
|
|
return .body |
|
|
|
|
case .accessoryCircular: |
|
|
|
|
@ -93,16 +109,16 @@ struct MultiCountdownView: View { |
|
|
|
|
|
|
|
|
|
var body: some View { |
|
|
|
|
|
|
|
|
|
if timers.isEmpty { |
|
|
|
|
if self.timers.isEmpty { |
|
|
|
|
VoidView() |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
LazyVGrid( |
|
|
|
|
columns: columns, |
|
|
|
|
columns: self.columns, |
|
|
|
|
spacing: 10.0 |
|
|
|
|
) { |
|
|
|
|
|
|
|
|
|
ForEach(timers) { timer in |
|
|
|
|
ForEach(self.timers) { timer in |
|
|
|
|
|
|
|
|
|
Link(destination: timer.url) { |
|
|
|
|
HStack { |
|
|
|
|
@ -127,23 +143,6 @@ struct MultiCountdownView: View { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}.padding() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// HStack { |
|
|
|
|
// ForEach(countdowns) { countdown in |
|
|
|
|
// |
|
|
|
|
// Link(destination: countdown.url) { |
|
|
|
|
// VStack { |
|
|
|
|
// Text(countdown.name ?? "") |
|
|
|
|
// Text(countdown.duration.minuteSecond) |
|
|
|
|
// } |
|
|
|
|
// .font(self.font) |
|
|
|
|
// .frame(maxWidth: .infinity, maxHeight: .infinity) |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// }.frame(maxWidth: .infinity) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|