From f2e7aed5121cdf7bc0eae978a8582260216819be Mon Sep 17 00:00:00 2001 From: Claire Date: Sat, 24 Sep 2022 22:48:25 -0700 Subject: [PATCH] fixed broken icon for end-stage new moon --- LunaMac/AppDelegate.swift | 6 +++++- LunaMac/Changelog.xib | 30 ++++++++++++++++++++++++++++++ LunaMac/ViewController.swift | 10 ++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/LunaMac/AppDelegate.swift b/LunaMac/AppDelegate.swift index 4c16f7e..cbbbad9 100644 --- a/LunaMac/AppDelegate.swift +++ b/LunaMac/AppDelegate.swift @@ -136,8 +136,12 @@ class AppDelegate: NSObject, NSApplicationDelegate { } } + // if key is new2, rename to new + + let key2 = key.contains("2") ? "new" : key + // set image filename - let imgName = key + suffix + ".png" + let imgName = key2 + suffix + ".png" statusBarItem?.button?.image = NSImage(named: imgName) diff --git a/LunaMac/Changelog.xib b/LunaMac/Changelog.xib index 5c09ddd..1ef9618 100644 --- a/LunaMac/Changelog.xib +++ b/LunaMac/Changelog.xib @@ -16,11 +16,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LunaMac/ViewController.swift b/LunaMac/ViewController.swift index b23825b..99c4e49 100644 --- a/LunaMac/ViewController.swift +++ b/LunaMac/ViewController.swift @@ -12,6 +12,8 @@ class ViewController: NSViewController, NSWindowDelegate { let appDelegate = NSApplication.shared.delegate as! AppDelegate + @IBOutlet var textView: NSTextView! + override func viewDidLoad() { print("view did load") super.viewDidLoad() @@ -21,6 +23,14 @@ class ViewController: NSViewController, NSWindowDelegate { override func viewDidAppear() { self.view.window?.delegate = self + + // use this to load the changelog, maybe? + if (self.view.window?.title.contains("Changelog") ?? false) { + let logPath = Bundle.main.path(forResource: "changelog.txt", ofType: nil)! + let logText = try! String(contentsOfFile: logPath, encoding: String.Encoding.utf8) + + print(logText) + } } // triggers when window is closed