Skip to content

Commit

Permalink
Swiftlint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
leits committed Aug 14, 2023
1 parent 98b0bdf commit ef98656
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 16 deletions.
3 changes: 1 addition & 2 deletions MeetingBar/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
@objc
func handleURLEvent(getURLEvent event: NSAppleEventDescriptor, replyEvent _: NSAppleEventDescriptor) {
if let string = event.paramDescriptor(forKeyword: keyDirectObject)?.stringValue,
let url = URL(string: string)
{
let url = URL(string: string) {
if url == URL(string: "meetingbar://preferences") {
openPrefecencesWindow(nil)
} else {
Expand Down
2 changes: 1 addition & 1 deletion MeetingBar/AppIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enum EventDetailsTypeAppEnum: String, AppEnum {
.calendarTitle: "Calendar",
.url: "URL",
.notes: "Notes",
.location: "Location",
.location: "Location"
]
}

Expand Down
8 changes: 3 additions & 5 deletions MeetingBar/EventStores/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ class MBEvent {
endDate: Date,
isAllDay: Bool,
recurrent: Bool,
calendar: MBCalendar)
{
calendar: MBCalendar) {
self.calendar = calendar
self.ID = ID
self.lastModifiedDate = lastModifiedDate
Expand Down Expand Up @@ -120,15 +119,14 @@ class MBEvent {
location,
url?.absoluteString,
notes,
notes?.htmlTagsStripped(),
notes?.htmlTagsStripped()
].compactMap { $0 }

for linkField in linkFields {
if var detectedLink = detectMeetingLink(linkField) {
if detectedLink.service == .meet,
let account = calendar.email,
let urlEncodedAccount = account.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
{
let urlEncodedAccount = account.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) {
detectedLink.url = URL(string: (detectedLink.url.absoluteString) + "?authuser=\(urlEncodedAccount)")!
}
meetingLink = detectedLink
Expand Down
5 changes: 2 additions & 3 deletions MeetingBar/EventStores/GCEventStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class GCEventStore: NSObject, EventStore, OIDExternalUserAgent {
let scopes = [
"email",
"https://www.googleapis.com/auth/calendar.calendarlist.readonly",
"https://www.googleapis.com/auth/calendar.events.readonly",
"https://www.googleapis.com/auth/calendar.events.readonly"
]

let request = OIDAuthorizationRequest(configuration: config,
Expand Down Expand Up @@ -340,8 +340,7 @@ class GCEventStore: NSObject, EventStore, OIDExternalUserAgent {

func present(_ request: OIDExternalUserAgentRequest, session _: OIDExternalUserAgentSession) -> Bool {
if let url = request.externalUserAgentRequestURL(),
NSWorkspace.shared.open(url)
{
NSWorkspace.shared.open(url) {
return true
}

Expand Down
3 changes: 1 addition & 2 deletions MeetingBar/Extensions/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ extension String {
html: data,
options: [.documentType: NSAttributedString.DocumentType.html],
documentAttributes: nil
)
{
) {
return attributedSelf.string
}
return self
Expand Down
2 changes: 1 addition & 1 deletion MeetingBar/Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func createNSViewFromText(text: String) -> NSView {
text.splitWithNewLineAttributedString(
with: [
NSAttributedString.Key.paragraphStyle: paragraphStyle,
NSAttributedString.Key.font: NSFont.systemFont(ofSize: 14),
NSAttributedString.Key.font: NSFont.systemFont(ofSize: 14)
],
maxWidth: 300.0
)
Expand Down
2 changes: 1 addition & 1 deletion MeetingBar/StatusBarItemController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class StatusBarItemController {

let timeAttributes = [
NSAttributedString.Key.font: NSFont.systemFont(ofSize: 9),
NSAttributedString.Key.foregroundColor: NSColor.lightGray,
NSAttributedString.Key.foregroundColor: NSColor.lightGray
]
menuTitle.append(NSAttributedString(string: "\n" + time, attributes: timeAttributes))

Expand Down
2 changes: 1 addition & 1 deletion MeetingBarTests/MeetingServicesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let meetings = [
MeetingLink(service: .gather, url: URL(string: "https://app.gather.town/app/1a2S3d4F5G/1a2S-3d4F_5G6h?meeting=1a2S3d4F5G")!),
MeetingLink(service: .vimeo, url: URL(string: "https://venues.vimeo.com/12345678/abcdef123")!),
MeetingLink(service: .reclaim, url: URL(string: "https://reclaim.ai/z/T01ABCDEFGH/C02ABCDEFGH")!),
MeetingLink(service: .tuple, url: URL(string: "https://tuple.app/c/V1StGXR8_Z5jdHi6B")!),
MeetingLink(service: .tuple, url: URL(string: "https://tuple.app/c/V1StGXR8_Z5jdHi6B")!)
]

class MeetingServicesTests: XCTestCase {
Expand Down

0 comments on commit ef98656

Please sign in to comment.