Browse Source

Minor semantic changes

master
Claire 2 years ago
parent
commit
ed5dc41085
  1. 12
      LunaMac/AppDelegate.swift
  2. 2
      LunaMac/Base.lproj/MainMenu.xib
  3. 2
      LunaMac/Changelog.xib
  4. 18
      LunaMac/InfoBox.xib
  5. 4
      LunaMac/ViewController.swift

12
LunaMac/AppDelegate.swift

@ -243,10 +243,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
var newArr = [String:[String:NSString]]()
newArr = phaseArray.filter{findPhase(key: $0.key, val: $0.value, start: $0.value["start"]?.doubleValue ?? 0, end: $0.value["end"]?.doubleValue ?? 0, curr: currDays)}
newArr = phaseArray.filter{
findPhase(
start: $0.value["start"]?.doubleValue ?? 0,
end: $0.value["end"]?.doubleValue ?? 0,
curr: currDays
)
}
// we want newArr[0].value which is [String:NSString]
let theKey = newArr.first!.key
let theKey = newArr.first?.key ?? "default"
buildMenu(key: theKey)
} else {
// if dateDiff is negative, something went wrong.
@ -254,7 +260,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}
@objc func findPhase(key: String, val: [String:NSString], start: Double, end: Double, curr: Double) -> Bool {
@objc func findPhase(start: Double, end: Double, curr: Double) -> Bool {
if ((curr >= start) && (curr <= end)) {
return true

2
LunaMac/Base.lproj/MainMenu.xib

@ -10,7 +10,7 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="LunaMac" customModuleProvider="target"/>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
</objects>

2
LunaMac/Changelog.xib

@ -9,7 +9,7 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Changelog" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1366" height="745"/>

18
LunaMac/InfoBox.xib

@ -28,21 +28,21 @@
</connections>
</buttonCell>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Jwa-x9-RgK">
<rect key="frame" x="18" y="20" width="199" height="89"/>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="24S-3e-fTg">
<rect key="frame" x="11" y="121" width="212" height="19"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" selectable="YES" alignment="left" id="ZyF-AY-vyC">
<font key="font" metaFont="system"/>
<string key="title">LunaMac calculates the current moon phase when it launches. If you see a ⨂ instead of a moon phase, try again from the status bar icon's menu.</string>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Using LunaMac" id="3Ea-1B-yru">
<font key="font" metaFont="system" size="15"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="24S-3e-fTg">
<rect key="frame" x="11" y="121" width="212" height="19"/>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Jwa-x9-RgK">
<rect key="frame" x="11" y="20" width="211" height="85"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Using LunaMac" id="3Ea-1B-yru">
<font key="font" metaFont="system" size="15"/>
<textFieldCell key="cell" selectable="YES" alignment="justified" id="ZyF-AY-vyC">
<font key="font" metaFont="system"/>
<string key="title">LunaMac calculates the current moon phase by your system clock (UTC). If you see a ⨂ instead of a moon phase, try again from the status bar icon's menu.</string>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>

4
LunaMac/ViewController.swift

@ -14,8 +14,6 @@ class ViewController: NSViewController, NSWindowDelegate {
@IBOutlet var textView: NSTextView!
override func viewDidLoad() {
super.viewDidLoad()
@ -30,7 +28,7 @@ class ViewController: NSViewController, NSWindowDelegate {
// get log file path
let logPath = Bundle.main.path(forResource: "changelog.txt", ofType: nil)!
// get contents of log file
let logText = try! String(contentsOfFile: logPath, encoding: String.Encoding.utf8)
let logText = (try? String(contentsOfFile: logPath, encoding: String.Encoding.utf8)) ?? "Changelog couldn't be read."
// create an object to hold the text and its formatting
let textStorage = NSTextStorage(string: logText)

Loading…
Cancel
Save