mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
82 lines
1.7 KiB
Swift
82 lines
1.7 KiB
Swift
//
|
|
// 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)
|
|
}
|
|
}
|
|
|
|
@ViewBuilder
|
|
func invalidatableContentIfAvailable() -> some View
|
|
{
|
|
if #available(iOSApplicationExtension 17, *)
|
|
{
|
|
self.invalidatableContent()
|
|
}
|
|
else
|
|
{
|
|
self
|
|
}
|
|
}
|
|
|
|
@ViewBuilder
|
|
func activatesRefreshAllAppsIntent() -> some View
|
|
{
|
|
if #available(iOSApplicationExtension 17, *)
|
|
{
|
|
Button(intent: RefreshAllAppsWidgetIntent()) {
|
|
self
|
|
}
|
|
.buttonStyle(.plain)
|
|
}
|
|
else
|
|
{
|
|
self
|
|
}
|
|
}
|
|
|
|
@ViewBuilder
|
|
func pageUpButton(_ widgetID: Int?) -> some View {
|
|
if #available(iOSApplicationExtension 17, *) {
|
|
Button(intent: PaginationIntent(widgetID, .up)){
|
|
self
|
|
}
|
|
.buttonStyle(.plain)
|
|
} else {
|
|
self
|
|
}
|
|
}
|
|
|
|
@ViewBuilder
|
|
func pageDownButton(_ widgetID: Int?) -> some View {
|
|
if #available(iOSApplicationExtension 17, *) {
|
|
Button(intent: PaginationIntent(widgetID, .down)){
|
|
self
|
|
}
|
|
.buttonStyle(.plain)
|
|
} else {
|
|
self
|
|
}
|
|
}
|
|
|
|
}
|