Widgets-Fix: Ported Widget compatibility for ios 18+ from altstore (#746)

This commit is contained in:
Magesh K
2024-11-12 01:16:33 +05:30
committed by GitHub
parent 3161892585
commit 2842c8f669
4 changed files with 44 additions and 1 deletions

View File

@@ -82,6 +82,7 @@ struct ComplicationView: View
}
.gaugeStyle(.accessoryCircularCapacity)
.unredacted()
.widgetBackground(Color.clear)
}
}

View File

@@ -0,0 +1,27 @@
//
// View+AltWidget.swift
// AltStore
//
// Created by Riley Testut on 8/18/23.
// Copyright © 2023 Riley Testut. All rights reserved.
//
import SwiftUI
extension View
{
@ViewBuilder
func widgetBackground(_ backgroundView: some View) -> some View
{
if #available(iOSApplicationExtension 17, *)
{
containerBackground(for: .widget) {
backgroundView
}
}
else
{
background(backgroundView)
}
}
}

View File

@@ -104,7 +104,8 @@ struct WidgetView : View
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
.background(backgroundView(icon: entry.app?.icon, tintColor: entry.app?.tintColor))
.widgetBackground(backgroundView(icon: entry.app?.icon, tintColor: entry.app?.tintColor))
}
}