diff --git a/iina.xcodeproj/project.pbxproj b/iina.xcodeproj/project.pbxproj index ef088b5780..36adcb0ca6 100644 --- a/iina.xcodeproj/project.pbxproj +++ b/iina.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 49542986216C34950058F680 /* OpenInIINA.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 49542973216C34950058F680 /* OpenInIINA.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 496B19921E2968530035AF10 /* PIP.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 496B19911E2968530035AF10 /* PIP.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 519872FF26879B9B00F84BCC /* AccessibilityPreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519872FE26879B9B00F84BCC /* AccessibilityPreferences.swift */; }; + 51C1BA3A291CA76700C1208A /* InfoDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C1BA39291CA76700C1208A /* InfoDictionary.swift */; }; 51F7974728C7E00200812D0D /* Lock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F7974628C7E00200812D0D /* Lock.swift */; }; 6100FF2B1EDF9806002CF0FB /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 6100FF2A1EDF9806002CF0FB /* dsa_pub.pem */; }; 8400D5C41E17C6D2006785F5 /* AboutWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8400D5C21E17C6D2006785F5 /* AboutWindowController.swift */; }; @@ -774,6 +775,7 @@ 496B19911E2968530035AF10 /* PIP.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PIP.framework; path = ../../../../System/Library/PrivateFrameworks/PIP.framework; sourceTree = ""; }; 49F7E3BF2920D65C002DA28E /* Availability.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Availability.xcconfig; sourceTree = ""; }; 519872FE26879B9B00F84BCC /* AccessibilityPreferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessibilityPreferences.swift; sourceTree = ""; }; + 51C1BA39291CA76700C1208A /* InfoDictionary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InfoDictionary.swift; sourceTree = ""; }; 51F7974628C7E00200812D0D /* Lock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Lock.swift; sourceTree = ""; }; 5879479521A87DD700757A6F /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/MiniPlayerWindowController.strings; sourceTree = ""; }; 5879479621A87E6100757A6F /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/PreferenceWindowController.strings; sourceTree = ""; }; @@ -2105,6 +2107,7 @@ E301EFD921312AB300BC8588 /* KeychainAccess.swift */, E38B3215214FF700000F6D27 /* EventController.swift */, E39A11FC240F176E00A67F9F /* StringEncodingName.swift */, + 51C1BA39291CA76700C1208A /* InfoDictionary.swift */, ); name = Utils; sourceTree = ""; @@ -2928,6 +2931,7 @@ 845040471E0B0F500079C194 /* CropSettingsViewController.swift in Sources */, E33836852026223800ABC812 /* PrefOSCToolbarSettingsSheetController.swift in Sources */, E3958586253309C90096811F /* PluginSidebarView.swift in Sources */, + 51C1BA3A291CA76700C1208A /* InfoDictionary.swift in Sources */, E301EFDA21312AB300BC8588 /* KeychainAccess.swift in Sources */, 8434BAA71D5DF2DA003BECF2 /* Extensions.swift in Sources */, 845404AC1E43980900B02B12 /* LuaScript.swift in Sources */, diff --git a/iina/AboutWindowController.swift b/iina/AboutWindowController.swift index 2b03fa8fb4..8916887844 100644 --- a/iina/AboutWindowController.swift +++ b/iina/AboutWindowController.swift @@ -38,6 +38,11 @@ class AboutWindowController: NSWindowController { } @IBOutlet weak var versionLabel: NSTextField! @IBOutlet weak var mpvVersionLabel: NSTextField! + @IBOutlet weak var ffmpegVersionLabel: NSTextField! + @IBOutlet weak var buildView: NSView! + @IBOutlet weak var buildBranchLabel: NSTextField! + @IBOutlet weak var buildDateLabel: NSTextField! + @IBOutlet var detailTextView: NSTextView! @IBOutlet var creditsTextView: NSTextView! @@ -63,11 +68,19 @@ class AboutWindowController: NSWindowController { windowBackgroundBox.fillColor = .windowBackgroundColor iconImageView.image = NSApp.applicationIconImage - let (version, build) = Utility.iinaVersion() + let (version, build) = InfoDictionary.shared.version versionLabel.stringValue = "\(version) Build \(build)" - // let copyright = infoDic["NSHumanReadableCopyright"] as! String mpvVersionLabel.stringValue = PlayerCore.active.mpv.mpvVersion + ffmpegVersionLabel.stringValue = "FFmpeg \(String(cString: av_version_info()))" + + if let buildDate = InfoDictionary.shared.buildDate, + let buildBranch = InfoDictionary.shared.buildBranch { + buildDateLabel.stringValue = buildDate + buildDateLabel.isHidden = false + buildBranchLabel.stringValue = buildBranch + buildBranchLabel.isHidden = false + } if let contrubutionFile = Bundle.main.path(forResource: "Contribution", ofType: "rtf") { detailTextView.readRTFD(fromFile: contrubutionFile) diff --git a/iina/AppDelegate.swift b/iina/AppDelegate.swift index 18d3fec0f7..333e3c4c61 100644 --- a/iina/AppDelegate.swift +++ b/iina/AppDelegate.swift @@ -112,23 +112,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, SPUUpdaterDelegate { /// - The git branch /// - The git commit private func logBuildDetails() { - // Xcode refused to allow the build date in the Info.plist to use Date as the type because the - // value specified in the Info.plist is an identifier that is replaced at build time using the - // C preprocessor. So we need to convert from the ISO formatted string to a Date object. - let fromString = ISO8601DateFormatter() - // As recommended by Apple IINA's custom Info.plist keys start with the bundle identifier. - guard let infoDic = Bundle.main.infoDictionary, - let bundleIdentifier = infoDic["CFBundleIdentifier"] as? String else { return } - let keyPrefix = bundleIdentifier + ".build" - guard let branch = infoDic["\(keyPrefix).branch"] as? String, - let commit = infoDic["\(keyPrefix).commit"] as? String, - let date = infoDic["\(keyPrefix).date"] as? String, - let dateObj = fromString.date(from: date) else { return } - // Use a localized date in the log message. - let toString = DateFormatter() - toString.dateStyle = .medium - toString.timeStyle = .medium - Logger.log("Built \(toString.string(from: dateObj)) from branch \(branch), commit \(commit)") + guard let branch = InfoDictionary.shared.buildBranch, + let commit = InfoDictionary.shared.buildCommit, + let date = InfoDictionary.shared.buildDate else { return } + Logger.log("Built \(date) from branch \(branch), commit \(commit)") } func applicationWillFinishLaunching(_ notification: Notification) { @@ -136,12 +123,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, SPUUpdaterDelegate { registerUserDefaultValues() // Start the log file by logging the version of IINA producing the log file. - let (version, build) = Utility.iinaVersion() + let (version, build) = InfoDictionary.shared.version Logger.log("IINA \(version) Build \(build)") // The copyright is used in the Finder "Get Info" window which is a narrow window so the // copyright consists of multiple lines. - let copyright = Utility.iinaCopyright() + let copyright = InfoDictionary.shared.copyright copyright.enumerateLines { line, _ in Logger.log(line) } diff --git a/iina/Base.lproj/AboutWindowController.xib b/iina/Base.lproj/AboutWindowController.xib index 5690b4ab0a..0d9403f872 100644 --- a/iina/Base.lproj/AboutWindowController.xib +++ b/iina/Base.lproj/AboutWindowController.xib @@ -1,13 +1,16 @@ - + - + + + + @@ -16,6 +19,7 @@ + @@ -33,10 +37,10 @@ - + - + @@ -48,7 +52,7 @@ - + @@ -58,29 +62,76 @@ - - + - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +