diff --git a/MTMR.xcodeproj/project.pbxproj b/MTMR.xcodeproj/project.pbxproj index 882beef..e14e8aa 100644 --- a/MTMR.xcodeproj/project.pbxproj +++ b/MTMR.xcodeproj/project.pbxproj @@ -71,7 +71,7 @@ B0F8771A207AC1EA00D6E430 /* TouchBarSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F87719207AC1EA00D6E430 /* TouchBarSupport.m */; }; BAF5AB5724317B4300B04904 /* BasicView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAF5AB5624317B4300B04904 /* BasicView.swift */; }; BAF5AB5924317CAF00B04904 /* SwipeItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAF5AB5824317CAF00B04904 /* SwipeItem.swift */; }; - F29F6A2524BC7148004FF8E4 /* UpNextBarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F29F6A2424BC7148004FF8E4 /* UpNextBarItem.swift */; }; + F29F6A2524BC7148004FF8E4 /* UpNextScrubberTouchBarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F29F6A2424BC7148004FF8E4 /* UpNextScrubberTouchBarItem.swift */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -164,7 +164,7 @@ B0F8771B207AC92700D6E430 /* TouchBarSupport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TouchBarSupport.h; sourceTree = ""; }; BAF5AB5624317B4300B04904 /* BasicView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicView.swift; sourceTree = ""; }; BAF5AB5824317CAF00B04904 /* SwipeItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwipeItem.swift; sourceTree = ""; }; - F29F6A2424BC7148004FF8E4 /* UpNextBarItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpNextBarItem.swift; sourceTree = ""; }; + F29F6A2424BC7148004FF8E4 /* UpNextScrubberTouchBarItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpNextScrubberTouchBarItem.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -324,7 +324,7 @@ 4CFF5E5B22E623DD00BFB1EE /* YandexWeatherBarItem.swift */, B08126F0217BE19000A98970 /* WidgetProtocol.swift */, B0F54A792295AC7D00B4C509 /* DarkModeBarItem.swift */, - F29F6A2424BC7148004FF8E4 /* UpNextBarItem.swift */, + F29F6A2424BC7148004FF8E4 /* UpNextScrubberTouchBarItem.swift */, ); path = Widgets; sourceTree = ""; @@ -491,7 +491,7 @@ 6027D1BA2080E52A004FFDC7 /* VolumeViewController.swift in Sources */, 4CDC6E5022FCA93F0069ADD4 /* ShellScriptTouchBarItem.swift in Sources */, 607EEA4B2087835F009DA5F0 /* WeatherBarItem.swift in Sources */, - F29F6A2524BC7148004FF8E4 /* UpNextBarItem.swift in Sources */, + F29F6A2524BC7148004FF8E4 /* UpNextScrubberTouchBarItem.swift in Sources */, B0F3112520C9E35F0076BB88 /* SupportNSTouchBar.swift in Sources */, 4CFF5E5C22E623DD00BFB1EE /* YandexWeatherBarItem.swift in Sources */, 6042B6AA2083E27000C525C8 /* DeprecatedCarbonAPI.c in Sources */, diff --git a/MTMR/ItemsParsing.swift b/MTMR/ItemsParsing.swift index 6ffdc5a..b4f97e9 100644 --- a/MTMR/ItemsParsing.swift +++ b/MTMR/ItemsParsing.swift @@ -385,7 +385,7 @@ enum ItemType: Decodable { case .upnext: let from = try container.decodeIfPresent(Double.self, forKey: .from) ?? 0 // Lower bounds of period of time in hours to search for events let to = try container.decodeIfPresent(Double.self, forKey: .to) ?? 12 // Upper bounds of period of time in hours to search for events - let maxToShow = try container.decodeIfPresent(Int.self, forKey: .maxToShow) ?? 1 // 1 indexed array. Get the 1st, 2nd, 3rd event to display multiple notifications + let maxToShow = try container.decodeIfPresent(Int.self, forKey: .maxToShow) ?? 3 // 1 indexed array. Get the 1st, 2nd, 3rd event to display multiple notifications self = .upnext(from: from, to: to, maxToShow: maxToShow) } } diff --git a/MTMR/TouchBarController.swift b/MTMR/TouchBarController.swift index f4e5460..a2ab439 100644 --- a/MTMR/TouchBarController.swift +++ b/MTMR/TouchBarController.swift @@ -60,7 +60,7 @@ extension ItemType { case .swipe(direction: _, fingers: _, minOffset: _, sourceApple: _, sourceBash: _): return "com.toxblh.mtmr.swipe." case .upnext: - return "com.connorgmeehan.mtmrupnext." + return "com.connorgmeehan.mtmrup.next." } } } @@ -304,7 +304,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate { case let .swipe(direction: direction, fingers: fingers, minOffset: minOffset, sourceApple: sourceApple, sourceBash: sourceBash): barItem = SwipeItem(identifier: identifier, direction: direction, fingers: fingers, minOffset: minOffset, sourceApple: sourceApple, sourceBash: sourceBash) case let .upnext(from: from, to: to, maxToShow: maxToShow): - barItem = UpNextBarItem(identifier: identifier, interval: 2, from: from, to: to, maxToShow: maxToShow) + barItem = UpNextScrubberTouchBarItem(identifier: identifier, interval: 2, from: from, to: to, maxToShow: maxToShow) } if let action = self.action(forItem: item), let item = barItem as? CustomButtonTouchBarItem { diff --git a/MTMR/Widgets/UpNextBarItem.swift b/MTMR/Widgets/UpNextScrubberTouchBarItem.swift similarity index 97% rename from MTMR/Widgets/UpNextBarItem.swift rename to MTMR/Widgets/UpNextScrubberTouchBarItem.swift index 126c59a..f977703 100644 --- a/MTMR/Widgets/UpNextBarItem.swift +++ b/MTMR/Widgets/UpNextScrubberTouchBarItem.swift @@ -1,5 +1,5 @@ // -// UpNextBarItems.swift +// UpNextScrubberTouchBarItems.swift // MTMR // // Created by Connor Meehan on 13/7/20. @@ -10,7 +10,7 @@ import Foundation import EventKit -class UpNextBarItem: NSCustomTouchBarItem { +class UpNextScrubberTouchBarItem: NSCustomTouchBarItem { // Dependencies private let scrollView = NSScrollView() private let activity: NSBackgroundActivityScheduler // Update scheduler @@ -138,8 +138,6 @@ class UpNextBarItem: NSCustomTouchBarItem { let distance = abs(Date().timeIntervalSinceReferenceDate/60 - startDate.timeIntervalSinceReferenceDate/60) // Get time difference in minutes if(distance < 30 as TimeInterval) { // Less than 30 minutes, backround is red return NSColor.systemRed - } else if (distance < 120 as TimeInterval) { // Less than 2 hours, background is yellow - return NSColor.systemOrange } return NSColor.clear }