feat: show xcarchive developer notes
This commit is contained in:
29
src/Preview+ArchiveInfo.swift
Normal file
29
src/Preview+ArchiveInfo.swift
Normal file
@@ -0,0 +1,29 @@
|
||||
import Foundation
|
||||
|
||||
extension MetaInfo {
|
||||
/// Read `Info.plist` if type `.Archive`
|
||||
func readPlistXCArchive() -> PlistDict? {
|
||||
switch self.type {
|
||||
case .Archive:
|
||||
// not `readPayloadFile` because plist is in root dir
|
||||
return try? Data(contentsOf: self.url.appendingPathComponent("Info.plist", isDirectory: false)).asPlistOrNil()
|
||||
case .IPA, .Extension:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension PreviewGenerator {
|
||||
/// Process info of `.xcarchive` stored in root `Info.plist`
|
||||
mutating func procArchiveInfo(_ archivePlist: PlistDict?) {
|
||||
guard let archivePlist, let comment = archivePlist["Comment"] as? String else {
|
||||
self.apply(["ArchiveHidden": CLASS_HIDDEN])
|
||||
return
|
||||
}
|
||||
|
||||
self.apply([
|
||||
"ArchiveHidden": CLASS_VISIBLE,
|
||||
"ArchiveComment": comment,
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,13 @@ struct PreviewGenerator {
|
||||
init(_ meta: MetaInfo) {
|
||||
self.meta = meta
|
||||
let plistApp = meta.readPlistApp()
|
||||
let plistItunes = meta.readPlistItunes()
|
||||
let plistProvision = meta.readPlistProvision()
|
||||
|
||||
data["QuickLookTitle"] = stringForFileType(meta)
|
||||
|
||||
procAppInfo(plistApp, isOSX: meta.isOSX)
|
||||
procItunesMeta(plistItunes)
|
||||
procArchiveInfo(meta.readPlistXCArchive())
|
||||
procItunesMeta(meta.readPlistItunes())
|
||||
procTransportSecurity(plistApp)
|
||||
procEntitlements(meta, plistApp, plistProvision)
|
||||
procProvision(plistProvision, isOSX: meta.isOSX)
|
||||
|
||||
Reference in New Issue
Block a user