From 7d35876753ed2bd9c9ff3956b91494bd60fc6923 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Wed, 8 Mar 2023 10:59:49 +0000 Subject: [PATCH] Update danger message and brew dependencies. (#683) --- Dangerfile.swift | 2 +- ElementX/Sources/Other/Extensions/Task.swift | 2 +- .../Services/BugReport/BugReportService.swift | 2 +- .../Services/BugReport/ScreenshotDetector.swift | 2 +- .../Services/UserSession/RestorationToken.swift | 12 ++++++------ NSE/Sources/NotificationServiceExtension.swift | 2 +- NSE/Sources/Other/UNMutableNotificationContent.swift | 12 ++++++------ ci_scripts/ci_common.sh | 4 ++-- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Dangerfile.swift b/Dangerfile.swift index 11caf78fc..d6dc10358 100644 --- a/Dangerfile.swift +++ b/Dangerfile.swift @@ -31,7 +31,7 @@ if let ticketNumberRegex = try? NSRegularExpression(pattern: "#\\d+") { }.isEmpty if missingTicketNumber { - warn("Some of the commits are missing ticket numbers. Please consinder using them for better tracking.") + warn("Some of the commits are missing ticket numbers. Please consider squashing all commits that don't have a tracking number.") } } diff --git a/ElementX/Sources/Other/Extensions/Task.swift b/ElementX/Sources/Other/Extensions/Task.swift index 678fd5837..99f73bbe2 100644 --- a/ElementX/Sources/Other/Extensions/Task.swift +++ b/ElementX/Sources/Other/Extensions/Task.swift @@ -53,7 +53,7 @@ public extension Task where Success == Never, Failure == Never { try await withCheckedThrowingContinuation(function: function) { continuation in queue.async { do { - continuation.resume(returning: try body()) + try continuation.resume(returning: body()) } catch { continuation.resume(throwing: error) } diff --git a/ElementX/Sources/Services/BugReport/BugReportService.swift b/ElementX/Sources/Services/BugReport/BugReportService.swift index 1f0299eb1..693ca2f0a 100644 --- a/ElementX/Sources/Services/BugReport/BugReportService.swift +++ b/ElementX/Sources/Services/BugReport/BugReportService.swift @@ -243,7 +243,7 @@ private extension Data { case .file(let url): appendString(string: "; filename=\"\(url.lastPathComponent)\"\r\n") appendString(string: "Content-Type: \"content-type header\"\r\n\r\n") - append(try Data(contentsOf: url)) + try append(Data(contentsOf: url)) appendString(string: "\r\n") } } diff --git a/ElementX/Sources/Services/BugReport/ScreenshotDetector.swift b/ElementX/Sources/Services/BugReport/ScreenshotDetector.swift index b5532bc84..32cbe38e0 100644 --- a/ElementX/Sources/Services/BugReport/ScreenshotDetector.swift +++ b/ElementX/Sources/Services/BugReport/ScreenshotDetector.swift @@ -47,7 +47,7 @@ class ScreenshotDetector { findScreenshot() } else if authStatus == .notDetermined, autoRequestPHAuthorization { Task { - self.handleAuthStatus(await PHPhotoLibrary.requestAuthorization(for: .readWrite)) + await self.handleAuthStatus(PHPhotoLibrary.requestAuthorization(for: .readWrite)) } } else { fail(withError: ScreenshotDetectorError.notAuthorized) diff --git a/ElementX/Sources/Services/UserSession/RestorationToken.swift b/ElementX/Sources/Services/UserSession/RestorationToken.swift index 9ef34a8b9..287b2b0c4 100644 --- a/ElementX/Sources/Services/UserSession/RestorationToken.swift +++ b/ElementX/Sources/Services/UserSession/RestorationToken.swift @@ -24,12 +24,12 @@ struct RestorationToken: Codable, Equatable { extension MatrixRustSDK.Session: Codable { public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) - self = .init(accessToken: try container.decode(String.self, forKey: .accessToken), - refreshToken: try container.decodeIfPresent(String.self, forKey: .refreshToken), - userId: try container.decode(String.self, forKey: .userId), - deviceId: try container.decode(String.self, forKey: .deviceId), - homeserverUrl: try container.decode(String.self, forKey: .homeserverUrl), - slidingSyncProxy: try container.decode(String.self, forKey: .slidingSyncProxy)) + self = try .init(accessToken: container.decode(String.self, forKey: .accessToken), + refreshToken: container.decodeIfPresent(String.self, forKey: .refreshToken), + userId: container.decode(String.self, forKey: .userId), + deviceId: container.decode(String.self, forKey: .deviceId), + homeserverUrl: container.decode(String.self, forKey: .homeserverUrl), + slidingSyncProxy: container.decode(String.self, forKey: .slidingSyncProxy)) } public func encode(to encoder: Encoder) throws { diff --git a/NSE/Sources/NotificationServiceExtension.swift b/NSE/Sources/NotificationServiceExtension.swift index 6d70a008d..d504abb95 100644 --- a/NSE/Sources/NotificationServiceExtension.swift +++ b/NSE/Sources/NotificationServiceExtension.swift @@ -108,7 +108,7 @@ class NotificationServiceExtension: UNNotificationServiceExtension { // There is some media to load, process it again if let latestContent = try await itemProxy.process(with: roomId, - mediaProvider: try createMediaProvider(with: credentials)) { + mediaProvider: createMediaProvider(with: credentials)) { // Processing finished, hopefully with some media modifiedContent = latestContent return notify() diff --git a/NSE/Sources/Other/UNMutableNotificationContent.swift b/NSE/Sources/Other/UNMutableNotificationContent.swift index 3df418843..0e11e2bb5 100644 --- a/NSE/Sources/Other/UNMutableNotificationContent.swift +++ b/NSE/Sources/Other/UNMutableNotificationContent.swift @@ -51,12 +51,12 @@ extension UNMutableNotificationContent { case .success(let url): // Initialize only the sender for a one-to-one message intent. let handle = INPersonHandle(value: senderId, type: .unknown) - let sender = INPerson(personHandle: handle, - nameComponents: nil, - displayName: senderName, - image: INImage(imageData: try Data(contentsOf: url)), - contactIdentifier: nil, - customIdentifier: nil) + let sender = try INPerson(personHandle: handle, + nameComponents: nil, + displayName: senderName, + image: INImage(imageData: Data(contentsOf: url)), + contactIdentifier: nil, + customIdentifier: nil) // Because this communication is incoming, you can infer that the current user is // a recipient. Don't include the current user when initializing the intent. diff --git a/ci_scripts/ci_common.sh b/ci_scripts/ci_common.sh index 1a09c88b8..c07ea5231 100755 --- a/ci_scripts/ci_common.sh +++ b/ci_scripts/ci_common.sh @@ -30,7 +30,7 @@ setup_xcode_cloud_environment () { } install_xcode_cloud_brew_dependencies () { - brew install xcodegen imagemagick + brew update && install xcodegen imagemagick } install_xcode_cloud_python_dependencies () { @@ -38,7 +38,7 @@ install_xcode_cloud_python_dependencies () { } setup_github_actions_environment() { - brew install xcodegen swiftformat git-lfs + brew update && brew install xcodegen swiftformat git-lfs # brew "swiftlint" # Fails on the CI: `Target /usr/local/bin/swiftlint Target /usr/local/bin/swiftlint already exists`. Installed through https://github.com/actions/virtual-environments/blob/main/images/macos/macos-12-Readme.md#linters # brew "imagemagick" # Upgrading imagemagick has failed!