Skip to content

Commit

Permalink
1.4.7 beta, new videos from jan 25th, sparkle for auto updates, bug f…
Browse files Browse the repository at this point in the history
…ix for missing cache folder, new Update pane interface (in progress)
  • Loading branch information
glouel committed Jan 26, 2019
1 parent d8e747b commit c777d6e
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 100 deletions.
8 changes: 4 additions & 4 deletions Aerial/App/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
<string>Aerial uses location services to calculate Sunset and Sunrise times from your position</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>SUPublicEDKey</key>
<string>fbiQGEFq55xl4bjwj2/SpIO4JMsKmEyhHEWlMMueyDY=</string>
<key>SUFeedURL</key>
<string>https://raw.githubusercontent.com/JohnCoates/Aerial/master/appcast.xml</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>SUFeedURL</key>
<string>https://raw.githubusercontent.com/JohnCoates/Aerial/master/appcast.xml</string>
<key>SUPublicEDKey</key>
<string>fbiQGEFq55xl4bjwj2/SpIO4JMsKmEyhHEWlMMueyDY=</string>
</dict>
</plist>
28 changes: 26 additions & 2 deletions Aerial/Source/Controllers/PreferencesWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo

@IBOutlet var moveOldVideosButton: NSButton!
@IBOutlet var trashOldVideosButton: NSButton!

@IBOutlet var automaticallyCheckForUpdatesCheckbox: NSButton!

@IBOutlet var lastCheckedSparkle: NSTextField!

var player: AVPlayer = AVPlayer()

var videos: [AerialVideo]?
Expand All @@ -206,6 +211,7 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo
var savedBrightness: Float?

var locationManager: CLLocationManager?
var sparkleUpdater: SUUpdater?

public var appMode: Bool = false

Expand Down Expand Up @@ -241,6 +247,7 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo
// swiftlint:disable:next cyclomatic_complexity
override func awakeFromNib() {
super.awakeFromNib()
sparkleUpdater = SUUpdater.init(for: Bundle(for: PreferencesWindowController.self))

// tmp
let tm = TimeManagement.sharedInstance
Expand Down Expand Up @@ -535,6 +542,16 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo

newVideosModePopup.selectItem(at: preferences.newVideosMode!)
lastCheckedVideosLabel.stringValue = "Last checked on " + preferences.lastVideoCheck!

// Format date
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
let sparkleDate = dateFormatter.string(from: sparkleUpdater!.lastUpdateCheckDate)
lastCheckedSparkle.stringValue = "Last checked on " + sparkleDate
if sparkleUpdater!.automaticallyChecksForUpdates {
automaticallyCheckForUpdatesCheckbox.state = .on
}

colorizeProjectPageLinks()

if let cacheDirectory = VideoCache.cacheDirectory {
Expand Down Expand Up @@ -1309,6 +1326,13 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo
debugLog("UI dimInMinutes \(sender.stringValue)")
}

// MARK: - Update panel
@IBAction func automaticallyCheckForUpdatesChange(_ button: NSButton) {
let onState = button.state == .on
sparkleUpdater!.automaticallyChecksForUpdates = onState
debugLog("UI automaticallyCheckForUpdatesChange: \(onState)")
}

// MARK: - Advanced panel

@IBAction func logButtonClick(_ sender: NSButton) {
Expand Down Expand Up @@ -1401,9 +1425,9 @@ final class PreferencesWindowController: NSWindowController, NSOutlineViewDataSo

@IBAction func checkForUpdatesButton(_ sender: Any) {
debugLog("check for updates")
let supd = SUUpdater.init(for: Bundle(for: PreferencesWindowController.self))
supd?.checkForUpdates(self)
sparkleUpdater!.checkForUpdates(self)
}

@IBAction func trashOldVideosClick(_ sender: Any) {
ManifestLoader.instance.trashOldVideos()

Expand Down
6 changes: 6 additions & 0 deletions Aerial/Source/Models/AerialVideo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ private let spaceVideos = [
"7719B48A-2005-4011-9280-2F64EEC6FD91",
"63C042F0-90EF-4A95-B7CC-CC9A64BF8421",
"B1B5DDC5-73C8-4920-8133-BACCE38A08DE",
"03EC0F5E-CCA8-4E0A-9FEC-5BD1CE151182", // 25/01 Antartica Aurora
"737E9E24-49BE-4104-9B72-F352DE1AD2BF", // North America Aurora
"E556BBC5-D0A0-4DB1-AC77-BC76E4A526F4", // Sahara and Italy
]

private let timeInformation = [
Expand All @@ -52,6 +55,7 @@ private let timeInformation = [
"009BA758-7060-4479-8EE8-FB9B40C8FB97": "night", // Korean and Japan Night (v18)
"78911B7E-3C69-47AD-B635-9C2486F6301D": "day", // New Zealand (sunrise...)
"D60B4DDA-69EB-4841-9690-E8BAE7BC4F80": "day", // Sahara and Italy
"E556BBC5-D0A0-4DB1-AC77-BC76E4A526F4": "day", // Sahara and Italy
"7719B48A-2005-4011-9280-2F64EEC6FD91": "day", // Southern California to Baja
"63C042F0-90EF-4A95-B7CC-CC9A64BF8421": "day", // Western Africa to the Alps (sunset...)
"BAF76353-3475-4855-B7E1-CE96CC9BC3A7": "night", // Dubai
Expand All @@ -72,6 +76,8 @@ private let timeInformation = [
"F5804DD6-5963-40DA-9FA0-39C0C6E6DEF9": "night", // Downtown (LA)
"640DFB00-FBB9-45DA-9444-9F663859F4BC": "night", // Lower Manhattan
"44166C39-8566-4ECA-BD16-43159429B52F": "night", // Seventh Avenue
"03EC0F5E-CCA8-4E0A-9FEC-5BD1CE151182": "night", // Antartica Aurora
"737E9E24-49BE-4104-9B72-F352DE1AD2BF": "night", // North America Aurora
]

final class AerialVideo: CustomStringConvertible, Equatable {
Expand Down
13 changes: 10 additions & 3 deletions Aerial/Source/Models/Cache/VideoCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,16 @@ final class VideoCache {
let preferences = Preferences.sharedInstance

if let customCacheDirectory = preferences.customCacheDirectory {
// We may have overriden the cache directory
cacheDirectory = customCacheDirectory
} else {
// We may have overriden the cache directory, but it may no longer exist !
if FileManager.default.fileExists(atPath: customCacheDirectory as String) {
cacheDirectory = customCacheDirectory
} else {
// If it doesn't we need to reset that preference
preferences.customCacheDirectory = nil
}
}

if cacheDirectory == nil {
let localCachePaths = NSSearchPathForDirectoriesInDomains(.cachesDirectory,
.localDomainMask,
true)
Expand Down
6 changes: 6 additions & 0 deletions Aerial/Source/Models/ErrorLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,18 @@ func Log(level: ErrorLevel, message: String) {
}

// We may log to disk, asyncly
// Comment the firt if to always log to disk
if preferences.logToDisk {
DispatchQueue.main.async {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .none
dateFormatter.timeStyle = .medium
let string = dateFormatter.string(from: Date()) + " : " + message + "\n"
//let string = message + "\n"

// tmpOverride
//if var cacheFileUrl = try? FileManager.default.url(for: .desktopDirectory, in: .userDomainMask, appropriateFor: nil, create: false) {

if let cacheDirectory = VideoCache.cacheDirectory {
var cacheFileUrl = URL(fileURLWithPath: cacheDirectory as String)
cacheFileUrl.appendPathComponent("AerialLog.txt")
Expand Down Expand Up @@ -115,6 +120,7 @@ func debugLog(_ message: String) {
print("\(message)\n")
#endif

// Comment the condition to always log debug mode
let preferences = Preferences.sharedInstance
if preferences.debugMode {
Log(level: .debug, message: message)
Expand Down
6 changes: 5 additions & 1 deletion Aerial/Source/Models/ManifestLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class ManifestLoader {
"b9-1.mov", // Dupe of b2-2 (Hawaii, day)
"b9-2.mov", // Dupe of b3-1 (London, night)
"comp_LA_A005_C009_v05_t9_6M.mov", // Low quality version of Los Angeles day 687B36CB-BA5D-4434-BA99-2F2B8B6EC163
"comp_LA_A009_C009_t9_6M_tag0.mov", ] // Low quality version of Los Angeles night 89B1643B-06DD-4DEC-B1B0-774493B0F7B7
"comp_LA_A009_C009_t9_6M_tag0.mov",
] // Low quality version of Los Angeles night 89B1643B-06DD-4DEC-B1B0-774493B0F7B7

// This is used for videos where URLs should be merged with different ID
// This is used to dedupe old versions of videos
Expand All @@ -56,6 +57,8 @@ class ManifestLoader {
"802866E6-4AAF-4A69-96EA-C582651391F1": "3FFA2A97-7D28-49EA-AA39-5BC9051B2745", // Marina 2
"D34A7B19-EC33-4300-B4ED-0C8BC494C035": "3FFA2A97-7D28-49EA-AA39-5BC9051B2745", // Marina 2
"02EA5DBE-3A67-4DFA-8528-12901DFD6CC1": "00BA71CD-2C54-415A-A68A-8358E677D750", // Downtown
"AC9C09DD-1D97-4013-A09F-B0F5259E64C3": "876D51F4-3D78-4221-8AD2-F9E78C0FD9B9", // Sheikh Zayed Road (day)
"DFA399FA-620A-4517-94D6-BF78BF8C5E5A": "876D51F4-3D78-4221-8AD2-F9E78C0FD9B9", // Sheikh Zayed Road (day)
"D388F00A-5A32-4431-A95C-38BF7FF7268D": "B8F204CE-6024-49AB-85F9-7CA2F6DCD226", // Nuusuaq Peninsula
"E4ED0B22-EB81-4D4F-A29E-7E1EA6B6D980": "B8F204CE-6024-49AB-85F9-7CA2F6DCD226", // Nuusuaq Peninsula
"30047FDA-3AE3-4E74-9575-3520AD77865B": "2F52E34C-39D4-4AB1-9025-8F7141FAA720", // Ilulissat Icefjord day
Expand Down Expand Up @@ -90,6 +93,7 @@ class ManifestLoader {
"b1-4": "3E94AE98-EAF2-4B09-96E3-452F46BC114E", // Bay bridge night
"b9-3": "DE851E6D-C2BE-4D9F-AB54-0F9CE994DC51", // Bay and Golden Bridge
"b7-3": "29BDF297-EB43-403A-8719-A78DA11A2948", // Fisherman's Wharf
"b3-3": "85CE77BF-3413-4A7B-9B0F-732E96229A73", // Embarcadero, Market Street
]

// Extra info to be merged for a given ID, as of right now only one known video
Expand Down
8 changes: 6 additions & 2 deletions Resources/Community/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"name" : "Great Wall 3"
},
{
"id" : "AC9C09DD-1D97-4013-A09F-B0F5259E64C3",
"id" : "876D51F4-3D78-4221-8AD2-F9E78C0FD9B9",
"name" : "Sheikh Zayed Road"
},
{
Expand Down Expand Up @@ -312,7 +312,7 @@
}
},
{
"id" : "b3-3",
"id" : "85CE77BF-3413-4A7B-9B0F-732E96229A73",
"name" : "Embarcadero, Market Street",
"pointsOfInterest" : {
"0" : "Heading southwest over San Francisco Bay to the San Francisco Ferry Building",
Expand Down Expand Up @@ -373,6 +373,10 @@
"10" : "Passing the Transamerica Pyramid",
"50" : "Former Bank of America headquarters blotting out the sun"
}
},
{
"id" : "4AD99907-9E76-408D-A7FC-8429FF014201",
"name" : "Bay and Embarcadero"
}
]
}
Expand Down
21 changes: 0 additions & 21 deletions Resources/Community/missingvideos.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
{
"assets" : [
{
"pointsOfInterest" : {
"285" : "A009_C001_10181A_285",
"245" : "A009_C001_10181A_245",
"310" : "A009_C001_10181A_310",
"0" : "A009_C001_10181A_0",
"30" : "A009_C001_10181A_30",
"195" : "A009_C001_10181A_195",
"110" : "A009_C001_10181A_110",
"230" : "A009_C001_10181A_230",
"155" : "A009_C001_10181A_155",
"210" : "A009_C001_10181A_210"
},
"url-1080-H264" : "https:\/\/sylvan.apple.com\/Videos\/comp_A009_C001_010181A_v09_SDR_PS_FINAL_20180725_SDR_2K_AVC.mov",
"accessibilityLabel" : "Sahara and Italy",
"id" : "D60B4DDA-69EB-4841-9690-E8BAE7BC4F80",
"url-1080-HDR" : "https:\/\/sylvan.apple.com\/Aerials\/2x\/Videos\/comp_A009_C001_010181A_v09_HDR_PS_FINAL_20180725_HDR_2K_HEVC.mov",
"url-1080-SDR" : "https:\/\/sylvan.apple.com\/Aerials\/2x\/Videos\/comp_A009_C001_010181A_v09_SDR_PS_FINAL_20180725_SDR_2K_HEVC.mov",
"url-4K-SDR" : "https:\/\/sylvan.apple.com\/Aerials\/2x\/Videos\/comp_A009_C001_010181A_v09_SDR_PS_FINAL_20180725_SDR_4K_HEVC.mov",
"url-4K-HDR" : "https:\/\/sylvan.apple.com\/Aerials\/2x\/Videos\/comp_A009_C001_010181A_v09_HDR_PS_FINAL_20180725_HDR_4K_HEVC.mov"
},
{
"pointsOfInterest" : {
"0" : "HK_H004_C001_0"
Expand Down
4 changes: 2 additions & 2 deletions Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.6test1</string>
<string>1.4.7beta1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.6test1</string>
<string>1.4.7beta1</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSMinimumSystemVersion</key>
Expand Down
Loading

0 comments on commit c777d6e

Please sign in to comment.