mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-11 15:53:30 +01:00
[AltWidget] Adds interactive Active Apps widget to view + refresh all active apps (iOS 17+)
This commit is contained in:
@@ -39,3 +39,51 @@ extension AppSnapshot
|
||||
self.icon = application?.icon?.resizing(toFill: CGSize(width: 180, height: 180))
|
||||
}
|
||||
}
|
||||
|
||||
extension AppSnapshot
|
||||
{
|
||||
static func makePreviewSnapshots() -> (altstore: AppSnapshot, delta: AppSnapshot, clip: AppSnapshot, longAltStore: AppSnapshot, longDelta: AppSnapshot, longClip: AppSnapshot)
|
||||
{
|
||||
let shortRefreshedDate = Calendar.current.date(byAdding: .day, value: -2, to: Date()) ?? Date()
|
||||
let shortExpirationDate = Calendar.current.date(byAdding: .day, value: 7, to: shortRefreshedDate) ?? Date()
|
||||
|
||||
let longRefreshedDate = Calendar.current.date(byAdding: .day, value: -100, to: Date()) ?? Date()
|
||||
let longExpirationDate = Calendar.current.date(byAdding: .day, value: 365, to: longRefreshedDate) ?? Date()
|
||||
|
||||
let altstore = AppSnapshot(name: "AltStore",
|
||||
bundleIdentifier: "com.rileytestut.AltStore",
|
||||
expirationDate: shortExpirationDate,
|
||||
refreshedDate: shortRefreshedDate,
|
||||
tintColor: .altPrimary,
|
||||
icon: UIImage(named: "AltStore"))
|
||||
|
||||
let delta = AppSnapshot(name: "Delta",
|
||||
bundleIdentifier: "com.rileytestut.Delta",
|
||||
expirationDate: shortExpirationDate,
|
||||
refreshedDate: shortRefreshedDate,
|
||||
tintColor: .deltaPrimary,
|
||||
icon: UIImage(named: "Delta"))
|
||||
|
||||
let clip = AppSnapshot(name: "Clip",
|
||||
bundleIdentifier: "com.rileytestut.Clip",
|
||||
expirationDate: shortExpirationDate,
|
||||
refreshedDate: shortRefreshedDate,
|
||||
tintColor: .clipPrimary,
|
||||
icon: UIImage(named: "Clip"))
|
||||
|
||||
let longAltStore = altstore.with(refreshedDate: longRefreshedDate, expirationDate: longExpirationDate)
|
||||
let longDelta = delta.with(refreshedDate: longRefreshedDate, expirationDate: longExpirationDate)
|
||||
let longClip = clip.with(refreshedDate: longRefreshedDate, expirationDate: longExpirationDate)
|
||||
|
||||
return (altstore, delta, clip, longAltStore, longDelta, longClip)
|
||||
}
|
||||
|
||||
private func with(refreshedDate: Date, expirationDate: Date) -> AppSnapshot
|
||||
{
|
||||
var app = self
|
||||
app.refreshedDate = refreshedDate
|
||||
app.expirationDate = expirationDate
|
||||
|
||||
return app
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user