Update dynamic island

This commit is contained in:
Balazs Perlaki-Horvath 2025-02-28 09:53:24 +01:00 committed by Kelson
parent e84deb1360
commit 41992a810d

View File

@ -63,28 +63,35 @@ struct DownloadsLiveActivity: Widget {
DynamicIsland { DynamicIsland {
// Expanded UI // Expanded UI
DynamicIslandExpandedRegion(.leading) { DynamicIslandExpandedRegion(.leading) {
Spacer() let timeInterval = startTime...Date(
KiwixLogo(maxHeight: 50) timeInterval: context.state.estimatedTimeLeft,
Spacer() since: .now
} )
DynamicIslandExpandedRegion(.trailing) {
ProgressView(value: context.state.progress)
.progressViewStyle(CircularProgressGaugeStyle(lineWidth: 11.4))
.padding(6.0)
}
DynamicIslandExpandedRegion(.center) {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text(context.state.title) Text(context.state.title)
.lineLimit(1) .lineLimit(1)
.multilineTextAlignment(.leading) .multilineTextAlignment(.leading)
.font(.headline) .font(.headline)
.bold() .bold()
ProgressView(timerInterval: timeInterval, countsDown: false, label: {
Text(context.state.progressDescription) Text(context.state.progressDescription)
.lineLimit(1) .lineLimit(1)
.multilineTextAlignment(.leading)
.font(.caption) .font(.caption)
.tint(.secondary) .tint(.secondary)
}, currentValueLabel: {
Text(timerInterval: timeInterval)
.font(.caption)
.tint(.secondary)
})
.tint(Color.primary)
} }
.padding(.leading)
.dynamicIsland(verticalPlacement: .belowIfTooWide)
}
DynamicIslandExpandedRegion(.trailing) {
KiwixLogo(maxHeight: 50)
.padding()
} }
} compactLeading: { } compactLeading: {
KiwixLogo() KiwixLogo()