feat: make appPlist optional (again)
This commit is contained in:
@@ -15,7 +15,7 @@ struct AppIcon {
|
||||
|
||||
/// Try multiple methods to extract image.
|
||||
/// This method will always return an image even if none is found, in which case it returns the default image.
|
||||
func extractImage(from appPlist: PlistDict) -> NSImage {
|
||||
func extractImage(from appPlist: PlistDict?) -> NSImage {
|
||||
// no need to unwrap the plist, and most .ipa should include the Artwork anyway
|
||||
if meta.type == .IPA {
|
||||
if let data = meta.zipFile!.unzipFile("iTunesArtwork") {
|
||||
@@ -25,12 +25,13 @@ struct AppIcon {
|
||||
}
|
||||
|
||||
// Extract image name from app plist
|
||||
var plistImgNames = iconNamesFromPlist(appPlist)
|
||||
var plistImgNames = (appPlist == nil) ? [] : iconNamesFromPlist(appPlist!)
|
||||
os_log(.debug, log: log, "[icon] icon names in plist: %{public}@", plistImgNames)
|
||||
|
||||
// If no previous filename works (or empty), try default icon names
|
||||
plistImgNames.append("Icon")
|
||||
plistImgNames.append("icon")
|
||||
plistImgNames.append("AppIcon")
|
||||
|
||||
// First, try if an image file with that name exists.
|
||||
if let actualName = expandImageName(plistImgNames) {
|
||||
|
||||
@@ -78,7 +78,10 @@ extension PreviewGenerator {
|
||||
}
|
||||
|
||||
/// Process info stored in `Info.plist`
|
||||
mutating func procAppInfo(_ appPlist: PlistDict, isOSX: Bool) {
|
||||
mutating func procAppInfo(_ appPlist: PlistDict?, isOSX: Bool) {
|
||||
guard let appPlist else {
|
||||
return
|
||||
}
|
||||
let minVersion = appPlist[isOSX ? "LSMinimumSystemVersion" : "MinimumOSVersion"] as? String ?? ""
|
||||
|
||||
let extensionType = (appPlist["NSExtension"] as? PlistDict)?["NSExtensionPointIdentifier"] as? String
|
||||
|
||||
@@ -22,8 +22,8 @@ extension PreviewGenerator {
|
||||
}
|
||||
|
||||
/// Process compiled binary and provision plist to extract `Entitlements`
|
||||
mutating func procEntitlements(_ meta: MetaInfo, _ appPlist: PlistDict, _ provisionPlist: PlistDict?) {
|
||||
var entitlements = readEntitlements(meta, appPlist["CFBundleExecutable"] as? String)
|
||||
mutating func procEntitlements(_ meta: MetaInfo, _ appPlist: PlistDict?, _ provisionPlist: PlistDict?) {
|
||||
var entitlements = readEntitlements(meta, appPlist?["CFBundleExecutable"] as? String)
|
||||
entitlements.applyFallbackIfNeeded(provisionPlist?["Entitlements"] as? PlistDict)
|
||||
|
||||
self.apply([
|
||||
|
||||
@@ -8,9 +8,7 @@ struct PreviewGenerator {
|
||||
|
||||
init(_ meta: MetaInfo) {
|
||||
self.meta = meta
|
||||
guard let plistApp = meta.readPlistApp() else {
|
||||
return
|
||||
}
|
||||
let plistApp = meta.readPlistApp()
|
||||
let plistItunes = meta.readPlistItunes()
|
||||
let plistProvision = meta.readPlistProvision()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user