[AltWidget] Adds interactive Active Apps widget to view + refresh all active apps (iOS 17+)

This commit is contained in:
Riley Testut
2023-09-01 13:27:28 -05:00
committed by Magesh K
parent 3f6688523a
commit ea2600aba9
16 changed files with 497 additions and 7 deletions

View File

@@ -15,13 +15,15 @@ struct Countdown: View
var endDate: Date?
var currentDate: Date = Date()
var strokeWidth: Double = 4.0
@Environment(\.font) private var font
private var numberOfDays: Int {
guard let date = self.endDate else { return 0 }
let numberOfDays = date.numberOfCalendarDays(since: self.currentDate)
return numberOfDays
return max(numberOfDays, 0) // Never show negative values.
}
private var fractionComplete: CGFloat {
@@ -35,7 +37,7 @@ struct Countdown: View
@ViewBuilder
private func overlay(progress: CGFloat) -> some View
{
let strokeStyle = StrokeStyle(lineWidth: 4.0, lineCap: .round, lineJoin: .round)
let strokeStyle = StrokeStyle(lineWidth: self.strokeWidth, lineCap: .round, lineJoin: .round)
if self.numberOfDays > 9 || self.numberOfDays < 0 {
Capsule(style: .continuous)