Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Commit 2c1726a

Browse files
authored
Update about window and refactor project structure (#20)
1 parent 27f8af2 commit 2c1726a

File tree

17 files changed

+225
-164
lines changed

17 files changed

+225
-164
lines changed
194 KB
Loading

Nocturnal.xcodeproj/project.pbxproj

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
7D1B5C372399AE770061D0CF /* NSWindow+Fade.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D1B5C362399AE770061D0CF /* NSWindow+Fade.swift */; };
1313
7D1B5C39239A39BB0061D0CF /* StateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D1B5C38239A39BB0061D0CF /* StateManager.swift */; };
1414
7D3E6F2723A0902700D88A16 /* LaunchAtLogin.framework.dSYM in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7D3E6F2623A0902700D88A16 /* LaunchAtLogin.framework.dSYM */; };
15+
7D67CB8424B2E72600FF330B /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D67CB8324B2E72600FF330B /* Utils.swift */; };
1516
7D6A1022235F300100BB75EB /* CoreBrightness.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D6A1021235F300100BB75EB /* CoreBrightness.framework */; };
1617
7D6EE5DA23A088C60011D52C /* Cartfile in Resources */ = {isa = PBXBuildFile; fileRef = 7D6EE5D923A088C60011D52C /* Cartfile */; };
1718
7D6EE5DC23A088FB0011D52C /* LaunchAtLogin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D6EE5DB23A088FB0011D52C /* LaunchAtLogin.framework */; };
@@ -30,8 +31,7 @@
3031
7DF1F92D2356AFAA0041E9CA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DF1F92C2356AFAA0041E9CA /* AppDelegate.swift */; };
3132
7DF1F9312356AFB00041E9CA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7DF1F9302356AFB00041E9CA /* Assets.xcassets */; };
3233
7DF1F9342356AFB00041E9CA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7DF1F9322356AFB00041E9CA /* Main.storyboard */; };
33-
7DF36EA5239E5377000CFB5A /* CustomTimeWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DF36EA4239E5377000CFB5A /* CustomTimeWindowController.swift */; };
34-
7DF36EA7239E730C000CFB5A /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DF36EA6239E730C000CFB5A /* Preferences.swift */; };
34+
7DF36EA7239E730C000CFB5A /* Shortcuts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DF36EA6239E730C000CFB5A /* Shortcuts.swift */; };
3535
7DF36EAA239EFB29000CFB5A /* PreferencesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DF36EA9239EFB29000CFB5A /* PreferencesViewController.swift */; };
3636
7DF36EAE239F6AED000CFB5A /* HyperLinkTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DF36EAD239F6AED000CFB5A /* HyperLinkTextField.swift */; };
3737
/* End PBXBuildFile section */
@@ -70,6 +70,7 @@
7070
7D3E6F2623A0902700D88A16 /* LaunchAtLogin.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = LaunchAtLogin.framework.dSYM; path = Carthage/Build/Mac/LaunchAtLogin.framework.dSYM; sourceTree = "<group>"; };
7171
7D56898C235EFC5600A51FC5 /* Nocturnal-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Nocturnal-Bridging-Header.h"; sourceTree = "<group>"; };
7272
7D56898D235EFCAE00A51FC5 /* CBBlueLightClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CBBlueLightClient.h; sourceTree = "<group>"; };
73+
7D67CB8324B2E72600FF330B /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
7374
7D6A1021235F300100BB75EB /* CoreBrightness.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBrightness.framework; path = ../../../../../System/Library/PrivateFrameworks/CoreBrightness.framework; sourceTree = "<group>"; };
7475
7D6EE5D923A088C60011D52C /* Cartfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cartfile; sourceTree = "<group>"; };
7576
7D6EE5DB23A088FB0011D52C /* LaunchAtLogin.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LaunchAtLogin.framework; path = Carthage/Build/Mac/LaunchAtLogin.framework; sourceTree = "<group>"; };
@@ -89,8 +90,7 @@
8990
7DF1F9332356AFB00041E9CA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
9091
7DF1F9352356AFB00041E9CA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9192
7DF1F9362356AFB00041E9CA /* Nocturnal.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Nocturnal.entitlements; sourceTree = "<group>"; };
92-
7DF36EA4239E5377000CFB5A /* CustomTimeWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTimeWindowController.swift; sourceTree = "<group>"; };
93-
7DF36EA6239E730C000CFB5A /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
93+
7DF36EA6239E730C000CFB5A /* Shortcuts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shortcuts.swift; sourceTree = "<group>"; };
9494
7DF36EA9239EFB29000CFB5A /* PreferencesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesViewController.swift; sourceTree = "<group>"; };
9595
7DF36EAD239F6AED000CFB5A /* HyperLinkTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = HyperLinkTextField.swift; path = Nocturnal/Application/Preferences/HyperLinkTextField.swift; sourceTree = SOURCE_ROOT; };
9696
/* End PBXFileReference section */
@@ -140,15 +140,16 @@
140140
path = TouchBar;
141141
sourceTree = "<group>";
142142
};
143-
7DA5B1F7238BAF6F00FE0597 /* Models */ = {
143+
7DA5B1F7238BAF6F00FE0597 /* Utils */ = {
144144
isa = PBXGroup;
145145
children = (
146+
7D67CB8324B2E72600FF330B /* Utils.swift */,
146147
7D1B5C33239934440061D0CF /* Dimness.swift */,
147148
7DA5B1F8238BAF9500FE0597 /* NightShift.swift */,
148-
7DF36EA6239E730C000CFB5A /* Preferences.swift */,
149+
7DF36EA6239E730C000CFB5A /* Shortcuts.swift */,
149150
7D1B5C38239A39BB0061D0CF /* StateManager.swift */,
150151
);
151-
path = Models;
152+
path = Utils;
152153
sourceTree = "<group>";
153154
};
154155
7DF1F9202356AFA90041E9CA = {
@@ -173,7 +174,7 @@
173174
isa = PBXGroup;
174175
children = (
175176
7D6A1023235FADBD00BB75EB /* Headers */,
176-
7DA5B1F7238BAF6F00FE0597 /* Models */,
177+
7DA5B1F7238BAF6F00FE0597 /* Utils */,
177178
7DF36E9E239E4FA9000CFB5A /* Application */,
178179
7DF1F9352356AFB00041E9CA /* Info.plist */,
179180
7DF1F9362356AFB00041E9CA /* Nocturnal.entitlements */,
@@ -209,7 +210,6 @@
209210
isa = PBXGroup;
210211
children = (
211212
7D1B5C2F2395340E0061D0CF /* CustomTimeViewController.swift */,
212-
7DF36EA4239E5377000CFB5A /* CustomTimeWindowController.swift */,
213213
);
214214
path = "Custom Time";
215215
sourceTree = "<group>";
@@ -346,13 +346,13 @@
346346
files = (
347347
7DA5B1F4238BAC8000FE0597 /* MenuController.swift in Sources */,
348348
7D87458B238BFB5A00A676F1 /* DimnessWindowController.swift in Sources */,
349-
7DF36EA7239E730C000CFB5A /* Preferences.swift in Sources */,
349+
7DF36EA7239E730C000CFB5A /* Shortcuts.swift in Sources */,
350350
7D1B5C302395340E0061D0CF /* CustomTimeViewController.swift in Sources */,
351-
7DF36EA5239E5377000CFB5A /* CustomTimeWindowController.swift in Sources */,
352351
7D1B5C39239A39BB0061D0CF /* StateManager.swift in Sources */,
353352
7DF36EAA239EFB29000CFB5A /* PreferencesViewController.swift in Sources */,
354353
7D1B5C372399AE770061D0CF /* NSWindow+Fade.swift in Sources */,
355354
7D1B5C34239934440061D0CF /* Dimness.swift in Sources */,
355+
7D67CB8424B2E72600FF330B /* Utils.swift in Sources */,
356356
7D8F091A24AC7ECA003DA62E /* TouchBar.swift in Sources */,
357357
7DF36EAE239F6AED000CFB5A /* HyperLinkTextField.swift in Sources */,
358358
7DA5B1F9238BAF9500FE0597 /* NightShift.swift in Sources */,
@@ -531,6 +531,7 @@
531531
"$(inherited)",
532532
"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks/CoreBrightness.framework/Versions/A",
533533
);
534+
MARKETING_VERSION = 1.1;
534535
PRODUCT_BUNDLE_IDENTIFIER = com.joshua.jon.Nocturnal;
535536
PRODUCT_NAME = "$(TARGET_NAME)";
536537
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -566,6 +567,7 @@
566567
"$(inherited)",
567568
"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks/CoreBrightness.framework/Versions/A",
568569
);
570+
MARKETING_VERSION = 1.1;
569571
PRODUCT_BUNDLE_IDENTIFIER = com.joshua.jon.Nocturnal;
570572
PRODUCT_NAME = "$(TARGET_NAME)";
571573
PROVISIONING_PROFILE_SPECIFIER = "";

Nocturnal/Application/Custom Time/CustomTimeWindowController.swift

Lines changed: 0 additions & 19 deletions
This file was deleted.

Nocturnal/Application/Main/AppDelegate.swift

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
1313
static var dimnessControllers = [] as [DimnessWindowController]
1414

1515
func applicationDidFinishLaunching(_: Notification) {
16-
verifyMacOsVersion()
17-
verifySupportsNightShift()
16+
Utils.verifyMacOsVersion()
17+
Utils.verifySupportsNightShift()
1818
initDimnessControllers()
1919
NightShift.strength = 0
2020
NightShift.enable()
@@ -49,46 +49,4 @@ class AppDelegate: NSObject, NSApplicationDelegate {
4949
TouchBar.hideTouchBar()
5050
}
5151
}
52-
53-
func verifyMacOsVersion() {
54-
if !ProcessInfo().isOperatingSystemAtLeast(OperatingSystemVersion(majorVersion: 10, minorVersion: 15, patchVersion: 0)) {
55-
NSApplication.shared.activate(ignoringOtherApps: true)
56-
let version = ProcessInfo().operatingSystemVersionString
57-
let message = "Nocturnal is not supported on this version of macOS"
58-
let info = "\(version) does not support Nocturnal. Please update macOS to version 10.15 (Catalina) or higher."
59-
let alert = createAlert(message, info)
60-
alert.runModal()
61-
NSApplication.shared.terminate(self)
62-
}
63-
}
64-
65-
func verifySupportsNightShift() {
66-
if !NightShift.supportsNightShift {
67-
NSApplication.shared.activate(ignoringOtherApps: true)
68-
let message = "Your Mac does not support Night Shift"
69-
let info = "A newer Mac is required to use Nocturnal. To view the list of all compatible Macs click the 'More info...' button."
70-
let alert = createAlert(message, info)
71-
alert.addButton(withTitle: "More info...")
72-
alert.buttons[1].target = self
73-
alert.buttons[1].action = #selector(moreInfo)
74-
alert.runModal()
75-
NSApplication.shared.terminate(self)
76-
}
77-
}
78-
79-
func createAlert(_ message: String, _ info: String) -> NSAlert {
80-
let alert: NSAlert = NSAlert()
81-
alert.alertStyle = NSAlert.Style.warning
82-
alert.messageText = message
83-
alert.informativeText = info
84-
alert.addButton(withTitle: "Okay")
85-
return alert
86-
}
87-
88-
@objc func moreInfo() {
89-
if let url = URL(string: "https://support.apple.com/en-us/HT207513#requirements") {
90-
NSWorkspace.shared.open(url)
91-
}
92-
NSApplication.shared.terminate(self)
93-
}
9452
}

0 commit comments

Comments
 (0)