diff --git a/Aerial.xcodeproj/project.pbxproj b/Aerial.xcodeproj/project.pbxproj
index f30398f6..69b5290a 100644
--- a/Aerial.xcodeproj/project.pbxproj
+++ b/Aerial.xcodeproj/project.pbxproj
@@ -1169,7 +1169,7 @@
CODE_SIGN_IDENTITY = "Developer ID Application: Guillaume Louel (3L54M5L5KK)";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 1.5.1beta5;
+ CURRENT_PROJECT_VERSION = 1.5.1beta6;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 3L54M5L5KK;
ENABLE_HARDENED_RUNTIME = YES;
@@ -1177,7 +1177,7 @@
INSTALL_PATH = "$(HOME)/Library/Screen Savers";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
- MARKETING_VERSION = 1.5.1beta5;
+ MARKETING_VERSION = 1.5.1beta6;
PRODUCT_BUNDLE_IDENTIFIER = com.johncoates.Aerial;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1198,7 +1198,7 @@
CODE_SIGN_IDENTITY = "Developer ID Application: Guillaume Louel (3L54M5L5KK)";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 1.5.1beta5;
+ CURRENT_PROJECT_VERSION = 1.5.1beta6;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 3L54M5L5KK;
ENABLE_HARDENED_RUNTIME = YES;
@@ -1206,7 +1206,7 @@
INSTALL_PATH = "$(HOME)/Library/Screen Savers";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
- MARKETING_VERSION = 1.5.1beta5;
+ MARKETING_VERSION = 1.5.1beta6;
OTHER_CODE_SIGN_FLAGS = "--timestamp";
PRODUCT_BUNDLE_IDENTIFIER = com.johncoates.Aerial;
PRODUCT_NAME = "$(TARGET_NAME)";
diff --git a/Aerial/App/AppDelegate.swift b/Aerial/App/AppDelegate.swift
index c3f4a495..0d24dbe4 100644
--- a/Aerial/App/AppDelegate.swift
+++ b/Aerial/App/AppDelegate.swift
@@ -28,7 +28,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
func applicationDidFinishLaunching(_ notification: Notification) {
-
let objects = objectsFromNib(loadNibNamed: "PreferencesWindow")
preferencesWindowController.appMode = true
// We need to find the correct window in our nib
@@ -54,17 +53,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
private func objectsFromNib(loadNibNamed nibName: String) -> [AnyObject] {
- let bundle = Bundle.main
var topLevelObjects: NSArray? = NSArray()
- print("bundle \(bundle)")
-
- //let res = Bundle.main.loadNibNamed(nibName, owner: preferencesWindowController, topLevelObjects: &topLevelObjects)
- let res = bundle.loadNibNamed(nibName,
- owner: preferencesWindowController,
- topLevelObjects: &topLevelObjects)
+ _ = Bundle.main.loadNibNamed(nibName, owner: preferencesWindowController,
+ topLevelObjects: &topLevelObjects)
- print("res")
return topLevelObjects! as [AnyObject]
}
}
diff --git a/Aerial/Source/Models/AerialVideo.swift b/Aerial/Source/Models/AerialVideo.swift
index ad9afd8d..eb25784f 100644
--- a/Aerial/Source/Models/AerialVideo.swift
+++ b/Aerial/Source/Models/AerialVideo.swift
@@ -228,6 +228,7 @@ final class AerialVideo: CustomStringConvertible, Equatable {
updateDuration() // We need to have the video duration
}
+ // swiftlint:disable:next cyclomatic_complexity
func updateDuration() {
// We need to retrieve video duration from the cached files.
// This is a workaround as currently, the VideoCache infrastructure
@@ -247,25 +248,40 @@ final class AerialVideo: CustomStringConvertible, Equatable {
self.duration = 0
}
} else {
- let cacheDirectoryPath = VideoCache.cacheDirectory! as NSString
+ // let cacheDirectoryPath = VideoCache.cacheDirectory! as NSString
+
+ var videoCache1080pH264Path = "", videoCache1080pHEVCPath = "",
+ videoCache4KHEVCPath = "", videoCache1080pHDRPath = "",
+ videoCache4KHDRPath = ""
- var videoCache1080pH264Path = "", videoCache1080pHEVCPath = "", videoCache4KHEVCPath = ""
if self.url1080pH264 != "" {
- videoCache1080pH264Path = cacheDirectoryPath.appendingPathComponent((URL(string: url1080pH264)?.lastPathComponent)!)
+ videoCache1080pH264Path = VideoCache.cachePath(forFilename: (URL(string: url1080pH264)?.lastPathComponent)!)!
}
if self.url1080pHEVC != "" {
- videoCache1080pHEVCPath = cacheDirectoryPath.appendingPathComponent((URL(string: url1080pHEVC)?.lastPathComponent)!)
+ videoCache1080pHEVCPath = VideoCache.cachePath(forFilename: (URL(string: url1080pHEVC)?.lastPathComponent)!)!
}
if self.url4KHEVC != "" {
- videoCache4KHEVCPath = cacheDirectoryPath.appendingPathComponent((URL(string: url4KHEVC)?.lastPathComponent)!)
+ videoCache4KHEVCPath = VideoCache.cachePath(forFilename: (URL(string: url4KHEVC)?.lastPathComponent)!)!
+ }
+ if self.url1080pHDR != "" {
+ videoCache1080pHDRPath = VideoCache.cachePath(forFilename: (URL(string: url1080pHDR)?.lastPathComponent)!)!
+ }
+ if self.url4KHDR != "" {
+ videoCache4KHDRPath = VideoCache.cachePath(forFilename: (URL(string: url4KHDR)?.lastPathComponent)!)!
}
if fileManager.fileExists(atPath: videoCache4KHEVCPath) {
let asset = AVAsset(url: URL(fileURLWithPath: videoCache4KHEVCPath))
self.duration = CMTimeGetSeconds(asset.duration)
+ } else if fileManager.fileExists(atPath: videoCache4KHDRPath) {
+ let asset = AVAsset(url: URL(fileURLWithPath: videoCache4KHDRPath))
+ self.duration = CMTimeGetSeconds(asset.duration)
} else if fileManager.fileExists(atPath: videoCache1080pHEVCPath) {
let asset = AVAsset(url: URL(fileURLWithPath: videoCache1080pHEVCPath))
self.duration = CMTimeGetSeconds(asset.duration)
+ } else if fileManager.fileExists(atPath: videoCache1080pHDRPath) {
+ let asset = AVAsset(url: URL(fileURLWithPath: videoCache1080pHDRPath))
+ self.duration = CMTimeGetSeconds(asset.duration)
} else if fileManager.fileExists(atPath: videoCache1080pH264Path) {
let asset = AVAsset(url: URL(fileURLWithPath: videoCache1080pH264Path))
self.duration = CMTimeGetSeconds(asset.duration)
diff --git a/Aerial/Source/Models/Cache/VideoCache.swift b/Aerial/Source/Models/Cache/VideoCache.swift
index 04e3eb57..232f8e25 100644
--- a/Aerial/Source/Models/Cache/VideoCache.swift
+++ b/Aerial/Source/Models/Cache/VideoCache.swift
@@ -21,6 +21,7 @@ final class VideoCache {
static var computedCacheDirectory: String?
static var computedAppSupportDirectory: String?
+ // MARK: - Application Support directory
static var appSupportDirectory: String? {
// We only process this once if successful
if computedAppSupportDirectory != nil {
@@ -67,13 +68,13 @@ final class VideoCache {
return computedAppSupportDirectory
}
+ // MARK: - User Video cache directory
static var cacheDirectory: String? {
// We only process this once if successful
if computedCacheDirectory != nil {
return computedCacheDirectory
}
- debugLog("appSupport : \(appSupportDirectory)")
var cacheDirectory: String?
let preferences = Preferences.sharedInstance
@@ -140,6 +141,7 @@ final class VideoCache {
return cacheDirectory
}
+ // MARK: - Helpers
static func aerialFolderExists(at: NSString) -> Bool {
let aerialFolder = at.appendingPathComponent("Aerial")
if FileManager.default.fileExists(atPath: aerialFolder as String) {
@@ -149,6 +151,7 @@ final class VideoCache {
}
}
+ // Is a video cached (in either appSupport or cache)
static func isAvailableOffline(video: AerialVideo) -> Bool {
let fileManager = FileManager.default
@@ -190,13 +193,32 @@ final class VideoCache {
}
static func cachePath(forFilename filename: String) -> String? {
- guard let cacheDirectory = VideoCache.cacheDirectory else {
+ guard let cacheDirectory = VideoCache.cacheDirectory, let appSupportDirectory = VideoCache.appSupportDirectory else {
return nil
}
+ // Let's compute both
+ let appSupportPath = appSupportDirectory as NSString
+ let appSupportVideoPath = appSupportPath.appendingPathComponent(filename)
+
let cacheDirectoryPath = cacheDirectory as NSString
- let videoCachePath = cacheDirectoryPath.appendingPathComponent(filename)
- return videoCachePath
+ let cacheVideoPath = cacheDirectoryPath.appendingPathComponent(filename)
+
+ // If the file exists in either dir, returns that
+ if FileManager.default.fileExists(atPath: appSupportVideoPath as String) {
+ return appSupportVideoPath
+ } else if FileManager.default.fileExists(atPath: cacheVideoPath as String) {
+ return cacheVideoPath
+ } else {
+ // File doesn't have to exist, this is also used to compute the save location
+ // So now with Catalina, considering containerization we need to use appSupport
+ // Pre catalina we return cache folder instead (no change for users)
+ if #available(OSX 10.15, *) {
+ return appSupportVideoPath
+ } else {
+ return cacheVideoPath
+ }
+ }
}
init(URL: Foundation.URL) {
diff --git a/Aerial/Source/Models/Time/TimeManagement.swift b/Aerial/Source/Models/Time/TimeManagement.swift
index de759e3e..981e9fbf 100644
--- a/Aerial/Source/Models/Time/TimeManagement.swift
+++ b/Aerial/Source/Models/Time/TimeManagement.swift
@@ -252,7 +252,8 @@ final class TimeManagement: NSObject {
}
}
- // swiftlint:disable:next cyclomatic_complexity large_tuple
+ // siftlint:disable:next cyclomatic_complexity large_tuple
+ // swiftlint:disable:next large_tuple
func getNightShiftInformation() -> (Bool, sunrise: Date?, sunset: Date?, error: String?) {
// Catalina workaround, /usr/bin/corebrightnessdiag no longer exists
return (false, nil, nil, "Nightshift disabled because of Catalina")
diff --git a/Resources/PreferencesWindow.xib b/Resources/PreferencesWindow.xib
index 73b25439..414475a9 100644
--- a/Resources/PreferencesWindow.xib
+++ b/Resources/PreferencesWindow.xib
@@ -2230,7 +2230,7 @@ Gw
-
+