Add SwiftFormat to the project. (#129)

* Run swiftformat for whitespace.
* Run swiftformat with some rules.
This commit is contained in:
Doug
2022-07-06 14:49:05 +01:00
committed by GitHub
parent 26d8affaa8
commit 02eb4b35e2
188 changed files with 759 additions and 717 deletions
@@ -7,10 +7,10 @@
//
import Foundation
import MatrixRustSDK
import UIKit
import GZIP
import MatrixRustSDK
import Sentry
import UIKit
enum BugReportServiceError: Error {
case invalidBaseUrlString
@@ -33,7 +33,7 @@ class BugReportService: BugReportServiceProtocol {
guard !sentryEndpoint.isEmpty else {
throw BugReportServiceError.invalidSentryEndpoint
}
self.baseURL = url
baseURL = url
self.sentryEndpoint = sentryEndpoint
self.applicationId = applicationId
self.session = session
@@ -69,7 +69,7 @@ class BugReportService: BugReportServiceProtocol {
// MARK: - BugReportServiceProtocol
var crashedLastRun: Bool {
return SentrySDK.crashedLastRun
SentrySDK.crashedLastRun
}
func crash() {
@@ -182,8 +182,8 @@ class BugReportService: BugReportServiceProtocol {
filesToCompress.append(URL(fileURLWithPath: crashLogFile))
}
var totalSize: Int = 0
var totalZippedSize: Int = 0
var totalSize = 0
var totalZippedSize = 0
var zippedFiles: [URL] = []
for url in filesToCompress {
@@ -16,10 +16,10 @@ class MockBugReportService: BugReportServiceProtocol {
includeCrashLog: Bool,
githubLabels: [String],
files: [URL]) async throws -> SubmitBugReportResponse {
return SubmitBugReportResponse(reportUrl: "https://www.example/com/123")
SubmitBugReportResponse(reportUrl: "https://www.example/com/123")
}
var crashedLastRun: Bool = false
var crashedLastRun = false
func crash() {
// no-op
@@ -7,8 +7,8 @@
//
import Foundation
import UIKit
import Photos
import UIKit
enum ScreenshotDetectorError: String, Error {
case loadFailed
@@ -18,7 +18,7 @@ enum ScreenshotDetectorError: String, Error {
@MainActor
class ScreenshotDetector {
var callback: (@MainActor (UIImage?, Error?) -> Void)?
var callback: (@MainActor(UIImage?, Error?) -> Void)?
/// Flag to whether ask for photos authorization by default if needed.
var autoRequestPHAuthorization = true
@@ -38,7 +38,7 @@ class ScreenshotDetector {
let authStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite)
if authStatus == .authorized {
findScreenshot()
} else if authStatus == .notDetermined && autoRequestPHAuthorization {
} else if authStatus == .notDetermined, autoRequestPHAuthorization {
Task {
self.handleAuthStatus(await PHPhotoLibrary.requestAuthorization(for: .readWrite))
}