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