mirror of
https://github.com/SideStore/SideStore.git
synced 2026-05-11 20:05:40 +02:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user