Browse Source

Swiftformat.

pull/113/head
Abhishek 3 years ago
parent
commit
add37287c3
  1. 6
      Clocker/CoreLoggerKit/Package.swift
  2. 2
      Clocker/CoreLoggerKit/Tests/CoreLoggerKitTests/CoreLoggerKitTests.swift
  3. 2
      Clocker/CoreLoggerKit/Tests/CoreLoggerKitTests/XCTestManifests.swift
  4. 8
      Clocker/CoreModelKit/Package.swift
  5. 2
      Clocker/CoreModelKit/Sources/CoreModelKit/TimezoneData.swift
  6. 2
      Clocker/CoreModelKit/Tests/CoreModelKitTests/XCTestManifests.swift
  7. 8
      Clocker/Events and Reminders/CalendarHandler.swift
  8. 3
      Clocker/Events and Reminders/RemindersHandler.swift
  9. 10
      Clocker/Menu Bar/StatusContainerView.swift
  10. 3
      Clocker/Menu Bar/StatusItemHandler.swift
  11. 8
      Clocker/Menu Bar/StatusItemView.swift

6
Clocker/CoreLoggerKit/Package.swift

@ -6,13 +6,13 @@ import PackageDescription
let package = Package( let package = Package(
name: "CoreLoggerKit", name: "CoreLoggerKit",
platforms: [ platforms: [
.macOS(.v10_12), .macOS(.v10_12)
], ],
products: [ products: [
.library( .library(
name: "CoreLoggerKit", name: "CoreLoggerKit",
targets: ["CoreLoggerKit"] targets: ["CoreLoggerKit"]
), )
], ],
dependencies: [], dependencies: [],
targets: [ targets: [
@ -23,6 +23,6 @@ let package = Package(
.testTarget( .testTarget(
name: "CoreLoggerKitTests", name: "CoreLoggerKitTests",
dependencies: ["CoreLoggerKit"] dependencies: ["CoreLoggerKit"]
), )
] ]
) )

2
Clocker/CoreLoggerKit/Tests/CoreLoggerKitTests/CoreLoggerKitTests.swift

@ -3,6 +3,6 @@ import XCTest
final class CoreLoggerKitTests: XCTestCase { final class CoreLoggerKitTests: XCTestCase {
static var allTests = [ static var allTests = [
("testExample", testExample), ("testExample", testExample)
] ]
} }

2
Clocker/CoreLoggerKit/Tests/CoreLoggerKitTests/XCTestManifests.swift

@ -3,7 +3,7 @@ import XCTest
#if !canImport(ObjectiveC) #if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] { public func allTests() -> [XCTestCaseEntry] {
return [ return [
testCase(CoreLoggerKitTests.allTests), testCase(CoreLoggerKitTests.allTests)
] ]
} }
#endif #endif

8
Clocker/CoreModelKit/Package.swift

@ -6,19 +6,19 @@ import PackageDescription
let package = Package( let package = Package(
name: "CoreModelKit", name: "CoreModelKit",
platforms: [ platforms: [
.macOS(.v10_12), .macOS(.v10_12)
], ],
products: [ products: [
// Products define the executables and libraries a package produces, and make them visible to other packages. // Products define the executables and libraries a package produces, and make them visible to other packages.
.library( .library(
name: "CoreModelKit", name: "CoreModelKit",
targets: ["CoreModelKit"] targets: ["CoreModelKit"]
), )
], ],
dependencies: [ dependencies: [
// Dependencies declare other packages that this package depends on. // Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"), // .package(url: /* package url */, from: "1.0.0"),
.package(path: "../CoreLoggerKit/"), .package(path: "../CoreLoggerKit/")
], ],
targets: [ targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets are the basic building blocks of a package. A target can define a module or a test suite.
@ -30,6 +30,6 @@ let package = Package(
.testTarget( .testTarget(
name: "CoreModelKitTests", name: "CoreModelKitTests",
dependencies: ["CoreModelKit", "CoreLoggerKit"] dependencies: ["CoreModelKit", "CoreLoggerKit"]
), )
] ]
) )

2
Clocker/CoreModelKit/Sources/CoreModelKit/TimezoneData.swift

@ -66,7 +66,7 @@ public class TimezoneData: NSObject, NSCoding {
// Suffix // Suffix
NSNumber(integerLiteral: 9): DateFormat.twelveHourWithoutSuffix, NSNumber(integerLiteral: 9): DateFormat.twelveHourWithoutSuffix,
NSNumber(integerLiteral: 10): DateFormat.twelveHourWithoutSuffixAndSeconds, NSNumber(integerLiteral: 10): DateFormat.twelveHourWithoutSuffixAndSeconds,
NSNumber(integerLiteral: 11): DateFormat.epochTime, NSNumber(integerLiteral: 11): DateFormat.epochTime
] ]
public var customLabel: String? public var customLabel: String?

2
Clocker/CoreModelKit/Tests/CoreModelKitTests/XCTestManifests.swift

@ -3,7 +3,7 @@ import XCTest
#if !canImport(ObjectiveC) #if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] { public func allTests() -> [XCTestCaseEntry] {
return [ return [
testCase(CoreModelKitTests.allTests), testCase(CoreModelKitTests.allTests)
] ]
} }
#endif #endif

8
Clocker/Events and Reminders/CalendarHandler.swift

@ -383,7 +383,7 @@ extension EventCenter {
// Borrowing logic from Ityscal // Borrowing logic from Ityscal
@discardableResult @discardableResult
private func findAppropriateURLs(_ description: String) -> URL? { private func findAppropriateURLs(_ description: String) -> URL? {
guard let results = EventCenter.dataDetector?.matches(in: description, options: .reportCompletion, range: NSMakeRange(0, description.count)) else { guard let results = EventCenter.dataDetector?.matches(in: description, options: .reportCompletion, range: NSRange(location: 0, length: description.count)) else {
return nil return nil
} }
for result in results { for result in results {
@ -391,8 +391,7 @@ extension EventCenter {
// Check for Zoom links // Check for Zoom links
if actualLink.contains("zoom.us/j/") if actualLink.contains("zoom.us/j/")
|| actualLink.contains("zoom.us/s/") || actualLink.contains("zoom.us/s/")
|| actualLink.contains("zoom.us/w/") || actualLink.contains("zoom.us/w/") {
{
// Create a Zoom App link // Create a Zoom App link
let workspace = NSWorkspace.shared let workspace = NSWorkspace.shared
if workspace.urlForApplication(toOpen: URL(string: "zoommtg://")!) != nil { if workspace.urlForApplication(toOpen: URL(string: "zoommtg://")!) != nil {
@ -418,8 +417,7 @@ extension EventCenter {
|| actualLink.contains("public.senfcall.de") || actualLink.contains("public.senfcall.de")
|| actualLink.contains("youcanbook.me/zoom/") || actualLink.contains("youcanbook.me/zoom/")
|| actualLink.contains("workplace.com/groupcall") || actualLink.contains("workplace.com/groupcall")
|| actualLink.contains("bluejeans.com/") || actualLink.contains("bluejeans.com/") {
{
if let meetingLink = result.url { if let meetingLink = result.url {
return meetingLink return meetingLink
} }

3
Clocker/Events and Reminders/RemindersHandler.swift

@ -51,8 +51,7 @@ extension EventCenter {
timezone: String, timezone: String,
alertIndex: Int, alertIndex: Int,
reminderDate: Date, reminderDate: Date,
additionalNotes: String?) -> Bool additionalNotes: String?) -> Bool {
{
initializeStoreIfNeccesary() initializeStoreIfNeccesary()
if reminderAccessNotDetermined() || reminderAccessDenied() { if reminderAccessNotDetermined() || reminderAccessDenied() {

10
Clocker/Menu Bar/StatusContainerView.swift

@ -31,12 +31,10 @@ func compactWidth(for timezone: TimezoneData) -> Int {
if timeFormat == DateFormat.twelveHour if timeFormat == DateFormat.twelveHour
|| timeFormat == DateFormat.twelveHourWithSeconds || timeFormat == DateFormat.twelveHourWithSeconds
|| timeFormat == DateFormat.twelveHourWithZero || timeFormat == DateFormat.twelveHourWithZero
|| timeFormat == DateFormat.twelveHourWithSeconds || timeFormat == DateFormat.twelveHourWithSeconds {
{
totalWidth += 20 totalWidth += 20
} else if timeFormat == DateFormat.twentyFourHour } else if timeFormat == DateFormat.twentyFourHour
|| timeFormat == DateFormat.twentyFourHourWithSeconds || timeFormat == DateFormat.twentyFourHourWithSeconds {
{
totalWidth += 0 totalWidth += 0
} }
@ -77,7 +75,7 @@ class StatusContainerView: NSView {
let timeBasedAttributes = [ let timeBasedAttributes = [
NSAttributedString.Key.font: compactModeTimeFont, NSAttributedString.Key.font: compactModeTimeFont,
NSAttributedString.Key.backgroundColor: NSColor.clear, NSAttributedString.Key.backgroundColor: NSColor.clear,
NSAttributedString.Key.paragraphStyle: defaultParagraphStyle, NSAttributedString.Key.paragraphStyle: defaultParagraphStyle
] ]
func containerWidth(for timezones: [Data]) -> CGFloat { func containerWidth(for timezones: [Data]) -> CGFloat {
@ -136,7 +134,7 @@ class StatusContainerView: NSView {
NSAttributedString.Key.font: compactModeTimeFont, NSAttributedString.Key.font: compactModeTimeFont,
NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.foregroundColor: textColor,
NSAttributedString.Key.backgroundColor: NSColor.clear, NSAttributedString.Key.backgroundColor: NSColor.clear,
NSAttributedString.Key.paragraphStyle: defaultParagraphStyle, NSAttributedString.Key.paragraphStyle: defaultParagraphStyle
] ]
let operation = TimezoneDataOperations(with: timezone) let operation = TimezoneDataOperations(with: timezone)

3
Clocker/Menu Bar/StatusItemHandler.swift

@ -112,8 +112,7 @@ class StatusItemHandler: NSObject {
userNotificationsDidChangeNotif = center.addObserver(forName: UserDefaults.didChangeNotification, userNotificationsDidChangeNotif = center.addObserver(forName: UserDefaults.didChangeNotification,
object: self, object: self,
queue: mainQueue) queue: mainQueue) { _ in
{ _ in
self.setupStatusItem() self.setupStatusItem()
} }
} }

8
Clocker/Menu Bar/StatusItemView.swift

@ -49,7 +49,7 @@ class StatusItemView: NSView {
NSAttributedString.Key.font: compactModeTimeFont, NSAttributedString.Key.font: compactModeTimeFont,
NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.foregroundColor: textColor,
NSAttributedString.Key.backgroundColor: NSColor.clear, NSAttributedString.Key.backgroundColor: NSColor.clear,
NSAttributedString.Key.paragraphStyle: defaultParagraphStyle, NSAttributedString.Key.paragraphStyle: defaultParagraphStyle
] ]
return attributes return attributes
} }
@ -61,7 +61,7 @@ class StatusItemView: NSView {
NSAttributedString.Key.font: NSFont.boldSystemFont(ofSize: 10), NSAttributedString.Key.font: NSFont.boldSystemFont(ofSize: 10),
NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.foregroundColor: textColor,
NSAttributedString.Key.backgroundColor: NSColor.clear, NSAttributedString.Key.backgroundColor: NSColor.clear,
NSAttributedString.Key.paragraphStyle: defaultParagraphStyle, NSAttributedString.Key.paragraphStyle: defaultParagraphStyle
] ]
return textFontAttributes return textFontAttributes
} }
@ -90,14 +90,14 @@ class StatusItemView: NSView {
locationView.leadingAnchor.constraint(equalTo: leadingAnchor), locationView.leadingAnchor.constraint(equalTo: leadingAnchor),
locationView.trailingAnchor.constraint(equalTo: trailingAnchor), locationView.trailingAnchor.constraint(equalTo: trailingAnchor),
locationView.topAnchor.constraint(equalTo: topAnchor, constant: 7), locationView.topAnchor.constraint(equalTo: topAnchor, constant: 7),
locationView.heightAnchor.constraint(equalTo: heightAnchor, multiplier: 0.35), locationView.heightAnchor.constraint(equalTo: heightAnchor, multiplier: 0.35)
]) ])
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
timeView.leadingAnchor.constraint(equalTo: leadingAnchor), timeView.leadingAnchor.constraint(equalTo: leadingAnchor),
timeView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: 0), timeView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: 0),
timeView.topAnchor.constraint(equalTo: locationView.bottomAnchor), timeView.topAnchor.constraint(equalTo: locationView.bottomAnchor),
timeView.bottomAnchor.constraint(equalTo: bottomAnchor), timeView.bottomAnchor.constraint(equalTo: bottomAnchor)
]) ])
} }

Loading…
Cancel
Save