fix(widget): blank app icons

Signed-off-by: Mod4 <omarelfarok24135@gmail.com>
Co-authored-by: mahee96 <47920326+mahee96@users.noreply.github.com>
This commit is contained in:
Mod4
2026-05-09 23:45:42 +04:00
committed by GitHub
parent 9223da751d
commit 0d8a2df802
5 changed files with 236 additions and 36 deletions

View File

@@ -74,6 +74,9 @@ private struct ActiveAppsWidgetView: View
@Environment(\.colorScheme)
private var colorScheme
@Environment(\.widgetRenderingMode)
private var renderingMode
var body: some View {
Group {
@@ -92,6 +95,12 @@ private struct ActiveAppsWidgetView: View
{
LinearGradient(colors: [.altGradientDark, .altGradientExtraDark], startPoint: .top, endPoint: .bottom)
}
else if renderingMode == .accented
{
// Plain dark background in tinted mode so the system's
// accent colour composites cleanly over it.
Color.black
}
else
{
LinearGradient(colors: [.altGradientLight, .altGradientDark], startPoint: .top, endPoint: .bottom)
@@ -128,11 +137,16 @@ private struct ActiveAppsWidgetView: View
let daysRemaining = app.expirationDate.numberOfCalendarDays(since: entry.date)
HStack(spacing: 10) {
// In tinted (accented) mode, luminanceToAlpha() converts the icon's
// brightness into opacity so the system can tint it with the user's
// chosen accent colour. widgetAccentable() opts the view into that
// accent group. In fullColor mode both are no-ops (via the helpers).
Image(uiImage: resizedIcon)
.resizable()
.aspectRatio(contentMode: .fit)
.cornerRadius(cornerRadius)
.luminanceToAlphaInAccentedMode()
.mask(RoundedRectangle(cornerRadius: cornerRadius, style: .continuous))
.widgetAccentableIfAvailable()
VStack(alignment: .leading, spacing: 1) {
Text(app.name)
@@ -151,6 +165,7 @@ private struct ActiveAppsWidgetView: View
.font(.system(size: 13, weight: .semibold, design: .rounded))
.foregroundStyle(.secondary)
}
.widgetAccentableIfAvailable()
Spacer()
@@ -167,6 +182,7 @@ private struct ActiveAppsWidgetView: View
.activatesRefreshAllAppsIntent()
// this modifier invalidates the view (disables user interaction and shows a blinking effect)
.invalidatableContent()
.widgetAccentableIfAvailable()
}
.frame(height: rowHeight)