Skip to content

Commit

Permalink
Merge pull request #618 from glouel/testfix
Browse files Browse the repository at this point in the history
Fix crash on coordinates where calculating dawn/dusk may not be possi…
  • Loading branch information
glouel authored Nov 1, 2018
2 parents 270da51 + e6a73c8 commit d7f03d6
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 44 deletions.
35 changes: 25 additions & 10 deletions Aerial/Source/Models/Time/TimeManagement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,35 @@ class TimeManagement: NSObject {

switch preferences.solarMode {
case Preferences.SolarMode.official.rawValue:
sunriseString = dateFormatter.string(from: (solar?.sunrise)!)
sunsetString = dateFormatter.string(from: (solar?.sunset)!)
guard let sunrise = solar?.sunrise, let sunset = solar?.sunset else {
return (false, "Can't process your coordinates, please verify")
}
sunriseString = dateFormatter.string(from: sunrise)
sunsetString = dateFormatter.string(from: sunset)
case Preferences.SolarMode.strict.rawValue:
sunriseString = dateFormatter.string(from: (solar?.strictSunrise)!)
sunsetString = dateFormatter.string(from: (solar?.strictSunset)!)
guard let sunrise = solar?.strictSunrise, let sunset = solar?.strictSunset else {
return (false, "Can't process your coordinates, please verify")
}
sunriseString = dateFormatter.string(from: sunrise)
sunsetString = dateFormatter.string(from: sunset)
case Preferences.SolarMode.civil.rawValue:
sunriseString = dateFormatter.string(from: (solar?.civilSunrise)!)
sunsetString = dateFormatter.string(from: (solar?.civilSunset)!)
guard let sunrise = solar?.civilSunrise, let sunset = solar?.civilSunset else {
return (false, "Can't process your coordinates, please verify")
}
sunriseString = dateFormatter.string(from: sunrise)
sunsetString = dateFormatter.string(from: sunset)
case Preferences.SolarMode.nautical.rawValue:
sunriseString = dateFormatter.string(from: (solar?.nauticalSunrise)!)
sunsetString = dateFormatter.string(from: (solar?.nauticalSunset)!)
guard let sunrise = solar?.nauticalSunrise, let sunset = solar?.nauticalSunset else {
return (false, "Can't process your coordinates, please verify")
}
sunriseString = dateFormatter.string(from: sunrise)
sunsetString = dateFormatter.string(from: sunset)
default:
sunriseString = dateFormatter.string(from: (solar?.astronomicalSunrise)!)
sunsetString = dateFormatter.string(from: (solar?.astronomicalSunset)!)
guard let sunrise = solar?.astronomicalSunrise, let sunset = solar?.astronomicalSunset else {
return (false, "Can't process your coordinates, please verify")
}
sunriseString = dateFormatter.string(from: sunrise)
sunsetString = dateFormatter.string(from: sunset)
}

if preferences.solarMode == Preferences.SolarMode.official.rawValue ||
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.5beta3</string>
<string>1.4.5beta4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.5beta3</string>
<string>1.4.5beta4</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSMinimumSystemVersion</key>
Expand Down
Loading

0 comments on commit d7f03d6

Please sign in to comment.