mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-08 22:33:26 +01:00
[AltWidget] Refactors widgets into separate files
This commit is contained in:
41
AltWidget/Model/AppSnapshot.swift
Normal file
41
AltWidget/Model/AppSnapshot.swift
Normal file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// AppsEntry.swift
|
||||
// AltWidgetExtension
|
||||
//
|
||||
// Created by Riley Testut on 8/22/23.
|
||||
// Copyright © 2023 Riley Testut. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import WidgetKit
|
||||
|
||||
import AltStoreCore
|
||||
import AltSign
|
||||
|
||||
struct AppSnapshot
|
||||
{
|
||||
var name: String
|
||||
var bundleIdentifier: String
|
||||
var expirationDate: Date
|
||||
var refreshedDate: Date
|
||||
|
||||
var tintColor: UIColor?
|
||||
var icon: UIImage?
|
||||
}
|
||||
|
||||
extension AppSnapshot
|
||||
{
|
||||
// Declared in extension so we retain synthesized initializer.
|
||||
init(installedApp: InstalledApp)
|
||||
{
|
||||
self.name = installedApp.name
|
||||
self.bundleIdentifier = installedApp.bundleIdentifier
|
||||
self.expirationDate = installedApp.expirationDate
|
||||
self.refreshedDate = installedApp.refreshedDate
|
||||
|
||||
self.tintColor = installedApp.storeApp?.tintColor
|
||||
|
||||
let application = ALTApplication(fileURL: installedApp.fileURL)
|
||||
self.icon = application?.icon?.resizing(toFill: CGSize(width: 180, height: 180))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user