diff --git a/.swiftformat b/.swiftformat index 1589bb4f3f..9751483843 100644 --- a/.swiftformat +++ b/.swiftformat @@ -1,7 +1,7 @@ # format options --indent 4 --ifdef noindent ---swiftversion 5.8.1 +--swiftversion 6.2 --header strip --funcattributes prev-line --typeattributes prev-line diff --git a/Authenticator/Application/AppDelegate.swift b/Authenticator/Application/AppDelegate.swift index 1ccec1068c..0c225d4359 100644 --- a/Authenticator/Application/AppDelegate.swift +++ b/Authenticator/Application/AppDelegate.swift @@ -30,7 +30,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD func application( _: UIApplication, - didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil + didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil, ) -> Bool { // Exit early if testing to avoid running any app functionality. guard !isTesting else { return true } @@ -45,7 +45,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD let services = ServiceContainer( application: UIApplication.shared, - errorReporter: errorReporter + errorReporter: errorReporter, ) let appModule = DefaultAppModule(services: services) appProcessor = AppProcessor(appModule: appModule, services: services) diff --git a/Authenticator/Application/SceneDelegate.swift b/Authenticator/Application/SceneDelegate.swift index 9aa117d369..ee3dcb42ba 100644 --- a/Authenticator/Application/SceneDelegate.swift +++ b/Authenticator/Application/SceneDelegate.swift @@ -26,7 +26,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func scene( _ scene: UIScene, willConnectTo session: UISceneSession, - options connectionOptions: UIScene.ConnectionOptions + options connectionOptions: UIScene.ConnectionOptions, ) { guard let windowScene = scene as? UIWindowScene else { return } guard let appProcessor else { @@ -56,7 +56,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { await appProcessor.start( appContext: .mainApp, navigator: rootViewController, - window: appWindow + window: appWindow, ) hideSplash() isStartingUp = false @@ -84,7 +84,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { window.isHidden = false window.rootViewController = UIStoryboard( name: "LaunchScreen", - bundle: .main + bundle: .main, ).instantiateInitialViewController() window.windowLevel = UIWindow.Level.alert + 1 return window @@ -115,7 +115,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { private func addTripleTapGestureRecognizer(to window: UIWindow) { let tapGesture = UITapGestureRecognizer( target: self, - action: #selector(handleTripleTapGesture) + action: #selector(handleTripleTapGesture), ) tapGesture.numberOfTapsRequired = 3 tapGesture.numberOfTouchesRequired = 1 diff --git a/AuthenticatorBridgeKit/AuthenticatorBridgeDataStore.swift b/AuthenticatorBridgeKit/AuthenticatorBridgeDataStore.swift index 271c46fc46..73e84e3202 100644 --- a/AuthenticatorBridgeKit/AuthenticatorBridgeDataStore.swift +++ b/AuthenticatorBridgeKit/AuthenticatorBridgeDataStore.swift @@ -66,13 +66,13 @@ public class AuthenticatorBridgeDataStore { public init( errorReporter: ErrorReporter, groupIdentifier: String, - storeType: AuthenticatorBridgeStoreType = .persisted + storeType: AuthenticatorBridgeStoreType = .persisted, ) { self.errorReporter = errorReporter persistentContainer = NSPersistentContainer( name: authenticatorBridgeModelName, - managedObjectModel: Self.managedObjectModel + managedObjectModel: Self.managedObjectModel, ) let storeDescription: NSPersistentStoreDescription switch storeType { @@ -105,7 +105,7 @@ public class AuthenticatorBridgeDataStore { try await backgroundContext.perform { try self.backgroundContext.executeAndMergeChanges( batchDeleteRequest: request, - additionalContexts: [self.persistentContainer.viewContext] + additionalContexts: [self.persistentContainer.viewContext], ) } } @@ -118,7 +118,7 @@ public class AuthenticatorBridgeDataStore { try await backgroundContext.perform { try self.backgroundContext.executeAndMergeChanges( batchInsertRequest: request, - additionalContexts: [self.persistentContainer.viewContext] + additionalContexts: [self.persistentContainer.viewContext], ) } } @@ -132,13 +132,13 @@ public class AuthenticatorBridgeDataStore { /// public func executeBatchReplace( deleteRequest: NSBatchDeleteRequest, - insertRequest: NSBatchInsertRequest + insertRequest: NSBatchInsertRequest, ) async throws { try await backgroundContext.perform { try self.backgroundContext.executeAndMergeChanges( batchDeleteRequest: deleteRequest, batchInsertRequest: insertRequest, - additionalContexts: [self.persistentContainer.viewContext] + additionalContexts: [self.persistentContainer.viewContext], ) } } diff --git a/AuthenticatorBridgeKit/AuthenticatorBridgeItemData.swift b/AuthenticatorBridgeKit/AuthenticatorBridgeItemData.swift index 81a6ffc1dd..98d50f11ea 100644 --- a/AuthenticatorBridgeKit/AuthenticatorBridgeItemData.swift +++ b/AuthenticatorBridgeKit/AuthenticatorBridgeItemData.swift @@ -29,7 +29,7 @@ public class AuthenticatorBridgeItemData: NSManagedObject, CodableModelData { convenience init( context: NSManagedObjectContext, userId: String, - authenticatorItem: AuthenticatorBridgeItemDataModel + authenticatorItem: AuthenticatorBridgeItemDataModel, ) throws { self.init(context: context) id = authenticatorItem.id @@ -54,7 +54,7 @@ extension AuthenticatorBridgeItemData: ManagedUserObject { #keyPath(AuthenticatorBridgeItemData.userId), userId, #keyPath(AuthenticatorBridgeItemData.id), - id + id, ) } diff --git a/AuthenticatorBridgeKit/AuthenticatorBridgeItemService.swift b/AuthenticatorBridgeKit/AuthenticatorBridgeItemService.swift index 344d5407fc..45f0cfafaf 100644 --- a/AuthenticatorBridgeKit/AuthenticatorBridgeItemService.swift +++ b/AuthenticatorBridgeKit/AuthenticatorBridgeItemService.swift @@ -154,10 +154,10 @@ public class DefaultAuthenticatorBridgeItemService: AuthenticatorBridgeItemServi public func fetchTemporaryItem() async throws -> AuthenticatorBridgeItemDataView? { let decryptedItems = try await fetchAllForUserId( - DefaultAuthenticatorBridgeItemService.temporaryUserId + DefaultAuthenticatorBridgeItemService.temporaryUserId, ) try await deleteAllForUserId( - DefaultAuthenticatorBridgeItemService.temporaryUserId + DefaultAuthenticatorBridgeItemService.temporaryUserId, ) return decryptedItems.first @@ -178,14 +178,14 @@ public class DefaultAuthenticatorBridgeItemService: AuthenticatorBridgeItemServi forUserId userId: String) async throws { let encryptedItems = try await cryptoService.encryptAuthenticatorItems(items) try await dataStore.executeBatchInsert( - AuthenticatorBridgeItemData.batchInsertRequest(objects: encryptedItems, userId: userId) + AuthenticatorBridgeItemData.batchInsertRequest(objects: encryptedItems, userId: userId), ) } public func insertTemporaryItem(_ item: AuthenticatorBridgeItemDataView) async throws { try await replaceAllItems( with: [item], - forUserId: DefaultAuthenticatorBridgeItemService.temporaryUserId + forUserId: DefaultAuthenticatorBridgeItemService.temporaryUserId, ) } @@ -201,11 +201,11 @@ public class DefaultAuthenticatorBridgeItemService: AuthenticatorBridgeItemServi let deleteRequest = AuthenticatorBridgeItemData.deleteByUserIdRequest(userId: userId) let insertRequest = try AuthenticatorBridgeItemData.batchInsertRequest( objects: encryptedItems, - userId: userId + userId: userId, ) try await dataStore.executeBatchReplace( deleteRequest: deleteRequest, - insertRequest: insertRequest + insertRequest: insertRequest, ) } @@ -214,13 +214,13 @@ public class DefaultAuthenticatorBridgeItemService: AuthenticatorBridgeItemServi try await checkForLogout() let fetchRequest = AuthenticatorBridgeItemData.fetchRequest( predicate: NSPredicate( - format: "userId != %@", DefaultAuthenticatorBridgeItemService.temporaryUserId - ) + format: "userId != %@", DefaultAuthenticatorBridgeItemService.temporaryUserId, + ), ) fetchRequest.sortDescriptors = [NSSortDescriptor(keyPath: \AuthenticatorBridgeItemData.userId, ascending: true)] return FetchedResultsPublisher( context: dataStore.persistentContainer.viewContext, - request: fetchRequest + request: fetchRequest, ) .map { dataItems in dataItems.compactMap(\.model) diff --git a/AuthenticatorBridgeKit/Mocks/MockSharedTimeoutService.swift b/AuthenticatorBridgeKit/Mocks/MockSharedTimeoutService.swift index 5138700d98..8d2dcb0454 100644 --- a/AuthenticatorBridgeKit/Mocks/MockSharedTimeoutService.swift +++ b/AuthenticatorBridgeKit/Mocks/MockSharedTimeoutService.swift @@ -27,7 +27,7 @@ public final class MockSharedTimeoutService: SharedTimeoutService { public func updateTimeout( forUserId userId: String, lastActiveDate: Date?, - timeoutLength: SessionTimeoutValue + timeoutLength: SessionTimeoutValue, ) async throws { if let updateTimeoutError { throw updateTimeoutError diff --git a/AuthenticatorBridgeKit/SharedCryptographyService.swift b/AuthenticatorBridgeKit/SharedCryptographyService.swift index fd22d6a168..2a15b91aa9 100644 --- a/AuthenticatorBridgeKit/SharedCryptographyService.swift +++ b/AuthenticatorBridgeKit/SharedCryptographyService.swift @@ -16,7 +16,7 @@ public protocol SharedCryptographyService: AnyObject { /// key is not in the shared repository. /// func decryptAuthenticatorItems( - _ items: [AuthenticatorBridgeItemDataModel] + _ items: [AuthenticatorBridgeItemDataModel], ) async throws -> [AuthenticatorBridgeItemDataView] /// Takes an array of `AuthenticatorBridgeItemDataView` with decrypted data and @@ -28,7 +28,7 @@ public protocol SharedCryptographyService: AnyObject { /// key is not in the shared repository. /// func encryptAuthenticatorItems( - _ items: [AuthenticatorBridgeItemDataView] + _ items: [AuthenticatorBridgeItemDataView], ) async throws -> [AuthenticatorBridgeItemDataModel] } @@ -55,7 +55,7 @@ public class DefaultAuthenticatorCryptographyService: SharedCryptographyService // MARK: Methods public func decryptAuthenticatorItems( - _ items: [AuthenticatorBridgeItemDataModel] + _ items: [AuthenticatorBridgeItemDataModel], ) async throws -> [AuthenticatorBridgeItemDataView] { guard !items.isEmpty else { return [] } @@ -70,13 +70,13 @@ public class DefaultAuthenticatorCryptographyService: SharedCryptographyService id: item.id, name: (try? decrypt(item.name, withKey: symmetricKey)) ?? "", totpKey: try? decrypt(item.totpKey, withKey: symmetricKey), - username: try? decrypt(item.username, withKey: symmetricKey) + username: try? decrypt(item.username, withKey: symmetricKey), ) } } public func encryptAuthenticatorItems( - _ items: [AuthenticatorBridgeItemDataView] + _ items: [AuthenticatorBridgeItemDataView], ) async throws -> [AuthenticatorBridgeItemDataModel] { let key = try await sharedKeychainRepository.getAuthenticatorKey() let symmetricKey = SymmetricKey(data: key) @@ -89,7 +89,7 @@ public class DefaultAuthenticatorCryptographyService: SharedCryptographyService id: item.id, name: encrypt(item.name, withKey: symmetricKey) ?? "", totpKey: encrypt(item.totpKey, withKey: symmetricKey), - username: encrypt(item.username, withKey: symmetricKey) + username: encrypt(item.username, withKey: symmetricKey), ) } } @@ -106,11 +106,11 @@ public class DefaultAuthenticatorCryptographyService: SharedCryptographyService return nil } let encryptedSealedBox = try AES.GCM.SealedBox( - combined: data + combined: data, ) let decryptedBox = try AES.GCM.open( encryptedSealedBox, - using: key + using: key, ) return String(data: decryptedBox, encoding: .utf8) } diff --git a/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainRepository.swift b/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainRepository.swift index 59b59cb630..004feb2cd7 100644 --- a/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainRepository.swift +++ b/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainRepository.swift @@ -29,7 +29,7 @@ public protocol SharedKeychainRepository { /// - Returns: The time the user should be automatically logged out. If `nil`, then the user should not be. /// func getAccountAutoLogoutTime( - userId: String + userId: String, ) async throws -> Date? /// Sets when a user account should automatically log out. @@ -40,7 +40,7 @@ public protocol SharedKeychainRepository { /// func setAccountAutoLogoutTime( _ value: Date?, - userId: String + userId: String, ) async throws } @@ -94,7 +94,7 @@ public class DefaultSharedKeychainRepository: SharedKeychainRepository { /// public func setAccountAutoLogoutTime( _ value: Date?, - userId: String + userId: String, ) async throws { try await storage.setValue(value, for: .accountAutoLogout(userId: userId)) } diff --git a/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainRepositoryTests.swift b/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainRepositoryTests.swift index 0dd44a5620..321d41ed3d 100644 --- a/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainRepositoryTests.swift +++ b/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainRepositoryTests.swift @@ -17,7 +17,7 @@ final class SharedKeychainRepositoryTests: BitwardenTestCase { override func setUp() { storage = MockSharedKeychainStorage() subject = DefaultSharedKeychainRepository( - storage: storage + storage: storage, ) } diff --git a/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainService.swift b/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainService.swift index 3a63fb6543..36dcb5e118 100644 --- a/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainService.swift +++ b/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainService.swift @@ -40,7 +40,7 @@ public enum SharedKeychainServiceError: Error, Equatable, CustomNSError { public var errorUserInfo: [String: Any] { switch self { case let .keyNotFound(keychainItem): - return ["Keychain Item": keychainItem.unformattedKey] + ["Keychain Item": keychainItem.unformattedKey] } } } diff --git a/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainStorage.swift b/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainStorage.swift index 55b364c154..9fb76fc60a 100644 --- a/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainStorage.swift +++ b/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainStorage.swift @@ -74,7 +74,7 @@ public class DefaultSharedKeychainStorage: SharedKeychainStorage { /// - sharedAppGroupIdentifier: An identifier for the shared access group used by the application. public init( keychainService: SharedKeychainService, - sharedAppGroupIdentifier: String + sharedAppGroupIdentifier: String, ) { self.keychainService = keychainService self.sharedAppGroupIdentifier = sharedAppGroupIdentifier @@ -89,7 +89,7 @@ public class DefaultSharedKeychainStorage: SharedKeychainStorage { kSecAttrAccessGroup: sharedAppGroupIdentifier, kSecAttrAccount: item.unformattedKey, kSecClass: kSecClassGenericPassword, - ] as CFDictionary + ] as CFDictionary, ) } @@ -103,7 +103,7 @@ public class DefaultSharedKeychainStorage: SharedKeychainStorage { kSecAttrAccessible: kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, kSecAttrAccount: item.unformattedKey, kSecClass: kSecClassGenericPassword, - ] as CFDictionary + ] as CFDictionary, ) guard let resultDictionary = foundItem as? [String: Any], @@ -128,7 +128,7 @@ public class DefaultSharedKeychainStorage: SharedKeychainStorage { try? keychainService.delete(query: query) try keychainService.add( - attributes: query + attributes: query, ) } } diff --git a/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainStorageTests.swift b/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainStorageTests.swift index 48b64ecdee..dd1a824b61 100644 --- a/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainStorageTests.swift +++ b/AuthenticatorBridgeKit/SharedKeychain/SharedKeychainStorageTests.swift @@ -17,7 +17,7 @@ final class SharedKeychainStorageTests: BitwardenTestCase { keychainService = MockSharedKeychainService() subject = DefaultSharedKeychainStorage( keychainService: keychainService, - sharedAppGroupIdentifier: accessGroup + sharedAppGroupIdentifier: accessGroup, ) } diff --git a/AuthenticatorBridgeKit/SharedTimeoutService.swift b/AuthenticatorBridgeKit/SharedTimeoutService.swift index e804864454..282a45fad7 100644 --- a/AuthenticatorBridgeKit/SharedTimeoutService.swift +++ b/AuthenticatorBridgeKit/SharedTimeoutService.swift @@ -47,7 +47,7 @@ public final class DefaultSharedTimeoutService: SharedTimeoutService { public init( sharedKeychainRepository: SharedKeychainRepository, - timeProvider: TimeProvider + timeProvider: TimeProvider, ) { self.sharedKeychainRepository = sharedKeychainRepository self.timeProvider = timeProvider @@ -67,7 +67,7 @@ public final class DefaultSharedTimeoutService: SharedTimeoutService { public func updateTimeout( forUserId userId: String, lastActiveDate: Date?, - timeoutLength: SessionTimeoutValue + timeoutLength: SessionTimeoutValue, ) async throws { guard let lastActiveDate else { try await clearTimeout(forUserId: userId) diff --git a/AuthenticatorBridgeKit/SharedTimeoutServiceTests.swift b/AuthenticatorBridgeKit/SharedTimeoutServiceTests.swift index cb2e96c391..3e75c2c290 100644 --- a/AuthenticatorBridgeKit/SharedTimeoutServiceTests.swift +++ b/AuthenticatorBridgeKit/SharedTimeoutServiceTests.swift @@ -22,7 +22,7 @@ final class SharedTimeoutServiceTests: BitwardenTestCase { subject = DefaultSharedTimeoutService( sharedKeychainRepository: sharedKeychainRepository, - timeProvider: timeProvider + timeProvider: timeProvider, ) } @@ -86,11 +86,11 @@ final class SharedTimeoutServiceTests: BitwardenTestCase { try await subject.updateTimeout( forUserId: "1", lastActiveDate: timeProvider.presentTime, - timeoutLength: .fourHours + timeoutLength: .fourHours, ) XCTAssertEqual( sharedKeychainRepository.accountAutoLogoutTime["1"], - timeProvider.presentTime.addingTimeInterval(TimeInterval(SessionTimeoutValue.fourHours.seconds)) + timeProvider.presentTime.addingTimeInterval(TimeInterval(SessionTimeoutValue.fourHours.seconds)), ) } @@ -108,7 +108,7 @@ final class SharedTimeoutServiceTests: BitwardenTestCase { try await self.subject.updateTimeout( forUserId: "1", lastActiveDate: timeProvider.presentTime, - timeoutLength: .fourHours + timeoutLength: .fourHours, ) } } diff --git a/AuthenticatorBridgeKit/Tests/AuthenticatorBridgeItemDataTests.swift b/AuthenticatorBridgeKit/Tests/AuthenticatorBridgeItemDataTests.swift index b54dca4498..bd07fbbfa2 100644 --- a/AuthenticatorBridgeKit/Tests/AuthenticatorBridgeItemDataTests.swift +++ b/AuthenticatorBridgeKit/Tests/AuthenticatorBridgeItemDataTests.swift @@ -25,13 +25,13 @@ final class AuthenticatorBridgeItemDataTests: AuthenticatorBridgeKitTestCase { dataStore = AuthenticatorBridgeDataStore( errorReporter: errorReporter, groupIdentifier: accessGroup, - storeType: .memory + storeType: .memory, ) itemService = DefaultAuthenticatorBridgeItemService( cryptoService: cryptoService, dataStore: dataStore, sharedKeychainRepository: MockSharedKeychainRepository(), - sharedTimeoutService: MockSharedTimeoutService() + sharedTimeoutService: MockSharedTimeoutService(), ) } @@ -59,8 +59,8 @@ final class AuthenticatorBridgeItemDataTests: AuthenticatorBridgeKitTestCase { id: "is", name: "name", totpKey: "TOTP Key", - username: "username" - ) + username: "username", + ), ) let modelData = try XCTUnwrap(subject.modelData) @@ -110,7 +110,7 @@ final class AuthenticatorBridgeItemDataTests: AuthenticatorBridgeKitTestCase { XCTAssertTrue(cryptoService.encryptCalled) let fetchRequest = AuthenticatorBridgeItemData.fetchByUserIdRequest( - userId: "nonexistent userId" + userId: "nonexistent userId", ) let result = try dataStore.persistentContainer.viewContext.fetch(fetchRequest) diff --git a/AuthenticatorBridgeKit/Tests/AuthenticatorBridgeItemServiceTests.swift b/AuthenticatorBridgeKit/Tests/AuthenticatorBridgeItemServiceTests.swift index 3502620679..26bc690b4f 100644 --- a/AuthenticatorBridgeKit/Tests/AuthenticatorBridgeItemServiceTests.swift +++ b/AuthenticatorBridgeKit/Tests/AuthenticatorBridgeItemServiceTests.swift @@ -28,7 +28,7 @@ final class AuthenticatorBridgeItemServiceTests: AuthenticatorBridgeKitTestCase dataStore = AuthenticatorBridgeDataStore( errorReporter: errorReporter, groupIdentifier: accessGroup, - storeType: .memory + storeType: .memory, ) keychainRepository = MockSharedKeychainRepository() sharedTimeoutService = MockSharedTimeoutService() @@ -36,7 +36,7 @@ final class AuthenticatorBridgeItemServiceTests: AuthenticatorBridgeKitTestCase cryptoService: cryptoService, dataStore: dataStore, sharedKeychainRepository: keychainRepository, - sharedTimeoutService: sharedTimeoutService + sharedTimeoutService: sharedTimeoutService, ) } @@ -58,12 +58,12 @@ final class AuthenticatorBridgeItemServiceTests: AuthenticatorBridgeKitTestCase func test_deleteAll_success() async throws { try await subject.insertItems( AuthenticatorBridgeItemDataView.fixtures(), - forUserId: "userID 1" + forUserId: "userID 1", ) try await subject.insertItems( AuthenticatorBridgeItemDataView.fixtures(), - forUserId: "userID 2" + forUserId: "userID 2", ) keychainRepository.authenticatorKey = keychainRepository.generateMockKeyData() @@ -87,12 +87,12 @@ final class AuthenticatorBridgeItemServiceTests: AuthenticatorBridgeKitTestCase func test_deleteAll_error() async throws { try await subject.insertItems( AuthenticatorBridgeItemDataView.fixtures(), - forUserId: "userID 1" + forUserId: "userID 1", ) try await subject.insertItems( AuthenticatorBridgeItemDataView.fixtures(), - forUserId: "userID 2" + forUserId: "userID 2", ) keychainRepository.errorToThrow = BitwardenTestError.example @@ -297,7 +297,7 @@ final class AuthenticatorBridgeItemServiceTests: AuthenticatorBridgeKitTestCase receiveCompletion: { _ in }, receiveValue: { value in results.append(value) - } + }, ) defer { publisher.cancel() } @@ -319,7 +319,7 @@ final class AuthenticatorBridgeItemServiceTests: AuthenticatorBridgeKitTestCase receiveCompletion: { _ in }, receiveValue: { value in results.append(value) - } + }, ) defer { publisher.cancel() } @@ -341,7 +341,7 @@ final class AuthenticatorBridgeItemServiceTests: AuthenticatorBridgeKitTestCase receiveCompletion: { _ in }, receiveValue: { value in results.append(value) - } + }, ) defer { publisher.cancel() } @@ -361,7 +361,7 @@ final class AuthenticatorBridgeItemServiceTests: AuthenticatorBridgeKitTestCase receiveCompletion: { _ in }, receiveValue: { value in results.append(value) - } + }, ) defer { publisher.cancel() } @@ -384,7 +384,7 @@ final class AuthenticatorBridgeItemServiceTests: AuthenticatorBridgeKitTestCase receiveCompletion: { _ in }, receiveValue: { value in results.append(value) - } + }, ) defer { publisher.cancel() } @@ -415,7 +415,7 @@ final class AuthenticatorBridgeItemServiceTests: AuthenticatorBridgeKitTestCase receiveCompletion: { _ in }, receiveValue: { value in results.append(value) - } + }, ) defer { publisher.cancel() } @@ -447,7 +447,7 @@ final class AuthenticatorBridgeItemServiceTests: AuthenticatorBridgeKitTestCase receiveCompletion: { _ in }, receiveValue: { value in results.append(value) - } + }, ) publisher.cancel() } diff --git a/AuthenticatorBridgeKit/Tests/SharedCryptographyServiceTests.swift b/AuthenticatorBridgeKit/Tests/SharedCryptographyServiceTests.swift index 973fcccfcf..bda08b310c 100644 --- a/AuthenticatorBridgeKit/Tests/SharedCryptographyServiceTests.swift +++ b/AuthenticatorBridgeKit/Tests/SharedCryptographyServiceTests.swift @@ -19,7 +19,7 @@ final class SharedCryptographyServiceTests: AuthenticatorBridgeKitTestCase { sharedKeychainRepository = MockSharedKeychainRepository() sharedKeychainRepository.authenticatorKey = sharedKeychainRepository.generateMockKeyData() subject = DefaultAuthenticatorCryptographyService( - sharedKeychainRepository: sharedKeychainRepository + sharedKeychainRepository: sharedKeychainRepository, ) } diff --git a/AuthenticatorBridgeKit/Tests/TestHelpers/Fixtures/AuthenticatorBridgeItemDataView+Fixtures.swift b/AuthenticatorBridgeKit/Tests/TestHelpers/Fixtures/AuthenticatorBridgeItemDataView+Fixtures.swift index ad56077160..8844e4ad00 100644 --- a/AuthenticatorBridgeKit/Tests/TestHelpers/Fixtures/AuthenticatorBridgeItemDataView+Fixtures.swift +++ b/AuthenticatorBridgeKit/Tests/TestHelpers/Fixtures/AuthenticatorBridgeItemDataView+Fixtures.swift @@ -10,7 +10,7 @@ extension AuthenticatorBridgeItemDataView { id: String = UUID().uuidString, name: String = "Name", totpKey: String? = nil, - username: String? = nil + username: String? = nil, ) -> AuthenticatorBridgeItemDataView { AuthenticatorBridgeItemDataView( accountDomain: accountDomain, @@ -19,7 +19,7 @@ extension AuthenticatorBridgeItemDataView { id: id, name: name, totpKey: totpKey, - username: username + username: username, ) } diff --git a/AuthenticatorBridgeKit/Tests/TestHelpers/MockSharedCryptographyService.swift b/AuthenticatorBridgeKit/Tests/TestHelpers/MockSharedCryptographyService.swift index db693a0c46..96c654b109 100644 --- a/AuthenticatorBridgeKit/Tests/TestHelpers/MockSharedCryptographyService.swift +++ b/AuthenticatorBridgeKit/Tests/TestHelpers/MockSharedCryptographyService.swift @@ -9,7 +9,7 @@ class MockSharedCryptographyService: SharedCryptographyService { var errorToThrow: Error? func decryptAuthenticatorItems( - _ items: [AuthenticatorBridgeItemDataModel] + _ items: [AuthenticatorBridgeItemDataModel], ) async throws -> [AuthenticatorBridgeItemDataView] { if let errorToThrow { throw errorToThrow @@ -23,13 +23,13 @@ class MockSharedCryptographyService: SharedCryptographyService { id: model.id, name: model.name, totpKey: model.totpKey, - username: model.username + username: model.username, ) } } func encryptAuthenticatorItems( - _ items: [AuthenticatorBridgeItemDataView] + _ items: [AuthenticatorBridgeItemDataView], ) async throws -> [AuthenticatorBridgeItemDataModel] { if let errorToThrow { throw errorToThrow @@ -43,7 +43,7 @@ class MockSharedCryptographyService: SharedCryptographyService { id: view.id, name: view.name, totpKey: view.totpKey, - username: view.username + username: view.username, ) } } diff --git a/AuthenticatorBridgeKit/Tests/TestHelpers/Support/AuthenticatorBridgeKitTestCase.swift b/AuthenticatorBridgeKit/Tests/TestHelpers/Support/AuthenticatorBridgeKitTestCase.swift index 1b25fbb898..f6a5252ab3 100644 --- a/AuthenticatorBridgeKit/Tests/TestHelpers/Support/AuthenticatorBridgeKitTestCase.swift +++ b/AuthenticatorBridgeKit/Tests/TestHelpers/Support/AuthenticatorBridgeKitTestCase.swift @@ -18,7 +18,7 @@ open class AuthenticatorBridgeKitTestCase: XCTestCase { open func assertAsyncThrows( _ block: () async throws -> Void, file: StaticString = #file, - line: UInt = #line + line: UInt = #line, ) async { do { try await block() @@ -43,7 +43,7 @@ open class AuthenticatorBridgeKitTestCase: XCTestCase { error: E, file: StaticString = #file, line: UInt = #line, - _ block: () async throws -> Void + _ block: () async throws -> Void, ) async { do { try await block() @@ -54,7 +54,7 @@ open class AuthenticatorBridgeKitTestCase: XCTestCase { XCTFail( "The error caught (\(caughtError)) does not match the type of error provided (\(error)).", file: file, - line: line + line: line, ) } } @@ -72,7 +72,7 @@ open class AuthenticatorBridgeKitTestCase: XCTestCase { open func assertAsyncDoesNotThrow( _ block: () async throws -> Void, file: StaticString = #file, - line: UInt = #line + line: UInt = #line, ) async { do { try await block() @@ -98,7 +98,7 @@ open class AuthenticatorBridgeKitTestCase: XCTestCase { timeout: TimeInterval = 10.0, failureMessage: String = "waitFor condition wasn't met within the time limit", file: StaticString = #file, - line: UInt = #line + line: UInt = #line, ) { let start = Date() let limit = Date(timeIntervalSinceNow: timeout) @@ -130,14 +130,14 @@ open class AuthenticatorBridgeKitTestCase: XCTestCase { timeout: TimeInterval = 10.0, failureMessage: String = "waitFor condition wasn't met within the time limit", file: StaticString = #file, - line: UInt = #line + line: UInt = #line, ) { waitFor( condition, timeout: timeout, failureMessage: failureMessage, file: file, - line: line + line: line, ) } @@ -158,7 +158,7 @@ open class AuthenticatorBridgeKitTestCase: XCTestCase { timeout: TimeInterval = 10.0, failureMessage: String = "waitForAsync condition wasn't met within the time limit", file: StaticString = #file, - line: UInt = #line + line: UInt = #line, ) async throws { let start = Date() let limit = Date(timeIntervalSinceNow: timeout) @@ -182,7 +182,7 @@ open class AuthenticatorBridgeKitTestCase: XCTestCase { start: Date, afterSeconds: Int = 3, functionName: String = #function, - line: UInt = #line + line: UInt = #line, ) { // If the condition took more than 3 seconds to satisfy, add a warning to the logs to look into it. let elapsed = Date().timeIntervalSince(start) diff --git a/AuthenticatorShared/Core/Auth/Models/Response/ResponseValidationErrorModelTests.swift b/AuthenticatorShared/Core/Auth/Models/Response/ResponseValidationErrorModelTests.swift index dba15a9184..549885e565 100644 --- a/AuthenticatorShared/Core/Auth/Models/Response/ResponseValidationErrorModelTests.swift +++ b/AuthenticatorShared/Core/Auth/Models/Response/ResponseValidationErrorModelTests.swift @@ -13,7 +13,7 @@ class ResponseValidationErrorModelTests: BitwardenTestCase { let subject = ResponseValidationErrorModel( error: "invalid_input", errorDescription: "invalid_username", - errorModel: ErrorModel(message: "error message", object: "error") + errorModel: ErrorModel(message: "error message", object: "error"), ) XCTAssertEqual(subject.errorModel.message, "error message") } diff --git a/AuthenticatorShared/Core/Auth/Services/API/Account/Fixtures/APITestData+Account.swift b/AuthenticatorShared/Core/Auth/Services/API/Account/Fixtures/APITestData+Account.swift index dd4b929e60..7b2209ceab 100644 --- a/AuthenticatorShared/Core/Auth/Services/API/Account/Fixtures/APITestData+Account.swift +++ b/AuthenticatorShared/Core/Auth/Services/API/Account/Fixtures/APITestData+Account.swift @@ -5,7 +5,7 @@ extension APITestData { // MARK: Account Revision Date static func accountRevisionDate( // swiftlint:disable:this type_contents_order - _ date: Date = Date(timeIntervalSince1970: 1_704_067_200) + _ date: Date = Date(timeIntervalSince1970: 1_704_067_200), ) -> APITestData { APITestData(data: Data(String(date.timeIntervalSince1970 * 1000).utf8)) } diff --git a/AuthenticatorShared/Core/Auth/Services/Biometrics/BiometricsRepository.swift b/AuthenticatorShared/Core/Auth/Services/Biometrics/BiometricsRepository.swift index 9944655384..b2868a1e07 100644 --- a/AuthenticatorShared/Core/Auth/Services/Biometrics/BiometricsRepository.swift +++ b/AuthenticatorShared/Core/Auth/Services/Biometrics/BiometricsRepository.swift @@ -78,7 +78,7 @@ class DefaultBiometricsRepository: BiometricsRepository { init( biometricsService: BiometricsService, keychainService: KeychainRepository, - stateService: StateService + stateService: StateService, ) { self.biometricsService = biometricsService keychainRepository = keychainService @@ -117,7 +117,7 @@ class DefaultBiometricsRepository: BiometricsRepository { return .available( type, enabled: hasEnabledBiometricUnlock, - hasValidIntegrity: hasValidIntegrityState + hasValidIntegrity: hasValidIntegrityState, ) case .denied, .lockedOut, diff --git a/AuthenticatorShared/Core/Auth/Services/Biometrics/BiometricsService.swift b/AuthenticatorShared/Core/Auth/Services/Biometrics/BiometricsService.swift index 6247078890..ebdf86a125 100644 --- a/AuthenticatorShared/Core/Auth/Services/Biometrics/BiometricsService.swift +++ b/AuthenticatorShared/Core/Auth/Services/Biometrics/BiometricsService.swift @@ -15,7 +15,7 @@ protocol BiometricsService: AnyObject { /// func evaluateBiometricPolicy( _ suppliedContext: LAContext?, - for biometricAuthStatus: BiometricAuthorizationStatus + for biometricAuthStatus: BiometricAuthorizationStatus, ) async -> Bool /// Returns the status for device BiometricAuthenticationType. @@ -51,7 +51,7 @@ extension BiometricsService { class DefaultBiometricsService: BiometricsService { func evaluateBiometricPolicy( _ suppliedContext: LAContext?, - for biometricAuthStatus: BiometricAuthorizationStatus + for biometricAuthStatus: BiometricAuthorizationStatus, ) async -> Bool { // First check if the existing status can be evaluated. guard case .authorized = biometricAuthStatus else { @@ -65,7 +65,7 @@ class DefaultBiometricsService: BiometricsService { do { let result = try await authContext.evaluatePolicy( .deviceOwnerAuthenticationWithBiometrics, - localizedReason: Localizations.useBiometricsToUnlock + localizedReason: Localizations.useBiometricsToUnlock, ) return result } catch { @@ -133,7 +133,7 @@ class DefaultBiometricsService: BiometricsService { /// func errorStatus( biometricAuthType: BiometricAuthenticationType?, - error: Error + error: Error, ) -> BiometricAuthorizationStatus { guard let biometricAuthType else { // Biometrics are not available on the device. diff --git a/AuthenticatorShared/Core/Auth/Services/Biometrics/TestHelpers/MockBiometricsService.swift b/AuthenticatorShared/Core/Auth/Services/Biometrics/TestHelpers/MockBiometricsService.swift index 521bb99de2..77d2dce547 100644 --- a/AuthenticatorShared/Core/Auth/Services/Biometrics/TestHelpers/MockBiometricsService.swift +++ b/AuthenticatorShared/Core/Auth/Services/Biometrics/TestHelpers/MockBiometricsService.swift @@ -10,7 +10,7 @@ class MockBiometricsService: BiometricsService { func evaluateBiometricPolicy( _ suppliedContext: LAContext?, - for biometricAuthStatus: BiometricAuthorizationStatus + for biometricAuthStatus: BiometricAuthorizationStatus, ) async -> Bool { evaluationResult } diff --git a/AuthenticatorShared/Core/Auth/Services/ClientFido2Service.swift b/AuthenticatorShared/Core/Auth/Services/ClientFido2Service.swift index afc10e0346..e5135de96a 100644 --- a/AuthenticatorShared/Core/Auth/Services/ClientFido2Service.swift +++ b/AuthenticatorShared/Core/Auth/Services/ClientFido2Service.swift @@ -12,7 +12,7 @@ protocol ClientFido2Service: AnyObject { /// - Returns: Returns the `ClientFido2Authenticator` to perform Fido2 authenticator tasks func authenticator( userInterface: Fido2UserInterface, - credentialStore: Fido2CredentialStore + credentialStore: Fido2CredentialStore, ) -> ClientFido2AuthenticatorProtocol /// Returns the `ClientFido2Client` to perform Fido2 client tasks. @@ -22,7 +22,7 @@ protocol ClientFido2Service: AnyObject { /// - Returns: Returns the `ClientFido2Client` to perform Fido2 client tasks func client( userInterface: Fido2UserInterface, - credentialStore: Fido2CredentialStore + credentialStore: Fido2CredentialStore, ) -> ClientFido2ClientProtocol /// Decrypts the `CipherView` Fido2 credentials but returning an array of `Fido2CredentialAutofillView` @@ -36,14 +36,14 @@ protocol ClientFido2Service: AnyObject { extension ClientFido2: ClientFido2Service { func authenticator( userInterface: Fido2UserInterface, - credentialStore: Fido2CredentialStore + credentialStore: Fido2CredentialStore, ) -> ClientFido2AuthenticatorProtocol { authenticator(userInterface: userInterface, credentialStore: credentialStore) as ClientFido2Authenticator } func client( userInterface: Fido2UserInterface, - credentialStore: Fido2CredentialStore + credentialStore: Fido2CredentialStore, ) -> ClientFido2ClientProtocol { client(userInterface: userInterface, credentialStore: credentialStore) as ClientFido2Client } diff --git a/AuthenticatorShared/Core/Auth/Services/KeychainRepository.swift b/AuthenticatorShared/Core/Auth/Services/KeychainRepository.swift index 2bfe52a15f..e031680a5e 100644 --- a/AuthenticatorShared/Core/Auth/Services/KeychainRepository.swift +++ b/AuthenticatorShared/Core/Auth/Services/KeychainRepository.swift @@ -115,7 +115,7 @@ class DefaultKeychainRepository: KeychainRepository { init( appIdService: AppIdService, - keychainService: KeychainService + keychainService: KeychainService, ) { self.appIdService = appIdService self.keychainService = keychainService @@ -146,8 +146,8 @@ class DefaultKeychainRepository: KeychainRepository { kSecMatchLimit: kSecMatchLimitOne, kSecReturnData: true, kSecReturnAttributes: true, - ] - ) + ], + ), ) if let resultDictionary = foundItem as? [String: Any], @@ -168,7 +168,7 @@ class DefaultKeychainRepository: KeychainRepository { /// func keychainQueryValues( for item: KeychainItem, - adding additionalPairs: [CFString: Any] = [:] + adding additionalPairs: [CFString: Any] = [:], ) async -> CFDictionary { // Prepare a formatted `kSecAttrAccount` value. let formattedSecAttrAccount = await formattedKey(for: item) @@ -197,14 +197,14 @@ class DefaultKeychainRepository: KeychainRepository { /// func setValue(_ value: String, for item: KeychainItem) async throws { let accessControl = try keychainService.accessControl( - for: item.protection ?? [] + for: item.protection ?? [], ) let query = await keychainQueryValues( for: item, adding: [ kSecAttrAccessControl: accessControl as Any, kSecValueData: Data(value.utf8), - ] + ], ) // Delete the previous secret, if it exists, @@ -213,7 +213,7 @@ class DefaultKeychainRepository: KeychainRepository { // Add the new key. try keychainService.add( - attributes: query + attributes: query, ) } } @@ -221,7 +221,7 @@ class DefaultKeychainRepository: KeychainRepository { extension DefaultKeychainRepository { func deleteUserAuthKey(for item: KeychainItem) async throws { try await keychainService.delete( - query: keychainQueryValues(for: item) + query: keychainQueryValues(for: item), ) } diff --git a/AuthenticatorShared/Core/Auth/Services/KeychainService.swift b/AuthenticatorShared/Core/Auth/Services/KeychainService.swift index 38bd7492bd..820ad534b9 100644 --- a/AuthenticatorShared/Core/Auth/Services/KeychainService.swift +++ b/AuthenticatorShared/Core/Auth/Services/KeychainService.swift @@ -13,7 +13,7 @@ protocol KeychainService: AnyObject { /// - Returns: The SecAccessControl. /// func accessControl( - for flags: SecAccessControlCreateFlags + for flags: SecAccessControlCreateFlags, ) throws -> SecAccessControl /// Adds a set of attributes. @@ -64,14 +64,14 @@ class DefaultKeychainService: KeychainService { // MARK: Methods func accessControl( - for flags: SecAccessControlCreateFlags + for flags: SecAccessControlCreateFlags, ) throws -> SecAccessControl { var error: Unmanaged? let accessControl = SecAccessControlCreateWithFlags( nil, kSecAttrAccessibleWhenUnlockedThisDeviceOnly, flags, - &error + &error, ) guard let accessControl, diff --git a/AuthenticatorShared/Core/Auth/Services/TestHelpers/BitwardenSdk+AuthFixtures.swift b/AuthenticatorShared/Core/Auth/Services/TestHelpers/BitwardenSdk+AuthFixtures.swift index 932cdf0505..f01102418a 100644 --- a/AuthenticatorShared/Core/Auth/Services/TestHelpers/BitwardenSdk+AuthFixtures.swift +++ b/AuthenticatorShared/Core/Auth/Services/TestHelpers/BitwardenSdk+AuthFixtures.swift @@ -10,13 +10,13 @@ extension BitwardenSdk.AuthenticatorAssertionResponse { clientDataJson: Data = Data(capacity: 37), authenticatorData: Data = Data(capacity: 37), signature: Data = Data(capacity: 64), - userHandle: Data = Data(capacity: 64) + userHandle: Data = Data(capacity: 64), ) -> BitwardenSdk.AuthenticatorAssertionResponse { .init( clientDataJson: clientDataJson, authenticatorData: authenticatorData, signature: signature, - userHandle: userHandle + userHandle: userHandle, ) } } @@ -28,7 +28,7 @@ extension BitwardenSdk.AuthenticatorAttestationResponse { publicKey: Data? = nil, publicKeyAlgorithm: Int64 = -7, attestationObject: Data = Data(capacity: 64), - transports: [String]? = nil + transports: [String]? = nil, ) -> BitwardenSdk.AuthenticatorAttestationResponse { .init( clientDataJson: clientDataJson, @@ -36,14 +36,14 @@ extension BitwardenSdk.AuthenticatorAttestationResponse { publicKey: publicKey, publicKeyAlgorithm: publicKeyAlgorithm, attestationObject: attestationObject, - transports: transports + transports: transports, ) } } extension BitwardenSdk.ClientExtensionResults { static func fixture( - credProps: BitwardenSdk.CredPropsResult? = nil + credProps: BitwardenSdk.CredPropsResult? = nil, ) -> BitwardenSdk.ClientExtensionResults { .init(credProps: credProps) } @@ -55,14 +55,14 @@ extension BitwardenSdk.GetAssertionResult { authenticatorData: Data = Data(capacity: 37), signature: Data = Data(capacity: 64), userHandle: Data = Data(capacity: 64), - selectedCredential: SelectedCredential = .fixture() + selectedCredential: SelectedCredential = .fixture(), ) -> BitwardenSdk.GetAssertionResult { .init( credentialId: credentialId, authenticatorData: authenticatorData, signature: signature, userHandle: userHandle, - selectedCredential: selectedCredential + selectedCredential: selectedCredential, ) } } @@ -71,12 +71,12 @@ extension BitwardenSdk.MakeCredentialResult { static func fixture( authenticatorData: Data = Data(capacity: 37), attestationObject: Data = Data(capacity: 37), - credentialId: Data = Data(capacity: 16) + credentialId: Data = Data(capacity: 16), ) -> BitwardenSdk.MakeCredentialResult { .init( authenticatorData: authenticatorData, attestationObject: attestationObject, - credentialId: credentialId + credentialId: credentialId, ) } } @@ -89,7 +89,7 @@ extension BitwardenSdk.PublicKeyCredentialAuthenticatorAssertionResponse { authenticatorAttachment: String? = nil, clientExtensionResults: ClientExtensionResults = .fixture(), response: AuthenticatorAssertionResponse = .fixture(), - selectedCredential: SelectedCredential = .fixture() + selectedCredential: SelectedCredential = .fixture(), ) -> BitwardenSdk.PublicKeyCredentialAuthenticatorAssertionResponse { .init( id: id, @@ -98,7 +98,7 @@ extension BitwardenSdk.PublicKeyCredentialAuthenticatorAssertionResponse { authenticatorAttachment: authenticatorAttachment, clientExtensionResults: clientExtensionResults, response: response, - selectedCredential: selectedCredential + selectedCredential: selectedCredential, ) } } @@ -111,7 +111,7 @@ extension BitwardenSdk.PublicKeyCredentialAuthenticatorAttestationResponse { authenticatorAttachment: String? = nil, clientExtensionResults: ClientExtensionResults = .fixture(), response: AuthenticatorAttestationResponse = .fixture(), - selectedCredential: SelectedCredential = .fixture() + selectedCredential: SelectedCredential = .fixture(), ) -> BitwardenSdk.PublicKeyCredentialAuthenticatorAttestationResponse { .init( id: id, @@ -120,7 +120,7 @@ extension BitwardenSdk.PublicKeyCredentialAuthenticatorAttestationResponse { authenticatorAttachment: authenticatorAttachment, clientExtensionResults: clientExtensionResults, response: response, - selectedCredential: selectedCredential + selectedCredential: selectedCredential, ) } } @@ -128,7 +128,7 @@ extension BitwardenSdk.PublicKeyCredentialAuthenticatorAttestationResponse { extension BitwardenSdk.SelectedCredential { static func fixture( cipherView: CipherView = .fixture(), - credential: Fido2CredentialView = .fixture() + credential: Fido2CredentialView = .fixture(), ) -> BitwardenSdk.SelectedCredential { .init(cipher: .fixture(), credential: .fixture()) } @@ -143,7 +143,7 @@ extension BitwardenSdk.Fido2CredentialAutofillView { rpId: String = defaultRpId, userNameForUi: String? = nil, userHandle: Data = Data(capacity: 64), - hasCounter: Bool = false + hasCounter: Bool = false, ) -> BitwardenSdk.Fido2CredentialAutofillView { .init( credentialId: credentialId, @@ -151,7 +151,7 @@ extension BitwardenSdk.Fido2CredentialAutofillView { rpId: rpId, userNameForUi: userNameForUi, userHandle: userHandle, - hasCounter: hasCounter + hasCounter: hasCounter, ) } } @@ -170,7 +170,7 @@ extension BitwardenSdk.Fido2CredentialNewView { counter: String = "0", rpName: String? = nil, userDisplayName: String? = nil, - creationDate: DateTime = DateTime.distantPast + creationDate: DateTime = DateTime.distantPast, ) -> BitwardenSdk.Fido2CredentialNewView { .init( credentialId: credentialId, @@ -183,7 +183,7 @@ extension BitwardenSdk.Fido2CredentialNewView { counter: counter, rpName: rpName, userDisplayName: userDisplayName, - creationDate: creationDate + creationDate: creationDate, ) } } diff --git a/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockAuthClient.swift b/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockAuthClient.swift index eeba5ec68a..430e8fab39 100644 --- a/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockAuthClient.swift +++ b/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockAuthClient.swift @@ -18,8 +18,8 @@ class MockAuthClient: AuthClientProtocol { KeyConnectorResponse( masterKey: "masterKey", encryptedUserKey: "encryptedUserKey", - keys: RsaKeyPair(public: "public", private: "private") - ) + keys: RsaKeyPair(public: "public", private: "private"), + ), ) var makeRegisterKeysEmail: String? @@ -28,7 +28,7 @@ class MockAuthClient: AuthClientProtocol { var makeRegisterKeysResult: Result = .success(RegisterKeyResponse( masterPasswordHash: "masterPasswordHash", encryptedUserKey: "encryptedUserKey", - keys: RsaKeyPair(public: "public", private: "private") + keys: RsaKeyPair(public: "public", private: "private"), )) var makeRegisterTdeKeysEmail: String? @@ -43,9 +43,9 @@ class MockAuthClient: AuthClientProtocol { deviceKey: "deviceKey", protectedUserKey: "protectedUserKey", protectedDevicePrivateKey: "protectedDevicePrivateKey", - protectedDevicePublicKey: "protectedDevicePublicKey" - ) - ) + protectedDevicePublicKey: "protectedDevicePublicKey", + ), + ), ) var newAuthRequestEmail: String? @@ -54,8 +54,8 @@ class MockAuthClient: AuthClientProtocol { privateKey: "private", publicKey: "public", fingerprint: "fingerprint", - accessCode: "12345" - ) + accessCode: "12345", + ), ) var passwordStrengthResult = UInt8(2) var passwordStrengthPassword: String? @@ -82,8 +82,8 @@ class MockAuthClient: AuthClientProtocol { deviceKey: "DEVICE_KEY", protectedUserKey: "USER_KEY", protectedDevicePrivateKey: "DEVICE_PRIVATE_KEY", - protectedDevicePublicKey: "DEVICE_PUBLIC_KEY" - ) + protectedDevicePublicKey: "DEVICE_PUBLIC_KEY", + ), ) func approveAuthRequest(publicKey: String) throws -> UnsignedSharedKey { @@ -116,7 +116,7 @@ class MockAuthClient: AuthClientProtocol { func makeRegisterTdeKeys( email: String, orgPublicKey: String, - rememberDevice: Bool + rememberDevice: Bool, ) throws -> BitwardenSdk.RegisterTdeKeyResponse { makeRegisterTdeKeysEmail = email makeRegisterTdeKeysOrgPublicKey = orgPublicKey diff --git a/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockClientFido2Client.swift b/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockClientFido2Client.swift index fc665bc525..b23b3e1b3d 100644 --- a/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockClientFido2Client.swift +++ b/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockClientFido2Client.swift @@ -4,16 +4,16 @@ import BitwardenSdk class MockClientFido2Client: ClientFido2ClientProtocol { var authenticateResult: Result = .success( - .fixture() + .fixture(), ) var register: Result = .success( - .fixture() + .fixture(), ) func authenticate( origin: BitwardenSdk.Origin, request: String, - clientData: BitwardenSdk.ClientData + clientData: BitwardenSdk.ClientData, ) async throws -> BitwardenSdk.PublicKeyCredentialAuthenticatorAssertionResponse { try authenticateResult.get() } @@ -21,7 +21,7 @@ class MockClientFido2Client: ClientFido2ClientProtocol { func register( origin: BitwardenSdk.Origin, request: String, - clientData: BitwardenSdk.ClientData + clientData: BitwardenSdk.ClientData, ) async throws -> BitwardenSdk.PublicKeyCredentialAuthenticatorAttestationResponse { try register.get() } diff --git a/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockClientFido2Service.swift b/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockClientFido2Service.swift index 1abd5795d2..da3df07806 100644 --- a/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockClientFido2Service.swift +++ b/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockClientFido2Service.swift @@ -12,14 +12,14 @@ class MockClientFido2Service: ClientFido2Service { func authenticator( userInterface: any BitwardenSdk.Fido2UserInterface, - credentialStore: any BitwardenSdk.Fido2CredentialStore + credentialStore: any BitwardenSdk.Fido2CredentialStore, ) -> BitwardenSdk.ClientFido2AuthenticatorProtocol { clientFido2AuthenticatorMock } func client( userInterface: any BitwardenSdk.Fido2UserInterface, - credentialStore: any BitwardenSdk.Fido2CredentialStore + credentialStore: any BitwardenSdk.Fido2CredentialStore, ) -> BitwardenSdk.ClientFido2ClientProtocol { clientFido2ClientMock } diff --git a/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockCryptoClient.swift b/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockCryptoClient.swift index bbec3f1665..86cbc118a5 100644 --- a/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockCryptoClient.swift +++ b/AuthenticatorShared/Core/Auth/Services/TestHelpers/MockCryptoClient.swift @@ -9,7 +9,7 @@ class MockCryptoClient: CryptoClientProtocol { var derivePinKeyPin: String? var derivePinUserKey: String? var derivePinKeyResult: Result = .success( - DerivePinKeyResponse(pinProtectedUserKey: "", encryptedPin: "") + DerivePinKeyResponse(pinProtectedUserKey: "", encryptedPin: ""), ) var derivePinUserKeyPin: String? @@ -24,16 +24,16 @@ class MockCryptoClient: CryptoClientProtocol { var enrollPinResult: Result = .success( EnrollPinResponse( pinProtectedUserKeyEnvelope: "pinProtectedUserKeyEnvelope", - userKeyEncryptedPin: "userKeyEncryptedPin" - ) + userKeyEncryptedPin: "userKeyEncryptedPin", + ), ) var enrollPinWithEncryptedPinEncryptedPin: String? var enrollPinWithEncryptedPinResult: Result = .success( EnrollPinResponse( pinProtectedUserKeyEnvelope: "pinProtectedUserKeyEnvelope", - userKeyEncryptedPin: "userKeyEncryptedPin" - ) + userKeyEncryptedPin: "userKeyEncryptedPin", + ), ) var getUserEncryptionKeyResult: Result = .success("USER_ENCRYPTION_KEY") @@ -51,27 +51,27 @@ class MockCryptoClient: CryptoClientProtocol { masterPasswordAuthenticationData: MasterPasswordAuthenticationData( kdf: .pbkdf2(iterations: NonZeroU32(600_000)), salt: "AUTHENTICATION_SALT", - masterPasswordAuthenticationHash: "MASTER_PASSWORD_AUTHENTICATION_HASH" + masterPasswordAuthenticationHash: "MASTER_PASSWORD_AUTHENTICATION_HASH", ), masterPasswordUnlockData: MasterPasswordUnlockData( kdf: .pbkdf2(iterations: NonZeroU32(600_000)), masterKeyWrappedUserKey: "MASTER_KEY_WRAPPED_USER_KEY", - salt: "UNLOCK_SALT" + salt: "UNLOCK_SALT", ), oldMasterPasswordAuthenticationData: MasterPasswordAuthenticationData( kdf: .pbkdf2(iterations: NonZeroU32(600_000)), salt: "OLD_AUTHENTICATION_SALT", - masterPasswordAuthenticationHash: "MASTER_PASSWORD_AUTHENTICATION_HASH" - ) - ) + masterPasswordAuthenticationHash: "MASTER_PASSWORD_AUTHENTICATION_HASH", + ), + ), ) var updatePasswordNewPassword: String? var updatePasswordResult: Result = .success( UpdatePasswordResponse( passwordHash: "password hash", - newKey: "new key" - ) + newKey: "new key", + ), ) func deriveKeyConnector(request: DeriveKeyConnectorRequest) throws -> String { diff --git a/AuthenticatorShared/Core/Platform/Extentions/FileManager+Extensions.swift b/AuthenticatorShared/Core/Platform/Extentions/FileManager+Extensions.swift index c27849a68c..795e684f7d 100644 --- a/AuthenticatorShared/Core/Platform/Extentions/FileManager+Extensions.swift +++ b/AuthenticatorShared/Core/Platform/Extentions/FileManager+Extensions.swift @@ -10,7 +10,7 @@ extension FileManager { for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, - create: true + create: true, ) .appendingPathComponent("Exports", isDirectory: true) } diff --git a/AuthenticatorShared/Core/Platform/Models/Domain/CameraAuthorizationStatus.swift b/AuthenticatorShared/Core/Platform/Models/Domain/CameraAuthorizationStatus.swift index 3004b36faa..90ec97f5ea 100644 --- a/AuthenticatorShared/Core/Platform/Models/Domain/CameraAuthorizationStatus.swift +++ b/AuthenticatorShared/Core/Platform/Models/Domain/CameraAuthorizationStatus.swift @@ -30,7 +30,7 @@ extension CameraAuthorizationStatus { self = .restricted @unknown default: Logger.application.warning( - "Unhandled AVAuthorizationStatus detected: \(String(describing: avAuthorizationStatus))" + "Unhandled AVAuthorizationStatus detected: \(String(describing: avAuthorizationStatus))", ) self = .denied } diff --git a/AuthenticatorShared/Core/Platform/Models/Enum/DefaultSaveOptionTests.swift b/AuthenticatorShared/Core/Platform/Models/Enum/DefaultSaveOptionTests.swift index 3ee1b955b8..152e2608a3 100644 --- a/AuthenticatorShared/Core/Platform/Models/Enum/DefaultSaveOptionTests.swift +++ b/AuthenticatorShared/Core/Platform/Models/Enum/DefaultSaveOptionTests.swift @@ -14,7 +14,7 @@ class DefaultSaveOptionTests: BitwardenTestCase { .saveToBitwarden, .saveHere, .none, - ] + ], ) } diff --git a/AuthenticatorShared/Core/Platform/Models/Enum/SessionTimeoutValueTests.swift b/AuthenticatorShared/Core/Platform/Models/Enum/SessionTimeoutValueTests.swift index 794a8f9a9a..7477c8f539 100644 --- a/AuthenticatorShared/Core/Platform/Models/Enum/SessionTimeoutValueTests.swift +++ b/AuthenticatorShared/Core/Platform/Models/Enum/SessionTimeoutValueTests.swift @@ -21,7 +21,7 @@ final class SessionTimeoutValueTests: BitwardenTestCase { .fourHours, .onAppRestart, .never, - ] + ], ) } diff --git a/AuthenticatorShared/Core/Platform/Services/API/APIService.swift b/AuthenticatorShared/Core/Platform/Services/API/APIService.swift index d21f5b90a5..e75cbd5029 100644 --- a/AuthenticatorShared/Core/Platform/Services/API/APIService.swift +++ b/AuthenticatorShared/Core/Platform/Services/API/APIService.swift @@ -33,7 +33,7 @@ class APIService { /// init( client: HTTPClient = URLSession.shared, - environmentService: EnvironmentService + environmentService: EnvironmentService, ) { self.client = client @@ -41,14 +41,14 @@ class APIService { appName: "Bitwarden_Authenticator_Mobile", appVersion: Bundle.main.appVersion, buildNumber: Bundle.main.buildNumber, - systemDevice: UIDevice.current + systemDevice: UIDevice.current, ) apiUnauthenticatedService = HTTPService( baseURLGetter: { environmentService.apiURL }, client: client, requestHandlers: [defaultHeadersRequestHandler], - responseHandlers: [responseValidationHandler] + responseHandlers: [responseValidationHandler], ) } } diff --git a/AuthenticatorShared/Core/Platform/Services/API/APIServiceTests.swift b/AuthenticatorShared/Core/Platform/Services/API/APIServiceTests.swift index c988979f7f..255baf3a43 100644 --- a/AuthenticatorShared/Core/Platform/Services/API/APIServiceTests.swift +++ b/AuthenticatorShared/Core/Platform/Services/API/APIServiceTests.swift @@ -27,7 +27,7 @@ class APIServiceTests: BitwardenTestCase { let apiUnauthenticatedServiceBaseURL = subject.apiUnauthenticatedService.baseURL XCTAssertEqual(apiUnauthenticatedServiceBaseURL, URL(string: "https://example.com/api")!) XCTAssertTrue( - subject.apiUnauthenticatedService.requestHandlers.contains(where: { $0 is DefaultHeadersRequestHandler }) + subject.apiUnauthenticatedService.requestHandlers.contains(where: { $0 is DefaultHeadersRequestHandler }), ) XCTAssertNil(subject.apiUnauthenticatedService.tokenProvider) } diff --git a/AuthenticatorShared/Core/Platform/Services/API/TestHelpers/APIService+Mocks.swift b/AuthenticatorShared/Core/Platform/Services/API/TestHelpers/APIService+Mocks.swift index b4b622899b..e8f9df2334 100644 --- a/AuthenticatorShared/Core/Platform/Services/API/TestHelpers/APIService+Mocks.swift +++ b/AuthenticatorShared/Core/Platform/Services/API/TestHelpers/APIService+Mocks.swift @@ -6,11 +6,11 @@ import Networking extension APIService { convenience init( - client: HTTPClient + client: HTTPClient, ) { self.init( client: client, - environmentService: MockEnvironmentService() + environmentService: MockEnvironmentService(), ) } } diff --git a/AuthenticatorShared/Core/Platform/Services/CameraService.swift b/AuthenticatorShared/Core/Platform/Services/CameraService.swift index 789b29e389..f2a015ccaf 100644 --- a/AuthenticatorShared/Core/Platform/Services/CameraService.swift +++ b/AuthenticatorShared/Core/Platform/Services/CameraService.swift @@ -101,7 +101,7 @@ class DefaultCameraService: NSObject { extension DefaultCameraService: CameraService { func checkStatus() -> CameraAuthorizationStatus { CameraAuthorizationStatus( - avAuthorizationStatus: AVCaptureDevice.authorizationStatus(for: .video) + avAuthorizationStatus: AVCaptureDevice.authorizationStatus(for: .video), ) } @@ -133,7 +133,7 @@ extension DefaultCameraService: CameraService { let videoDevices = AVCaptureDevice.DiscoverySession( deviceTypes: acceptedDevices, mediaType: .video, - position: .unspecified + position: .unspecified, ).devices return !videoDevices.isEmpty @@ -191,7 +191,7 @@ extension DefaultCameraService: AVCaptureMetadataOutputObjectsDelegate { func metadataOutput( _ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], - from connection: AVCaptureConnection + from connection: AVCaptureConnection, ) { for metadata in metadataObjects { if let readableObject = metadata as? AVMetadataMachineReadableCodeObject, diff --git a/AuthenticatorShared/Core/Platform/Services/ClientService.swift b/AuthenticatorShared/Core/Platform/Services/ClientService.swift index a022b9069a..32dbbf9126 100644 --- a/AuthenticatorShared/Core/Platform/Services/ClientService.swift +++ b/AuthenticatorShared/Core/Platform/Services/ClientService.swift @@ -169,7 +169,7 @@ actor DefaultClientService: ClientService { configService: ConfigService, errorReporter: ErrorReporter, settings: ClientSettings? = nil, - stateService: StateService + stateService: StateService, ) { self.clientBuilder = clientBuilder self.configService = configService diff --git a/AuthenticatorShared/Core/Platform/Services/EnvironmentService.swift b/AuthenticatorShared/Core/Platform/Services/EnvironmentService.swift index 071a053478..4502ccb7a5 100644 --- a/AuthenticatorShared/Core/Platform/Services/EnvironmentService.swift +++ b/AuthenticatorShared/Core/Platform/Services/EnvironmentService.swift @@ -63,11 +63,11 @@ extension DefaultEnvironmentService { var region: RegionType { if environmentURLs.baseURL == EnvironmentURLData.defaultUS.base { - return .unitedStates + .unitedStates } else if environmentURLs.baseURL == EnvironmentURLData.defaultEU.base { - return .europe + .europe } else { - return .selfHosted + .selfHosted } } diff --git a/AuthenticatorShared/Core/Platform/Services/ErrorReporter/BitwardenError.swift b/AuthenticatorShared/Core/Platform/Services/ErrorReporter/BitwardenError.swift index e2de3d1206..bc538b799a 100644 --- a/AuthenticatorShared/Core/Platform/Services/ErrorReporter/BitwardenError.swift +++ b/AuthenticatorShared/Core/Platform/Services/ErrorReporter/BitwardenError.swift @@ -33,7 +33,7 @@ enum BitwardenError { code: Code.dataError.rawValue, userInfo: [ "ErrorMessage": message, - ] + ], ) } @@ -47,7 +47,7 @@ enum BitwardenError { code: Code.generatorOptionsError.rawValue, userInfo: [ NSUnderlyingErrorKey: error, - ] + ], ) } @@ -61,7 +61,7 @@ enum BitwardenError { code: Code.logoutError.rawValue, userInfo: [ NSUnderlyingErrorKey: error, - ] + ], ) } } diff --git a/AuthenticatorShared/Core/Platform/Services/MigrationService.swift b/AuthenticatorShared/Core/Platform/Services/MigrationService.swift index 93734b92ea..f0708bab83 100644 --- a/AuthenticatorShared/Core/Platform/Services/MigrationService.swift +++ b/AuthenticatorShared/Core/Platform/Services/MigrationService.swift @@ -39,7 +39,7 @@ class DefaultMigrationService { init( appSettingsStore: AppSettingsStore, errorReporter: ErrorReporter, - keychainRepository: KeychainRepository + keychainRepository: KeychainRepository, ) { self.appSettingsStore = appSettingsStore self.errorReporter = errorReporter diff --git a/AuthenticatorShared/Core/Platform/Services/NotificationCenterServiceTests.swift b/AuthenticatorShared/Core/Platform/Services/NotificationCenterServiceTests.swift index 4cd636d08a..b85055091a 100644 --- a/AuthenticatorShared/Core/Platform/Services/NotificationCenterServiceTests.swift +++ b/AuthenticatorShared/Core/Platform/Services/NotificationCenterServiceTests.swift @@ -32,7 +32,7 @@ final class NotificationCenterServiceTests: BitwardenTestCase { notificationCenter.post( name: UIApplication.didEnterBackgroundNotification, - object: nil + object: nil, ) wait(for: [expectation], timeout: 1) @@ -49,7 +49,7 @@ final class NotificationCenterServiceTests: BitwardenTestCase { notificationCenter.post( name: UIApplication.willEnterForegroundNotification, - object: nil + object: nil, ) wait(for: [expectation], timeout: 1) diff --git a/AuthenticatorShared/Core/Platform/Services/PasteboardService.swift b/AuthenticatorShared/Core/Platform/Services/PasteboardService.swift index 5df0df4fa6..f6dc806b52 100644 --- a/AuthenticatorShared/Core/Platform/Services/PasteboardService.swift +++ b/AuthenticatorShared/Core/Platform/Services/PasteboardService.swift @@ -48,7 +48,7 @@ class DefaultPasteboardService: PasteboardService { /// init( errorReporter: ErrorReporter, - pasteboard: UIPasteboard = .general + pasteboard: UIPasteboard = .general, ) { self.errorReporter = errorReporter self.pasteboard = pasteboard @@ -61,7 +61,7 @@ class DefaultPasteboardService: PasteboardService { if clearClipboardValue == .never { pasteboard.setItems( [[UTType.utf8PlainText.identifier: string]], - options: [.localOnly: true] + options: [.localOnly: true], ) } else { // Set the expiration date if the clear clipboard preference is not never. @@ -71,7 +71,7 @@ class DefaultPasteboardService: PasteboardService { options: [ .localOnly: true, .expirationDate: expirationDate, - ] + ], ) } } diff --git a/AuthenticatorShared/Core/Platform/Services/ServiceContainer.swift b/AuthenticatorShared/Core/Platform/Services/ServiceContainer.swift index d5397764c1..9e642d320c 100644 --- a/AuthenticatorShared/Core/Platform/Services/ServiceContainer.swift +++ b/AuthenticatorShared/Core/Platform/Services/ServiceContainer.swift @@ -119,7 +119,7 @@ public class ServiceContainer: Services { pasteboardService: PasteboardService, stateService: StateService, timeProvider: TimeProvider, - totpService: TOTPService + totpService: TOTPService, ) { self.application = application self.appInfoService = appInfoService @@ -150,10 +150,10 @@ public class ServiceContainer: Services { /// public convenience init( // swiftlint:disable:this function_body_length application: Application, - errorReporter: ErrorReporter + errorReporter: ErrorReporter, ) { let appSettingsStore = DefaultAppSettingsStore( - userDefaults: UserDefaults(suiteName: Bundle.main.groupIdentifier)! + userDefaults: UserDefaults(suiteName: Bundle.main.groupIdentifier)!, ) let appIdService = AppIdService(appSettingStore: appSettingsStore) @@ -166,18 +166,18 @@ public class ServiceContainer: Services { let keychainRepository = DefaultKeychainRepository( appIdService: appIdService, - keychainService: keychainService + keychainService: keychainService, ) let stateService = DefaultStateService( appSettingsStore: appSettingsStore, - dataStore: dataStore + dataStore: dataStore, ) let environmentService = DefaultEnvironmentService() let apiService = APIService( - environmentService: environmentService + environmentService: environmentService, ) let timeProvider = CurrentTime() @@ -185,7 +185,7 @@ public class ServiceContainer: Services { let biometricsRepository = DefaultBiometricsRepository( biometricsService: biometricsService, keychainService: keychainRepository, - stateService: stateService + stateService: stateService, ) let configService = DefaultConfigService( @@ -193,7 +193,7 @@ public class ServiceContainer: Services { configApiService: apiService, errorReporter: errorReporter, stateService: stateService, - timeProvider: timeProvider + timeProvider: timeProvider, ) let clientBuilder = DefaultClientBuilder(errorReporter: errorReporter) @@ -201,21 +201,21 @@ public class ServiceContainer: Services { clientBuilder: clientBuilder, configService: configService, errorReporter: errorReporter, - stateService: stateService + stateService: stateService, ) let cryptographyKeyService = CryptographyKeyService( - stateService: stateService + stateService: stateService, ) let cryptographyService = DefaultCryptographyService( - cryptographyKeyService: cryptographyKeyService + cryptographyKeyService: cryptographyKeyService, ) let migrationService = DefaultMigrationService( appSettingsStore: appSettingsStore, errorReporter: errorReporter, - keychainRepository: keychainRepository + keychainRepository: keychainRepository, ) let notificationCenterService = DefaultNotificationCenterService() @@ -223,46 +223,46 @@ public class ServiceContainer: Services { let totpService = DefaultTOTPService( clientService: clientService, errorReporter: errorReporter, - timeProvider: timeProvider + timeProvider: timeProvider, ) let pasteboardService = DefaultPasteboardService( - errorReporter: errorReporter + errorReporter: errorReporter, ) let authenticatorItemService = DefaultAuthenticatorItemService( - authenticatorItemDataStore: dataStore + authenticatorItemDataStore: dataStore, ) let sharedKeychainStorage = DefaultSharedKeychainStorage( keychainService: keychainService, - sharedAppGroupIdentifier: Bundle.main.sharedAppGroupIdentifier + sharedAppGroupIdentifier: Bundle.main.sharedAppGroupIdentifier, ) let sharedKeychainRepository = DefaultSharedKeychainRepository( - storage: sharedKeychainStorage + storage: sharedKeychainStorage, ) let sharedCryptographyService = DefaultAuthenticatorCryptographyService( - sharedKeychainRepository: sharedKeychainRepository + sharedKeychainRepository: sharedKeychainRepository, ) let sharedDataStore = AuthenticatorBridgeDataStore( errorReporter: errorReporter, groupIdentifier: Bundle.main.sharedAppGroupIdentifier, - storeType: .persisted + storeType: .persisted, ) let sharedTimeoutService = DefaultSharedTimeoutService( sharedKeychainRepository: sharedKeychainRepository, - timeProvider: timeProvider + timeProvider: timeProvider, ) let sharedItemService = DefaultAuthenticatorBridgeItemService( cryptoService: sharedCryptographyService, dataStore: sharedDataStore, sharedKeychainRepository: sharedKeychainRepository, - sharedTimeoutService: sharedTimeoutService + sharedTimeoutService: sharedTimeoutService, ) let authenticatorItemRepository = DefaultAuthenticatorItemRepository( @@ -273,18 +273,18 @@ public class ServiceContainer: Services { errorReporter: errorReporter, sharedItemService: sharedItemService, timeProvider: timeProvider, - totpService: totpService + totpService: totpService, ) let exportItemsService = DefaultExportItemsService( authenticatorItemRepository: authenticatorItemRepository, errorReporter: errorReporter, - timeProvider: timeProvider + timeProvider: timeProvider, ) let importItemsService = DefaultImportItemsService( authenticatorItemRepository: authenticatorItemRepository, - errorReporter: errorReporter + errorReporter: errorReporter, ) self.init( @@ -306,7 +306,7 @@ public class ServiceContainer: Services { pasteboardService: pasteboardService, stateService: stateService, timeProvider: timeProvider, - totpService: totpService + totpService: totpService, ) } } diff --git a/AuthenticatorShared/Core/Platform/Services/StateService.swift b/AuthenticatorShared/Core/Platform/Services/StateService.swift index 3f002aecf9..2832fdc32a 100644 --- a/AuthenticatorShared/Core/Platform/Services/StateService.swift +++ b/AuthenticatorShared/Core/Platform/Services/StateService.swift @@ -182,7 +182,7 @@ actor DefaultStateService: StateService, ConfigStateService { /// init( appSettingsStore: AppSettingsStore, - dataStore: DataStore + dataStore: DataStore, ) { self.appSettingsStore = appSettingsStore self.dataStore = dataStore diff --git a/AuthenticatorShared/Core/Platform/Services/Stores/AppSettingsStore.swift b/AuthenticatorShared/Core/Platform/Services/Stores/AppSettingsStore.swift index 00b510df8a..7839de8d1c 100644 --- a/AuthenticatorShared/Core/Platform/Services/Stores/AppSettingsStore.swift +++ b/AuthenticatorShared/Core/Platform/Services/Stores/AppSettingsStore.swift @@ -290,7 +290,7 @@ class DefaultAppSettingsStore { userDefaults.set(String(data: data, encoding: .utf8), forKey: key.storageKey) } catch { Logger.application.error( - "Error storing \(key.storageKey): \(String(describing: value)) to UserDefaults: \(error)" + "Error storing \(key.storageKey): \(String(describing: value)) to UserDefaults: \(error)", ) } } @@ -321,44 +321,43 @@ extension DefaultAppSettingsStore: AppSettingsStore, ConfigSettingsStore { /// Returns the key used to store the data under for retrieving it later. var storageKey: String { - let key: String - switch self { + let key = switch self { case .appId: - key = "appId" + "appId" case .appLocale: - key = "appLocale" + "appLocale" case .appTheme: - key = "theme" + "theme" case let .biometricAuthEnabled(userId): - key = "biometricUnlock_\(userId)" + "biometricUnlock_\(userId)" case let .biometricIntegrityState(userId, bundleId): - key = "biometricIntegritySource_\(userId)_\(bundleId)" + "biometricIntegritySource_\(userId)_\(bundleId)" case let .cardClosedState(card: card): - key = "cardClosedState_\(card)" + "cardClosedState_\(card)" case let .clearClipboardValue(userId): - key = "clearClipboard_\(userId)" + "clearClipboard_\(userId)" case let .debugFeatureFlag(name): - key = "debugFeatureFlag_\(name)" + "debugFeatureFlag_\(name)" case .defaultSaveOption: - key = "defaultSaveOption" + "defaultSaveOption" case .disableWebIcons: - key = "disableFavicon" + "disableFavicon" case .hasSeenWelcomeTutorial: - key = "hasSeenWelcomeTutorial" + "hasSeenWelcomeTutorial" case let .hasSyncedAccount(name: name): - key = "hasSyncedAccount_\(name)" + "hasSyncedAccount_\(name)" case let .lastActiveTime(userId): - key = "lastActiveTime_\(userId)" + "lastActiveTime_\(userId)" case .migrationVersion: - key = "migrationVersion" + "migrationVersion" case .preAuthServerConfig: - key = "preAuthServerConfig" + "preAuthServerConfig" case let .secretKey(userId): - key = "secretKey_\(userId)" + "secretKey_\(userId)" case let .serverConfig(userId): - key = "serverConfig_\(userId)" + "serverConfig_\(userId)" case let .vaultTimeout(userId): - key = "vaultTimeout_\(userId)" + "vaultTimeout_\(userId)" } return "bwaPreferencesStorage:\(key)" } @@ -418,8 +417,8 @@ extension DefaultAppSettingsStore: AppSettingsStore, ConfigSettingsStore { fetch( for: .biometricIntegrityState( userId: userId, - bundleId: bundleId - ) + bundleId: bundleId, + ), ) } @@ -472,8 +471,8 @@ extension DefaultAppSettingsStore: AppSettingsStore, ConfigSettingsStore { base64EncodedIntegrityState, for: .biometricIntegrityState( userId: userId, - bundleId: bundleId - ) + bundleId: bundleId, + ), ) } diff --git a/AuthenticatorShared/Core/Platform/Services/Stores/AppSettingsStoreTests.swift b/AuthenticatorShared/Core/Platform/Services/Stores/AppSettingsStoreTests.swift index ef01cee2a3..9e271fc143 100644 --- a/AuthenticatorShared/Core/Platform/Services/Stores/AppSettingsStoreTests.swift +++ b/AuthenticatorShared/Core/Platform/Services/Stores/AppSettingsStoreTests.swift @@ -202,8 +202,7 @@ class AppSettingsStoreTests: BitwardenTestCase { // Stores with the hashed value: XCTAssertTrue(userDefaults.bool( - forKey: "bwaPreferencesStorage:hasSyncedAccount_\(accountName.hexSHA256Hash)") - ) + forKey: "bwaPreferencesStorage:hasSyncedAccount_\(accountName.hexSHA256Hash)")) // A new account that we've not synced before defaults to `false` XCTAssertFalse(subject.hasSyncedAccount(name: "New Account")) diff --git a/AuthenticatorShared/Core/Platform/Services/Stores/DataStore.swift b/AuthenticatorShared/Core/Platform/Services/Stores/DataStore.swift index 6d1947bdb5..514eba7017 100644 --- a/AuthenticatorShared/Core/Platform/Services/Stores/DataStore.swift +++ b/AuthenticatorShared/Core/Platform/Services/Stores/DataStore.swift @@ -94,7 +94,7 @@ class DataStore { try await backgroundContext.perform { try self.backgroundContext.executeAndMergeChanges( batchDeleteRequest: request, - additionalContexts: [self.persistentContainer.viewContext] + additionalContexts: [self.persistentContainer.viewContext], ) } } @@ -111,7 +111,7 @@ class DataStore { try self.backgroundContext.executeAndMergeChanges( batchDeleteRequest: deleteRequest, batchInsertRequest: insertRequest, - additionalContexts: [self.persistentContainer.viewContext] + additionalContexts: [self.persistentContainer.viewContext], ) } } diff --git a/AuthenticatorShared/Core/Platform/Services/TestHelpers/MockClientService.swift b/AuthenticatorShared/Core/Platform/Services/TestHelpers/MockClientService.swift index df4f0bbb45..a4d5885124 100644 --- a/AuthenticatorShared/Core/Platform/Services/TestHelpers/MockClientService.swift +++ b/AuthenticatorShared/Core/Platform/Services/TestHelpers/MockClientService.swift @@ -23,7 +23,7 @@ class MockClientService: ClientService { generators: MockGeneratorClient = MockGeneratorClient(), platform: MockPlatformClientService = MockPlatformClientService(), sends: MockSendClient = MockSendClient(), - vault: MockVaultClientService = MockVaultClientService() + vault: MockVaultClientService = MockVaultClientService(), ) { mockAuth = auth mockCrypto = crypto diff --git a/AuthenticatorShared/Core/Platform/Services/TestHelpers/ServiceContainer+Mocks.swift b/AuthenticatorShared/Core/Platform/Services/TestHelpers/ServiceContainer+Mocks.swift index 326941fc26..2f2b772ec8 100644 --- a/AuthenticatorShared/Core/Platform/Services/TestHelpers/ServiceContainer+Mocks.swift +++ b/AuthenticatorShared/Core/Platform/Services/TestHelpers/ServiceContainer+Mocks.swift @@ -25,7 +25,7 @@ extension ServiceContainer { pasteboardService: PasteboardService = MockPasteboardService(), stateService: StateService = MockStateService(), timeProvider: TimeProvider = MockTimeProvider(.currentTime), - totpService: TOTPService = MockTOTPService() + totpService: TOTPService = MockTOTPService(), ) -> ServiceContainer { ServiceContainer( application: application, @@ -46,7 +46,7 @@ extension ServiceContainer { pasteboardService: pasteboardService, stateService: stateService, timeProvider: timeProvider, - totpService: totpService + totpService: totpService, ) } } diff --git a/AuthenticatorShared/Core/Platform/Utilities/ExternalLinksConstants.swift b/AuthenticatorShared/Core/Platform/Utilities/ExternalLinksConstants.swift index 7782c01a5f..eefe285644 100644 --- a/AuthenticatorShared/Core/Platform/Utilities/ExternalLinksConstants.swift +++ b/AuthenticatorShared/Core/Platform/Utilities/ExternalLinksConstants.swift @@ -47,7 +47,7 @@ enum ExternalLinksConstants { /// A markdown link to Bitwarden's help page about protecting individual items. static let protectIndividualItems = URL( - string: "https://bitwarden.com/help/managing-items/#protect-individual-items" + string: "https://bitwarden.com/help/managing-items/#protect-individual-items", )! /// A link to Bitwarden's recovery code help page. diff --git a/AuthenticatorShared/Core/Vault/Models/Data/AuthenticatorItemData.swift b/AuthenticatorShared/Core/Vault/Models/Data/AuthenticatorItemData.swift index 48686e2c76..33b60bec4b 100644 --- a/AuthenticatorShared/Core/Vault/Models/Data/AuthenticatorItemData.swift +++ b/AuthenticatorShared/Core/Vault/Models/Data/AuthenticatorItemData.swift @@ -29,7 +29,7 @@ class AuthenticatorItemData: NSManagedObject, ManagedUserObject, CodableModelDat convenience init( context: NSManagedObjectContext, userId: String, - authenticatorItem: AuthenticatorItem + authenticatorItem: AuthenticatorItem, ) throws { self.init(context: context) id = authenticatorItem.id @@ -63,7 +63,7 @@ extension AuthenticatorItemData { #keyPath(AuthenticatorItemData.userId), userId, #keyPath(AuthenticatorItemData.id), - id + id, ) } } diff --git a/AuthenticatorShared/Core/Vault/Models/Domain/AuthenticatorItem.swift b/AuthenticatorShared/Core/Vault/Models/Domain/AuthenticatorItem.swift index c2bfc091b2..1b494366b5 100644 --- a/AuthenticatorShared/Core/Vault/Models/Domain/AuthenticatorItem.swift +++ b/AuthenticatorShared/Core/Vault/Models/Domain/AuthenticatorItem.swift @@ -36,14 +36,14 @@ extension AuthenticatorItem { id: String = "ID", name: String = "Example", totpKey: String? = "example", - username: String? = "person@example.com" + username: String? = "person@example.com", ) -> AuthenticatorItem { AuthenticatorItem( favorite: favorite, id: id, name: name, totpKey: totpKey, - username: username + username: username, ) } } @@ -64,14 +64,14 @@ extension AuthenticatorItemView { id: String = "ID", name: String = "Example", totpKey: String? = "example", - username: String? = "person@example.com" + username: String? = "person@example.com", ) -> AuthenticatorItemView { AuthenticatorItemView( favorite: favorite, id: id, name: name, totpKey: totpKey, - username: username + username: username, ) } } diff --git a/AuthenticatorShared/Core/Vault/Models/Domain/Fixtures/AuthenticatorBridgeItemDataView+Fixtures.swift b/AuthenticatorShared/Core/Vault/Models/Domain/Fixtures/AuthenticatorBridgeItemDataView+Fixtures.swift index bf2b7698b2..0c84a41a06 100644 --- a/AuthenticatorShared/Core/Vault/Models/Domain/Fixtures/AuthenticatorBridgeItemDataView+Fixtures.swift +++ b/AuthenticatorShared/Core/Vault/Models/Domain/Fixtures/AuthenticatorBridgeItemDataView+Fixtures.swift @@ -10,7 +10,7 @@ extension AuthenticatorBridgeItemDataView { id: String = UUID().uuidString, name: String = "Name", totpKey: String? = nil, - username: String? = nil + username: String? = nil, ) -> AuthenticatorBridgeItemDataView { AuthenticatorBridgeItemDataView( accountDomain: accountDomain, @@ -19,7 +19,7 @@ extension AuthenticatorBridgeItemDataView { id: id, name: name, totpKey: totpKey, - username: username + username: username, ) } @@ -29,7 +29,7 @@ extension AuthenticatorBridgeItemDataView { accountEmail: "test@example.com", name: "Name", totpKey: "TOTP", - username: "username" + username: "username", ) } diff --git a/AuthenticatorShared/Core/Vault/Models/Domain/Fixtures/ItemListItem+Fixtures.swift b/AuthenticatorShared/Core/Vault/Models/Domain/Fixtures/ItemListItem+Fixtures.swift index 4898f68d64..0d3b298d60 100644 --- a/AuthenticatorShared/Core/Vault/Models/Domain/Fixtures/ItemListItem+Fixtures.swift +++ b/AuthenticatorShared/Core/Vault/Models/Domain/Fixtures/ItemListItem+Fixtures.swift @@ -9,7 +9,7 @@ extension ItemListSection { ItemListSection( id: "example", items: [ItemListItem.fixture()], - name: "Section" + name: "Section", ) } } @@ -19,13 +19,13 @@ extension ItemListItem { id: String = "123", name: String = "Name", accountName: String = "person@example.com", - totp: ItemListTotpItem = .fixture() + totp: ItemListTotpItem = .fixture(), ) -> ItemListItem { ItemListItem( id: id, name: name, accountName: accountName, - itemType: .totp(model: totp) + itemType: .totp(model: totp), ) } @@ -33,13 +33,13 @@ extension ItemListItem { id: String = "123", name: String = "Name", accountName: String? = "person@example.com", - totp: ItemListSharedTotpItem = .fixture() + totp: ItemListSharedTotpItem = .fixture(), ) -> ItemListItem { ItemListItem( id: id, name: name, accountName: accountName, - itemType: .sharedTotp(model: totp) + itemType: .sharedTotp(model: totp), ) } } @@ -50,12 +50,12 @@ extension ItemListTotpItem { totpCode: TOTPCodeModel = TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) + period: 30, + ), ) -> ItemListTotpItem { ItemListTotpItem( itemView: itemView, - totpCode: totpCode + totpCode: totpCode, ) } } @@ -66,12 +66,12 @@ extension ItemListSharedTotpItem { totpCode: TOTPCodeModel = TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) + period: 30, + ), ) -> ItemListSharedTotpItem { ItemListSharedTotpItem( itemView: itemView, - totpCode: totpCode + totpCode: totpCode, ) } } diff --git a/AuthenticatorShared/Core/Vault/Models/Domain/TestHelpers/AuthenticatorItem+Mocking.swift b/AuthenticatorShared/Core/Vault/Models/Domain/TestHelpers/AuthenticatorItem+Mocking.swift index 370eea605a..e3f26c5138 100644 --- a/AuthenticatorShared/Core/Vault/Models/Domain/TestHelpers/AuthenticatorItem+Mocking.swift +++ b/AuthenticatorShared/Core/Vault/Models/Domain/TestHelpers/AuthenticatorItem+Mocking.swift @@ -7,7 +7,7 @@ extension AuthenticatorItem { id: authenticatorItemView.id, name: authenticatorItemView.name, totpKey: authenticatorItemView.totpKey, - username: authenticatorItemView.username + username: authenticatorItemView.username, ) } } @@ -19,7 +19,7 @@ extension AuthenticatorItemView { id: authenticatorItem.id, name: authenticatorItem.name, totpKey: authenticatorItem.totpKey, - username: authenticatorItem.username + username: authenticatorItem.username, ) } } diff --git a/AuthenticatorShared/Core/Vault/Models/Enum/ImportFormatType.swift b/AuthenticatorShared/Core/Vault/Models/Enum/ImportFormatType.swift index 2aa420acec..d7c3574ce8 100644 --- a/AuthenticatorShared/Core/Vault/Models/Enum/ImportFormatType.swift +++ b/AuthenticatorShared/Core/Vault/Models/Enum/ImportFormatType.swift @@ -41,11 +41,11 @@ enum ImportFormatType: Menuable { case .bitwardenJson, .lastpassJson, .raivoJson: - return .jsonFile + .jsonFile case .googleQr: - return nil + nil case .twoFasJason: - return .file + .file } } diff --git a/AuthenticatorShared/Core/Vault/Repositories/AuthenticatorItemRepository.swift b/AuthenticatorShared/Core/Vault/Repositories/AuthenticatorItemRepository.swift index 3ec6eb4597..7fb0b15119 100644 --- a/AuthenticatorShared/Core/Vault/Repositories/AuthenticatorItemRepository.swift +++ b/AuthenticatorShared/Core/Vault/Repositories/AuthenticatorItemRepository.swift @@ -80,7 +80,7 @@ protocol AuthenticatorItemRepository: AnyObject { /// which will be notified as details of the item change /// func authenticatorItemDetailsPublisher( - id: String + id: String, ) async throws -> AsyncThrowingPublisher> /// A publisher for the list of a user's items, which returns a list of sections @@ -97,7 +97,7 @@ protocol AuthenticatorItemRepository: AnyObject { /// - Returns: A publisher searching for the user's ciphers. /// func searchItemListPublisher( - searchText: String + searchText: String, ) async throws -> AsyncThrowingPublisher> } @@ -157,7 +157,7 @@ class DefaultAuthenticatorItemRepository { errorReporter: ErrorReporter, sharedItemService: AuthenticatorBridgeItemService, timeProvider: TimeProvider, - totpService: TOTPService + totpService: TOTPService, ) { self.application = application self.authenticatorItemService = authenticatorItemService @@ -184,7 +184,7 @@ class DefaultAuthenticatorItemRepository { /// private func combinedSections( localSections: [ItemListSection], - sharedItems: [AuthenticatorBridgeItemDataView] + sharedItems: [AuthenticatorBridgeItemDataView], ) async -> [ItemListSection] { guard await isPasswordManagerSyncActive() else { return localSections @@ -194,7 +194,7 @@ class DefaultAuthenticatorItemRepository { sections.append(ItemListSection( id: "SyncError", items: [.syncError()], - name: "" + name: "", )) return sections } @@ -205,7 +205,7 @@ class DefaultAuthenticatorItemRepository { [item.accountEmail, item.accountDomain] .compactMap { $0?.nilIfEmpty } .joined(separator: " | ") - } + }, ) var sections = localSections @@ -230,7 +230,7 @@ class DefaultAuthenticatorItemRepository { /// - Returns: A list of the sections to display in the item list /// private func itemListSections( - from authenticatorItems: [AuthenticatorItem] + from authenticatorItems: [AuthenticatorItem], ) async throws -> [ItemListSection] { let items = try await authenticatorItems.asyncMap { item in try await self.cryptographyService.decrypt(item) @@ -363,7 +363,7 @@ extension DefaultAuthenticatorItemRepository: AuthenticatorItemRepository { id: item.id, name: item.name, totpKey: item.totpKey, - username: item.username + username: item.username, )) } @@ -375,7 +375,7 @@ extension DefaultAuthenticatorItemRepository: AuthenticatorItemRepository { // MARK: Publishers func authenticatorItemDetailsPublisher( - id: String + id: String, ) async throws -> AsyncThrowingPublisher> { try await authenticatorItemService.authenticatorItemsPublisher() .asyncTryMap { items -> AuthenticatorItemView? in @@ -391,7 +391,7 @@ extension DefaultAuthenticatorItemRepository: AuthenticatorItemRepository { } func searchItemListPublisher( - searchText: String + searchText: String, ) async throws -> AsyncThrowingPublisher> { try await itemListSectionPublisher().map { sections -> [ItemListItem] in let query = searchText.trimmingCharacters(in: .whitespacesAndNewlines) diff --git a/AuthenticatorShared/Core/Vault/Repositories/AuthenticatorItemRepositoryTests.swift b/AuthenticatorShared/Core/Vault/Repositories/AuthenticatorItemRepositoryTests.swift index 49bcf996a7..6327cb1d7c 100644 --- a/AuthenticatorShared/Core/Vault/Repositories/AuthenticatorItemRepositoryTests.swift +++ b/AuthenticatorShared/Core/Vault/Repositories/AuthenticatorItemRepositoryTests.swift @@ -45,7 +45,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable errorReporter: errorReporter, sharedItemService: sharedItemService, timeProvider: timeProvider, - totpService: totpService + totpService: totpService, ) } @@ -71,7 +71,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable XCTAssertEqual(cryptographyService.encryptedAuthenticatorItems, [item]) XCTAssertEqual( authItemService.addAuthenticatorItemAuthenticatorItems.last, - AuthenticatorItem(authenticatorItemView: item) + AuthenticatorItem(authenticatorItemView: item), ) } @@ -154,7 +154,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable let error = try XCTUnwrap(errorReporter.errors[0] as? TOTPServiceError) XCTAssertEqual( error, - .unableToGenerateCode("Unable to refresh TOTP code for list view item: \(item.id)") + .unableToGenerateCode("Unable to refresh TOTP code for list view item: \(item.id)"), ) XCTAssertEqual(actual.id, item.id) XCTAssertEqual(actual.name, item.name) @@ -171,7 +171,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable let error = try XCTUnwrap(errorReporter.errors[0] as? TOTPServiceError) XCTAssertEqual( error, - .unableToGenerateCode("Unable to refresh TOTP code for list view item: \(item.id)") + .unableToGenerateCode("Unable to refresh TOTP code for list view item: \(item.id)"), ) XCTAssertEqual(actual.id, item.id) XCTAssertEqual(actual.name, item.name) @@ -184,7 +184,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable let newCodeModel = TOTPCodeModel( code: newCode, codeGenerationDate: timeProvider.presentTime, - period: 30 + period: 30, ) totpService.getTotpCodeResult = .success(newCodeModel) @@ -285,7 +285,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable let codeModel = TOTPCodeModel( code: "123456", codeGenerationDate: timeProvider.presentTime, - period: 30 + period: 30, ) totpService.getTotpCodeResult = .success(codeModel) let expected = items.map { item in @@ -294,8 +294,8 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable name: item.name, totp: ItemListTotpItem.fixture( itemView: AuthenticatorItemView(authenticatorItem: item), - totpCode: codeModel - ) + totpCode: codeModel, + ), ) }.sorted { $0.name.localizedStandardCompare($1.name) == .orderedAscending } authItemService.authenticatorItemsSubject.send(items) @@ -309,7 +309,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable ItemListSection(id: "Unorganized", items: expected, name: ""), - ] + ], ) } @@ -329,9 +329,9 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: timeProvider.presentTime, - period: 30 - ) - ) + period: 30, + ), + ), ) let favoritedItem = ItemListItem.fixture( id: items[1].id, @@ -341,9 +341,9 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: timeProvider.presentTime, - period: 30 - ) - ) + period: 30, + ), + ), ) authItemService.authenticatorItemsSubject.send(items) @@ -360,7 +360,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable ItemListSection(id: "Unorganized", items: [unorganizedItem], name: ""), - ] + ], ) } @@ -398,7 +398,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable ItemListSection(id: "SyncError", items: [.syncError()], name: ""), - ] + ], ) XCTAssertEqual(errorReporter.errors as? [BitwardenTestError], [.example]) @@ -438,7 +438,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable ItemListSection(id: "SyncError", items: [.syncError()], name: ""), - ] + ], ) } @@ -460,9 +460,9 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: timeProvider.presentTime, - period: 30 - ) - ) + period: 30, + ), + ), ) let favoritedItem = ItemListItem.fixture( id: items[1].id, @@ -472,9 +472,9 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: timeProvider.presentTime, - period: 30 - ) - ) + period: 30, + ), + ), ) authItemService.authenticatorItemsSubject.send(items) @@ -491,7 +491,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable ItemListSection(id: "Unorganized", items: [unorganizedItem], name: ""), - ] + ], ) } @@ -533,7 +533,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable ItemListSection(id: "shared@example.com | Domain", items: [sharedListItem], name: "shared@example.com | Domain"), - ] + ], ) XCTAssertEqual(sharedItemService.storedItems, ["userId": [sharedItem]]) @@ -587,7 +587,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable ItemListSection(id: "shared@example.com | Domain", items: [fullListItem], name: "shared@example.com | Domain"), - ] + ], ) } @@ -603,7 +603,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable let sharedItem = AuthenticatorBridgeItemDataView.fixture( accountDomain: "Domain", accountEmail: "shared@example.com", - totpKey: "totpKey" + totpKey: "totpKey", ) sharedItemService.storedItems = ["userId": [sharedItem]] @@ -624,7 +624,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable let codeModel = TOTPCodeModel( code: "123456", codeGenerationDate: timeProvider.presentTime, - period: 30 + period: 30, ) totpService.getTotpCodeResult = .success(codeModel) let expected = items.map { item in @@ -633,8 +633,8 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable name: item.name, totp: ItemListTotpItem.fixture( itemView: AuthenticatorItemView(authenticatorItem: item), - totpCode: codeModel - ) + totpCode: codeModel, + ), ) } @@ -656,7 +656,7 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable let codeModel = TOTPCodeModel( code: "123456", codeGenerationDate: timeProvider.presentTime, - period: 30 + period: 30, ) totpService.getTotpCodeResult = .success(codeModel) let expected = items.map { item in @@ -665,8 +665,8 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable name: item.name, totp: ItemListTotpItem.fixture( itemView: AuthenticatorItemView(authenticatorItem: item), - totpCode: codeModel - ) + totpCode: codeModel, + ), ) } @@ -694,9 +694,9 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: timeProvider.presentTime, - period: 30 - ) - ) + period: 30, + ), + ), ) } @@ -716,9 +716,9 @@ class AuthenticatorItemRepositoryTests: BitwardenTestCase { // swiftlint:disable totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: timeProvider.presentTime, - period: 30 - ) - ) + period: 30, + ), + ), ) } } // swiftlint:disable:this file_length diff --git a/AuthenticatorShared/Core/Vault/Repositories/TestHelpers/MockAuthenticatorItemRepository.swift b/AuthenticatorShared/Core/Vault/Repositories/TestHelpers/MockAuthenticatorItemRepository.swift index e87df99a34..7bb7c6bcf5 100644 --- a/AuthenticatorShared/Core/Vault/Repositories/TestHelpers/MockAuthenticatorItemRepository.swift +++ b/AuthenticatorShared/Core/Vault/Repositories/TestHelpers/MockAuthenticatorItemRepository.swift @@ -82,7 +82,7 @@ class MockAuthenticatorItemRepository: AuthenticatorItemRepository { } func authenticatorItemDetailsPublisher( - id: String + id: String, ) async throws -> AsyncThrowingPublisher> { authenticatorItemDetailsSubject.eraseToAnyPublisher().values } @@ -92,7 +92,7 @@ class MockAuthenticatorItemRepository: AuthenticatorItemRepository { } func searchItemListPublisher( - searchText: String + searchText: String, ) async throws -> AsyncThrowingPublisher> { searchItemListSubject.eraseToAnyPublisher().values } diff --git a/AuthenticatorShared/Core/Vault/Services/AuthenticatorItemService.swift b/AuthenticatorShared/Core/Vault/Services/AuthenticatorItemService.swift index bd29584045..5007c29fd8 100644 --- a/AuthenticatorShared/Core/Vault/Services/AuthenticatorItemService.swift +++ b/AuthenticatorShared/Core/Vault/Services/AuthenticatorItemService.swift @@ -69,7 +69,7 @@ class DefaultAuthenticatorItemService { /// - authenticatorItemDataStore: The data store for persisted items /// init( - authenticatorItemDataStore: AuthenticatorItemDataStore + authenticatorItemDataStore: AuthenticatorItemDataStore, ) { self.authenticatorItemDataStore = authenticatorItemDataStore } diff --git a/AuthenticatorShared/Core/Vault/Services/AuthenticatorItemServiceTests.swift b/AuthenticatorShared/Core/Vault/Services/AuthenticatorItemServiceTests.swift index 9c5d060d2e..da9945611b 100644 --- a/AuthenticatorShared/Core/Vault/Services/AuthenticatorItemServiceTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/AuthenticatorItemServiceTests.swift @@ -16,7 +16,7 @@ class AuthenticatorItemServiceTests: BitwardenTestCase { authenticatorItemDataStore = MockAuthenticatorItemDataStore() subject = DefaultAuthenticatorItemService( - authenticatorItemDataStore: authenticatorItemDataStore + authenticatorItemDataStore: authenticatorItemDataStore, ) } diff --git a/AuthenticatorShared/Core/Vault/Services/CryptographyKeyService.swift b/AuthenticatorShared/Core/Vault/Services/CryptographyKeyService.swift index 6ec3450776..1f58e47192 100644 --- a/AuthenticatorShared/Core/Vault/Services/CryptographyKeyService.swift +++ b/AuthenticatorShared/Core/Vault/Services/CryptographyKeyService.swift @@ -40,7 +40,7 @@ actor CryptographyKeyService { let key = SymmetricKey(size: .bits256) try await stateService.setSecretKey( key.base64EncodedString(), - userId: userId + userId: userId, ) return key } diff --git a/AuthenticatorShared/Core/Vault/Services/CryptographyService.swift b/AuthenticatorShared/Core/Vault/Services/CryptographyService.swift index c43db98ba4..1b1ceeb2a1 100644 --- a/AuthenticatorShared/Core/Vault/Services/CryptographyService.swift +++ b/AuthenticatorShared/Core/Vault/Services/CryptographyService.swift @@ -26,7 +26,7 @@ class DefaultCryptographyService: CryptographyService { /// - cryptographyKeyService: A service for getting the cryptography key /// init( - cryptographyKeyService: CryptographyKeyService + cryptographyKeyService: CryptographyKeyService, ) { self.cryptographyKeyService = cryptographyKeyService } @@ -51,7 +51,7 @@ class DefaultCryptographyService: CryptographyService { id: authenticatorItemView.id, name: encryptedName, totpKey: encryptString(authenticatorItemView.totpKey, withKey: secretKey), - username: encryptString(authenticatorItemView.username, withKey: secretKey) + username: encryptString(authenticatorItemView.username, withKey: secretKey), ) } @@ -69,7 +69,7 @@ class DefaultCryptographyService: CryptographyService { id: authenticatorItem.id, name: decryptString(authenticatorItem.name, withKey: secretKey) ?? "", totpKey: decryptString(authenticatorItem.totpKey, withKey: secretKey), - username: decryptString(authenticatorItem.username, withKey: secretKey) + username: decryptString(authenticatorItem.username, withKey: secretKey), ) } @@ -89,7 +89,7 @@ class DefaultCryptographyService: CryptographyService { let encryptedSealedBox = try AES.GCM.seal( data, - using: secretKey + using: secretKey, ) return encryptedSealedBox.combined?.base64EncodedString() @@ -107,12 +107,12 @@ class DefaultCryptographyService: CryptographyService { } let encryptedSealedBox = try AES.GCM.SealedBox( - combined: data + combined: data, ) let decryptedBox = try AES.GCM.open( encryptedSealedBox, - using: secretKey + using: secretKey, ) return String(data: decryptedBox, encoding: .utf8) diff --git a/AuthenticatorShared/Core/Vault/Services/CryptographyServiceTests.swift b/AuthenticatorShared/Core/Vault/Services/CryptographyServiceTests.swift index cbf9cfba95..272a7a9fc8 100644 --- a/AuthenticatorShared/Core/Vault/Services/CryptographyServiceTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/CryptographyServiceTests.swift @@ -21,8 +21,8 @@ class CryptographyServiceTests: BitwardenTestCase { subject = DefaultCryptographyService( cryptographyKeyService: CryptographyKeyService( - stateService: stateService - ) + stateService: stateService, + ), ) } @@ -46,7 +46,7 @@ class CryptographyServiceTests: BitwardenTestCase { id: "ID", name: "", totpKey: "", - username: "" + username: "", ) let decrypted = try await subject.decrypt(item) @@ -65,7 +65,7 @@ class CryptographyServiceTests: BitwardenTestCase { id: "ID", name: "Name", totpKey: "otpauth://totp/ACME%20Co:john.doe@email.com?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=ACME%20Co&algorithm=SHA1&digits=6&period=30", - username: "john.doe@email.com" + username: "john.doe@email.com", ) let encrypted = try await subject.encrypt(item) @@ -90,7 +90,7 @@ class CryptographyServiceTests: BitwardenTestCase { id: "ID", name: "Name", totpKey: nil, - username: nil + username: nil, ) let encrypted = try await subject.encrypt(item) @@ -115,7 +115,7 @@ class CryptographyServiceTests: BitwardenTestCase { id: "ID", name: "", totpKey: nil, - username: nil + username: nil, ) let encrypted = try await subject.encrypt(item) diff --git a/AuthenticatorShared/Core/Vault/Services/ExportItemsService.swift b/AuthenticatorShared/Core/Vault/Services/ExportItemsService.swift index 923d722fe4..8aec4bb9ab 100644 --- a/AuthenticatorShared/Core/Vault/Services/ExportItemsService.swift +++ b/AuthenticatorShared/Core/Vault/Services/ExportItemsService.swift @@ -82,7 +82,7 @@ class DefaultExportItemsService: ExportItemsService { init( authenticatorItemRepository: AuthenticatorItemRepository, errorReporter: ErrorReporter, - timeProvider: TimeProvider + timeProvider: TimeProvider, ) { self.authenticatorItemRepository = authenticatorItemRepository self.errorReporter = errorReporter @@ -127,7 +127,7 @@ class DefaultExportItemsService: ExportItemsService { func writeToFile( name fileName: String, - content fileContent: String + content fileContent: String, ) throws -> URL { // Get the exports directory. let exportsDirectoryURL = try FileManager.default.exportedItemsUrl() @@ -137,7 +137,7 @@ class DefaultExportItemsService: ExportItemsService { try FileManager.default.createDirectory( at: exportsDirectoryURL, withIntermediateDirectories: true, - attributes: nil + attributes: nil, ) } diff --git a/AuthenticatorShared/Core/Vault/Services/ExportItemsServiceTests.swift b/AuthenticatorShared/Core/Vault/Services/ExportItemsServiceTests.swift index 93337cbaee..d00f611ecf 100644 --- a/AuthenticatorShared/Core/Vault/Services/ExportItemsServiceTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/ExportItemsServiceTests.swift @@ -26,20 +26,20 @@ final class ExportItemsServiceTests: BitwardenTestCase { .init( year: 2024, month: 02, - day: 14 - ) - ) + day: 14, + ), + ), ) importService = DefaultImportItemsService( authenticatorItemRepository: authItemRepository, - errorReporter: errorReporter + errorReporter: errorReporter, ) subject = DefaultExportItemsService( authenticatorItemRepository: authItemRepository, errorReporter: errorReporter, - timeProvider: timeProvider + timeProvider: timeProvider, ) } @@ -65,7 +65,7 @@ final class ExportItemsServiceTests: BitwardenTestCase { id: "One", name: "Name", totpKey: "otpauth://totp/Bitwarden:person@example.com?secret=EXAMPLE&issuer=Bitwarden", - username: "person@example.com" + username: "person@example.com", ), ] authItemRepository.fetchAllAuthenticatorItemsResult = .success(items) @@ -92,14 +92,14 @@ final class ExportItemsServiceTests: BitwardenTestCase { id: "One", name: "Name", totpKey: "otpauth://totp/Bitwarden:person@example.com?secret=EXAMPLE&issuer=Bitwarden", - username: "person@example.com" + username: "person@example.com", ), AuthenticatorItemView( favorite: true, id: "Two", name: "Steam", totpKey: "steam://EXAMPLE", - username: "person@example.com" + username: "person@example.com", ), ] authItemRepository.fetchAllAuthenticatorItemsResult = .success(items) diff --git a/AuthenticatorShared/Core/Vault/Services/ImportItemsService.swift b/AuthenticatorShared/Core/Vault/Services/ImportItemsService.swift index 84949bf22f..8cf88307b1 100644 --- a/AuthenticatorShared/Core/Vault/Services/ImportItemsService.swift +++ b/AuthenticatorShared/Core/Vault/Services/ImportItemsService.swift @@ -49,7 +49,7 @@ class DefaultImportItemsService: ImportItemsService { /// init( authenticatorItemRepository: AuthenticatorItemRepository, - errorReporter: ErrorReporter + errorReporter: ErrorReporter, ) { self.authenticatorItemRepository = authenticatorItemRepository self.errorReporter = errorReporter @@ -58,18 +58,17 @@ class DefaultImportItemsService: ImportItemsService { // MARK: Methods func importItems(data: Data, format: ImportFileFormat) async throws { - let items: [AuthenticatorItemView] - switch format { + let items: [AuthenticatorItemView] = switch format { case .bitwardenJson: - items = try BitwardenImporter.importItems(data: data) + try BitwardenImporter.importItems(data: data) case .googleProtobuf: - items = try GoogleImporter.importItems(data: data) + try GoogleImporter.importItems(data: data) case .lastpassJson: - items = try LastpassImporter.importItems(data: data) + try LastpassImporter.importItems(data: data) case .raivoJson: - items = try RaivoImporter.importItems(data: data) + try RaivoImporter.importItems(data: data) case .twoFasJson: - items = try TwoFasImporter.importItems(data: data) + try TwoFasImporter.importItems(data: data) } try await items.asyncForEach { item in try await authenticatorItemRepository.addAuthenticatorItem(item) diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/BitwardenImporter.swift b/AuthenticatorShared/Core/Vault/Services/Importers/BitwardenImporter.swift index e8ee62ae96..af819574d0 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/BitwardenImporter.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/BitwardenImporter.swift @@ -11,7 +11,7 @@ class BitwardenImporter { id: cipherLike.id, name: cipherLike.name, totpKey: cipherLike.login?.totp, - username: cipherLike.login?.username + username: cipherLike.login?.username, ) } } diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/BitwardenImporterTests.swift b/AuthenticatorShared/Core/Vault/Services/Importers/BitwardenImporterTests.swift index 5b6790bd64..d82f6d028a 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/BitwardenImporterTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/BitwardenImporterTests.swift @@ -12,14 +12,14 @@ final class BitwardenImporterTests: BitwardenTestCase { id: "One", name: "Name", totpKey: "otpauth://totp/Bitwarden:person@example.com?secret=EXAMPLE&issuer=Bitwarden", - username: "person@example.com" + username: "person@example.com", ), AuthenticatorItemView( favorite: true, id: "Two", name: "Steam", totpKey: "steam://EXAMPLE", - username: "person@example.com" + username: "person@example.com", ), ] let actual = try BitwardenImporter.importItems(data: data) diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/GoogleImporter.swift b/AuthenticatorShared/Core/Vault/Services/Importers/GoogleImporter.swift index 8538e71628..f87b0c3b41 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/GoogleImporter.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/GoogleImporter.swift @@ -29,14 +29,14 @@ class GoogleImporter { digits: (5 ... 10).contains(Int(item.digits)) ? Int(item.digits) : 6, issuer: item.issuer.nilIfEmpty, period: 30, - secret: secret + secret: secret, ) return AuthenticatorItemView( favorite: false, id: UUID().uuidString, name: item.issuer.nilIfEmpty ?? item.name, totpKey: otp.otpAuthUri, - username: item.name.nilIfEmpty + username: item.name.nilIfEmpty, ) } } diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/GoogleImporterTests.swift b/AuthenticatorShared/Core/Vault/Services/Importers/GoogleImporterTests.swift index a8d7afee5f..ff23b7770f 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/GoogleImporterTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/GoogleImporterTests.swift @@ -13,14 +13,14 @@ final class GoogleImporterTests: BitwardenTestCase { id: "One", name: "Name", totpKey: "otpauth://totp/Name?secret=JBSWY3DPEHPK3PXP&algorithm=SHA1&digits=6&period=30", - username: "Name" + username: "Name", ), AuthenticatorItemView( favorite: false, id: "Two", name: "Name2", totpKey: "otpauth://totp/Name2?secret=ABCI23HDJWHD73YEVDJA&algorithm=SHA1&digits=6&period=30", - username: "Name2" + username: "Name2", ), ] let actual = try GoogleImporter.importItems(data: data) diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/LastpassImporter.swift b/AuthenticatorShared/Core/Vault/Services/Importers/LastpassImporter.swift index da9dca1a53..9e6b3e69b9 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/LastpassImporter.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/LastpassImporter.swift @@ -11,14 +11,14 @@ class LastpassImporter { digits: account.digits, issuer: account.issuerName.nilIfEmpty, period: account.timeStep, - secret: account.secret + secret: account.secret, ) return AuthenticatorItemView( favorite: account.isFavorite, id: UUID().uuidString, name: account.issuerName, totpKey: otp.otpAuthUri, - username: account.userName.nilIfEmpty + username: account.userName.nilIfEmpty, ) } } diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/LastpassImporterTests.swift b/AuthenticatorShared/Core/Vault/Services/Importers/LastpassImporterTests.swift index 1478a8ddb1..0c4c886560 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/LastpassImporterTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/LastpassImporterTests.swift @@ -13,14 +13,14 @@ final class LastpassImporterTests: BitwardenTestCase { id: "One", name: "Name", totpKey: "otpauth://totp/Name:person%40example%2Ecom?secret=Secret1One&issuer=Name&algorithm=SHA1&digits=6&period=30", - username: "person@example.com" + username: "person@example.com", ), AuthenticatorItemView( favorite: true, id: "Two", name: "Issuer2", totpKey: "otpauth://totp/Issuer2:name?secret=SecretTwo&issuer=Issuer2&algorithm=SHA512&digits=8&period=60", - username: "name" + username: "name", ), ] let actual = try LastpassImporter.importItems(data: data) diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/RaivoImporter.swift b/AuthenticatorShared/Core/Vault/Services/Importers/RaivoImporter.swift index 34db650df6..3c449726a1 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/RaivoImporter.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/RaivoImporter.swift @@ -11,14 +11,14 @@ class RaivoImporter { digits: Int(item.digits) ?? 6, issuer: item.issuer.nilIfEmpty, period: Int(item.timer) ?? 30, - secret: item.secret + secret: item.secret, ) return AuthenticatorItemView( favorite: Bool(item.pinned) ?? false, id: UUID().uuidString, name: item.issuer, totpKey: otp.otpAuthUri, - username: item.account.nilIfEmpty + username: item.account.nilIfEmpty, ) } } diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/RaivoImporterTests.swift b/AuthenticatorShared/Core/Vault/Services/Importers/RaivoImporterTests.swift index e6fc013edf..34a8b461f4 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/RaivoImporterTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/RaivoImporterTests.swift @@ -13,14 +13,14 @@ final class RaivoImporterTests: BitwardenTestCase { id: "One", name: "Name", totpKey: "otpauth://totp/Name:person%40example%2Ecom?secret=Secret1One&issuer=Name&algorithm=SHA1&digits=6&period=30", - username: "person@example.com" + username: "person@example.com", ), AuthenticatorItemView( favorite: true, id: "Two", name: "Issuer2", totpKey: "otpauth://totp/?secret=SecretTwo&issuer=Issuer2&algorithm=SHA256&digits=8&period=60", - username: nil + username: nil, ), ] let actual = try RaivoImporter.importItems(data: data) diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/Support/Base32.swift b/AuthenticatorShared/Core/Vault/Services/Importers/Support/Base32.swift index e55ea16f8c..135f340720 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/Support/Base32.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/Support/Base32.swift @@ -69,7 +69,7 @@ enum Base32 { return Octets( octet1Index: octetIndex, octet2Index: overhangsOctet ? octetIndex + 1 : nil, - bitOffset: octetBitOffset + bitOffset: octetBitOffset, ) } diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/Support/Base32Tests.swift b/AuthenticatorShared/Core/Vault/Services/Importers/Support/Base32Tests.swift index d481edcfc8..757a4310ae 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/Support/Base32Tests.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/Support/Base32Tests.swift @@ -104,16 +104,16 @@ class Base32Tests: XCTestCase { XCTAssertEqual( try Base32.decode( string: "O5UGC5BAORUGKIJAI5CVIICPKVKCAT2GEBEEKUSFEATCAKY", - padded: false + padded: false, ), - "what the! GET OUT OF HERE & +".data(using: .ascii)! + "what the! GET OUT OF HERE & +".data(using: .ascii)!, ) XCTAssertEqual( try Base32.decode( string: "O5UGC5BAORUGKIJAI5CVIICPKVKCAT2GEBEEKUSFEATCAKY=", - padded: true + padded: true, ), - "what the! GET OUT OF HERE & +".data(using: .ascii)! + "what the! GET OUT OF HERE & +".data(using: .ascii)!, ) } diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/TwoFasImporter.swift b/AuthenticatorShared/Core/Vault/Services/Importers/TwoFasImporter.swift index 47fe6d686d..eff8677945 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/TwoFasImporter.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/TwoFasImporter.swift @@ -18,14 +18,14 @@ class TwoFasImporter { digits: service.otp.digits ?? 6, issuer: service.otp.issuer ?? service.name, period: service.otp.period ?? 30, - secret: service.secret + secret: service.secret, ) return AuthenticatorItemView( favorite: false, id: UUID().uuidString, name: service.name, totpKey: otp.otpAuthUri, - username: service.otp.account + username: service.otp.account, ) case "STEAM": return AuthenticatorItemView( @@ -33,7 +33,7 @@ class TwoFasImporter { id: UUID().uuidString, name: service.name, totpKey: "steam://\(service.secret)", - username: service.otp.account + username: service.otp.account, ) default: return nil diff --git a/AuthenticatorShared/Core/Vault/Services/Importers/TwoFasImporterTests.swift b/AuthenticatorShared/Core/Vault/Services/Importers/TwoFasImporterTests.swift index e38a4fb0f0..0ba989f3db 100644 --- a/AuthenticatorShared/Core/Vault/Services/Importers/TwoFasImporterTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/Importers/TwoFasImporterTests.swift @@ -13,21 +13,21 @@ final class TwoFasImporterTests: BitwardenTestCase { id: "One", name: "Name", totpKey: "otpauth://totp/Name:person%40example%2Ecom?secret=Secret1One&issuer=Name&algorithm=SHA1&digits=6&period=30", - username: "person@example.com" + username: "person@example.com", ), AuthenticatorItemView( favorite: false, id: "Two", name: "Issuer2", totpKey: "otpauth://totp/?secret=SecretTwo&issuer=Issuer2&algorithm=SHA256&digits=8&period=60", - username: nil + username: nil, ), AuthenticatorItemView( favorite: false, id: "Three", name: "Steam", totpKey: "steam://STEAMSECRET", - username: "addl" + username: "addl", ), ] let actual = try TwoFasImporter.importItems(data: data) diff --git a/AuthenticatorShared/Core/Vault/Services/Stores/AuthenticatorItemDataStore.swift b/AuthenticatorShared/Core/Vault/Services/Stores/AuthenticatorItemDataStore.swift index 4dede1bb46..862a18e7f1 100644 --- a/AuthenticatorShared/Core/Vault/Services/Stores/AuthenticatorItemDataStore.swift +++ b/AuthenticatorShared/Core/Vault/Services/Stores/AuthenticatorItemDataStore.swift @@ -69,7 +69,7 @@ extension DataStore: AuthenticatorItemDataStore { func deleteAuthenticatorItem(id: String, userId: String) async throws { try await backgroundContext.performAndSave { let results = try self.backgroundContext.fetch( - AuthenticatorItemData.fetchByIdRequest(id: id, userId: userId) + AuthenticatorItemData.fetchByIdRequest(id: id, userId: userId), ) for result in results { self.backgroundContext.delete(result) @@ -98,7 +98,7 @@ extension DataStore: AuthenticatorItemDataStore { fetchRequest.sortDescriptors = [NSSortDescriptor(keyPath: \AuthenticatorItemData.id, ascending: true)] return FetchedResultsPublisher( context: persistentContainer.viewContext, - request: fetchRequest + request: fetchRequest, ) .tryMap { try $0.map(AuthenticatorItem.init) } .eraseToAnyPublisher() @@ -109,7 +109,7 @@ extension DataStore: AuthenticatorItemDataStore { let insertRequest = try AuthenticatorItemData.batchInsertRequest(objects: authenticatorItems, userId: userId) try await executeBatchReplace( deleteRequest: deleteRequest, - insertRequest: insertRequest + insertRequest: insertRequest, ) } @@ -118,7 +118,7 @@ extension DataStore: AuthenticatorItemDataStore { _ = try AuthenticatorItemData( context: self.backgroundContext, userId: userId, - authenticatorItem: authenticatorItem + authenticatorItem: authenticatorItem, ) } } diff --git a/AuthenticatorShared/Core/Vault/Services/Stores/AuthenticatorItemDataStoreTests.swift b/AuthenticatorShared/Core/Vault/Services/Stores/AuthenticatorItemDataStoreTests.swift index 9d2ef1bc48..7db9847b8d 100644 --- a/AuthenticatorShared/Core/Vault/Services/Stores/AuthenticatorItemDataStoreTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/Stores/AuthenticatorItemDataStoreTests.swift @@ -39,7 +39,7 @@ class AuthenticatorItemDataStoreTests: BitwardenTestCase { receiveCompletion: { _ in }, receiveValue: { values in publishedValues.append(values) - } + }, ) defer { publisher.cancel() } @@ -69,7 +69,7 @@ class AuthenticatorItemDataStoreTests: BitwardenTestCase { try XCTAssertEqual( fetchAuthenticatorItems(userId: "1"), - authenticatorItems.filter { $0.id != "2" } + authenticatorItems.filter { $0.id != "2" }, ) } @@ -140,7 +140,7 @@ class AuthenticatorItemDataStoreTests: BitwardenTestCase { _ = try AuthenticatorItemData( context: self.subject.backgroundContext, userId: userId, - authenticatorItem: authenticatorItem + authenticatorItem: authenticatorItem, ) } } diff --git a/AuthenticatorShared/Core/Vault/Services/TOTP/OTPAuthModel.swift b/AuthenticatorShared/Core/Vault/Services/TOTP/OTPAuthModel.swift index c53197581e..06ade1fedb 100644 --- a/AuthenticatorShared/Core/Vault/Services/TOTP/OTPAuthModel.swift +++ b/AuthenticatorShared/Core/Vault/Services/TOTP/OTPAuthModel.swift @@ -71,7 +71,7 @@ struct OTPAuthModel: Equatable { digits: Int, issuer: String?, period: Int, - secret: String + secret: String, ) { self.accountName = accountName?.nilIfEmpty self.algorithm = algorithm @@ -101,13 +101,11 @@ struct OTPAuthModel: Equatable { let issuer = queryItems.first { $0.name == "issuer" }?.value let period = queryItems.first { $0.name == "period" }?.value.flatMap(Int.init) ?? 30 - let accountName: String? - - if let issuer { + let accountName: String? = if let issuer { // Remove the leading slash and trailing colon as well - accountName = String(urlComponents.path.dropFirst(issuer.count + 2)) + String(urlComponents.path.dropFirst(issuer.count + 2)) } else { - accountName = String(urlComponents.path.dropFirst()) + String(urlComponents.path.dropFirst()) } self.init( @@ -116,7 +114,7 @@ struct OTPAuthModel: Equatable { digits: digits, issuer: issuer, period: period, - secret: secret + secret: secret, ) } @@ -132,7 +130,7 @@ struct OTPAuthModel: Equatable { digits: 6, issuer: issuer, period: 30, - secret: secret + secret: secret, ) } } diff --git a/AuthenticatorShared/Core/Vault/Services/TOTP/OTPAuthModelTests.swift b/AuthenticatorShared/Core/Vault/Services/TOTP/OTPAuthModelTests.swift index a999551a1b..deeb036f89 100644 --- a/AuthenticatorShared/Core/Vault/Services/TOTP/OTPAuthModelTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/TOTP/OTPAuthModelTests.swift @@ -109,7 +109,7 @@ class OTPAuthModelTests: BitwardenTestCase { digits: 6, issuer: "Bitwarden", period: 30, - secret: "JBSWY3DPEHPK3PXP" + secret: "JBSWY3DPEHPK3PXP", ) // swiftlint:disable:next line_length XCTAssertEqual(subject.otpAuthUri, "otpauth://totp/Bitwarden:person%40bitwarden%2Ecom?secret=JBSWY3DPEHPK3PXP&issuer=Bitwarden&algorithm=SHA1&digits=6&period=30") @@ -124,7 +124,7 @@ class OTPAuthModelTests: BitwardenTestCase { digits: 6, issuer: nil, period: 30, - secret: "JBSWY3DPEHPK3PXP" + secret: "JBSWY3DPEHPK3PXP", ) XCTAssertEqual(subject.otpAuthUri, "otpauth://totp/?secret=JBSWY3DPEHPK3PXP&algorithm=SHA1&digits=6&period=30") XCTAssertEqual(OTPAuthModel(otpAuthUri: subject.otpAuthUri), subject) @@ -138,7 +138,7 @@ class OTPAuthModelTests: BitwardenTestCase { digits: 6, issuer: "Bitwarden", period: 30, - secret: "JBSWY3DPEHPK3PXP" + secret: "JBSWY3DPEHPK3PXP", ) // swiftlint:disable:next line_length XCTAssertEqual(subject.otpAuthUri, "otpauth://totp/?secret=JBSWY3DPEHPK3PXP&issuer=Bitwarden&algorithm=SHA1&digits=6&period=30") @@ -153,7 +153,7 @@ class OTPAuthModelTests: BitwardenTestCase { digits: 6, issuer: nil, period: 30, - secret: "JBSWY3DPEHPK3PXP" + secret: "JBSWY3DPEHPK3PXP", ) // swiftlint:disable:next line_length XCTAssertEqual(subject.otpAuthUri, "otpauth://totp/person%40bitwarden%2Ecom?secret=JBSWY3DPEHPK3PXP&algorithm=SHA1&digits=6&period=30") @@ -168,7 +168,7 @@ class OTPAuthModelTests: BitwardenTestCase { digits: 6, issuer: "Issuer Two: 100% the Sequel", period: 30, - secret: "JBSWY3DPEHPK3PXP" + secret: "JBSWY3DPEHPK3PXP", ) // swiftlint:disable:next line_length XCTAssertEqual(subject.otpAuthUri, "otpauth://totp/Issuer%20Two%3A%20100%25%20the%20Sequel:person%40bitwarden%2Ecom?secret=JBSWY3DPEHPK3PXP&issuer=Issuer%20Two%3A%20100%25%20the%20Sequel&algorithm=SHA1&digits=6&period=30") diff --git a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPCodeConfigTests.swift b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPCodeConfigTests.swift index 54bed02a88..63e711608e 100644 --- a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPCodeConfigTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPCodeConfigTests.swift @@ -10,7 +10,7 @@ final class TOTPCodeConfigTests: BitwardenTestCase { /// Tests that a malformed string does not create a model. func test_init_totpCodeConfig_failure_incompletePrefix() { let subject = TOTPKeyModel( - authenticatorKey: "totp/Example:eliot@livefront.com?secret=JBSWY3DPEHPK3PXP" + authenticatorKey: "totp/Example:eliot@livefront.com?secret=JBSWY3DPEHPK3PXP", ) XCTAssertNil(subject) } @@ -18,7 +18,7 @@ final class TOTPCodeConfigTests: BitwardenTestCase { /// Tests that a malformed string does not create a model. func test_init_totpCodeConfig_failure_noSecret() { let subject = TOTPKeyModel( - authenticatorKey: "otpauth://totp/Example:eliot@livefront.com?issuer=Example&algorithm=SHA256&digits=6&period=30" // swiftlint:disable:this line_length + authenticatorKey: "otpauth://totp/Example:eliot@livefront.com?issuer=Example&algorithm=SHA256&digits=6&period=30", // swiftlint:disable:this line_length ) XCTAssertNil(subject) } @@ -26,7 +26,7 @@ final class TOTPCodeConfigTests: BitwardenTestCase { /// Tests that a base32 string creates the model. func test_init_totpCodeConfig_base32() { let subject = TOTPKeyModel( - authenticatorKey: .base32Key + authenticatorKey: .base32Key, ) XCTAssertNotNil(subject) XCTAssertEqual(subject?.base32Key, .base32Key) @@ -35,7 +35,7 @@ final class TOTPCodeConfigTests: BitwardenTestCase { /// Tests that a base32 string with spaces creates the model with the spaces removed. func test_init_totpCodeConfig_base32_withSpaces() { let subject = TOTPKeyModel( - authenticatorKey: .base32KeyWithSpaces + authenticatorKey: .base32KeyWithSpaces, ) XCTAssertNotNil(subject) XCTAssertEqual(subject?.base32Key, .base32Key) @@ -44,36 +44,36 @@ final class TOTPCodeConfigTests: BitwardenTestCase { /// Tests that an otp auth string creates the model. func test_init_totpCodeConfig_success_full() { let subject = TOTPKeyModel( - authenticatorKey: .otpAuthUriKeyComplete + authenticatorKey: .otpAuthUriKeyComplete, ) XCTAssertNotNil(subject) XCTAssertEqual( subject?.base32Key, - .base32Key + .base32Key, ) } /// Tests that an otp auth string creates the model. func test_init_totpCodeConfig_success_partial() { let subject = TOTPKeyModel( - authenticatorKey: .otpAuthUriKeyPartial + authenticatorKey: .otpAuthUriKeyPartial, ) XCTAssertNotNil(subject) XCTAssertEqual( subject?.base32Key, - .base32Key + .base32Key, ) } /// Tests that an otp auth string creates the model. func test_init_totpCodeConfig_success_sha512() { let subject = TOTPKeyModel( - authenticatorKey: .otpAuthUriKeySHA512 + authenticatorKey: .otpAuthUriKeySHA512, ) XCTAssertNotNil(subject) XCTAssertEqual( subject?.base32Key, - .base32Key + .base32Key, ) } diff --git a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPExpirationCalculator.swift b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPExpirationCalculator.swift index e4053393c2..83d4174a29 100644 --- a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPExpirationCalculator.swift +++ b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPExpirationCalculator.swift @@ -17,7 +17,7 @@ enum TOTPExpirationCalculator { /// static func hasCodeExpired( _ codeModel: TOTPCodeModel, - timeProvider: any TimeProvider + timeProvider: any TimeProvider, ) -> Bool { let period = codeModel.period let codeGenerationDate = codeModel.codeGenerationDate @@ -45,7 +45,7 @@ enum TOTPExpirationCalculator { /// static func listItemsByExpiration( _ items: [ItemListItem], - timeProvider: any TimeProvider + timeProvider: any TimeProvider, ) -> [Bool: [ItemListItem]] { let sortedItems: [Bool: [ItemListItem]] = Dictionary(grouping: items, by: { item in guard let totpCode = item.totpCodeModel else { return false } diff --git a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPExpirationCalculatorTests.swift b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPExpirationCalculatorTests.swift index aa6d98afec..ccaa5d8ef4 100644 --- a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPExpirationCalculatorTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPExpirationCalculatorTests.swift @@ -12,10 +12,10 @@ final class TOTPExpirationCalculatorTests: BitwardenTestCase { .init( code: "", codeGenerationDate: .distantPast, - period: 30 + period: 30, ), - timeProvider: MockTimeProvider(.currentTime) - ) + timeProvider: MockTimeProvider(.currentTime), + ), ) } @@ -25,20 +25,20 @@ final class TOTPExpirationCalculatorTests: BitwardenTestCase { .init( code: "", codeGenerationDate: Date(year: 2024, month: 1, day: 1, second: 29), - period: 30 + period: 30, ), - timeProvider: MockTimeProvider(.mockTime(Date(year: 2024, month: 1, day: 1, second: 30))) - ) + timeProvider: MockTimeProvider(.mockTime(Date(year: 2024, month: 1, day: 1, second: 30))), + ), ) XCTAssertTrue( TOTPExpirationCalculator.hasCodeExpired( .init( code: "", codeGenerationDate: Date(year: 2024, month: 1, day: 1, second: 29), - period: 30 + period: 30, ), - timeProvider: MockTimeProvider(.mockTime(Date(year: 2024, month: 1, day: 1, second: 31))) - ) + timeProvider: MockTimeProvider(.mockTime(Date(year: 2024, month: 1, day: 1, second: 31))), + ), ) } @@ -48,20 +48,20 @@ final class TOTPExpirationCalculatorTests: BitwardenTestCase { .init( code: "", codeGenerationDate: Date(year: 2024, month: 1, day: 1, second: 15), - period: 30 + period: 30, ), - timeProvider: MockTimeProvider(.mockTime(Date(year: 2024, month: 1, day: 1, second: 15))) - ) + timeProvider: MockTimeProvider(.mockTime(Date(year: 2024, month: 1, day: 1, second: 15))), + ), ) XCTAssertFalse( TOTPExpirationCalculator.hasCodeExpired( .init( code: "", codeGenerationDate: Date(year: 2024, month: 1, day: 1, second: 0), - period: 30 + period: 30, ), - timeProvider: MockTimeProvider(.mockTime(Date(year: 2024, month: 1, day: 1, second: 29))) - ) + timeProvider: MockTimeProvider(.mockTime(Date(year: 2024, month: 1, day: 1, second: 29))), + ), ) } @@ -69,20 +69,20 @@ final class TOTPExpirationCalculatorTests: BitwardenTestCase { let expiredTotp = TOTPCodeModel( code: "", codeGenerationDate: Date(year: 2024, month: 1, day: 1, second: 29), - period: 30 + period: 30, ) let expired = ItemListItem.fixture(totp: ItemListTotpItem.fixture(totpCode: expiredTotp)) let expiredShared = ItemListItem.fixtureShared( - totp: ItemListSharedTotpItem.fixture(totpCode: expiredTotp) + totp: ItemListSharedTotpItem.fixture(totpCode: expiredTotp), ) let currentTotp = TOTPCodeModel( code: "", codeGenerationDate: Date(year: 2024, month: 1, day: 1, second: 31), - period: 30 + period: 30, ) let current = ItemListItem.fixture(totp: ItemListTotpItem.fixture(totpCode: currentTotp)) let currentShared = ItemListItem.fixtureShared( - totp: ItemListSharedTotpItem.fixture(totpCode: currentTotp) + totp: ItemListSharedTotpItem.fixture(totpCode: currentTotp), ) let expectation = [ true: [ @@ -104,11 +104,11 @@ final class TOTPExpirationCalculatorTests: BitwardenTestCase { year: 2024, month: 1, day: 1, - second: 31 - ) - ) - ) - ) + second: 31, + ), + ), + ), + ), ) } @@ -116,9 +116,9 @@ final class TOTPExpirationCalculatorTests: BitwardenTestCase { XCTAssertEqual( TOTPExpirationCalculator.remainingSeconds( for: Date(year: 2024, month: 1, day: 1, second: 29, nanosecond: 90_000_000), - using: 30 + using: 30, ), - 1 + 1, ) } } diff --git a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPKey.swift b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPKey.swift index cb32cde74b..d78ca45076 100644 --- a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPKey.swift +++ b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPKey.swift @@ -34,11 +34,11 @@ enum TOTPKey: Equatable { var digits: Int { switch self { case .base32: - return 6 + 6 case let .otpAuthUri(model): - return model.digits + model.digits case .steamUri: - return 5 + 5 } } @@ -61,9 +61,9 @@ enum TOTPKey: Equatable { switch self { case let .base32(key), let .steamUri(key): - return key + key case let .otpAuthUri(model): - return model.secret + model.secret } } @@ -74,9 +74,9 @@ enum TOTPKey: Equatable { switch self { case .base32, .steamUri: - return 30 + 30 case let .otpAuthUri(model): - return model.period + model.period } } diff --git a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPService.swift b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPService.swift index 346fa1826d..82aa00aeed 100644 --- a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPService.swift +++ b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPService.swift @@ -44,7 +44,7 @@ class DefaultTOTPService { init( clientService: ClientService, errorReporter: ErrorReporter, - timeProvider: TimeProvider + timeProvider: TimeProvider, ) { self.clientService = clientService self.errorReporter = errorReporter @@ -56,7 +56,7 @@ extension DefaultTOTPService: TOTPService { func getTotpCode(for key: TOTPKeyModel) async throws -> TOTPCodeModel { try await clientService.vault().generateTOTPCode( for: key.rawAuthenticatorKey, - date: timeProvider.presentTime + date: timeProvider.presentTime, ) } diff --git a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPServiceTests.swift b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPServiceTests.swift index 7b159d0f1b..415d0e1131 100644 --- a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPServiceTests.swift +++ b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPServiceTests.swift @@ -25,7 +25,7 @@ final class TOTPServiceTests: BitwardenTestCase { subject = DefaultTOTPService( clientService: clientService, errorReporter: errorReporter, - timeProvider: timeProvider + timeProvider: timeProvider, ) } @@ -60,11 +60,11 @@ final class TOTPServiceTests: BitwardenTestCase { func test_default_getTOTPConfiguration_failure() { XCTAssertThrowsError( - try subject.getTOTPConfiguration(key: "1234") + try subject.getTOTPConfiguration(key: "1234"), ) { error in XCTAssertEqual( error as? TOTPServiceError, - .invalidKeyFormat + .invalidKeyFormat, ) } } diff --git a/AuthenticatorShared/Core/Vault/Services/TOTP/TestHelpers/MockTOTPService.swift b/AuthenticatorShared/Core/Vault/Services/TOTP/TestHelpers/MockTOTPService.swift index a3af5f30e9..0b825619c9 100644 --- a/AuthenticatorShared/Core/Vault/Services/TOTP/TestHelpers/MockTOTPService.swift +++ b/AuthenticatorShared/Core/Vault/Services/TOTP/TestHelpers/MockTOTPService.swift @@ -4,7 +4,7 @@ import Foundation class MockTOTPService: TOTPService { var getTotpCodeResult: Result = .success( - TOTPCodeModel(code: "123456", codeGenerationDate: .now, period: 30) + TOTPCodeModel(code: "123456", codeGenerationDate: .now, period: 30), ) var getTotpCodeConfig: TOTPKeyModel? diff --git a/AuthenticatorShared/Core/Vault/Services/TestHelpers/BitwardenSdk+VaultMocking.swift b/AuthenticatorShared/Core/Vault/Services/TestHelpers/BitwardenSdk+VaultMocking.swift index 705c1897d1..8442bcd48f 100644 --- a/AuthenticatorShared/Core/Vault/Services/TestHelpers/BitwardenSdk+VaultMocking.swift +++ b/AuthenticatorShared/Core/Vault/Services/TestHelpers/BitwardenSdk+VaultMocking.swift @@ -11,7 +11,7 @@ extension Attachment { size: attachmentView.size, sizeName: attachmentView.sizeName, fileName: attachmentView.fileName, - key: attachmentView.key + key: attachmentView.key, ) } } @@ -24,7 +24,7 @@ extension AttachmentView { size: attachment.size, sizeName: attachment.sizeName, fileName: attachment.fileName, - key: attachment.key + key: attachment.key, ) } } @@ -37,7 +37,7 @@ extension Card { expYear: cardView.expYear, code: cardView.code, brand: cardView.brand, - number: cardView.number + number: cardView.number, ) } } @@ -50,7 +50,7 @@ extension CardView { expYear: card.expYear, code: card.code, brand: card.brand, - number: card.number + number: card.number, ) } } @@ -79,7 +79,7 @@ extension CipherListView { revisionDate: cipher.revisionDate, archivedDate: cipher.archivedDate, copyableFields: [], - localData: cipher.localData.map(LocalDataView.init) + localData: cipher.localData.map(LocalDataView.init), ) } } @@ -100,8 +100,8 @@ extension CipherListViewType { ), username: nil, totp: cipher.login?.totp, - uris: cipher.login?.uris?.map { LoginUriView(loginUri: $0) } - ) + uris: cipher.login?.uris?.map { LoginUriView(loginUri: $0) }, + ), ) case .secureNote: self = .secureNote @@ -140,7 +140,7 @@ extension Cipher { creationDate: cipherView.creationDate, deletedDate: cipherView.deletedDate, revisionDate: cipherView.revisionDate, - archivedDate: cipherView.archivedDate + archivedDate: cipherView.archivedDate, ) } } @@ -174,7 +174,7 @@ extension CipherView { creationDate: cipher.creationDate, deletedDate: cipher.deletedDate, revisionDate: cipher.revisionDate, - archivedDate: cipher.archivedDate + archivedDate: cipher.archivedDate, ) } } @@ -189,7 +189,7 @@ extension CollectionView { hidePasswords: collection.hidePasswords, readOnly: collection.readOnly, manage: collection.manage, - type: collection.type + type: collection.type, ) } } @@ -209,7 +209,7 @@ extension Fido2Credential { rpName: fido2CredentialView.rpName, userDisplayName: fido2CredentialView.userDisplayName, discoverable: fido2CredentialView.discoverable, - creationDate: fido2CredentialView.creationDate + creationDate: fido2CredentialView.creationDate, ) } } @@ -229,7 +229,7 @@ extension Fido2CredentialView { rpName: fido2Credential.rpName, userDisplayName: fido2Credential.userDisplayName, discoverable: fido2Credential.discoverable, - creationDate: fido2Credential.creationDate + creationDate: fido2Credential.creationDate, ) } } @@ -240,7 +240,7 @@ extension Field { name: fieldView.name, value: fieldView.value, type: fieldView.type, - linkedId: fieldView.linkedId + linkedId: fieldView.linkedId, ) } } @@ -251,7 +251,7 @@ extension FieldView { name: field.name, value: field.value, type: field.type, - linkedId: field.linkedId + linkedId: field.linkedId, ) } } @@ -261,7 +261,7 @@ extension Folder { self.init( id: folderView.id, name: folderView.name, - revisionDate: folderView.revisionDate + revisionDate: folderView.revisionDate, ) } } @@ -271,7 +271,7 @@ extension FolderView { self.init( id: folder.id, name: folder.name, - revisionDate: folder.revisionDate + revisionDate: folder.revisionDate, ) } } @@ -296,7 +296,7 @@ extension Identity { ssn: identityView.ssn, username: identityView.username, passportNumber: identityView.passportNumber, - licenseNumber: identityView.licenseNumber + licenseNumber: identityView.licenseNumber, ) } } @@ -321,7 +321,7 @@ extension IdentityView { ssn: identity.ssn, username: identity.username, passportNumber: identity.passportNumber, - licenseNumber: identity.licenseNumber + licenseNumber: identity.licenseNumber, ) } } @@ -330,7 +330,7 @@ extension LocalData { init(localDataView: LocalDataView) { self.init( lastUsedDate: localDataView.lastUsedDate, - lastLaunched: localDataView.lastLaunched + lastLaunched: localDataView.lastLaunched, ) } } @@ -339,7 +339,7 @@ extension LocalDataView { init(localData: LocalData) { self.init( lastUsedDate: localData.lastUsedDate, - lastLaunched: localData.lastLaunched + lastLaunched: localData.lastLaunched, ) } } @@ -353,7 +353,7 @@ extension Login { uris: loginView.uris?.map(LoginUri.init), totp: loginView.totp, autofillOnPageLoad: loginView.autofillOnPageLoad, - fido2Credentials: loginView.fido2Credentials + fido2Credentials: loginView.fido2Credentials, ) } } @@ -367,7 +367,7 @@ extension LoginView { uris: login.uris?.map(LoginUriView.init), totp: login.totp, autofillOnPageLoad: login.autofillOnPageLoad, - fido2Credentials: login.fido2Credentials + fido2Credentials: login.fido2Credentials, ) } } @@ -377,7 +377,7 @@ extension LoginUri { self.init( uri: loginUriView.uri, match: loginUriView.match, - uriChecksum: loginUriView.uriChecksum + uriChecksum: loginUriView.uriChecksum, ) } } @@ -387,7 +387,7 @@ extension LoginUriView { self.init( uri: loginUri.uri, match: loginUri.match, - uriChecksum: loginUri.uriChecksum + uriChecksum: loginUri.uriChecksum, ) } } @@ -396,7 +396,7 @@ extension PasswordHistory { init(passwordHistoryView: PasswordHistoryView) { self.init( password: passwordHistoryView.password, - lastUsedDate: passwordHistoryView.lastUsedDate + lastUsedDate: passwordHistoryView.lastUsedDate, ) } } @@ -405,7 +405,7 @@ extension PasswordHistoryView { init(passwordHistory: PasswordHistory) { self.init( password: passwordHistory.password, - lastUsedDate: passwordHistory.lastUsedDate + lastUsedDate: passwordHistory.lastUsedDate, ) } } @@ -428,7 +428,7 @@ extension SendFileView { id: sendFile.id, fileName: sendFile.fileName, size: sendFile.size, - sizeName: sendFile.sizeName + sizeName: sendFile.sizeName, ) } } @@ -437,7 +437,7 @@ extension SendTextView { init(sendText: SendText) { self.init( text: sendText.text, - hidden: sendText.hidden + hidden: sendText.hidden, ) } } @@ -461,7 +461,7 @@ extension SendView { hideEmail: send.hideEmail, revisionDate: send.revisionDate, deletionDate: send.deletionDate, - expirationDate: send.expirationDate + expirationDate: send.expirationDate, ) } } @@ -472,7 +472,7 @@ extension SendFile { id: sendFileView.id, fileName: sendFileView.fileName, size: sendFileView.size, - sizeName: sendFileView.sizeName + sizeName: sendFileView.sizeName, ) } } @@ -481,7 +481,7 @@ extension SendText { init(sendTextView: SendTextView) { self.init( text: sendTextView.text, - hidden: sendTextView.hidden + hidden: sendTextView.hidden, ) } } @@ -504,7 +504,7 @@ extension Send { hideEmail: sendView.hideEmail, revisionDate: sendView.revisionDate, deletionDate: sendView.deletionDate, - expirationDate: sendView.expirationDate + expirationDate: sendView.expirationDate, ) } } @@ -514,7 +514,7 @@ extension SshKey { self.init( privateKey: sshKeyView.privateKey, publicKey: sshKeyView.publicKey, - fingerprint: sshKeyView.fingerprint + fingerprint: sshKeyView.fingerprint, ) } } @@ -524,7 +524,7 @@ extension SshKeyView { self.init( privateKey: sshKey.privateKey, publicKey: sshKey.publicKey, - fingerprint: sshKey.fingerprint + fingerprint: sshKey.fingerprint, ) } } // swiftlint:disable:this file_length diff --git a/AuthenticatorShared/Core/Vault/Services/TestHelpers/MockExporterClient.swift b/AuthenticatorShared/Core/Vault/Services/TestHelpers/MockExporterClient.swift index 9b52a3013f..910b405448 100644 --- a/AuthenticatorShared/Core/Vault/Services/TestHelpers/MockExporterClient.swift +++ b/AuthenticatorShared/Core/Vault/Services/TestHelpers/MockExporterClient.swift @@ -54,7 +54,7 @@ extension MockExporterClient: ExporterClientProtocol { func exportOrganizationVault( collections: [BitwardenSdk.Collection], ciphers: [BitwardenSdk.Cipher], - format: BitwardenSdk.ExportFormat + format: BitwardenSdk.ExportFormat, ) throws -> String { self.collections = collections self.ciphers = ciphers @@ -65,7 +65,7 @@ extension MockExporterClient: ExporterClientProtocol { func exportVault( folders: [BitwardenSdk.Folder], ciphers: [BitwardenSdk.Cipher], - format: BitwardenSdk.ExportFormat + format: BitwardenSdk.ExportFormat, ) throws -> String { self.folders = folders self.ciphers = ciphers diff --git a/AuthenticatorShared/Core/Vault/Services/TestHelpers/MockVaultClientService.swift b/AuthenticatorShared/Core/Vault/Services/TestHelpers/MockVaultClientService.swift index 764f28e388..6d41c83ed3 100644 --- a/AuthenticatorShared/Core/Vault/Services/TestHelpers/MockVaultClientService.swift +++ b/AuthenticatorShared/Core/Vault/Services/TestHelpers/MockVaultClientService.swift @@ -35,7 +35,7 @@ class MockVaultClientService: VaultClientService { return TOTPCodeModel( code: code, codeGenerationDate: date ?? timeProvider.presentTime, - period: totpPeriod + period: totpPeriod, ) } @@ -60,7 +60,7 @@ class MockClientAttachments: AttachmentsClientProtocol { cipher _: Cipher, attachment _: AttachmentView, encryptedFilePath: String, - decryptedFilePath _: String + decryptedFilePath _: String, ) throws { encryptedFilePaths.append(encryptedFilePath) } @@ -68,7 +68,7 @@ class MockClientAttachments: AttachmentsClientProtocol { func encryptBuffer( cipher _: Cipher, attachment: AttachmentView, - buffer: Data + buffer: Data, ) throws -> AttachmentEncryptResult { encryptedBuffers.append(buffer) return AttachmentEncryptResult(attachment: Attachment(attachmentView: attachment), contents: buffer) @@ -78,7 +78,7 @@ class MockClientAttachments: AttachmentsClientProtocol { cipher _: Cipher, attachment: AttachmentView, decryptedFilePath _: String, - encryptedFilePath _: String + encryptedFilePath _: String, ) throws -> Attachment { Attachment(attachmentView: attachment) } @@ -119,7 +119,7 @@ class MockClientCiphers: CiphersClientProtocol { func decryptListWithFailures(ciphers: [Cipher]) -> DecryptCipherListResult { decryptListWithFailuresResult ?? DecryptCipherListResult( successes: ciphers.map(CipherListView.init), - failures: [] + failures: [], ) } @@ -129,13 +129,13 @@ class MockClientCiphers: CiphersClientProtocol { throw encryptError } return try encryptCipherResult?.get() ?? EncryptionContext( - encryptedFor: "1", cipher: Cipher(cipherView: cipherView) + encryptedFor: "1", cipher: Cipher(cipherView: cipherView), ) } func moveToOrganization( cipher: CipherView, - organizationId: Uuid + organizationId: Uuid, ) throws -> CipherView { moveToOrganizationCipher = cipher moveToOrganizationOrganizationId = organizationId diff --git a/AuthenticatorShared/Core/Vault/Services/VaultClientService.swift b/AuthenticatorShared/Core/Vault/Services/VaultClientService.swift index 9e956e8394..682a2b4106 100644 --- a/AuthenticatorShared/Core/Vault/Services/VaultClientService.swift +++ b/AuthenticatorShared/Core/Vault/Services/VaultClientService.swift @@ -60,7 +60,7 @@ extension VaultClient: VaultClientService { return TOTPCodeModel( code: response.code, codeGenerationDate: calculationDate, - period: response.period + period: response.period, ) } diff --git a/AuthenticatorShared/UI/Auth/AuthCoordinator.swift b/AuthenticatorShared/UI/Auth/AuthCoordinator.swift index 4405e654e7..764a5d65c9 100644 --- a/AuthenticatorShared/UI/Auth/AuthCoordinator.swift +++ b/AuthenticatorShared/UI/Auth/AuthCoordinator.swift @@ -59,7 +59,7 @@ final class AuthCoordinator: NSObject, Coordinator, HasStackNavigator, HasRouter rootNavigator: RootNavigator, router: AnyRouter, services: Services, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) { self.delegate = delegate self.rootNavigator = rootNavigator @@ -103,7 +103,7 @@ final class AuthCoordinator: NSObject, Coordinator, HasStackNavigator, HasRouter let processor = VaultUnlockProcessor( coordinator: asAnyCoordinator(), services: services, - state: VaultUnlockState() + state: VaultUnlockState(), ) processor.shouldAttemptAutomaticBiometricUnlock = true let view = VaultUnlockView(store: Store(processor: processor)) diff --git a/AuthenticatorShared/UI/Auth/AuthModule.swift b/AuthenticatorShared/UI/Auth/AuthModule.swift index b46f034d5a..b15a3da906 100644 --- a/AuthenticatorShared/UI/Auth/AuthModule.swift +++ b/AuthenticatorShared/UI/Auth/AuthModule.swift @@ -14,7 +14,7 @@ protocol AuthModule { func makeAuthCoordinator( delegate: AuthCoordinatorDelegate, rootNavigator: RootNavigator, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator /// Initializes a router for converting AuthEvents into AuthRoutes. @@ -30,14 +30,14 @@ extension DefaultAppModule: AuthModule { func makeAuthCoordinator( delegate: AuthCoordinatorDelegate, rootNavigator: RootNavigator, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator { AuthCoordinator( delegate: delegate, rootNavigator: rootNavigator, router: makeAuthRouter(), services: services, - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ).asAnyCoordinator() } diff --git a/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockProcessor.swift b/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockProcessor.swift index 2710e3defc..d8f42179d5 100644 --- a/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockProcessor.swift +++ b/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockProcessor.swift @@ -7,7 +7,7 @@ import OSLog class VaultUnlockProcessor: StateProcessor< VaultUnlockState, VaultUnlockAction, - VaultUnlockEffect + VaultUnlockEffect, > { // MARK: Types @@ -37,7 +37,7 @@ class VaultUnlockProcessor: StateProcessor< init( coordinator: AnyCoordinator, services: Services, - state: VaultUnlockState + state: VaultUnlockState, ) { self.coordinator = coordinator self.services = services diff --git a/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockView.swift b/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockView.swift index 69cb101392..b2ffc81ac7 100644 --- a/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockView.swift +++ b/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockView.swift @@ -21,7 +21,7 @@ struct VaultUnlockView: View { } .toast(store.binding( get: \.toast, - send: VaultUnlockAction.toastShown + send: VaultUnlockAction.toastShown, )) } @@ -86,11 +86,11 @@ struct VaultUnlockView_Previews: PreviewProvider { biometricUnlockStatus: .available( .faceID, enabled: false, - hasValidIntegrity: false - ) - ) - ) - ) + hasValidIntegrity: false, + ), + ), + ), + ), ) }.previewDisplayName("No Button") @@ -102,11 +102,11 @@ struct VaultUnlockView_Previews: PreviewProvider { biometricUnlockStatus: .available( .faceID, enabled: true, - hasValidIntegrity: true - ) - ) - ) - ) + hasValidIntegrity: true, + ), + ), + ), + ), ) }.previewDisplayName("Face ID Button") @@ -118,11 +118,11 @@ struct VaultUnlockView_Previews: PreviewProvider { biometricUnlockStatus: .available( .touchID, enabled: true, - hasValidIntegrity: true - ) - ) - ) - ) + hasValidIntegrity: true, + ), + ), + ), + ), ) }.previewDisplayName("Touch ID Button") } diff --git a/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockViewTests.swift b/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockViewTests.swift index 79f7840c38..4adb0c2163 100644 --- a/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockViewTests.swift +++ b/AuthenticatorShared/UI/Auth/VaultUnlock/VaultUnlockViewTests.swift @@ -21,7 +21,7 @@ class VaultUnlockViewTests: BitwardenTestCase { let state = VaultUnlockState() processor = MockProcessor(state: state) subject = VaultUnlockView( - store: Store(processor: processor) + store: Store(processor: processor), ) } @@ -45,7 +45,7 @@ class VaultUnlockViewTests: BitwardenTestCase { .defaultPortraitAX5, .defaultLandscape, .defaultLandscapeAX5, - ] + ], ) } } diff --git a/AuthenticatorShared/UI/DebugMenu/DebugMenuCoordinator.swift b/AuthenticatorShared/UI/DebugMenu/DebugMenuCoordinator.swift index f21c98f67e..8b10fd6dd4 100644 --- a/AuthenticatorShared/UI/DebugMenu/DebugMenuCoordinator.swift +++ b/AuthenticatorShared/UI/DebugMenu/DebugMenuCoordinator.swift @@ -28,7 +28,7 @@ final class DebugMenuCoordinator: Coordinator, HasStackNavigator { /// init( services: Services, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) { self.services = services self.stackNavigator = stackNavigator @@ -38,7 +38,7 @@ final class DebugMenuCoordinator: Coordinator, HasStackNavigator { func navigate( to route: DebugMenuRoute, - context: AnyObject? + context: AnyObject?, ) { switch route { case .dismiss: @@ -58,7 +58,7 @@ final class DebugMenuCoordinator: Coordinator, HasStackNavigator { let processor = DebugMenuProcessor( coordinator: asAnyCoordinator(), services: services, - state: DebugMenuState() + state: DebugMenuState(), ) let view = DebugMenuView(store: Store(processor: processor)) diff --git a/AuthenticatorShared/UI/DebugMenu/DebugMenuCoordinatorTests.swift b/AuthenticatorShared/UI/DebugMenu/DebugMenuCoordinatorTests.swift index 8811333b2e..f9e5ede7ef 100644 --- a/AuthenticatorShared/UI/DebugMenu/DebugMenuCoordinatorTests.swift +++ b/AuthenticatorShared/UI/DebugMenu/DebugMenuCoordinatorTests.swift @@ -24,9 +24,9 @@ class DebugMenuCoordinatorTests: BitwardenTestCase { subject = DebugMenuCoordinator( services: ServiceContainer.withMocks( appSettingsStore: appSettingsStore, - configService: configService + configService: configService, ), - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ) } diff --git a/AuthenticatorShared/UI/DebugMenu/DebugMenuModule.swift b/AuthenticatorShared/UI/DebugMenu/DebugMenuModule.swift index bc180d8958..29284435d4 100644 --- a/AuthenticatorShared/UI/DebugMenu/DebugMenuModule.swift +++ b/AuthenticatorShared/UI/DebugMenu/DebugMenuModule.swift @@ -12,17 +12,17 @@ protocol DebugMenuModule { /// - Returns: A coordinator that can navigate to `DebugMenuRoute`s. /// func makeDebugMenuCoordinator( - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator } extension DefaultAppModule: DebugMenuModule { func makeDebugMenuCoordinator( - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator { DebugMenuCoordinator( services: services, - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ) .asAnyCoordinator() } diff --git a/AuthenticatorShared/UI/DebugMenu/DebugMenuProcessor.swift b/AuthenticatorShared/UI/DebugMenu/DebugMenuProcessor.swift index 13f8c65eaa..937d42cf10 100644 --- a/AuthenticatorShared/UI/DebugMenu/DebugMenuProcessor.swift +++ b/AuthenticatorShared/UI/DebugMenu/DebugMenuProcessor.swift @@ -30,7 +30,7 @@ final class DebugMenuProcessor: StateProcessor, services: Services, - state: DebugMenuState + state: DebugMenuState, ) { self.coordinator = coordinator self.services = services @@ -55,7 +55,7 @@ final class DebugMenuProcessor: StateProcessor Void)? + onShakeDetected: (() -> Void)?, ) { self.onShakeDetected = onShakeDetected super.init(windowScene: windowScene) @@ -44,7 +44,7 @@ public class ShakeWindow: UIWindow { /// override public func motionEnded( _ motion: UIEvent.EventSubtype, - with event: UIEvent? + with event: UIEvent?, ) { #if DEBUG_MENU if motion == .motionShake { diff --git a/AuthenticatorShared/UI/Platform/Application/AppCoordinator.swift b/AuthenticatorShared/UI/Platform/Application/AppCoordinator.swift index 0f16520be5..fa229b9041 100644 --- a/AuthenticatorShared/UI/Platform/Application/AppCoordinator.swift +++ b/AuthenticatorShared/UI/Platform/Application/AppCoordinator.swift @@ -50,7 +50,7 @@ class AppCoordinator: Coordinator, HasRootNavigator { appContext: AppContext, module: Module, rootNavigator: RootNavigator, - services: Services + services: Services, ) { self.appContext = appContext self.module = module @@ -110,7 +110,7 @@ class AppCoordinator: Coordinator, HasRootNavigator { let coordinator = module.makeAuthCoordinator( delegate: self, rootNavigator: rootNavigator, - stackNavigator: navigationController + stackNavigator: navigationController, ) coordinator.start() @@ -133,7 +133,7 @@ class AppCoordinator: Coordinator, HasRootNavigator { let coordinator = module.makeTabCoordinator( errorReporter: services.errorReporter, rootNavigator: rootNavigator, - tabNavigator: tabNavigator + tabNavigator: tabNavigator, ) coordinator.start() coordinator.navigate(to: route) @@ -149,7 +149,7 @@ class AppCoordinator: Coordinator, HasRootNavigator { private func showTutorial() { let navigationController = UINavigationController() let coordinator = module.makeTutorialCoordinator( - stackNavigator: navigationController + stackNavigator: navigationController, ) coordinator.start() @@ -177,7 +177,7 @@ class AppCoordinator: Coordinator, HasRootNavigator { rootNavigator?.rootViewController?.topmostViewController().present( stackNavigator, animated: true, - completion: { feedbackGenerator.impactOccurred() } + completion: { feedbackGenerator.impactOccurred() }, ) } #endif diff --git a/AuthenticatorShared/UI/Platform/Application/AppCoordinatorTests.swift b/AuthenticatorShared/UI/Platform/Application/AppCoordinatorTests.swift index 4bfe88f8a2..c7908d7a30 100644 --- a/AuthenticatorShared/UI/Platform/Application/AppCoordinatorTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/AppCoordinatorTests.swift @@ -25,7 +25,7 @@ class AppCoordinatorTests: BitwardenTestCase { appContext: .mainApp, module: module, rootNavigator: rootNavigator, - services: services + services: services, ) } diff --git a/AuthenticatorShared/UI/Platform/Application/AppModule.swift b/AuthenticatorShared/UI/Platform/Application/AppModule.swift index 9bdb08f44c..7f144661d9 100644 --- a/AuthenticatorShared/UI/Platform/Application/AppModule.swift +++ b/AuthenticatorShared/UI/Platform/Application/AppModule.swift @@ -12,7 +12,7 @@ public protocol AppModule: AnyObject { /// func makeAppCoordinator( appContext: AppContext, - navigator: RootNavigator + navigator: RootNavigator, ) -> AnyCoordinator } @@ -35,7 +35,7 @@ public class DefaultAppModule { /// - services: The services used by the app. /// public init( - services: ServiceContainer + services: ServiceContainer, ) { self.services = services } @@ -44,13 +44,13 @@ public class DefaultAppModule { extension DefaultAppModule: AppModule { public func makeAppCoordinator( appContext: AppContext, - navigator: RootNavigator + navigator: RootNavigator, ) -> AnyCoordinator { AppCoordinator( appContext: appContext, module: self, rootNavigator: navigator, - services: services + services: services, ).asAnyCoordinator() } } diff --git a/AuthenticatorShared/UI/Platform/Application/AppProcessor.swift b/AuthenticatorShared/UI/Platform/Application/AppProcessor.swift index 99119ef9a0..ec5ae9f89b 100644 --- a/AuthenticatorShared/UI/Platform/Application/AppProcessor.swift +++ b/AuthenticatorShared/UI/Platform/Application/AppProcessor.swift @@ -34,7 +34,7 @@ public class AppProcessor { /// public init( appModule: AppModule, - services: ServiceContainer + services: ServiceContainer, ) { self.appModule = appModule self.services = services @@ -77,7 +77,7 @@ public class AppProcessor { appContext: AppContext, initialRoute: AppRoute? = nil, navigator: RootNavigator, - window: UIWindow? + window: UIWindow?, ) async { let coordinator = appModule.makeAppCoordinator(appContext: appContext, navigator: navigator) coordinator.start() diff --git a/AuthenticatorShared/UI/Platform/Application/AppProcessorTests.swift b/AuthenticatorShared/UI/Platform/Application/AppProcessorTests.swift index 5b1ddf3e45..5e1dd7aed3 100644 --- a/AuthenticatorShared/UI/Platform/Application/AppProcessorTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/AppProcessorTests.swift @@ -34,8 +34,8 @@ class AppProcessorTests: BitwardenTestCase { appSettingsStore: appSettingsStore, errorReporter: errorReporter, notificationCenterService: notificationCenter, - timeProvider: timeProvider - ) + timeProvider: timeProvider, + ), ) subject.coordinator = coordinator.asAnyCoordinator() } diff --git a/AuthenticatorShared/UI/Platform/Application/Appearance/Modifiers/ImageStyle.swift b/AuthenticatorShared/UI/Platform/Application/Appearance/Modifiers/ImageStyle.swift index 4236391953..728fb675c3 100644 --- a/AuthenticatorShared/UI/Platform/Application/Appearance/Modifiers/ImageStyle.swift +++ b/AuthenticatorShared/UI/Platform/Application/Appearance/Modifiers/ImageStyle.swift @@ -41,7 +41,7 @@ extension ImageStyle { /// static func accessoryIcon( color: Color = Asset.Colors.primaryBitwarden.swiftUIColor, - scaleWithFont: Bool = false + scaleWithFont: Bool = false, ) -> ImageStyle { ImageStyle(color: color, scaleWithFont: scaleWithFont, width: 16, height: 16) } diff --git a/AuthenticatorShared/UI/Platform/Application/Appearance/Modifiers/TextFieldConfiguration.swift b/AuthenticatorShared/UI/Platform/Application/Appearance/Modifiers/TextFieldConfiguration.swift index 82b837fb4c..5b40ca9e19 100644 --- a/AuthenticatorShared/UI/Platform/Application/Appearance/Modifiers/TextFieldConfiguration.swift +++ b/AuthenticatorShared/UI/Platform/Application/Appearance/Modifiers/TextFieldConfiguration.swift @@ -27,7 +27,7 @@ extension TextFieldConfiguration { isAutocorrectionDisabled: true, keyboardType: .emailAddress, textContentType: .emailAddress, - textInputAutocapitalization: .never + textInputAutocapitalization: .never, ) /// A `TextFieldConfiguration` for applying common properties to URL text fields. @@ -35,7 +35,7 @@ extension TextFieldConfiguration { isAutocorrectionDisabled: true, keyboardType: .URL, textContentType: .URL, - textInputAutocapitalization: .never + textInputAutocapitalization: .never, ) /// A `TextFieldConfiguration` for applying common properties to numeric text fields. @@ -44,7 +44,7 @@ extension TextFieldConfiguration { isAutocorrectionDisabled: true, keyboardType: .numberPad, textContentType: textContentType, - textInputAutocapitalization: .never + textInputAutocapitalization: .never, ) } @@ -54,7 +54,7 @@ extension TextFieldConfiguration { isAutocorrectionDisabled: true, keyboardType: keyboardType, textContentType: .oneTimeCode, - textInputAutocapitalization: .never + textInputAutocapitalization: .never, ) } } diff --git a/AuthenticatorShared/UI/Platform/Application/Appearance/StyleGuideFont.swift b/AuthenticatorShared/UI/Platform/Application/Appearance/StyleGuideFont.swift index 4e1804a2ba..086928381a 100644 --- a/AuthenticatorShared/UI/Platform/Application/Appearance/StyleGuideFont.swift +++ b/AuthenticatorShared/UI/Platform/Application/Appearance/StyleGuideFont.swift @@ -59,7 +59,7 @@ extension StyleGuideFont { static let caption2Monospaced = StyleGuideFont( font: .system(.caption2, design: .monospaced), lineHeight: 13, - size: 11 + size: 11, ) } @@ -125,7 +125,7 @@ extension Text { weight: SwiftUI.Font.Weight = .regular, isItalic: Bool = false, includeLineSpacing: Bool = true, - monoSpacedDigit: Bool = false + monoSpacedDigit: Bool = false, ) -> some View { var textWithFont = font(.styleGuide(style)) .fontWeight(weight) diff --git a/AuthenticatorShared/UI/Platform/Application/Appearance/StyleGuideFontTests.swift b/AuthenticatorShared/UI/Platform/Application/Appearance/StyleGuideFontTests.swift index 221c35d465..efdc330f6a 100644 --- a/AuthenticatorShared/UI/Platform/Application/Appearance/StyleGuideFontTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Appearance/StyleGuideFontTests.swift @@ -11,7 +11,7 @@ final class StyleGuideFontTests: BitwardenTestCase { for preview in StyleGuideFont_Previews._allPreviews { assertSnapshots( of: preview.content, - as: [.defaultPortrait] + as: [.defaultPortrait], ) } } @@ -21,7 +21,7 @@ final class StyleGuideFontTests: BitwardenTestCase { for preview in StyleGuideFont_Previews._allPreviews { assertSnapshots( of: preview.content, - as: [.defaultPortraitAX5] + as: [.defaultPortraitAX5], ) } } diff --git a/AuthenticatorShared/UI/Platform/Application/Extensions/Alert+Networking.swift b/AuthenticatorShared/UI/Platform/Application/Extensions/Alert+Networking.swift index a5c910c291..5988aae012 100644 --- a/AuthenticatorShared/UI/Platform/Application/Extensions/Alert+Networking.swift +++ b/AuthenticatorShared/UI/Platform/Application/Extensions/Alert+Networking.swift @@ -23,7 +23,7 @@ extension Alert { } }, AlertAction(title: Localizations.cancel, style: .cancel), - ] + ], ) } @@ -37,18 +37,18 @@ extension Alert { /// static func networkResponseError( _ error: Error, - _ tryAgain: (() async -> Void)? = nil + _ tryAgain: (() async -> Void)? = nil, ) -> Alert { switch error { case let serverError as ServerError: - return defaultAlert( + defaultAlert( title: Localizations.anErrorHasOccurred, - message: serverError.message + message: serverError.message, ) case let error as URLError where error.code == .notConnectedToInternet || error.code == .networkConnectionLost: - return internetConnectionError(tryAgain) + internetConnectionError(tryAgain) case let error as URLError where error.code == .timedOut: - return defaultAlert( + defaultAlert( title: Localizations.anErrorHasOccurred, message: error.localizedDescription, alertActions: [ @@ -58,10 +58,10 @@ extension Alert { } }, AlertAction(title: Localizations.cancel, style: .cancel), - ] + ], ) default: - return defaultAlert(title: Localizations.anErrorHasOccurred) + defaultAlert(title: Localizations.anErrorHasOccurred) } } } diff --git a/AuthenticatorShared/UI/Platform/Application/Extensions/Alert+NetworkingTests.swift b/AuthenticatorShared/UI/Platform/Application/Extensions/Alert+NetworkingTests.swift index 122f09bf5a..e7d9da5e03 100644 --- a/AuthenticatorShared/UI/Platform/Application/Extensions/Alert+NetworkingTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Extensions/Alert+NetworkingTests.swift @@ -69,8 +69,8 @@ class AlertNetworkingTests: BitwardenTestCase { let response = HTTPResponse.failure(statusCode: 400, body: APITestData.responseValidationError.data) let error = try ServerError.validationError( validationErrorResponse: ResponseValidationErrorModel( - response: response - ) + response: response, + ), ) let subject = Alert.networkResponseError(error) diff --git a/AuthenticatorShared/UI/Platform/Application/Extensions/UIViewController.swift b/AuthenticatorShared/UI/Platform/Application/Extensions/UIViewController.swift index 1588a735bd..8750f9cbe8 100644 --- a/AuthenticatorShared/UI/Platform/Application/Extensions/UIViewController.swift +++ b/AuthenticatorShared/UI/Platform/Application/Extensions/UIViewController.swift @@ -7,15 +7,15 @@ extension UIViewController { /// func topmostViewController() -> UIViewController { if let presentedViewController { - return presentedViewController.topmostViewController() + presentedViewController.topmostViewController() } else { switch self { case let navigationController as UINavigationController: - return navigationController.topViewController?.topmostViewController() ?? navigationController + navigationController.topViewController?.topmostViewController() ?? navigationController case let tabBarController as UITabBarController: - return tabBarController.selectedViewController?.topmostViewController() ?? tabBarController + tabBarController.selectedViewController?.topmostViewController() ?? tabBarController default: - return self + self } } } diff --git a/AuthenticatorShared/UI/Platform/Application/Extensions/View.swift b/AuthenticatorShared/UI/Platform/Application/Extensions/View.swift index 4a4b2b2be4..2fa686a221 100644 --- a/AuthenticatorShared/UI/Platform/Application/Extensions/View.swift +++ b/AuthenticatorShared/UI/Platform/Application/Extensions/View.swift @@ -70,11 +70,11 @@ extension View { /// func navigationBar( title: String, - titleDisplayMode: NavigationBarItem.TitleDisplayMode + titleDisplayMode: NavigationBarItem.TitleDisplayMode, ) -> some View { modifier(NavigationBarViewModifier( title: title, - navigationBarTitleDisplayMode: titleDisplayMode + navigationBarTitleDisplayMode: titleDisplayMode, )) } diff --git a/AuthenticatorShared/UI/Platform/Application/LoadingState.swift b/AuthenticatorShared/UI/Platform/Application/LoadingState.swift index 65c38c4453..3bbcae929b 100644 --- a/AuthenticatorShared/UI/Platform/Application/LoadingState.swift +++ b/AuthenticatorShared/UI/Platform/Application/LoadingState.swift @@ -15,9 +15,9 @@ enum LoadingState: Equatable { var data: T? { switch self { case let .data(data): - return data + data case let .loading(maybeData): - return maybeData + maybeData } } } diff --git a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/Alert+Error.swift b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/Alert+Error.swift index df4fb4b053..af0288f35f 100644 --- a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/Alert+Error.swift +++ b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/Alert+Error.swift @@ -17,12 +17,12 @@ extension Alert { static func defaultAlert( title: String? = nil, message: String? = nil, - alertActions: [AlertAction]? = nil + alertActions: [AlertAction]? = nil, ) -> Alert { Alert( title: title, message: message, - alertActions: alertActions ?? [AlertAction(title: Localizations.ok, style: .cancel)] + alertActions: alertActions ?? [AlertAction(title: Localizations.ok, style: .cancel)], ) } @@ -35,7 +35,7 @@ extension Alert { Alert( title: Localizations.anErrorHasOccurred, message: error.message, - alertActions: [AlertAction(title: Localizations.ok, style: .default)] + alertActions: [AlertAction(title: Localizations.ok, style: .default)], ) } } diff --git a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/Alert.swift b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/Alert.swift index 06801606b4..a467dc1b82 100644 --- a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/Alert.swift +++ b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/Alert.swift @@ -42,7 +42,7 @@ public class Alert { message: String?, preferredStyle: UIAlertController.Style = .alert, alertActions: [AlertAction] = [], - alertTextFields: [AlertTextField] = [] + alertTextFields: [AlertTextField] = [], ) { self.title = title self.message = message @@ -111,7 +111,7 @@ public class Alert { textField.addTarget( alertTextField, action: #selector(AlertTextField.textChanged(in:)), - for: .editingChanged + for: .editingChanged, ) } } diff --git a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertAction.swift b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertAction.swift index 772519f023..41d910d9b1 100644 --- a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertAction.swift +++ b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertAction.swift @@ -29,7 +29,7 @@ public class AlertAction { public init( title: String, style: UIAlertAction.Style, - handler: ((AlertAction, [AlertTextField]) async -> Void)? = nil + handler: ((AlertAction, [AlertTextField]) async -> Void)? = nil, ) { self.title = title self.style = style @@ -46,7 +46,7 @@ public class AlertAction { public init( title: String, style: UIAlertAction.Style, - handler: @escaping (AlertAction) async -> Void + handler: @escaping (AlertAction) async -> Void, ) { self.title = title self.style = style diff --git a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertErrorTests.swift b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertErrorTests.swift index 59153eddfa..1447204fe4 100644 --- a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertErrorTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertErrorTests.swift @@ -17,8 +17,8 @@ class AlertErrorTests: BitwardenTestCase { func test_inputValidationAlert() { let subject = Alert.inputValidationAlert( error: InputValidationError( - message: Localizations.validationFieldRequired(Localizations.accountName) - ) + message: Localizations.validationFieldRequired(Localizations.accountName), + ), ) XCTAssertEqual(subject.title, Localizations.anErrorHasOccurred) diff --git a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertPresentable.swift b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertPresentable.swift index 9c4a4dee0b..58e329d8ea 100644 --- a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertPresentable.swift +++ b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertPresentable.swift @@ -33,7 +33,7 @@ public extension AlertPresentable { x: parent.view.bounds.midX, y: parent.view.bounds.midY, width: 0, - height: 0 + height: 0, ) alertController.popoverPresentationController?.permittedArrowDirections = [] } diff --git a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertTests.swift b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertTests.swift index 02ba20d241..239f69e5b8 100644 --- a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertTests.swift @@ -25,7 +25,7 @@ class AlertTests: BitwardenTestCase { isSecureTextEntry: true, keyboardType: .numberPad, placeholder: "placeholder", - text: "value" + text: "value", )) } @@ -67,7 +67,7 @@ class AlertTests: BitwardenTestCase { subject!.debugDescription, // swiftlint:disable:next line_length "Alert(title: 🍎, message: 🥝, alertActions: [AuthenticatorShared.AlertAction, AuthenticatorShared.AlertAction]," - + " alertTextFields: [AuthenticatorShared.AlertTextField])" + + " alertTextFields: [AuthenticatorShared.AlertTextField])", ) } @@ -83,7 +83,7 @@ class AlertTests: BitwardenTestCase { isSecureTextEntry: true, keyboardType: .numberPad, placeholder: "placeholder", - text: "value" + text: "value", ))) XCTAssertNotEqual(subject, Alert(title: "🍎", message: "🥝", preferredStyle: .alert) .add(AlertAction(title: "Cancel", style: .destructive)) @@ -95,7 +95,7 @@ class AlertTests: BitwardenTestCase { isSecureTextEntry: true, keyboardType: .numberPad, placeholder: "placeholder", - text: "value" + text: "value", ))) XCTAssertNotEqual(subject, Alert(title: "🍎", message: "🥝", preferredStyle: .alert)) XCTAssertNotEqual(subject, Alert(title: "🍎", message: "🥝", preferredStyle: .alert) @@ -108,7 +108,7 @@ class AlertTests: BitwardenTestCase { isSecureTextEntry: true, keyboardType: .numberPad, placeholder: "placeholder", - text: "value" + text: "value", ))) XCTAssertEqual(subject, Alert(title: "🍎", message: "🥝", preferredStyle: .alert) .add(AlertAction(title: "Cancel", style: .cancel)) diff --git a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertTextField.swift b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertTextField.swift index 23ca194d27..8cdac6d51f 100644 --- a/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertTextField.swift +++ b/AuthenticatorShared/UI/Platform/Application/Utilities/Alert/AlertTextField.swift @@ -45,7 +45,7 @@ public class AlertTextField { isSecureTextEntry: Bool = false, keyboardType: UIKeyboardType = .default, placeholder: String? = nil, - text: String? = nil + text: String? = nil, ) { self.id = id self.autocapitalizationType = autocapitalizationType diff --git a/AuthenticatorShared/UI/Platform/Application/Utilities/InputValidator/Validators/EmptyInputValidatorTests.swift b/AuthenticatorShared/UI/Platform/Application/Utilities/InputValidator/Validators/EmptyInputValidatorTests.swift index 2711761fc0..7cf2a07f7e 100644 --- a/AuthenticatorShared/UI/Platform/Application/Utilities/InputValidator/Validators/EmptyInputValidatorTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Utilities/InputValidator/Validators/EmptyInputValidatorTests.swift @@ -20,13 +20,13 @@ class EmptyInputValidatorTests: BitwardenTestCase { func assertThrowsInputValidationError( input: String?, file: StaticString = #filePath, - line: UInt = #line + line: UInt = #line, ) { XCTAssertThrowsError(try subject.validate(input: input)) { error in XCTAssertTrue(error is InputValidationError) XCTAssertEqual( error as? InputValidationError, - InputValidationError(message: "The Email field is required.") + InputValidationError(message: "The Email field is required."), ) } } diff --git a/AuthenticatorShared/UI/Platform/Application/Utilities/StackNavigator.swift b/AuthenticatorShared/UI/Platform/Application/Utilities/StackNavigator.swift index 8b47e80713..7772a46153 100644 --- a/AuthenticatorShared/UI/Platform/Application/Utilities/StackNavigator.swift +++ b/AuthenticatorShared/UI/Platform/Application/Utilities/StackNavigator.swift @@ -69,7 +69,7 @@ public protocol StackNavigator: Navigator { _ view: Content, animated: Bool, overFullscreen: Bool, - onCompletion: (() -> Void)? + onCompletion: (() -> Void)?, ) /// Presents a view controller modally. Supports presenting on top of presented modals if necessary. @@ -84,7 +84,7 @@ public protocol StackNavigator: Navigator { _ viewController: UIViewController, animated: Bool, overFullscreen: Bool, - onCompletion: (() -> Void)? + onCompletion: (() -> Void)?, ) /// Replaces the stack with the specified view. @@ -136,7 +136,7 @@ extension StackNavigator { _ viewController: UIViewController, animated: Bool = UI.animated, navigationTitle: String? = nil, - searchController: UISearchController? = nil + searchController: UISearchController? = nil, ) { if let navigationTitle { // Preset some navigation item values so that the navigation bar does not flash oddly once @@ -193,13 +193,13 @@ extension StackNavigator { _ view: Content, animated: Bool = UI.animated, overFullscreen: Bool = false, - onCompletion _: (() -> Void)? = nil + onCompletion _: (() -> Void)? = nil, ) { present( view, animated: animated, overFullscreen: overFullscreen, - onCompletion: nil + onCompletion: nil, ) } @@ -214,13 +214,13 @@ extension StackNavigator { func present( _ viewController: UIViewController, overFullscreen: Bool = false, - onCompletion: (() -> Void)? = nil + onCompletion: (() -> Void)? = nil, ) { present( viewController, animated: UI.animated, overFullscreen: overFullscreen, - onCompletion: onCompletion + onCompletion: onCompletion, ) } @@ -274,7 +274,7 @@ extension UINavigationController: StackNavigator { _ view: Content, animated: Bool, overFullscreen: Bool, - onCompletion: (() -> Void)? = nil + onCompletion: (() -> Void)? = nil, ) { let controller = UIHostingController(rootView: view) controller.isModalInPresentation = true @@ -290,7 +290,7 @@ extension UINavigationController: StackNavigator { _ viewController: UIViewController, animated: Bool, overFullscreen: Bool = false, - onCompletion: (() -> Void)? = nil + onCompletion: (() -> Void)? = nil, ) { var presentedChild = presentedViewController var availablePresenter: UIViewController? = self @@ -304,7 +304,7 @@ extension UINavigationController: StackNavigator { availablePresenter?.present( viewController, animated: animated, - completion: onCompletion + completion: onCompletion, ) } diff --git a/AuthenticatorShared/UI/Platform/Application/Utilities/StackNavigatorTests.swift b/AuthenticatorShared/UI/Platform/Application/Utilities/StackNavigatorTests.swift index ccc383d644..6e340b4bb2 100644 --- a/AuthenticatorShared/UI/Platform/Application/Utilities/StackNavigatorTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Utilities/StackNavigatorTests.swift @@ -27,7 +27,7 @@ class StackNavigatorTests: BitwardenTestCase { waitFor(subject.presentedViewController?.presentedViewController != nil) XCTAssertTrue( subject.presentedViewController?.presentedViewController - is UIHostingController> + is UIHostingController>, ) } diff --git a/AuthenticatorShared/UI/Platform/Application/Utilities/Store.swift b/AuthenticatorShared/UI/Platform/Application/Utilities/Store.swift index 3034e25039..f7ceefe221 100644 --- a/AuthenticatorShared/UI/Platform/Application/Utilities/Store.swift +++ b/AuthenticatorShared/UI/Platform/Application/Utilities/Store.swift @@ -50,7 +50,7 @@ open class Store: Observabl parentStore: Store, state parentToChildState: @escaping (ParentState) -> State, mapAction: ((Action) -> ParentAction)?, - mapEffect: ((Effect) -> ParentEffect)? + mapEffect: ((Effect) -> ParentEffect)?, ) { state = parentToChildState(parentStore.state) receive = { action in @@ -97,13 +97,13 @@ open class Store: Observabl open func child( state: @escaping (State) -> ChildState, mapAction: ((ChildAction) -> Action)?, - mapEffect: ((ChildEffect) -> Effect)? + mapEffect: ((ChildEffect) -> Effect)?, ) -> Store { Store( parentStore: self, state: state, mapAction: mapAction, - mapEffect: mapEffect + mapEffect: mapEffect, ) } @@ -119,13 +119,13 @@ open class Store: Observabl /// open func binding( get: @escaping (State) -> LocalState, - send stateToAction: @escaping (LocalState) -> Action + send stateToAction: @escaping (LocalState) -> Action, ) -> Binding { Binding( get: { get(self.state) }, set: { value, _ in self.send(stateToAction(value)) - } + }, ) } @@ -141,7 +141,7 @@ open class Store: Observabl /// open func bindingAsync( get: @escaping (State) -> LocalState, - perform stateToEffect: @escaping (LocalState) -> Effect + perform stateToEffect: @escaping (LocalState) -> Effect, ) -> Binding { Binding( get: { get(self.state) }, @@ -149,7 +149,7 @@ open class Store: Observabl Task { await self.perform(stateToEffect(value)) } - } + }, ) } @@ -164,7 +164,7 @@ open class Store: Observabl open func binding(get: @escaping (State) -> LocalState) -> Binding { Binding( get: { get(self.state) }, - set: { _ in } + set: { _ in }, ) } } diff --git a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenField.swift b/AuthenticatorShared/UI/Platform/Application/Views/BitwardenField.swift index 771a6a0e90..c10c415cb7 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenField.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/BitwardenField.swift @@ -82,7 +82,7 @@ struct BitwardenField: View where Content: View, Acce footerAccessibilityIdentifier: String? = nil, verticalPadding: CGFloat = 8, @ViewBuilder content: () -> Content, - @ViewBuilder accessoryContent: () -> AccessoryContent + @ViewBuilder accessoryContent: () -> AccessoryContent, ) { self.title = title self.titleAccessibilityIdentifier = titleAccessibilityIdentifier @@ -113,7 +113,7 @@ extension BitwardenField where AccessoryContent == EmptyView { footer: String? = nil, footerAccessibilityIdentifier: String? = nil, verticalPadding: CGFloat = 8, - @ViewBuilder content: () -> Content + @ViewBuilder content: () -> Content, ) { self.title = title self.titleAccessibilityIdentifier = titleAccessibilityIdentifier diff --git a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuField.swift b/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuField.swift index a2992fb757..69d7eb6efe 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuField.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuField.swift @@ -104,7 +104,7 @@ struct BitwardenMenuField: View where T: Menuable { footer: String? = nil, accessibilityIdentifier: String? = nil, options: [T], - selection: Binding + selection: Binding, ) where TrailingContent == EmptyView { self.accessibilityIdentifier = accessibilityIdentifier self.footer = footer @@ -130,7 +130,7 @@ struct BitwardenMenuField: View where T: Menuable { accessibilityIdentifier: String? = nil, options: [T], selection: Binding, - trailingContent: () -> TrailingContent + trailingContent: () -> TrailingContent, ) { self.accessibilityIdentifier = accessibilityIdentifier self.footer = footer @@ -149,9 +149,9 @@ private enum MenuPreviewOptions: CaseIterable, Menuable { var localizedName: String { switch self { - case .bear: return "🧸" - case .bird: return "🪿" - case .dog: return "🐕" + case .bear: "🧸" + case .bird: "🪿" + case .dog: "🐕" } } } @@ -161,7 +161,7 @@ private enum MenuPreviewOptions: CaseIterable, Menuable { BitwardenMenuField( title: "Animals", options: MenuPreviewOptions.allCases, - selection: .constant(.dog) + selection: .constant(.dog), ) .padding() } @@ -173,7 +173,7 @@ private enum MenuPreviewOptions: CaseIterable, Menuable { BitwardenMenuField( title: "Animals", options: MenuPreviewOptions.allCases, - selection: .constant(.dog) + selection: .constant(.dog), ) { Button {} label: { SharedAsset.Icons.camera16.swiftUIImage @@ -191,7 +191,7 @@ private enum MenuPreviewOptions: CaseIterable, Menuable { title: "Animals", footer: "Select your favorite animal", options: MenuPreviewOptions.allCases, - selection: .constant(.dog) + selection: .constant(.dog), ) .padding() } diff --git a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift b/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift index dd3567fffe..04e018b49c 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift @@ -33,7 +33,7 @@ class BitwardenMenuFieldTests: BitwardenTestCase { } subject = BitwardenMenuField( options: TestValue.allCases, - selection: binding + selection: binding, ) } diff --git a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenTextValueField.swift b/AuthenticatorShared/UI/Platform/Application/Views/BitwardenTextValueField.swift index 60070feb9b..d14de60153 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenTextValueField.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/BitwardenTextValueField.swift @@ -54,7 +54,7 @@ struct BitwardenTextValueField: View where AccessoryContent: V titleAccessibilityIdentifier: String? = "ItemName", value: String, valueAccessibilityIdentifier: String? = "ItemValue", - @ViewBuilder accessoryContent: () -> AccessoryContent + @ViewBuilder accessoryContent: () -> AccessoryContent, ) { self.title = title self.titleAccessibilityIdentifier = titleAccessibilityIdentifier @@ -77,13 +77,13 @@ extension BitwardenTextValueField where AccessoryContent == EmptyView { title: String? = nil, titleAccessibilityIdentifier: String? = "ItemName", value: String, - valueAccessibilityIdentifier: String? = "ItemValue" + valueAccessibilityIdentifier: String? = "ItemValue", ) { self.init( title: title, titleAccessibilityIdentifier: titleAccessibilityIdentifier, value: value, - valueAccessibilityIdentifier: valueAccessibilityIdentifier + valueAccessibilityIdentifier: valueAccessibilityIdentifier, ) { EmptyView() } @@ -97,7 +97,7 @@ extension BitwardenTextValueField where AccessoryContent == EmptyView { VStack { BitwardenTextValueField( title: "Title", - value: "Text field text" + value: "Text field text", ) .padding() } diff --git a/AuthenticatorShared/UI/Platform/Application/Views/ExpandableHeaderView.swift b/AuthenticatorShared/UI/Platform/Application/Views/ExpandableHeaderView.swift index 27e4ab94fe..ceca00197a 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/ExpandableHeaderView.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/ExpandableHeaderView.swift @@ -77,7 +77,7 @@ struct ExpandableHeaderView: View { title: String, count: Int, buttonAccessibilityIdentifier: String = "ExpandSectionButton", - @ViewBuilder content: () -> Content + @ViewBuilder content: () -> Content, ) { self.buttonAccessibilityIdentifier = buttonAccessibilityIdentifier self.content = content() diff --git a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift index eb3fe0f56b..9097da8356 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift @@ -48,7 +48,7 @@ struct FormMenuField: Equatable, Identifiable { keyPath: WritableKeyPath, options: [T], selection: T, - title: String + title: String, ) { self.accessibilityIdentifier = accessibilityIdentifier self.footer = footer @@ -84,7 +84,7 @@ struct FormMenuFieldView: View { accessibilityIdentifier: field.accessibilityIdentifier, options: field.options, selection: Binding(get: { field.selection }, set: action), - trailingContent: { trailingContent } + trailingContent: { trailingContent }, ) } @@ -98,7 +98,7 @@ struct FormMenuFieldView: View { /// init( field: FormMenuField, - action: @escaping (T) -> Void + action: @escaping (T) -> Void, ) where TrailingContent == EmptyView { self.action = action self.field = field @@ -115,7 +115,7 @@ struct FormMenuFieldView: View { init( field: FormMenuField, action: @escaping (T) -> Void, - trailingContent: @escaping () -> TrailingContent + trailingContent: @escaping () -> TrailingContent, ) { self.action = action self.field = field diff --git a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormTextFieldView.swift b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormTextFieldView.swift index ffed316185..d60a8d30fa 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormTextFieldView.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormTextFieldView.swift @@ -24,11 +24,11 @@ struct FormTextField: Equatable, Identifiable { var textInputAutocapitalization: TextInputAutocapitalization { switch self { case .never: - return .never + .never case .sentences: - return .sentences + .sentences case .words: - return .words + .words } } } @@ -105,7 +105,7 @@ struct FormTextField: Equatable, Identifiable { passwordVisibilityAccessibilityId: String? = nil, textContentType: UITextContentType? = nil, title: String, - value: String + value: String, ) { self.accessibilityId = accessibilityId self.autocapitalization = autocapitalization @@ -146,7 +146,7 @@ struct FormTextFieldView: View { passwordVisibilityAccessibilityId: field.passwordVisibilityAccessibilityId, isPasswordVisible: field.isPasswordVisible.map { isPasswordVisible in Binding(get: { isPasswordVisible }, set: isPasswordVisibleChangedAction ?? { _ in }) - } + }, ) .autocorrectionDisabled(field.isAutocorrectDisabled) .keyboardType(field.keyboardType) @@ -167,7 +167,7 @@ struct FormTextFieldView: View { init( field: FormTextField, action: @escaping (String) -> Void, - isPasswordVisibleChangedAction: ((Bool) -> Void)? = nil + isPasswordVisibleChangedAction: ((Bool) -> Void)? = nil, ) { self.action = action self.field = field diff --git a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/SliderFieldView.swift b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/SliderFieldView.swift index b71d9bce37..1ff5470c29 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/SliderFieldView.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/SliderFieldView.swift @@ -75,7 +75,7 @@ struct SliderFieldView: View { value: Binding(get: { field.value }, set: onValueChanged), in: field.range, step: field.step, - onEditingChanged: onEditingChanged + onEditingChanged: onEditingChanged, ) .tint(Asset.Colors.primaryBitwarden.swiftUIColor) .accessibilityLabel(field.title) @@ -99,7 +99,7 @@ struct SliderFieldView: View { init( field: SliderField, onEditingChanged: @escaping (Bool) -> Void = { _ in }, - onValueChanged: @escaping (Double) -> Void + onValueChanged: @escaping (Double) -> Void, ) { self.field = field self.onEditingChanged = onEditingChanged diff --git a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/StepperFieldView.swift b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/StepperFieldView.swift index 5aebe5f459..1038990903 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/StepperFieldView.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/StepperFieldView.swift @@ -47,7 +47,7 @@ struct StepperFieldView: View { VStack(spacing: 16) { Stepper( value: Binding(get: { field.value }, set: action), - in: field.range + in: field.range, ) { HStack { Text(field.title) diff --git a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/ToggleFieldView.swift b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/ToggleFieldView.swift index bc224a9a4a..aae419263e 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/ToggleFieldView.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/ToggleFieldView.swift @@ -51,7 +51,7 @@ struct ToggleFieldView: View { VStack(spacing: 0) { Toggle( field.title, - isOn: Binding(get: { field.isOn }, set: action) + isOn: Binding(get: { field.isOn }, set: action), ) .accessibilityIdentifier(field.accessibilityId ?? field.id) .accessibilityLabel(field.accessibilityLabel ?? field.title) diff --git a/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayDisplayHelperTests.swift b/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayDisplayHelperTests.swift index 4c7d17d7ee..e0b0045f64 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayDisplayHelperTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayDisplayHelperTests.swift @@ -13,7 +13,7 @@ class LoadingOverlayDisplayHelperTests: BitwardenTestCase { LoadingOverlayDisplayHelper.show( in: parentViewController, - state: LoadingOverlayState(title: "Loading...") + state: LoadingOverlayState(title: "Loading..."), ) let overlayView = try XCTUnwrap(window.viewWithTag(LoadingOverlayDisplayHelper.overlayViewTag)) @@ -33,7 +33,7 @@ class LoadingOverlayDisplayHelperTests: BitwardenTestCase { LoadingOverlayDisplayHelper.show( in: parentViewController, - state: LoadingOverlayState(title: "Loading...") + state: LoadingOverlayState(title: "Loading..."), ) let overlayView = try XCTUnwrap(window.viewWithTag(LoadingOverlayDisplayHelper.overlayViewTag)) diff --git a/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayView.swift b/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayView.swift index 8dff019075..fea7b53a2f 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayView.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayView.swift @@ -25,7 +25,7 @@ struct LoadingOverlayView: View { Asset.Colors.materialRegularBlend.swiftUIColor .blendMode(colorScheme == .light ? .colorDodge : .overlay) } - .compositingGroup() + .compositingGroup(), ) .cornerRadius(14) .controlSize(.large) diff --git a/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayViewTests.swift b/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayViewTests.swift index 1b46acd4e0..14489d54e6 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayViewTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/LoadingOverlay/LoadingOverlayViewTests.swift @@ -10,7 +10,7 @@ class LoadingOverlayViewTests: BitwardenTestCase { func disabletest_snapshot_loadingOverlay() { assertSnapshots( of: LoadingOverlayView(state: .init(title: "Loading...")), - as: [.defaultPortrait, .defaultPortraitDark] + as: [.defaultPortrait, .defaultPortraitDark], ) } } diff --git a/AuthenticatorShared/UI/Platform/Application/Views/SectionView.swift b/AuthenticatorShared/UI/Platform/Application/Views/SectionView.swift index 43f47f76c4..cc27e2593d 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/SectionView.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/SectionView.swift @@ -48,7 +48,7 @@ struct SectionView: View { _ title: String, titleSpacing: CGFloat = 8, contentSpacing: CGFloat = 16, - @ViewBuilder content: () -> Content + @ViewBuilder content: () -> Content, ) { self.title = title self.titleSpacing = titleSpacing diff --git a/AuthenticatorShared/UI/Platform/Application/Views/SectionViewTests.swift b/AuthenticatorShared/UI/Platform/Application/Views/SectionViewTests.swift index 47ee28234e..3ef8a03b2a 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/SectionViewTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/SectionViewTests.swift @@ -11,7 +11,7 @@ class SectionViewTests: BitwardenTestCase { for preview in SectionView_Previews._allPreviews { assertSnapshots( of: preview.content, - as: [.defaultPortrait] + as: [.defaultPortrait], ) } } diff --git a/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuField.swift b/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuField.swift index cb753e7c0a..a46b9087d6 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuField.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuField.swift @@ -84,7 +84,7 @@ struct SettingsMenuField: View where T: Menuable { hasDivider: Bool = true, accessibilityIdentifier: String? = nil, selectionAccessibilityID: String? = nil, - selection: Binding + selection: Binding, ) { self.accessibilityIdentifier = accessibilityIdentifier self.hasDivider = hasDivider @@ -103,9 +103,9 @@ private enum MenuPreviewOptions: CaseIterable, Menuable { var localizedName: String { switch self { - case .bear: return "🧸" - case .bird: return "🪿" - case .dog: return "🐕" + case .bear: "🧸" + case .bird: "🪿" + case .dog: "🐕" } } } @@ -116,14 +116,14 @@ private enum MenuPreviewOptions: CaseIterable, Menuable { SettingsMenuField( title: "Bear", options: MenuPreviewOptions.allCases, - selection: .constant(.bear) + selection: .constant(.bear), ) SettingsMenuField( title: "Dog", options: MenuPreviewOptions.allCases, hasDivider: false, - selection: .constant(.dog) + selection: .constant(.dog), ) } .padding(8) diff --git a/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift b/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift index ec1af1b640..4ab8b113c6 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift @@ -34,7 +34,7 @@ class SettingsMenuFieldTests: BitwardenTestCase { subject = SettingsMenuField( title: "Title", options: TestValue.allCases, - selection: binding + selection: binding, ) } diff --git a/AuthenticatorShared/UI/Platform/Application/Views/ToastDisplayHelperTests.swift b/AuthenticatorShared/UI/Platform/Application/Views/ToastDisplayHelperTests.swift index d44ec841f3..8308ebe2e6 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/ToastDisplayHelperTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/ToastDisplayHelperTests.swift @@ -13,7 +13,7 @@ class ToastDisplayHelperTests: BitwardenTestCase { ToastDisplayHelper.show( in: parentViewController, - toast: Toast(text: "With Butter") + toast: Toast(text: "With Butter"), ) let overlayView = try XCTUnwrap(window.viewWithTag(ToastDisplayHelper.toastTag)) @@ -34,7 +34,7 @@ class ToastDisplayHelperTests: BitwardenTestCase { ToastDisplayHelper.show( in: parentViewController, toast: Toast(text: "With Butter"), - duration: 0.1 + duration: 0.1, ) let overlayView = try XCTUnwrap(window.viewWithTag(ToastDisplayHelper.toastTag)) diff --git a/AuthenticatorShared/UI/Platform/Application/Views/ToastViewTests.swift b/AuthenticatorShared/UI/Platform/Application/Views/ToastViewTests.swift index 2a71ba092b..343025d7ea 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/ToastViewTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/ToastViewTests.swift @@ -11,7 +11,7 @@ final class ToastViewTests: BitwardenTestCase { for preview in ToastView_Previews._allPreviews { assertSnapshots( of: preview.content, - as: [.defaultPortrait, .defaultPortraitDark, .defaultPortraitAX5] + as: [.defaultPortrait, .defaultPortraitDark, .defaultPortraitAX5], ) } } diff --git a/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionCoordinator.swift b/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionCoordinator.swift index 1a0e6bfb80..999e5992d0 100644 --- a/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionCoordinator.swift +++ b/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionCoordinator.swift @@ -39,7 +39,7 @@ class FileSelectionCoordinator: NSObject, Coordinator, HasStackNavigator { init( delegate: FileSelectionDelegate, services: Services, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) { self.delegate = delegate self.services = services @@ -184,7 +184,7 @@ extension FileSelectionCoordinator: PHPickerViewControllerDelegate { self?.selected( image: image, suggestedName: result.itemProvider.suggestedName, - typeIdentifiers: result.itemProvider.registeredTypeIdentifiers + typeIdentifiers: result.itemProvider.registeredTypeIdentifiers, ) } } @@ -196,7 +196,7 @@ extension FileSelectionCoordinator: PHPickerViewControllerDelegate { extension FileSelectionCoordinator: UIImagePickerControllerDelegate { func imagePickerController( _ picker: UIImagePickerController, - didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any] + didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any], ) { picker.dismiss() diff --git a/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionCoordinatorTests.swift b/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionCoordinatorTests.swift index 00911366fc..7532aaf5d1 100644 --- a/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionCoordinatorTests.swift +++ b/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionCoordinatorTests.swift @@ -27,9 +27,9 @@ class FileSelectionCoordinatorTests: BitwardenTestCase { delegate: delegate, services: ServiceContainer.withMocks( cameraService: cameraService, - errorReporter: errorReporter + errorReporter: errorReporter, ), - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ) } diff --git a/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionModule.swift b/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionModule.swift index 368833002f..dbd69672e9 100644 --- a/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionModule.swift +++ b/AuthenticatorShared/UI/Platform/FileSelection/FileSelectionModule.swift @@ -13,19 +13,19 @@ protocol FileSelectionModule { /// func makeFileSelectionCoordinator( delegate: FileSelectionDelegate, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator } extension DefaultAppModule: FileSelectionModule { func makeFileSelectionCoordinator( delegate: FileSelectionDelegate, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator { FileSelectionCoordinator( delegate: delegate, services: services, - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ).asAnyCoordinator() } } diff --git a/AuthenticatorShared/UI/Platform/Settings/Extensions/Alert+Settings.swift b/AuthenticatorShared/UI/Platform/Settings/Extensions/Alert+Settings.swift index 570fcd4a4b..575b242a27 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Extensions/Alert+Settings.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Extensions/Alert+Settings.swift @@ -20,7 +20,7 @@ extension Alert { action() }, AlertAction(title: Localizations.ok, style: .default), - ] + ], ) } @@ -37,7 +37,7 @@ extension Alert { alertActions: [ AlertAction(title: Localizations.yes, style: .default) { _ in await action() }, AlertAction(title: Localizations.no, style: .cancel), - ] + ], ) } @@ -54,7 +54,7 @@ extension Alert { alertActions: [ AlertAction(title: Localizations.exportItems, style: .default) { _ in await action() }, AlertAction(title: Localizations.cancel, style: .cancel), - ] + ], ) } @@ -76,7 +76,7 @@ extension Alert { AlertAction(title: Localizations.continue, style: .default) { _ in action() }, - ] + ], ) } @@ -96,7 +96,7 @@ extension Alert { AlertAction(title: Localizations.ok, style: .default) { _ in action() }, - ] + ], ) } @@ -114,7 +114,7 @@ extension Alert { AlertAction(title: Localizations.continue, style: .default) { _ in action() }, - ] + ], ) } @@ -136,7 +136,7 @@ extension Alert { AlertAction(title: Localizations.continue, style: .default) { _ in action() }, - ] + ], ) } @@ -151,7 +151,7 @@ extension Alert { message: nil, alertActions: [ AlertAction(title: Localizations.ok, style: .default), - ] + ], ) } @@ -173,7 +173,7 @@ extension Alert { AlertAction(title: Localizations.continue, style: .default) { _ in action() }, - ] + ], ) } } diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/ExportItems/ExportItemsProcessor.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/ExportItems/ExportItemsProcessor.swift index 01999b3dd5..0d986d2efd 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/ExportItems/ExportItemsProcessor.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/ExportItems/ExportItemsProcessor.swift @@ -27,7 +27,7 @@ final class ExportItemsProcessor: StateProcessor, - services: Services + services: Services, ) { self.coordinator = coordinator self.services = services @@ -64,12 +64,11 @@ final class ExportItemsProcessor: StateProcessor, - services: Services + services: Services, ) { self.coordinator = coordinator self.services = services @@ -77,18 +77,17 @@ extension ImportItemsProcessor: FileSelectionDelegate { func fileSelectionCompleted(fileName: String, data: Data) { Task { do { - let importFileFormat: ImportFileFormat - switch state.fileFormat { + let importFileFormat: ImportFileFormat = switch state.fileFormat { case .bitwardenJson: - importFileFormat = .bitwardenJson + .bitwardenJson case .googleQr: - importFileFormat = .googleProtobuf + .googleProtobuf case .lastpassJson: - importFileFormat = .lastpassJson + .lastpassJson case .raivoJson: - importFileFormat = .raivoJson + .raivoJson case .twoFasJason: - importFileFormat = .twoFasJson + .twoFasJson } try await services.importItemsService.importItems(data: data, format: importFileFormat) state.toast = Toast(text: Localizations.itemsImported) @@ -128,7 +127,7 @@ extension ImportItemsProcessor: FileSelectionDelegate { keyPath: codingPath.map(\.stringValue).joined(separator: "."), action: { [weak self] in self?.state.url = ExternalLinksConstants.helpAndFeedback - } + }, )) } } @@ -136,7 +135,7 @@ extension ImportItemsProcessor: FileSelectionDelegate { extension ImportItemsProcessor: AuthenticatorKeyCaptureDelegate { func didCompleteAutomaticCapture( _ captureCoordinator: AnyCoordinator, - key: String + key: String, ) { let dismissAction = DismissAction(action: { [weak self] in Task { @@ -159,14 +158,14 @@ extension ImportItemsProcessor: AuthenticatorKeyCaptureDelegate { _ captureCoordinator: AnyCoordinator, key: String, name: String, - sendToBitwarden: Bool + sendToBitwarden: Bool, ) {} func showCameraScan( - _ captureCoordinator: AnyCoordinator + _ captureCoordinator: AnyCoordinator, ) {} func showManualEntry( - _ captureCoordinator: AnyCoordinator + _ captureCoordinator: AnyCoordinator, ) {} } diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsProcessorTests.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsProcessorTests.swift index 00a0a02ff0..307e262dd2 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsProcessorTests.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsProcessorTests.swift @@ -29,8 +29,8 @@ class ImportItemsProcessorTests: BitwardenTestCase { services: ServiceContainer.withMocks( application: application, errorReporter: errorReporter, - importItemsService: importItemsService - ) + importItemsService: importItemsService, + ), ) } @@ -50,7 +50,7 @@ class ImportItemsProcessorTests: BitwardenTestCase { @MainActor func test_fileSelectionCompleted_corruptedFile() async throws { importItemsService.errorToThrow = DecodingError.dataCorrupted( - DecodingError.Context(codingPath: [], debugDescription: "Not valid JSON") + DecodingError.Context(codingPath: [], debugDescription: "Not valid JSON"), ) let data = "Test Data".data(using: .utf8)! subject.fileSelectionCompleted(fileName: "Filename", data: data) @@ -60,7 +60,7 @@ class ImportItemsProcessorTests: BitwardenTestCase { coordinator.alertShown.last, .importFileCorrupted(action: { self.subject.state.url = ExternalLinksConstants.helpAndFeedback - }) + }), ) XCTAssertNil(subject.state.toast) } @@ -75,8 +75,8 @@ class ImportItemsProcessorTests: BitwardenTestCase { AnyCodingKey(stringValue: "services"), AnyCodingKey(stringValue: "item 0"), ], - debugDescription: "Missing key" - ) + debugDescription: "Missing key", + ), ) let data = "Test Data".data(using: .utf8)! subject.fileSelectionCompleted(fileName: "Filename", data: data) @@ -86,7 +86,7 @@ class ImportItemsProcessorTests: BitwardenTestCase { coordinator.alertShown.last, .requiredInfoMissing(keyPath: "services.item 0.missingKey", action: { self.subject.state.url = ExternalLinksConstants.helpAndFeedback - }) + }), ) XCTAssertNil(subject.state.toast) } @@ -101,8 +101,8 @@ class ImportItemsProcessorTests: BitwardenTestCase { AnyCodingKey(stringValue: "services"), AnyCodingKey(stringValue: "item 0"), ], - debugDescription: "Missing value" - ) + debugDescription: "Missing value", + ), ) let data = "Test Data".data(using: .utf8)! subject.fileSelectionCompleted(fileName: "Filename", data: data) @@ -112,7 +112,7 @@ class ImportItemsProcessorTests: BitwardenTestCase { coordinator.alertShown.last, .requiredInfoMissing(keyPath: "services.item 0", action: { self.subject.state.url = ExternalLinksConstants.helpAndFeedback - }) + }), ) XCTAssertNil(subject.state.toast) } @@ -152,8 +152,8 @@ class ImportItemsProcessorTests: BitwardenTestCase { AnyCodingKey(stringValue: "services"), AnyCodingKey(stringValue: "item 0"), ], - debugDescription: "Type Mismatch" - ) + debugDescription: "Type Mismatch", + ), ) let data = "Test Data".data(using: .utf8)! subject.fileSelectionCompleted(fileName: "Filename", data: data) @@ -163,7 +163,7 @@ class ImportItemsProcessorTests: BitwardenTestCase { coordinator.alertShown.last, .typeMismatch(action: { self.subject.state.url = ExternalLinksConstants.helpAndFeedback - }) + }), ) XCTAssertNil(subject.state.toast) } diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsView.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsView.swift index 102eca526a..4849829a1d 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsView.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsView.swift @@ -34,7 +34,7 @@ struct ImportItemsView: View { } .toast(store.binding( get: \.toast, - send: ImportItemsAction.toastShown + send: ImportItemsAction.toastShown, )) .toolbar { cancelToolbarItem { @@ -62,8 +62,8 @@ struct ImportItemsView: View { options: ImportFormatType.allCases, selection: store.binding( get: \.fileFormat, - send: ImportItemsAction.fileFormatTypeChanged - ) + send: ImportItemsAction.fileFormatTypeChanged, + ), ) } } diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageProcessor.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageProcessor.swift index 26e0da37e1..1fc31475a4 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageProcessor.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageProcessor.swift @@ -40,7 +40,7 @@ final class SelectLanguageProcessor: StateProcessor, delegate: SelectLanguageDelegate?, services: Services, - state: SelectLanguageState + state: SelectLanguageState, ) { self.coordinator = coordinator self.delegate = delegate diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageProcessorTests.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageProcessorTests.swift index bbb7fedcd8..2d5d40bbd6 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageProcessorTests.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageProcessorTests.swift @@ -21,14 +21,14 @@ class SelectLanguageProcessorTests: BitwardenTestCase { delegate = MockSelectLanguageDelegate() stateService = MockStateService() let services = ServiceContainer.withMocks( - stateService: stateService + stateService: stateService, ) subject = SelectLanguageProcessor( coordinator: coordinator.asAnyCoordinator(), delegate: delegate, services: services, - state: SelectLanguageState() + state: SelectLanguageState(), ) } diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageView.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageView.swift index b3c43321b6..44fb18a27b 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageView.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageView.swift @@ -45,7 +45,7 @@ struct SelectLanguageView: View { private func languageOptionRow(_ languageOption: LanguageOption) -> some View { SettingsListItem( languageOption.title, - hasDivider: !languageOption.isLast + hasDivider: !languageOption.isLast, ) { store.send(.languageTapped(languageOption)) } trailingContent: { diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageViewTests.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageViewTests.swift index a2d2d7cc33..de88438f22 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageViewTests.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/SelectLanguage/SelectLanguageViewTests.swift @@ -54,7 +54,7 @@ class SelectLanguageViewTests: BitwardenTestCase { func disabletest_viewRender() { assertSnapshots( of: subject.navStackWrapped, - as: [.defaultPortrait, .defaultPortraitDark, .tallPortraitAX5()] + as: [.defaultPortrait, .defaultPortraitDark, .tallPortraitAX5()], ) } } diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsListItem.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsListItem.swift index 1d14c10e8a..3e3c52876b 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsListItem.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsListItem.swift @@ -80,7 +80,7 @@ struct SettingsListItem: View { accessibilityIdentifier: String? = nil, nameAccessibilityID: String? = nil, action: @escaping () -> Void, - @ViewBuilder trailingContent: @escaping () -> Content? = { EmptyView() } + @ViewBuilder trailingContent: @escaping () -> Content? = { EmptyView() }, ) { self.accessibilityIdentifier = accessibilityIdentifier self.name = name diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsProcessor.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsProcessor.swift index 28232c6402..8b28b7bb12 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsProcessor.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsProcessor.swift @@ -40,7 +40,7 @@ final class SettingsProcessor: StateProcessor, services: Services, - state: SettingsState + state: SettingsState, ) { self.coordinator = coordinator self.services = services @@ -63,7 +63,7 @@ final class SettingsProcessor: StateProcessor String { switch biometryType { case .faceID: - return Localizations.unlockWith(Localizations.faceID) + Localizations.unlockWith(Localizations.faceID) case .touchID: - return Localizations.unlockWith(Localizations.touchID) + Localizations.unlockWith(Localizations.touchID) } } @@ -248,7 +248,7 @@ struct SettingsView: View { private func externalLinkRow( _ name: String, action: SettingsAction, - hasDivider: Bool = true + hasDivider: Bool = true, ) -> some View { SettingsListItem(name, hasDivider: hasDivider) { store.send(action) @@ -272,8 +272,8 @@ struct SettingsView: View { Text(LocalizedStringKey( Localizations.learnMoreLink( - ExternalLinksConstants.totpSyncHelp - ) + ExternalLinksConstants.totpSyncHelp, + ), )) .styleGuide(.subheadline) .foregroundColor(Asset.Colors.textSecondary.swiftUIColor) @@ -310,11 +310,11 @@ struct SettingsView_Previews: PreviewProvider { biometricUnlockStatus: .available( .faceID, enabled: false, - hasValidIntegrity: true - ) - ) - ) - ) + hasValidIntegrity: true, + ), + ), + ), + ), ) }.previewDisplayName("SettingsView") @@ -323,10 +323,10 @@ struct SettingsView_Previews: PreviewProvider { store: Store( processor: StateProcessor( state: SettingsState( - shouldShowDefaultSaveOption: true - ) - ) - ) + shouldShowDefaultSaveOption: true, + ), + ), + ), ) }.previewDisplayName("With Default Save Option") } diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsViewTests.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsViewTests.swift index be7c8b5276..265710217a 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsViewTests.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/SettingsViewTests.swift @@ -135,7 +135,7 @@ class SettingsViewTests: BitwardenTestCase { func disabletest_snapshot_viewRender() { assertSnapshots( of: subject, - as: [.defaultPortrait, .defaultPortraitDark, .defaultPortraitAX5] + as: [.defaultPortrait, .defaultPortraitDark, .defaultPortraitAX5], ) } @@ -145,7 +145,7 @@ class SettingsViewTests: BitwardenTestCase { processor.state.biometricUnlockStatus = .available(.faceID, enabled: false, hasValidIntegrity: true) assertSnapshots( of: subject, - as: [.defaultPortrait, .defaultPortraitDark, .defaultPortraitAX5] + as: [.defaultPortrait, .defaultPortraitDark, .defaultPortraitAX5], ) } @@ -155,7 +155,7 @@ class SettingsViewTests: BitwardenTestCase { processor.state.shouldShowDefaultSaveOption = true assertSnapshots( of: subject, - as: [.defaultPortrait, .defaultPortraitDark, .defaultPortraitAX5] + as: [.defaultPortrait, .defaultPortraitDark, .defaultPortraitAX5], ) } } diff --git a/AuthenticatorShared/UI/Platform/Settings/SettingsCoordinator.swift b/AuthenticatorShared/UI/Platform/Settings/SettingsCoordinator.swift index a284d3c2f4..c2e4f9c17a 100644 --- a/AuthenticatorShared/UI/Platform/Settings/SettingsCoordinator.swift +++ b/AuthenticatorShared/UI/Platform/Settings/SettingsCoordinator.swift @@ -57,7 +57,7 @@ final class SettingsCoordinator: Coordinator, HasStackNavigator { init( module: Module, services: Services, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) { self.module = module self.services = services @@ -124,7 +124,7 @@ final class SettingsCoordinator: Coordinator, HasStackNavigator { private func showExportItems() { let processor = ExportItemsProcessor( coordinator: asAnyCoordinator(), - services: services + services: services, ) let view = ExportItemsView(store: Store(processor: processor)) let navController = UINavigationController(rootViewController: UIHostingController(rootView: view)) @@ -136,7 +136,7 @@ final class SettingsCoordinator: Coordinator, HasStackNavigator { private func showImportItems() { let processor = ImportItemsProcessor( coordinator: asAnyCoordinator(), - services: services + services: services, ) let view = ImportItemsView(store: Store(processor: processor)) let navController = UINavigationController(rootViewController: UIHostingController(rootView: view)) @@ -149,7 +149,7 @@ final class SettingsCoordinator: Coordinator, HasStackNavigator { guard let stackNavigator else { return } let coordinator = module.makeFileSelectionCoordinator( delegate: delegate, - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ) coordinator.start() coordinator.navigate(to: route) @@ -162,7 +162,7 @@ final class SettingsCoordinator: Coordinator, HasStackNavigator { delegate: delegate, services: services, showManualEntry: false, - stackNavigator: navigationController + stackNavigator: navigationController, ) coordinator.start() @@ -177,7 +177,7 @@ final class SettingsCoordinator: Coordinator, HasStackNavigator { coordinator: asAnyCoordinator(), delegate: delegate, services: services, - state: SelectLanguageState(currentLanguage: currentLanguage) + state: SelectLanguageState(currentLanguage: currentLanguage), ) let view = SelectLanguageView(store: Store(processor: processor)) let navController = UINavigationController(rootViewController: UIHostingController(rootView: view)) @@ -190,7 +190,7 @@ final class SettingsCoordinator: Coordinator, HasStackNavigator { let processor = SettingsProcessor( coordinator: asAnyCoordinator(), services: services, - state: SettingsState() + state: SettingsState(), ) let view = SettingsView(store: Store(processor: processor)) stackNavigator?.push(view) @@ -201,7 +201,7 @@ final class SettingsCoordinator: Coordinator, HasStackNavigator { private func showTutorial() { let navigationController = UINavigationController() let coordinator = module.makeTutorialCoordinator( - stackNavigator: navigationController + stackNavigator: navigationController, ) coordinator.start() stackNavigator?.present(navigationController, overFullscreen: true) diff --git a/AuthenticatorShared/UI/Platform/Settings/SettingsCoordinatorTests.swift b/AuthenticatorShared/UI/Platform/Settings/SettingsCoordinatorTests.swift index fa39ffd070..6a4868157f 100644 --- a/AuthenticatorShared/UI/Platform/Settings/SettingsCoordinatorTests.swift +++ b/AuthenticatorShared/UI/Platform/Settings/SettingsCoordinatorTests.swift @@ -22,7 +22,7 @@ class SettingsCoordinatorTests: BitwardenTestCase { subject = SettingsCoordinator( module: module, services: ServiceContainer.withMocks(), - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ) } @@ -41,7 +41,7 @@ class SettingsCoordinatorTests: BitwardenTestCase { func test_navigateTo_alert() throws { let alert = Alert.defaultAlert( title: Localizations.anErrorHasOccurred, - message: Localizations.genericErrorMessage + message: Localizations.genericErrorMessage, ) subject.showAlert(alert) diff --git a/AuthenticatorShared/UI/Platform/Settings/SettingsModule.swift b/AuthenticatorShared/UI/Platform/Settings/SettingsModule.swift index 8fd1a664fd..2504d787a9 100644 --- a/AuthenticatorShared/UI/Platform/Settings/SettingsModule.swift +++ b/AuthenticatorShared/UI/Platform/Settings/SettingsModule.swift @@ -12,18 +12,18 @@ protocol SettingsModule { /// - Returns: A coordinator that can navigate to `SettingsRoute`s. /// func makeSettingsCoordinator( - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator } extension DefaultAppModule: SettingsModule { func makeSettingsCoordinator( - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator { SettingsCoordinator( module: self, services: services, - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ).asAnyCoordinator() } } diff --git a/AuthenticatorShared/UI/Platform/Tabs/TabCoordinator.swift b/AuthenticatorShared/UI/Platform/Tabs/TabCoordinator.swift index 186132e660..15a4dc9d18 100644 --- a/AuthenticatorShared/UI/Platform/Tabs/TabCoordinator.swift +++ b/AuthenticatorShared/UI/Platform/Tabs/TabCoordinator.swift @@ -55,7 +55,7 @@ final class TabCoordinator: Coordinator, HasTabNavigator { errorReporter: ErrorReporter, module: Module, rootNavigator: RootNavigator, - tabNavigator: TabNavigator + tabNavigator: TabNavigator, ) { self.errorReporter = errorReporter self.module = module @@ -88,13 +88,13 @@ final class TabCoordinator: Coordinator, HasTabNavigator { let itemListNavigator = UINavigationController() itemListNavigator.navigationBar.prefersLargeTitles = true itemListCoordinator = module.makeItemListCoordinator( - stackNavigator: itemListNavigator + stackNavigator: itemListNavigator, ) let settingsNavigator = UINavigationController() settingsNavigator.navigationBar.prefersLargeTitles = true let settingsCoordinator = module.makeSettingsCoordinator( - stackNavigator: settingsNavigator + stackNavigator: settingsNavigator, ) settingsCoordinator.start() self.settingsCoordinator = settingsCoordinator diff --git a/AuthenticatorShared/UI/Platform/Tabs/TabModule.swift b/AuthenticatorShared/UI/Platform/Tabs/TabModule.swift index cc8959c477..b9b7c4c231 100644 --- a/AuthenticatorShared/UI/Platform/Tabs/TabModule.swift +++ b/AuthenticatorShared/UI/Platform/Tabs/TabModule.swift @@ -20,7 +20,7 @@ protocol TabModule: AnyObject { func makeTabCoordinator( errorReporter: ErrorReporter, rootNavigator: RootNavigator, - tabNavigator: TabNavigator + tabNavigator: TabNavigator, ) -> AnyCoordinator } @@ -30,13 +30,13 @@ extension DefaultAppModule: TabModule { func makeTabCoordinator( errorReporter: ErrorReporter, rootNavigator: RootNavigator, - tabNavigator: TabNavigator + tabNavigator: TabNavigator, ) -> AnyCoordinator { TabCoordinator( errorReporter: errorReporter, module: self, rootNavigator: rootNavigator, - tabNavigator: tabNavigator + tabNavigator: tabNavigator, ).asAnyCoordinator() } } diff --git a/AuthenticatorShared/UI/Platform/Tabs/TabRoute.swift b/AuthenticatorShared/UI/Platform/Tabs/TabRoute.swift index e4b668f099..da86f56e92 100644 --- a/AuthenticatorShared/UI/Platform/Tabs/TabRoute.swift +++ b/AuthenticatorShared/UI/Platform/Tabs/TabRoute.swift @@ -14,8 +14,8 @@ public enum TabRoute: Equatable, Hashable { public var accessibilityIdentifier: String { switch self { - case .itemList: return "VerificationCodesTabButton" - case .settings: return "SettingsTabButton" + case .itemList: "VerificationCodesTabButton" + case .settings: "SettingsTabButton" } } } @@ -25,29 +25,29 @@ public enum TabRoute: Equatable, Hashable { extension TabRoute: TabRepresentable { public var image: UIImage? { switch self { - case .itemList: return SharedAsset.Icons.recoveryCodes.image - case .settings: return SharedAsset.Icons.gearFilled24.image + case .itemList: SharedAsset.Icons.recoveryCodes.image + case .settings: SharedAsset.Icons.gearFilled24.image } } public var index: Int { switch self { - case .itemList: return 0 - case .settings: return 1 + case .itemList: 0 + case .settings: 1 } } public var selectedImage: UIImage? { switch self { - case .itemList: return SharedAsset.Icons.recoveryCodes.image - case .settings: return SharedAsset.Icons.gearFilled24.image + case .itemList: SharedAsset.Icons.recoveryCodes.image + case .settings: SharedAsset.Icons.gearFilled24.image } } public var title: String { switch self { - case .itemList: return Localizations.verificationCodes - case .settings: return Localizations.settings + case .itemList: Localizations.verificationCodes + case .settings: Localizations.settings } } } diff --git a/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialProcessor.swift b/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialProcessor.swift index f44e1c346c..209fa92967 100644 --- a/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialProcessor.swift +++ b/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialProcessor.swift @@ -22,7 +22,7 @@ final class TutorialProcessor: StateProcessor, - state: TutorialState + state: TutorialState, ) { self.coordinator = coordinator super.init(state: state) diff --git a/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialView.swift b/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialView.swift index 572132ae32..d9974e74e0 100644 --- a/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialView.swift +++ b/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialView.swift @@ -31,25 +31,25 @@ struct TutorialView: View { TabView( selection: store.binding( get: \.page, - send: TutorialAction.pageChanged - ) + send: TutorialAction.pageChanged, + ), ) { slide( image: Asset.Images.recoveryCodesBig, titleText: Localizations.secureYourAssetsWithBitwardenAuthenticator, - bodyText: Localizations.getVerificationCodesForAllYourAccounts + bodyText: Localizations.getVerificationCodesForAllYourAccounts, ).tag(TutorialPage.intro) slide( image: Asset.Images.qrIllustration, titleText: Localizations.useYourDeviceCameraToScanCodes, - bodyText: Localizations.scanTheQRCodeInYourSettings + bodyText: Localizations.scanTheQRCodeInYourSettings, ).tag(TutorialPage.qrScanner) slide( image: Asset.Images.verificationCode, titleText: Localizations.signInUsingUniqueCodes, - bodyText: Localizations.whenUsingTwoStepVerification + bodyText: Localizations.whenUsingTwoStepVerification, ).tag(TutorialPage.uniqueCodes) } .tabViewStyle(.page(indexDisplayMode: .always)) @@ -118,9 +118,9 @@ struct TutorialView_Previews: PreviewProvider { TutorialView( store: Store( processor: StateProcessor( - state: TutorialState(page: .intro) - ) - ) + state: TutorialState(page: .intro), + ), + ), ) }.previewDisplayName("Intro") @@ -128,9 +128,9 @@ struct TutorialView_Previews: PreviewProvider { TutorialView( store: Store( processor: StateProcessor( - state: TutorialState(page: .qrScanner) - ) - ) + state: TutorialState(page: .qrScanner), + ), + ), ) }.previewDisplayName("QR Scanner") @@ -138,9 +138,9 @@ struct TutorialView_Previews: PreviewProvider { TutorialView( store: Store( processor: StateProcessor( - state: TutorialState(page: .uniqueCodes) - ) - ) + state: TutorialState(page: .uniqueCodes), + ), + ), ) }.previewDisplayName("Unique Codes") } diff --git a/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialViewTests.swift b/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialViewTests.swift index a36466263f..992ba04da6 100644 --- a/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialViewTests.swift +++ b/AuthenticatorShared/UI/Platform/Tutorial/Tutorial/TutorialViewTests.swift @@ -21,7 +21,7 @@ class TutorialViewTests: BitwardenTestCase { let state = TutorialState() processor = MockProcessor(state: state) subject = TutorialView( - store: Store(processor: processor) + store: Store(processor: processor), ) } @@ -45,7 +45,7 @@ class TutorialViewTests: BitwardenTestCase { .defaultLandscape, .defaultPortraitAX5, .defaultLandscapeAX5, - ] + ], ) } } diff --git a/AuthenticatorShared/UI/Platform/Tutorial/TutorialCoordinator.swift b/AuthenticatorShared/UI/Platform/Tutorial/TutorialCoordinator.swift index 80e370c082..ba63d23f4d 100644 --- a/AuthenticatorShared/UI/Platform/Tutorial/TutorialCoordinator.swift +++ b/AuthenticatorShared/UI/Platform/Tutorial/TutorialCoordinator.swift @@ -38,7 +38,7 @@ final class TutorialCoordinator: Coordinator, HasStackNavigator { init( module: Module, services: Services, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) { self.module = module self.services = services @@ -70,7 +70,7 @@ final class TutorialCoordinator: Coordinator, HasStackNavigator { private func showTutorial() { let processor = TutorialProcessor( coordinator: asAnyCoordinator(), - state: TutorialState() + state: TutorialState(), ) let view = TutorialView(store: Store(processor: processor)) stackNavigator?.push(view) diff --git a/AuthenticatorShared/UI/Platform/Tutorial/TutorialModule.swift b/AuthenticatorShared/UI/Platform/Tutorial/TutorialModule.swift index e896baef73..c18160612c 100644 --- a/AuthenticatorShared/UI/Platform/Tutorial/TutorialModule.swift +++ b/AuthenticatorShared/UI/Platform/Tutorial/TutorialModule.swift @@ -11,7 +11,7 @@ protocol TutorialModule { /// - Returns: A coordinator /// func makeTutorialCoordinator( - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator } @@ -20,7 +20,7 @@ extension DefaultAppModule: TutorialModule { TutorialCoordinator( module: self, services: services, - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ).asAnyCoordinator() } } diff --git a/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemCoordinator.swift b/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemCoordinator.swift index 55e4ce1c5e..ab2bb4fe34 100644 --- a/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemCoordinator.swift +++ b/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemCoordinator.swift @@ -39,7 +39,7 @@ class AuthenticatorItemCoordinator: NSObject, Coordinator, HasStackNavigator { init( module: Module, services: Services, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) { self.module = module self.services = services @@ -61,7 +61,7 @@ class AuthenticatorItemCoordinator: NSObject, Coordinator, HasStackNavigator { case let .editAuthenticatorItem(authenticatorItemView): showEditAuthenticatorItem( for: authenticatorItemView, - delegate: context as? AuthenticatorItemOperationDelegate + delegate: context as? AuthenticatorItemOperationDelegate, ) } } @@ -93,7 +93,7 @@ class AuthenticatorItemCoordinator: NSObject, Coordinator, HasStackNavigator { /// private func showEditAuthenticatorItem( for authenticatorItemView: AuthenticatorItemView, - delegate: AuthenticatorItemOperationDelegate? + delegate: AuthenticatorItemOperationDelegate?, ) { guard let stackNavigator else { return } if stackNavigator.isEmpty { @@ -104,7 +104,7 @@ class AuthenticatorItemCoordinator: NSObject, Coordinator, HasStackNavigator { coordinator: asAnyCoordinator(), delegate: delegate, services: services, - state: state + state: state, ) let store = Store(processor: processor) let view = EditAuthenticatorItemView(store: store) @@ -112,7 +112,7 @@ class AuthenticatorItemCoordinator: NSObject, Coordinator, HasStackNavigator { } else { presentChildAuthenticatorItemCoordinator( route: .editAuthenticatorItem(authenticatorItemView), - context: self + context: self, ) } } diff --git a/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemModule.swift b/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemModule.swift index 80edb71235..c353015c89 100644 --- a/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemModule.swift +++ b/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemModule.swift @@ -11,18 +11,18 @@ protocol AuthenticatorItemModule { /// - Returns: A coordinator that can navigate to a `AuthenticatorItemRoute`. /// func makeAuthenticatorItemCoordinator( - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator } extension DefaultAppModule: AuthenticatorItemModule { func makeAuthenticatorItemCoordinator( - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator { AuthenticatorItemCoordinator( module: self, services: services, - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ).asAnyCoordinator() } } diff --git a/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemState.swift b/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemState.swift index 314d78923b..b5c3c0f83e 100644 --- a/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemState.swift +++ b/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemState.swift @@ -86,7 +86,7 @@ struct AuthenticatorItemState: Equatable { period: TotpPeriodOptions, secret: String, totpState: LoginTOTPState, - totpType: TotpTypeOptions + totpType: TotpTypeOptions, ) { self.accountName = accountName self.algorithm = algorithm @@ -107,12 +107,11 @@ struct AuthenticatorItemState: Equatable { guard let keyModel = TOTPKeyModel(authenticatorKey: authenticatorItemView.totpKey) else { return nil } - let type: TotpTypeOptions - switch keyModel.totpKey { + let type: TotpTypeOptions = switch keyModel.totpKey { case .base32, .otpAuthUri: - type = .totp + .totp case .steamUri: - type = .steam + .steam } self.init( @@ -127,7 +126,7 @@ struct AuthenticatorItemState: Equatable { period: TotpPeriodOptions(rawValue: keyModel.period) ?? .thirty, secret: keyModel.base32Key, totpState: LoginTOTPState(authenticatorItemView.totpKey), - totpType: type + totpType: type, ) } } @@ -148,7 +147,7 @@ extension AuthenticatorItemState { id: UUID().uuidString, name: issuer, totpKey: totpState.rawAuthenticatorKeyString, - username: accountName + username: accountName, ) } } diff --git a/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemProcessor.swift b/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemProcessor.swift index f2be4f685f..08084dce11 100644 --- a/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemProcessor.swift +++ b/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemProcessor.swift @@ -17,7 +17,7 @@ protocol AuthenticatorItemOperationDelegate: AnyObject { final class EditAuthenticatorItemProcessor: StateProcessor< EditAuthenticatorItemState, EditAuthenticatorItemAction, - EditAuthenticatorItemEffect + EditAuthenticatorItemEffect, > { // MARK: Types @@ -48,7 +48,7 @@ final class EditAuthenticatorItemProcessor: StateProcessor< coordinator: AnyCoordinator, delegate: AuthenticatorItemOperationDelegate?, services: Services, - state: EditAuthenticatorItemState + state: EditAuthenticatorItemState, ) { self.coordinator = coordinator self.delegate = delegate @@ -152,7 +152,7 @@ final class EditAuthenticatorItemProcessor: StateProcessor< id: authenticatorItemView.id, name: state.issuer, totpKey: "steam://\(secret)", - username: state.accountName + username: state.accountName, ) case .totp: let newOtpUri = OTPAuthModel( @@ -161,7 +161,7 @@ final class EditAuthenticatorItemProcessor: StateProcessor< digits: state.digits, issuer: state.issuer.nilIfEmpty, period: state.period.rawValue, - secret: secret + secret: secret, ) newAuthenticatorItemView = AuthenticatorItemView( @@ -169,7 +169,7 @@ final class EditAuthenticatorItemProcessor: StateProcessor< id: authenticatorItemView.id, name: state.issuer, totpKey: newOtpUri.otpAuthUri, - username: state.accountName + username: state.accountName, ) } try await updateAuthenticatorItem(authenticatorItem: newAuthenticatorItemView) diff --git a/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemView.swift b/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemView.swift index 4e59e115db..3ec103fead 100644 --- a/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemView.swift +++ b/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemView.swift @@ -12,7 +12,7 @@ struct EditAuthenticatorItemView: View { @ObservedObject var store: Store< EditAuthenticatorItemState, EditAuthenticatorItemAction, - EditAuthenticatorItemEffect + EditAuthenticatorItemEffect, > // MARK: View @@ -28,7 +28,7 @@ struct EditAuthenticatorItemView: View { .task { await store.perform(.appeared) } .toast(store.binding( get: \.toast, - send: EditAuthenticatorItemAction.toastShown + send: EditAuthenticatorItemAction.toastShown, )) } @@ -51,7 +51,7 @@ struct EditAuthenticatorItemView: View { .dismissKeyboardImmediately() .background( Asset.Colors.backgroundSecondary.swiftUIColor - .ignoresSafeArea() + .ignoresSafeArea(), ) .navigationBarTitleDisplayMode(.inline) } @@ -62,8 +62,8 @@ struct EditAuthenticatorItemView: View { title: Localizations.name, text: store.binding( get: \.issuer, - send: EditAuthenticatorItemAction.issuerChanged - ) + send: EditAuthenticatorItemAction.issuerChanged, + ), ) .accessibilityIdentifier("EditItemNameField") @@ -71,14 +71,14 @@ struct EditAuthenticatorItemView: View { title: Localizations.key, text: store.binding( get: \.secret, - send: EditAuthenticatorItemAction.secretChanged + send: EditAuthenticatorItemAction.secretChanged, ), accessibilityIdentifier: "EditItemKeyField", passwordVisibilityAccessibilityId: "EditKeyVisibilityToggle", isPasswordVisible: store.binding( get: \.isSecretVisible, - send: EditAuthenticatorItemAction.toggleSecretVisibilityChanged - ) + send: EditAuthenticatorItemAction.toggleSecretVisibilityChanged, + ), ) .textFieldConfiguration(.password) @@ -86,15 +86,15 @@ struct EditAuthenticatorItemView: View { title: Localizations.username, text: store.binding( get: \.accountName, - send: EditAuthenticatorItemAction.accountNameChanged - ) + send: EditAuthenticatorItemAction.accountNameChanged, + ), ) .textFieldConfiguration(.username) .accessibilityIdentifier("EditItemUsernameField") Toggle(Localizations.favorite, isOn: store.binding( get: \.isFavorited, - send: EditAuthenticatorItemAction.favoriteChanged + send: EditAuthenticatorItemAction.favoriteChanged, )) .toggleStyle(.bitwarden) .accessibilityIdentifier("EditItemFavoriteToggle") @@ -125,8 +125,8 @@ struct EditAuthenticatorItemView: View { options: TotpTypeOptions.allCases, selection: store.binding( get: \.totpType, - send: EditAuthenticatorItemAction.totpTypeChanged - ) + send: EditAuthenticatorItemAction.totpTypeChanged, + ), ) if store.state.totpType == .totp { @@ -135,8 +135,8 @@ struct EditAuthenticatorItemView: View { options: TOTPCryptoHashAlgorithm.allCases, selection: store.binding( get: \.algorithm, - send: EditAuthenticatorItemAction.algorithmChanged - ) + send: EditAuthenticatorItemAction.algorithmChanged, + ), ) BitwardenMenuField( @@ -144,8 +144,8 @@ struct EditAuthenticatorItemView: View { options: TotpPeriodOptions.allCases, selection: store.binding( get: \.period, - send: EditAuthenticatorItemAction.periodChanged - ) + send: EditAuthenticatorItemAction.periodChanged, + ), ) StepperFieldView( @@ -154,11 +154,11 @@ struct EditAuthenticatorItemView: View { keyPath: \.digits, range: 5 ... 10, title: Localizations.numberOfDigits, - value: store.state.digits + value: store.state.digits, ), action: { newValue in store.send(.digitsChanged(newValue)) - } + }, ) } @@ -195,7 +195,7 @@ struct EditAuthenticatorItemView_Previews: PreviewProvider { accountName: "Account", algorithm: .sha1, configuration: .existing( - authenticatorItemView: AuthenticatorItemView.fixture() + authenticatorItemView: AuthenticatorItemView.fixture(), ), digits: 6, id: "1", @@ -209,14 +209,14 @@ struct EditAuthenticatorItemView_Previews: PreviewProvider { codeModel: TOTPCodeModel( code: "123456", codeGenerationDate: Date(timeIntervalSinceReferenceDate: 0), - period: 30 - ) + period: 30, + ), ), - totpType: .totp + totpType: .totp, ) - .editState - ) - ) + .editState, + ), + ), ) }.previewDisplayName("Advanced Closed") @@ -228,7 +228,7 @@ struct EditAuthenticatorItemView_Previews: PreviewProvider { accountName: "Account", algorithm: .sha1, configuration: .existing( - authenticatorItemView: AuthenticatorItemView.fixture() + authenticatorItemView: AuthenticatorItemView.fixture(), ), digits: 6, id: "1", @@ -243,14 +243,14 @@ struct EditAuthenticatorItemView_Previews: PreviewProvider { codeModel: TOTPCodeModel( code: "123456", codeGenerationDate: Date(timeIntervalSinceReferenceDate: 0), - period: 30 - ) + period: 30, + ), ), - totpType: .totp + totpType: .totp, ) - .editState - ) - ) + .editState, + ), + ), ) }.previewDisplayName("Advanced Open, TOTP") @@ -262,7 +262,7 @@ struct EditAuthenticatorItemView_Previews: PreviewProvider { accountName: "Account", algorithm: .sha1, configuration: .existing( - authenticatorItemView: AuthenticatorItemView.fixture() + authenticatorItemView: AuthenticatorItemView.fixture(), ), digits: 6, id: "1", @@ -277,14 +277,14 @@ struct EditAuthenticatorItemView_Previews: PreviewProvider { codeModel: TOTPCodeModel( code: "123456", codeGenerationDate: Date(timeIntervalSinceReferenceDate: 0), - period: 30 - ) + period: 30, + ), ), - totpType: .steam + totpType: .steam, ) - .editState - ) - ) + .editState, + ), + ), ) }.previewDisplayName("Advanced Open, Steam") } diff --git a/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemViewTests.swift b/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemViewTests.swift index 51f2f116e3..1c6dc0785a 100644 --- a/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemViewTests.swift +++ b/AuthenticatorShared/UI/Vault/AuthenticatorItem/EditAuthenticatorItem/EditAuthenticatorItemViewTests.swift @@ -13,7 +13,7 @@ class EditAuthenticatorItemViewTests: BitwardenTestCase { var processor: MockProcessor< EditAuthenticatorItemState, EditAuthenticatorItemAction, - EditAuthenticatorItemEffect + EditAuthenticatorItemEffect, >! var subject: EditAuthenticatorItemView! @@ -23,12 +23,12 @@ class EditAuthenticatorItemViewTests: BitwardenTestCase { super.setUp() let state = AuthenticatorItemState( - existing: AuthenticatorItemView.fixture() + existing: AuthenticatorItemView.fixture(), )! processor = MockProcessor(state: state) subject = EditAuthenticatorItemView( - store: Store(processor: processor) + store: Store(processor: processor), ) } @@ -46,7 +46,7 @@ class EditAuthenticatorItemViewTests: BitwardenTestCase { for preview in EditAuthenticatorItemView_Previews._allPreviews { assertSnapshots( of: preview.content, - as: ["\(preview.displayName ?? "")": .portrait(heightMultiple: 1.25)] + as: ["\(preview.displayName ?? "")": .portrait(heightMultiple: 1.25)], ) } } diff --git a/AuthenticatorShared/UI/Vault/Extensions/Alert+Scan.swift b/AuthenticatorShared/UI/Vault/Extensions/Alert+Scan.swift index b9d35cecd7..622db9399d 100644 --- a/AuthenticatorShared/UI/Vault/Extensions/Alert+Scan.swift +++ b/AuthenticatorShared/UI/Vault/Extensions/Alert+Scan.swift @@ -20,7 +20,7 @@ extension Alert { AlertAction(title: Localizations.saveHere, style: .default) { _, _ in await saveLocallyAction() }, AlertAction(title: Localizations.saveToBitwarden, style: .default) { _, _ in await sendToBitwardenAction() }, - ] + ], ) } @@ -41,7 +41,7 @@ extension Alert { AlertAction(title: Localizations.yesSetDefault, style: .default) { _, _ in await yesAction() }, AlertAction(title: Localizations.noAskMe, style: .default) { _, _ in await noAction() }, - ] + ], ) } } diff --git a/AuthenticatorShared/UI/Vault/Extensions/Alert+Vault.swift b/AuthenticatorShared/UI/Vault/Extensions/Alert+Vault.swift index 5bd55f74b8..82428f05a0 100644 --- a/AuthenticatorShared/UI/Vault/Extensions/Alert+Vault.swift +++ b/AuthenticatorShared/UI/Vault/Extensions/Alert+Vault.swift @@ -17,7 +17,7 @@ extension Alert { alertActions: [ AlertAction(title: Localizations.yes, style: .default) { _, _ in await action() }, AlertAction(title: Localizations.no, style: .cancel), - ] + ], ) } } diff --git a/AuthenticatorShared/UI/Vault/Extensions/Array+TOTPHelpers.swift b/AuthenticatorShared/UI/Vault/Extensions/Array+TOTPHelpers.swift index 66214d302e..d55882c095 100644 --- a/AuthenticatorShared/UI/Vault/Extensions/Array+TOTPHelpers.swift +++ b/AuthenticatorShared/UI/Vault/Extensions/Array+TOTPHelpers.swift @@ -20,7 +20,7 @@ extension [ItemListItem] { /// func updated( with updatedValues: [ItemListItem], - includeNewValues: Bool = false + includeNewValues: Bool = false, ) -> [ItemListItem] { var result = byId() updatedValues.forEach { new in @@ -43,7 +43,7 @@ extension [ItemListSection] { /// func updated( with updatedValues: [ItemListItem], - includeNewValues: Bool = false + includeNewValues: Bool = false, ) -> [ItemListSection] { map { section in let updatedItems = section.items.updated(with: updatedValues, includeNewValues: includeNewValues) diff --git a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListCardView.swift b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListCardView.swift index 8d722cfdfb..0daca0d6a5 100644 --- a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListCardView.swift +++ b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListCardView.swift @@ -110,7 +110,7 @@ struct ItemListCardView_Previews: PreviewProvider { }, titleText: Localizations.syncWithTheBitwardenApp, actionTapped: {}, - closeTapped: {} + closeTapped: {}, ) ItemListCardView( @@ -126,7 +126,7 @@ struct ItemListCardView_Previews: PreviewProvider { titleText: Localizations.syncWithTheBitwardenApp, actionTapped: {}, closeTapped: {}, - secondaryActionTapped: {} + secondaryActionTapped: {}, ) } .padding(16) diff --git a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListCardViewTests.swift b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListCardViewTests.swift index 9f2997007c..b5d63342d0 100644 --- a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListCardViewTests.swift +++ b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListCardViewTests.swift @@ -20,7 +20,7 @@ class ItemListCardViewTests: BitwardenTestCase { "\(name)-portrait": .defaultPortrait, "\(name)-portraitDark": .defaultPortraitDark, "\(name)-portraitAX5": .tallPortraitAX5(heightMultiple: 3), - ] + ], ) } } @@ -40,7 +40,7 @@ class ItemListCardViewTests: BitwardenTestCase { }, closeTapped: { expectationClose.fulfill() - } + }, ) try subject.inspect().find(buttonWithAccessibilityLabel: Localizations.close).tap() diff --git a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListItem.swift b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListItem.swift index 7d4dccf8ef..c44f685840 100644 --- a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListItem.swift +++ b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListItem.swift @@ -51,11 +51,11 @@ extension ItemListItem { var totpCodeModel: TOTPCodeModel? { switch itemType { case let .sharedTotp(model): - return model.totpCode + model.totpCode case .syncError: - return nil + nil case let .totp(model): - return model.totpCode + model.totpCode } } @@ -126,7 +126,7 @@ extension ItemListItem { id: "syncError", name: Localizations.unableToSyncCodesFromTheBitwardenApp, accountName: nil, - itemType: .syncError + itemType: .syncError, ) } @@ -145,7 +145,7 @@ extension ItemListItem { id: id, name: name, accountName: accountName, - itemType: .sharedTotp(model: updatedModel) + itemType: .sharedTotp(model: updatedModel), ) case .syncError: return self @@ -156,7 +156,7 @@ extension ItemListItem { id: id, name: name, accountName: accountName, - itemType: .totp(model: updatedModel) + itemType: .totp(model: updatedModel), ) } } diff --git a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListItemTests.swift b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListItemTests.swift index f094d37848..04cf05db7f 100644 --- a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListItemTests.swift +++ b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListItemTests.swift @@ -49,7 +49,7 @@ class ItemListItemTests: BitwardenTestCase { let newModel = TOTPCodeModel( code: "098765", codeGenerationDate: Date(), - period: 30 + period: 30, ) let newItem = subject.with(newTotpModel: newModel) @@ -62,7 +62,7 @@ class ItemListItemTests: BitwardenTestCase { let newModel = TOTPCodeModel( code: "098765", codeGenerationDate: Date(), - period: 30 + period: 30, ) let newItem = subject.with(newTotpModel: newModel) @@ -75,7 +75,7 @@ class ItemListItemTests: BitwardenTestCase { let newModel = TOTPCodeModel( code: "098765", codeGenerationDate: Date(), - period: 30 + period: 30, ) let newItem = subject.with(newTotpModel: newModel) diff --git a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListProcessor.swift b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListProcessor.swift index 108d352c87..79919aa69a 100644 --- a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListProcessor.swift +++ b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListProcessor.swift @@ -50,7 +50,7 @@ final class ItemListProcessor: StateProcessor, services: Services, - state: ItemListState + state: ItemListState, ) { self.coordinator = coordinator self.services = services @@ -63,7 +63,7 @@ final class ItemListProcessor: StateProcessor Void)? + onExpiration: (([ItemListItem]) -> Void)?, ) { self.timeProvider = timeProvider self.onExpiration = onExpiration @@ -402,7 +402,7 @@ private class TOTPExpirationManager { repeats: true, block: { _ in self.checkForExpirations() - } + }, ) } @@ -440,7 +440,7 @@ private class TOTPExpirationManager { itemsByInterval.forEach { period, items in let sortedItems: [Bool: [ItemListItem]] = TOTPExpirationCalculator.listItemsByExpiration( items, - timeProvider: timeProvider + timeProvider: timeProvider, ) expired.append(contentsOf: sortedItems[true] ?? []) notExpired[period] = sortedItems[false] @@ -454,12 +454,12 @@ private class TOTPExpirationManager { extension ItemListProcessor: AuthenticatorKeyCaptureDelegate { func didCompleteAutomaticCapture( _ captureCoordinator: AnyCoordinator, - key: String + key: String, ) { Task { guard await services.authenticatorItemRepository.isPasswordManagerSyncActive() else { captureCoordinator.navigate( - to: .dismiss(parseKeyAndDismiss(key, sendToBitwarden: false)) + to: .dismiss(parseKeyAndDismiss(key, sendToBitwarden: false)), ) return } @@ -474,13 +474,13 @@ extension ItemListProcessor: AuthenticatorKeyCaptureDelegate { coordinator.showAlert(.determineScanSaveLocation( saveLocallyAction: { [weak self] in captureCoordinator.navigate( - to: .dismiss(self?.parseKeyAndDismiss(key, sendToBitwarden: false)) + to: .dismiss(self?.parseKeyAndDismiss(key, sendToBitwarden: false)), ) }, sendToBitwardenAction: { [weak self] in captureCoordinator.navigate( - to: .dismiss(self?.parseKeyAndDismiss(key, sendToBitwarden: true)) + to: .dismiss(self?.parseKeyAndDismiss(key, sendToBitwarden: true)), ) - } + }, )) } } else { @@ -495,7 +495,7 @@ extension ItemListProcessor: AuthenticatorKeyCaptureDelegate { self?.confirmDefaultSaveAlert(key: key, sendToBitwarden: true) }) captureCoordinator.navigate(to: .dismiss(dismissAction)) - } + }, )) } } @@ -516,7 +516,7 @@ extension ItemListProcessor: AuthenticatorKeyCaptureDelegate { id: UUID().uuidString, name: itemName, totpKey: key, - username: accountName + username: accountName, ) try await storeNewItem(newItem, sendToBitwarden: sendToBitwarden) } catch { @@ -528,7 +528,7 @@ extension ItemListProcessor: AuthenticatorKeyCaptureDelegate { _ captureCoordinator: AnyCoordinator, key: String, name: String, - sendToBitwarden: Bool + sendToBitwarden: Bool, ) { let dismissAction = DismissAction(action: { [weak self] in Task { @@ -560,7 +560,7 @@ extension ItemListProcessor: AuthenticatorKeyCaptureDelegate { id: UUID().uuidString, name: itemName, totpKey: key, - username: nil + username: nil, ) try await storeNewItem(newItem, sendToBitwarden: sendToBitwarden) } catch { @@ -569,7 +569,7 @@ extension ItemListProcessor: AuthenticatorKeyCaptureDelegate { } func showCameraScan( - _ captureCoordinator: AnyCoordinator + _ captureCoordinator: AnyCoordinator, ) { guard services.cameraService.deviceSupportsCamera() else { return } let dismissAction = DismissAction(action: { [weak self] in @@ -582,7 +582,7 @@ extension ItemListProcessor: AuthenticatorKeyCaptureDelegate { } func showManualEntry( - _ captureCoordinator: AnyCoordinator + _ captureCoordinator: AnyCoordinator, ) { let dismissAction = DismissAction(action: { [weak self] in self?.coordinator.navigate(to: .setupTotpManual, context: self) @@ -614,7 +614,7 @@ extension ItemListProcessor: AuthenticatorKeyCaptureDelegate { }, noAction: { [weak self] in self?.services.appSettingsStore.defaultSaveOption = .none await self?.parseAndValidateAutomaticCaptureKey(key, sendToBitwarden: sendToBitwarden) - } + }, )) } diff --git a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListProcessorTests.swift b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListProcessorTests.swift index 09624e880f..986146409c 100644 --- a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListProcessorTests.swift +++ b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListProcessorTests.swift @@ -49,13 +49,13 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type errorReporter: errorReporter, notificationCenterService: notificationCenterService, pasteboardService: pasteboardService, - totpService: totpService + totpService: totpService, ) subject = ItemListProcessor( coordinator: coordinator.asAnyCoordinator(), services: services, - state: ItemListState() + state: ItemListState(), ) } @@ -135,9 +135,9 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type totpCode: TOTPCodeModel( code: "654321", codeGenerationDate: Date(year: 2023, month: 12, day: 31), - period: 30 - ) - ) + period: 30, + ), + ), ) let resultSection = ItemListSection(id: "", items: [result], name: "Items") @@ -178,14 +178,14 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type totpCode: TOTPCodeModel( code: "", codeGenerationDate: Date(timeIntervalSinceNow: -61), - period: 30 - ) - ) + period: 30, + ), + ), ) let firstSection = ItemListSection( id: "", items: [firstItem], - name: "Items" + name: "Items", ) let secondItem = ItemListItem.fixture( @@ -193,25 +193,25 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type totpCode: TOTPCodeModel( code: "345678", codeGenerationDate: Date(timeIntervalSinceNow: -61), - period: 30 - ) - ) + period: 30, + ), + ), ) let secondSection = ItemListSection( id: "", items: [secondItem], - name: "Items" + name: "Items", ) let thirdModel = TOTPCodeModel( code: "654321", codeGenerationDate: Date(), - period: 30 + period: 30, ) let thirdItem = ItemListItem.fixture( totp: .fixture( - totpCode: thirdModel - ) + totpCode: thirdModel, + ), ) let thirdResultSection = ItemListSection(id: "", items: [thirdItem], name: "Items") @@ -251,7 +251,7 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type XCTAssertEqual(pasteboardService.copiedString, totpCode) XCTAssertEqual( subject.state.toast?.text, - Localizations.valueHasBeenCopied(Localizations.verificationCode) + Localizations.valueHasBeenCopied(Localizations.verificationCode), ) } @@ -294,7 +294,7 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type XCTAssertEqual(pasteboardService.copiedString, totpCode) XCTAssertEqual( subject.state.toast?.text, - Localizations.valueHasBeenCopied(Localizations.verificationCode) + Localizations.valueHasBeenCopied(Localizations.verificationCode), ) } @@ -377,9 +377,9 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type totpCode: TOTPCodeModel( code: "654321", codeGenerationDate: Date(year: 2024, month: 6, day: 28), - period: 30 - ) - ) + period: 30, + ), + ), ) authItemRepository.searchItemListSubject.send([result]) @@ -403,7 +403,7 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type XCTAssertEqual(subject.state.searchResults.count, 0) XCTAssertEqual( subject.state.searchResults, - [] + [], ) } @@ -416,7 +416,7 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type XCTAssertEqual(subject.state.searchResults.count, 0) XCTAssertEqual( subject.state.searchResults, - [] + [], ) XCTAssertEqual(errorReporter.errors as? [BitwardenTestError], [.example]) } @@ -430,9 +430,9 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(timeIntervalSinceNow: -61), - period: 30 - ) - ) + period: 30, + ), + ), ) let firstSection = ItemListSection(id: "", items: [firstItem], name: "Items") subject.state.loadingState = .data([firstSection]) @@ -442,9 +442,9 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type totpCode: TOTPCodeModel( code: "345678", codeGenerationDate: Date(timeIntervalSinceNow: -61), - period: 30 - ) - ) + period: 30, + ), + ), ) let thirdItem = ItemListItem.fixture( @@ -452,9 +452,9 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type totpCode: TOTPCodeModel( code: "654321", codeGenerationDate: Date(), - period: 30 - ) - ) + period: 30, + ), + ), ) authItemRepository.refreshTotpCodesResult = .success([secondItem]) @@ -704,8 +704,8 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type message: nil, alertActions: [ AlertAction(title: Localizations.ok, style: .default), - ] - ) + ], + ), ) XCTAssertEqual(authItemRepository.addAuthItemAuthItems, []) XCTAssertNil(subject.state.toast) @@ -1067,8 +1067,8 @@ class ItemListProcessorTests: BitwardenTestCase { // swiftlint:disable:this type message: nil, alertActions: [ AlertAction(title: Localizations.ok, style: .default), - ] - ) + ], + ), ) XCTAssertEqual(authItemRepository.addAuthItemAuthItems, []) XCTAssertNil(subject.state.toast) diff --git a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListSection+Fixtures.swift b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListSection+Fixtures.swift index f84cd7b9df..980d94a4f1 100644 --- a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListSection+Fixtures.swift +++ b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListSection+Fixtures.swift @@ -17,10 +17,10 @@ extension ItemListSection { totpCode: TOTPCodeModel( code: "12345", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ItemListItem( id: "6", @@ -32,10 +32,10 @@ extension ItemListSection { totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ItemListItem( id: "7", @@ -47,10 +47,10 @@ extension ItemListSection { totpCode: TOTPCodeModel( code: "1234567", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ItemListItem( id: "8", @@ -62,10 +62,10 @@ extension ItemListSection { totpCode: TOTPCodeModel( code: "12345678", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ItemListItem( id: "9", @@ -77,10 +77,10 @@ extension ItemListSection { totpCode: TOTPCodeModel( code: "123456789", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ItemListItem( id: "10", @@ -92,13 +92,13 @@ extension ItemListSection { totpCode: TOTPCodeModel( code: "1234567890", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ], - name: "Digits" + name: "Digits", ) } } diff --git a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListView.swift b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListView.swift index c1c026763c..ced0da399c 100644 --- a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListView.swift +++ b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListView.swift @@ -47,19 +47,19 @@ private struct SearchableItemListView: View { // swiftlint:disable:this type_bod .background(Asset.Colors.backgroundSecondary.swiftUIColor.ignoresSafeArea()) .toast(store.binding( get: \.toast, - send: ItemListAction.toastShown + send: ItemListAction.toastShown, )) .onChange(of: isSearching) { newValue in store.send(.searchStateChanged(isSearching: newValue)) } .toast(store.binding( get: \.toast, - send: ItemListAction.toastShown + send: ItemListAction.toastShown, )) .animation(.default, value: isSearching) .toast(store.binding( get: \.toast, - send: ItemListAction.toastShown + send: ItemListAction.toastShown, )) .onChange(of: store.state.url) { newValue in guard let url = newValue else { return } @@ -147,7 +147,7 @@ private struct SearchableItemListView: View { // swiftlint:disable:this type_bod Task { await store.perform(.closeCard(.passwordManagerDownload)) } - } + }, ) .padding(.top, 16) } @@ -175,7 +175,7 @@ private struct SearchableItemListView: View { // swiftlint:disable:this type_bod }, secondaryActionTapped: { openURL(ExternalLinksConstants.totpSyncHelp) - } + }, ) .padding(.top, 16) } @@ -262,7 +262,7 @@ private struct SearchableItemListView: View { // swiftlint:disable:this type_bod } label: { itemListItemRow( for: item, - isLastInSection: isLastInSection + isLastInSection: isLastInSection, ) } primaryAction: { store.send(.itemPressed(item)) @@ -329,13 +329,13 @@ private struct SearchableItemListView: View { // swiftlint:disable:this type_bod iconBaseURL: state.iconBaseURL, item: item, hasDivider: !isLastInSection, - showWebIcons: state.showWebIcons + showWebIcons: state.showWebIcons, ) }, mapAction: nil, - mapEffect: nil + mapEffect: nil, ), - timeProvider: timeProvider + timeProvider: timeProvider, ) } } @@ -355,9 +355,9 @@ struct ItemListView: View { /// How the screen title is displayed, which depends on iOS version. private var titleDisplayMode: NavigationBarItem.TitleDisplayMode { if #available(iOS 26, *) { - return .inline + .inline } else { - return .large + .large } } @@ -365,15 +365,15 @@ struct ItemListView: View { ZStack { SearchableItemListView( store: store, - timeProvider: timeProvider + timeProvider: timeProvider, ) .searchable( text: store.binding( get: \.searchText, - send: ItemListAction.searchTextChanged + send: ItemListAction.searchTextChanged, ), placement: .navigationBarDrawer(displayMode: .always), - prompt: Localizations.search + prompt: Localizations.search, ) .task(id: store.state.searchText) { await store.perform(.search(store.state.searchText)) @@ -404,11 +404,11 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b store: Store( processor: StateProcessor( state: ItemListState( - loadingState: .loading(nil) - ) - ) + loadingState: .loading(nil), + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) }.previewDisplayName("Loading") @@ -417,11 +417,11 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b store: Store( processor: StateProcessor( state: ItemListState( - loadingState: .data([]) - ) - ) + loadingState: .data([]), + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) }.previewDisplayName("Empty") @@ -445,13 +445,13 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ], - name: "Favorites" + name: "Favorites", ), ItemListSection( id: "Section", @@ -466,10 +466,10 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ItemListItem( id: "Two", @@ -481,20 +481,20 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ], - name: "Personal" + name: "Personal", ), - ] - ) - ) - ) + ], + ), + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) }.previewDisplayName("Items with Favorite") @@ -518,10 +518,10 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ItemListItem( id: "Two", @@ -533,20 +533,20 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ], - name: "" + name: "", ), - ] - ) - ) - ) + ], + ), + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) }.previewDisplayName("Items without Favorite") @@ -556,11 +556,11 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b processor: StateProcessor( state: ItemListState( searchResults: [], - searchText: "Example" - ) - ) + searchText: "Example", + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) }.previewDisplayName("0 Search Results") @@ -580,17 +580,17 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ], - searchText: "One" - ) - ) + searchText: "One", + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) }.previewDisplayName("1 Search Result") @@ -610,10 +610,10 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ItemListItem( id: "Two", @@ -625,10 +625,10 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ItemListItem( id: "Three", @@ -640,17 +640,17 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ], - searchText: "One" - ) - ) + searchText: "One", + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) }.previewDisplayName("3 Search Results") @@ -659,11 +659,11 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b store: Store( processor: StateProcessor( state: ItemListState( - loadingState: .data([ItemListSection.digitsFixture(accountNames: true)]) - ) - ) + loadingState: .data([ItemListSection.digitsFixture(accountNames: true)]), + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) }.previewDisplayName("Digits") @@ -677,13 +677,13 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b ItemListSection( id: "", items: [.syncError()], - name: "" + name: "", ), - ]) - ) - ) + ]), + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) }.previewDisplayName("SyncError") @@ -707,19 +707,19 @@ struct ItemListView_Previews: PreviewProvider { // swiftlint:disable:this type_b totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), ], name: "example.com", ), - ]) - ) - ) + ]), + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) }.previewDisplayName("SharedItems") } diff --git a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListViewTests.swift b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListViewTests.swift index 6ed1e33455..e6cc36d926 100644 --- a/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListViewTests.swift +++ b/AuthenticatorShared/UI/Vault/ItemList/ItemList/ItemListViewTests.swift @@ -26,7 +26,7 @@ class ItemListViewTests: BitwardenTestCase { timeProvider = MockTimeProvider(.mockTime(Date(year: 2023, month: 12, day: 31))) subject = ItemListView( store: Store(processor: processor), - timeProvider: timeProvider + timeProvider: timeProvider, ) } @@ -50,7 +50,7 @@ class ItemListViewTests: BitwardenTestCase { "\(name)-portrait": .defaultPortrait, "\(name)-portraitDark": .defaultPortraitDark, "\(name)-portraitAX5": .defaultPortraitAX5, - ] + ], ) } } @@ -60,12 +60,12 @@ class ItemListViewTests: BitwardenTestCase { func disabletest_snapshot_ItemListView_card_download_empty() { let state = ItemListState( itemListCardState: .passwordManagerDownload, - loadingState: .data([]) + loadingState: .data([]), ) processor = MockProcessor(state: state) subject = ItemListView( store: Store(processor: processor), - timeProvider: timeProvider + timeProvider: timeProvider, ) assertSnapshot(of: NavigationView { subject }, as: .defaultPortrait) @@ -76,12 +76,12 @@ class ItemListViewTests: BitwardenTestCase { func disabletest_snapshot_ItemListView_card_download_with_items() { let state = ItemListState( itemListCardState: .passwordManagerDownload, - loadingState: .data([ItemListSection.fixture()]) + loadingState: .data([ItemListSection.fixture()]), ) processor = MockProcessor(state: state) subject = ItemListView( store: Store(processor: processor), - timeProvider: timeProvider + timeProvider: timeProvider, ) assertSnapshot(of: NavigationView { subject }, as: .defaultPortrait) @@ -92,12 +92,12 @@ class ItemListViewTests: BitwardenTestCase { func disabletest_snapshot_ItemListView_card_sync_empty() { let state = ItemListState( itemListCardState: .passwordManagerSync, - loadingState: .data([]) + loadingState: .data([]), ) processor = MockProcessor(state: state) subject = ItemListView( store: Store(processor: processor), - timeProvider: timeProvider + timeProvider: timeProvider, ) assertSnapshot(of: NavigationView { subject }, as: .defaultPortrait) @@ -108,12 +108,12 @@ class ItemListViewTests: BitwardenTestCase { func disabletest_snapshot_ItemListView_card_sync_with_items() { let state = ItemListState( itemListCardState: .passwordManagerSync, - loadingState: .data([ItemListSection.fixture()]) + loadingState: .data([ItemListSection.fixture()]), ) processor = MockProcessor(state: state) subject = ItemListView( store: Store(processor: processor), - timeProvider: timeProvider + timeProvider: timeProvider, ) assertSnapshot(of: NavigationView { subject }, as: .defaultPortrait) @@ -124,12 +124,12 @@ class ItemListViewTests: BitwardenTestCase { func disabletest_snapshot_itemListCardView_close_download() throws { let state = ItemListState( itemListCardState: .passwordManagerDownload, - loadingState: .data([ItemListSection.fixture()]) + loadingState: .data([ItemListSection.fixture()]), ) processor = MockProcessor(state: state) subject = ItemListView( store: Store(processor: processor), - timeProvider: timeProvider + timeProvider: timeProvider, ) try subject.inspect().find(buttonWithAccessibilityLabel: Localizations.close).tap() @@ -144,12 +144,12 @@ class ItemListViewTests: BitwardenTestCase { func disabletest_snapshot_itemListCardView_close_sync() throws { let state = ItemListState( itemListCardState: .passwordManagerSync, - loadingState: .data([]) + loadingState: .data([]), ) processor = MockProcessor(state: state) subject = ItemListView( store: Store(processor: processor), - timeProvider: timeProvider + timeProvider: timeProvider, ) try subject.inspect().find(buttonWithAccessibilityLabel: Localizations.close).tap() diff --git a/AuthenticatorShared/UI/Vault/ItemList/ItemListCoordinator.swift b/AuthenticatorShared/UI/Vault/ItemList/ItemListCoordinator.swift index c0d0f224aa..abdb9d51b8 100644 --- a/AuthenticatorShared/UI/Vault/ItemList/ItemListCoordinator.swift +++ b/AuthenticatorShared/UI/Vault/ItemList/ItemListCoordinator.swift @@ -39,7 +39,7 @@ final class ItemListCoordinator: Coordinator, HasStackNavigator { init( module: Module, services: Services, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) { self.module = module self.services = services @@ -81,7 +81,7 @@ final class ItemListCoordinator: Coordinator, HasStackNavigator { let coordinator = AuthenticatorKeyCaptureCoordinator( delegate: delegate, services: services, - stackNavigator: navigationController + stackNavigator: navigationController, ) coordinator.start() @@ -96,7 +96,7 @@ final class ItemListCoordinator: Coordinator, HasStackNavigator { let coordinator = AuthenticatorKeyCaptureCoordinator( delegate: delegate, services: services, - stackNavigator: navigationController + stackNavigator: navigationController, ).asAnyCoordinator() coordinator.start() coordinator.navigate(to: .manualKeyEntry, context: nil) @@ -109,12 +109,12 @@ final class ItemListCoordinator: Coordinator, HasStackNavigator { let processor = ItemListProcessor( coordinator: asAnyCoordinator(), services: services, - state: ItemListState() + state: ItemListState(), ) let store = Store(processor: processor) let view = ItemListView( store: store, - timeProvider: services.timeProvider + timeProvider: services.timeProvider, ) stackNavigator?.replace(view, animated: false) } diff --git a/AuthenticatorShared/UI/Vault/ItemList/ItemListModule.swift b/AuthenticatorShared/UI/Vault/ItemList/ItemListModule.swift index a0f9a6f1da..ac70d02a6d 100644 --- a/AuthenticatorShared/UI/Vault/ItemList/ItemListModule.swift +++ b/AuthenticatorShared/UI/Vault/ItemList/ItemListModule.swift @@ -13,18 +13,18 @@ protocol ItemListModule { /// - Returns: A coordinator that can navigate to an `ItemListRoute` /// func makeItemListCoordinator( - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator } extension DefaultAppModule: ItemListModule { func makeItemListCoordinator( - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) -> AnyCoordinator { ItemListCoordinator( module: self, services: services, - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ).asAnyCoordinator() } } diff --git a/AuthenticatorShared/UI/Vault/PreviewContent/BitwardenSdk+VaultFixtures.swift b/AuthenticatorShared/UI/Vault/PreviewContent/BitwardenSdk+VaultFixtures.swift index 6f303ddfbb..aafa19be4f 100644 --- a/AuthenticatorShared/UI/Vault/PreviewContent/BitwardenSdk+VaultFixtures.swift +++ b/AuthenticatorShared/UI/Vault/PreviewContent/BitwardenSdk+VaultFixtures.swift @@ -12,7 +12,7 @@ extension AttachmentView { key: String? = nil, size: String? = nil, sizeName: String? = nil, - url: String? = nil + url: String? = nil, ) -> AttachmentView { .init( id: id, @@ -20,7 +20,7 @@ extension AttachmentView { size: size, sizeName: sizeName, fileName: fileName, - key: key + key: key, ) } } @@ -53,7 +53,7 @@ extension Cipher { secureNote: SecureNote? = nil, sshKey: SshKey? = nil, type: BitwardenSdk.CipherType = .login, - viewPassword: Bool = true + viewPassword: Bool = true, ) -> Cipher { Cipher( id: id, @@ -82,7 +82,7 @@ extension Cipher { creationDate: creationDate, deletedDate: deletedDate, revisionDate: revisionDate, - archivedDate: archivedDate + archivedDate: archivedDate, ) } } @@ -115,7 +115,7 @@ extension CipherView { secureNote: SecureNoteView? = nil, sshKey: SshKeyView? = nil, type: BitwardenSdk.CipherType = .login, - viewPassword: Bool = true + viewPassword: Bool = true, ) -> CipherView { CipherView( id: id, @@ -144,7 +144,7 @@ extension CipherView { creationDate: creationDate, deletedDate: deletedDate, revisionDate: revisionDate, - archivedDate: archivedDate + archivedDate: archivedDate, ) } @@ -170,7 +170,7 @@ extension CipherView { permissions: CipherPermissions? = nil, reprompt: BitwardenSdk.CipherRepromptType = .none, revisionDate: Date = Date(year: 2023, month: 11, day: 5, hour: 9, minute: 41), - viewPassword: Bool = true + viewPassword: Bool = true, ) -> CipherView { CipherView( id: id, @@ -199,7 +199,7 @@ extension CipherView { creationDate: creationDate, deletedDate: deletedDate, revisionDate: revisionDate, - archivedDate: archivedDate + archivedDate: archivedDate, ) } @@ -225,7 +225,7 @@ extension CipherView { permissions: CipherPermissions? = nil, reprompt: BitwardenSdk.CipherRepromptType = .none, revisionDate: Date = Date(year: 2023, month: 11, day: 5, hour: 9, minute: 41), - viewPassword: Bool = true + viewPassword: Bool = true, ) -> CipherView { CipherView( id: id, @@ -254,19 +254,19 @@ extension CipherView { creationDate: creationDate, deletedDate: deletedDate, revisionDate: revisionDate, - archivedDate: archivedDate + archivedDate: archivedDate, ) } static func totpFixture( id: String = "8675", name: String = "Bitwarden", - totp: String = "1234" + totp: String = "1234", ) -> CipherView { .loginFixture( id: id, login: .fixture(totp: totp), - name: name + name: name, ) } } @@ -281,7 +281,7 @@ extension Collection { manage: Bool = false, readOnly: Bool = false, defaultUserCollectionEmail: String? = nil, - type: BitwardenSdk.CollectionType = .sharedCollection + type: BitwardenSdk.CollectionType = .sharedCollection, ) -> Collection { Collection( id: id, @@ -292,7 +292,7 @@ extension Collection { readOnly: readOnly, manage: manage, defaultUserCollectionEmail: defaultUserCollectionEmail, - type: type + type: type, ) } } @@ -304,7 +304,7 @@ extension BitwardenSdk.CardView { code: String? = nil, expMonth: String? = nil, expYear: String? = nil, - number: String? = nil + number: String? = nil, ) -> BitwardenSdk.CardView { BitwardenSdk.CardView( cardholderName: cardholderName, @@ -312,7 +312,7 @@ extension BitwardenSdk.CardView { expYear: expYear, code: code, brand: brand, - number: number + number: number, ) } } @@ -326,7 +326,7 @@ extension CollectionView { organizationId: String = "", manage: Bool = false, readOnly: Bool = false, - type: BitwardenSdk.CollectionType = .sharedCollection + type: BitwardenSdk.CollectionType = .sharedCollection, ) -> CollectionView { CollectionView( id: id, @@ -336,7 +336,7 @@ extension CollectionView { hidePasswords: hidePasswords, readOnly: readOnly, manage: manage, - type: type + type: type, ) } } @@ -355,7 +355,7 @@ extension Fido2Credential { rpName: String? = nil, userDisplayName: String? = nil, userHandle: String? = nil, - userName: String? = nil + userName: String? = nil, ) -> Fido2Credential { Fido2Credential( credentialId: credentialId, @@ -370,7 +370,7 @@ extension Fido2Credential { rpName: rpName, userDisplayName: userDisplayName, discoverable: discoverable, - creationDate: creationDate + creationDate: creationDate, ) } } @@ -382,7 +382,7 @@ extension BitwardenSdk.Fido2CredentialAutofillView { rpId: String = "myApp.com", userNameForUi: String? = nil, userHandle: Data = Data(capacity: 64), - hasCounter: Bool = false + hasCounter: Bool = false, ) -> BitwardenSdk.Fido2CredentialAutofillView { .init( credentialId: credentialId, @@ -390,7 +390,7 @@ extension BitwardenSdk.Fido2CredentialAutofillView { rpId: rpId, userNameForUi: userNameForUi, userHandle: userHandle, - hasCounter: hasCounter + hasCounter: hasCounter, ) } } @@ -409,7 +409,7 @@ extension Fido2CredentialView { rpName: String? = nil, userDisplayName: String? = nil, userHandle: String? = nil, - userName: String? = nil + userName: String? = nil, ) -> Fido2CredentialView { Fido2CredentialView( credentialId: credentialId, @@ -424,7 +424,7 @@ extension Fido2CredentialView { rpName: rpName, userDisplayName: userDisplayName, discoverable: discoverable, - creationDate: creationDate + creationDate: creationDate, ) } } @@ -434,13 +434,13 @@ extension BitwardenSdk.FieldView { name: String? = "Name", value: String? = "1", type: BitwardenSdk.FieldType = BitwardenSdk.FieldType.hidden, - linkedId: BitwardenSdk.LinkedIdType? = nil + linkedId: BitwardenSdk.LinkedIdType? = nil, ) -> BitwardenSdk.FieldView { BitwardenSdk.FieldView( name: name, value: value, type: type, - linkedId: linkedId + linkedId: linkedId, ) } } @@ -464,7 +464,7 @@ extension BitwardenSdk.IdentityView { ssn: String? = nil, username: String? = nil, passportNumber: String? = nil, - licenseNumber: String? = nil + licenseNumber: String? = nil, ) -> BitwardenSdk.IdentityView { BitwardenSdk.IdentityView( title: title, @@ -484,7 +484,7 @@ extension BitwardenSdk.IdentityView { ssn: ssn, username: username, passportNumber: passportNumber, - licenseNumber: licenseNumber + licenseNumber: licenseNumber, ) } } @@ -497,7 +497,7 @@ extension BitwardenSdk.Login { passwordRevisionDate: Date? = nil, uris: [LoginUri]? = nil, username: String? = nil, - totp: String? = nil + totp: String? = nil, ) -> BitwardenSdk.Login { BitwardenSdk.Login( username: username, @@ -506,7 +506,7 @@ extension BitwardenSdk.Login { uris: uris, totp: totp, autofillOnPageLoad: autofillOnPageLoad, - fido2Credentials: fido2Credentials + fido2Credentials: fido2Credentials, ) } } @@ -519,7 +519,7 @@ extension BitwardenSdk.LoginView { uris: [LoginUriView]? = nil, username: String? = nil, totp: String? = nil, - autofillOnPageLoad: Bool? = nil + autofillOnPageLoad: Bool? = nil, ) -> BitwardenSdk.LoginView { BitwardenSdk.LoginView( username: username, @@ -528,7 +528,7 @@ extension BitwardenSdk.LoginView { uris: uris, totp: totp, autofillOnPageLoad: autofillOnPageLoad, - fido2Credentials: fido2Credentials + fido2Credentials: fido2Credentials, ) } } @@ -537,12 +537,12 @@ extension BitwardenSdk.LoginUri { static func fixture( uri: String? = "https://example.com", match: BitwardenSdk.UriMatchType? = nil, - uriChecksum: String? = nil + uriChecksum: String? = nil, ) -> LoginUri { LoginUri( uri: uri, match: match, - uriChecksum: uriChecksum + uriChecksum: uriChecksum, ) } } @@ -551,12 +551,12 @@ extension BitwardenSdk.LoginUriView { static func fixture( uri: String? = "https://example.com", match: BitwardenSdk.UriMatchType? = nil, - uriChecksum: String? = nil + uriChecksum: String? = nil, ) -> LoginUriView { LoginUriView( uri: uri, match: match, - uriChecksum: uriChecksum + uriChecksum: uriChecksum, ) } } @@ -565,7 +565,7 @@ extension BitwardenSdk.SshKey { static func fixture( privateKey: String = "privateKey", publicKey: String = "publicKey", - fingerprint: String = "fingerprint" + fingerprint: String = "fingerprint", ) -> SshKey { SshKey(privateKey: privateKey, publicKey: publicKey, fingerprint: fingerprint) } @@ -575,7 +575,7 @@ extension BitwardenSdk.SshKeyView { static func fixture( privateKey: String = "privateKey", publicKey: String = "publicKey", - fingerprint: String = "fingerprint" + fingerprint: String = "fingerprint", ) -> SshKeyView { SshKeyView(privateKey: privateKey, publicKey: publicKey, fingerprint: fingerprint) } @@ -584,11 +584,11 @@ extension BitwardenSdk.SshKeyView { extension PasswordHistoryView { static func fixture( password: String = "", - lastUsedDate: Date = Date(year: 2024, month: 1, day: 1) + lastUsedDate: Date = Date(year: 2024, month: 1, day: 1), ) -> PasswordHistoryView { PasswordHistoryView( password: password, - lastUsedDate: lastUsedDate + lastUsedDate: lastUsedDate, ) } } diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/AuthenticatorKeyCaptureCoordinator.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/AuthenticatorKeyCaptureCoordinator.swift index ee2cb4c404..7ca5b18c95 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/AuthenticatorKeyCaptureCoordinator.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/AuthenticatorKeyCaptureCoordinator.swift @@ -16,7 +16,7 @@ protocol AuthenticatorKeyCaptureDelegate: AnyObject { /// func didCompleteAutomaticCapture( _ captureCoordinator: AnyCoordinator, - key: String + key: String, ) /// Called when the manual key entry flow has been completed. @@ -32,7 +32,7 @@ protocol AuthenticatorKeyCaptureDelegate: AnyObject { _ captureCoordinator: AnyCoordinator, key: String, name: String, - sendToBitwarden: Bool + sendToBitwarden: Bool, ) /// Called when the scan flow requests the scan code screen. @@ -40,7 +40,7 @@ protocol AuthenticatorKeyCaptureDelegate: AnyObject { /// - Parameters: /// - coordinator: The coordinator sending the action. func showCameraScan( - _ captureCoordinator: AnyCoordinator + _ captureCoordinator: AnyCoordinator, ) /// Called when the scan flow requests the manual entry screen. @@ -48,7 +48,7 @@ protocol AuthenticatorKeyCaptureDelegate: AnyObject { /// - Parameters: /// - coordinator: The coordinator sending the action. func showManualEntry( - _ captureCoordinator: AnyCoordinator + _ captureCoordinator: AnyCoordinator, ) } @@ -94,7 +94,7 @@ final class AuthenticatorKeyCaptureCoordinator: Coordinator, HasStackNavigator { delegate: AuthenticatorKeyCaptureDelegate?, services: Services, showManualEntry: Bool = true, - stackNavigator: StackNavigator + stackNavigator: StackNavigator, ) { self.delegate = delegate self.services = services @@ -115,13 +115,13 @@ final class AuthenticatorKeyCaptureCoordinator: Coordinator, HasStackNavigator { func navigate( to route: AuthenticatorKeyCaptureRoute, - context: AnyObject? + context: AnyObject?, ) { switch route { case let .complete(value): delegate?.didCompleteAutomaticCapture( asAnyCoordinator(), - key: value.content + key: value.content, ) case let .dismiss(onDismiss): stackNavigator?.dismiss(completion: { @@ -132,7 +132,7 @@ final class AuthenticatorKeyCaptureCoordinator: Coordinator, HasStackNavigator { asAnyCoordinator(), key: authKey, name: name, - sendToBitwarden: sendToBitwarden + sendToBitwarden: sendToBitwarden, ) case .manualKeyEntry: guard let stackNavigator else { return } @@ -181,12 +181,12 @@ final class AuthenticatorKeyCaptureCoordinator: Coordinator, HasStackNavigator { let processor = ScanCodeProcessor( coordinator: asAnyCoordinator(), services: services, - state: ScanCodeState(showManualEntry: showManualEntry) + state: ScanCodeState(showManualEntry: showManualEntry), ) let store = Store(processor: processor) let view = ScanCodeView( cameraSession: session, - store: store + store: store, ) stackNavigator?.replace(view) } @@ -200,11 +200,11 @@ final class AuthenticatorKeyCaptureCoordinator: Coordinator, HasStackNavigator { services: services, state: DefaultEntryState( deviceSupportsCamera: services.cameraService.deviceSupportsCamera() - && services.cameraService.checkStatus() == .authorized - ) + && services.cameraService.checkStatus() == .authorized, + ), ) let view = ManualEntryView( - store: Store(processor: processor) + store: Store(processor: processor), ) stackNavigator?.replace(view) } diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/AuthenticatorKeyCaptureCoordinatorTests.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/AuthenticatorKeyCaptureCoordinatorTests.swift index 6e7738b1ca..c88a9d88f9 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/AuthenticatorKeyCaptureCoordinatorTests.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/AuthenticatorKeyCaptureCoordinatorTests.swift @@ -28,9 +28,9 @@ class AuthenticatorKeyCaptureCoordinatorTests: BitwardenTestCase { delegate: delegate, services: ServiceContainer.withMocks( cameraService: cameraService, - errorReporter: errorReporter + errorReporter: errorReporter, ), - stackNavigator: stackNavigator + stackNavigator: stackNavigator, ) cameraService.cameraAuthorizationStatus = .authorized cameraService.startResult = .success(AVCaptureSession()) @@ -313,7 +313,7 @@ class MockAuthenticatorKeyCaptureDelegate: AuthenticatorKeyCaptureDelegate { func didCompleteCapture( _ captureCoordinator: AnyCoordinator, key: String, - name: String? + name: String?, ) { didCompleteCaptureCalled = true capturedCaptureCoordinator = captureCoordinator @@ -323,7 +323,7 @@ class MockAuthenticatorKeyCaptureDelegate: AuthenticatorKeyCaptureDelegate { func didCompleteAutomaticCapture( _ captureCoordinator: AnyCoordinator, - key: String + key: String, ) { didCompleteAutomaticCaptureCalled = true capturedCaptureCoordinator = captureCoordinator @@ -334,7 +334,7 @@ class MockAuthenticatorKeyCaptureDelegate: AuthenticatorKeyCaptureDelegate { _ captureCoordinator: AnyCoordinator, key: String, name: String, - sendToBitwarden: Bool + sendToBitwarden: Bool, ) { didCompleteManualCaptureCalled = true capturedCaptureCoordinator = captureCoordinator @@ -344,14 +344,14 @@ class MockAuthenticatorKeyCaptureDelegate: AuthenticatorKeyCaptureDelegate { } func showCameraScan( - _ captureCoordinator: AnyCoordinator + _ captureCoordinator: AnyCoordinator, ) { didRequestCamera = true capturedCaptureCoordinator = captureCoordinator } func showManualEntry( - _ captureCoordinator: AnyCoordinator + _ captureCoordinator: AnyCoordinator, ) { didRequestManual = true capturedCaptureCoordinator = captureCoordinator diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/CameraPreviewView.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/CameraPreviewView.swift index 3b6d25ffe1..7f41ec9c1c 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/CameraPreviewView.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/CameraPreviewView.swift @@ -44,7 +44,7 @@ public struct CameraPreviewView { self, selector: #selector(handleOrientationChange), name: UIDevice.orientationDidChangeNotification, - object: nil + object: nil, ) } diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/Extensions/Alert+ScanError.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/Extensions/Alert+ScanError.swift index f5f5f6b737..d2793db3bf 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/Extensions/Alert+ScanError.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/Extensions/Alert+ScanError.swift @@ -11,7 +11,7 @@ extension Alert { message: nil, alertActions: [ AlertAction(title: Localizations.ok, style: .default), - ] + ], ) } } diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryProcessor.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryProcessor.swift index e327625a10..37fc37f306 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryProcessor.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryProcessor.swift @@ -36,7 +36,7 @@ final class ManualEntryProcessor: StateProcessor, services: Services, - state: ManualEntryState + state: ManualEntryState, ) { self.coordinator = coordinator self.services = services diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryProcessorTests.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryProcessorTests.swift index d9f1b3c059..972b165611 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryProcessorTests.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryProcessorTests.swift @@ -24,9 +24,9 @@ final class ManualEntryProcessorTests: BitwardenTestCase { services: ServiceContainer.withMocks( appSettingsStore: appSettingsStore, authenticatorItemRepository: authItemRepository, - configService: configService + configService: configService, ), - state: DefaultEntryState(deviceSupportsCamera: true) + state: DefaultEntryState(deviceSupportsCamera: true), ) } diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryView.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryView.swift index 5c6e26b481..b54c6adf4e 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryView.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryView.swift @@ -16,7 +16,7 @@ struct ManualEntryView: View { content .navigationBar( title: Localizations.createVerificationCode, - titleDisplayMode: .inline + titleDisplayMode: .inline, ) .toolbar { cancelToolbarItem { @@ -36,8 +36,8 @@ struct ManualEntryView: View { ManualEntryAction.addPressed( code: store.state.authenticatorKey, name: store.state.name, - sendToBitwarden: false - ) + sendToBitwarden: false, + ), ) } .buttonStyle(.tertiary()) @@ -54,8 +54,8 @@ struct ManualEntryView: View { title: Localizations.name, text: store.binding( get: \.name, - send: ManualEntryAction.nameChanged - ) + send: ManualEntryAction.nameChanged, + ), ) .accessibilityIdentifier("ManualEntryNameField") @@ -63,8 +63,8 @@ struct ManualEntryView: View { title: Localizations.key, text: store.binding( get: \.authenticatorKey, - send: ManualEntryAction.authenticatorKeyChanged - ) + send: ManualEntryAction.authenticatorKeyChanged, + ), ) .accessibilityIdentifier("ManualEntryKeyField") @@ -83,7 +83,7 @@ struct ManualEntryView: View { } .background( Asset.Colors.backgroundSecondary.swiftUIColor - .ignoresSafeArea() + .ignoresSafeArea(), ) .scrollView() } @@ -121,8 +121,8 @@ struct ManualEntryView: View { ManualEntryAction.addPressed( code: store.state.authenticatorKey, name: store.state.name, - sendToBitwarden: sendToBitwarden - ) + sendToBitwarden: sendToBitwarden, + ), ) } .accessibilityIdentifier(accessibilityIdentifier) @@ -157,7 +157,7 @@ struct ManualEntryView: View { /// private func styledFooterText() -> AttributedString { var attributed = AttributedString( - Localizations.cannotAddAuthenticatorKey + " " + Localizations.scanQRCode + Localizations.cannotAddAuthenticatorKey + " " + Localizations.scanQRCode, ) if let range = attributed.range(of: Localizations.scanQRCode) { attributed[range].foregroundColor = Asset.Colors.primaryBitwarden.swiftUIColor @@ -197,9 +197,9 @@ struct ManualEntryView_Previews: PreviewProvider { ManualEntryView( store: Store( processor: StateProcessor( - state: PreviewState().manualEntryState - ) - ) + state: PreviewState().manualEntryState, + ), + ), ) } .previewDisplayName("Empty") @@ -212,10 +212,10 @@ struct ManualEntryView_Previews: PreviewProvider { processor: StateProcessor( state: PreviewState( authenticatorKey: "manualEntry", - name: "Manual Name" - ).manualEntryState - ) - ) + name: "Manual Name", + ).manualEntryState, + ), + ), ) } .previewDisplayName("Text Added") @@ -228,10 +228,10 @@ struct ManualEntryView_Previews: PreviewProvider { processor: StateProcessor( state: PreviewState( defaultSaveOption: .none, - isPasswordManagerSyncActive: true - ).manualEntryState - ) - ) + isPasswordManagerSyncActive: true, + ).manualEntryState, + ), + ), ) } .previewDisplayName("Sync Active - No default") @@ -244,10 +244,10 @@ struct ManualEntryView_Previews: PreviewProvider { processor: StateProcessor( state: PreviewState( defaultSaveOption: .saveToBitwarden, - isPasswordManagerSyncActive: true - ).manualEntryState - ) - ) + isPasswordManagerSyncActive: true, + ).manualEntryState, + ), + ), ) } .previewDisplayName("Sync Active - Bitwarden default") @@ -260,10 +260,10 @@ struct ManualEntryView_Previews: PreviewProvider { processor: StateProcessor( state: PreviewState( defaultSaveOption: .saveHere, - isPasswordManagerSyncActive: true - ).manualEntryState - ) - ) + isPasswordManagerSyncActive: true, + ).manualEntryState, + ), + ), ) } .previewDisplayName("Sync Active - Local default") diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryViewTests.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryViewTests.swift index 34d4c57b5c..32da770e25 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryViewTests.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ManualEntryViewTests.swift @@ -20,7 +20,7 @@ class ManualEntryViewTests: BitwardenTestCase { processor = MockProcessor(state: DefaultEntryState(deviceSupportsCamera: true)) let store = Store(processor: processor) subject = ManualEntryView( - store: store + store: store, ) } @@ -39,7 +39,7 @@ class ManualEntryViewTests: BitwardenTestCase { try button.tap() XCTAssertEqual( processor.dispatchedActions.last, - .addPressed(code: "", name: "", sendToBitwarden: false) + .addPressed(code: "", name: "", sendToBitwarden: false), ) } @@ -52,7 +52,7 @@ class ManualEntryViewTests: BitwardenTestCase { try button.tap() XCTAssertEqual( processor.dispatchedActions.last, - .addPressed(code: "pasta-batman", name: "wayne", sendToBitwarden: false) + .addPressed(code: "pasta-batman", name: "wayne", sendToBitwarden: false), ) } @@ -64,7 +64,7 @@ class ManualEntryViewTests: BitwardenTestCase { try button.tap() XCTAssertEqual( processor.dispatchedActions.last, - .addPressed(code: "", name: "", sendToBitwarden: false) + .addPressed(code: "", name: "", sendToBitwarden: false), ) } @@ -78,7 +78,7 @@ class ManualEntryViewTests: BitwardenTestCase { try button.tap() XCTAssertEqual( processor.dispatchedActions.last, - .addPressed(code: "pasta-batman", name: "wayne", sendToBitwarden: false) + .addPressed(code: "pasta-batman", name: "wayne", sendToBitwarden: false), ) } @@ -90,7 +90,7 @@ class ManualEntryViewTests: BitwardenTestCase { try button.tap() XCTAssertEqual( processor.dispatchedActions.last, - .addPressed(code: "", name: "", sendToBitwarden: true) + .addPressed(code: "", name: "", sendToBitwarden: true), ) } @@ -104,7 +104,7 @@ class ManualEntryViewTests: BitwardenTestCase { try button.tap() XCTAssertEqual( processor.dispatchedActions.last, - .addPressed(code: "pasta-batman", name: "wayne", sendToBitwarden: true) + .addPressed(code: "pasta-batman", name: "wayne", sendToBitwarden: true), ) } @@ -120,7 +120,7 @@ class ManualEntryViewTests: BitwardenTestCase { @MainActor func test_scanCodeButton_tap() throws { let button = try subject.inspect().find( - button: Localizations.cannotAddAuthenticatorKey + " " + Localizations.scanQRCode + button: Localizations.cannotAddAuthenticatorKey + " " + Localizations.scanQRCode, ) try button.tap() waitFor(!processor.effects.isEmpty) @@ -134,7 +134,7 @@ class ManualEntryViewTests: BitwardenTestCase { func disabletest_snapshot_manualEntryView_empty() { assertSnapshot( of: ManualEntryView_Previews.empty, - as: .defaultPortrait + as: .defaultPortrait, ) } @@ -142,7 +142,7 @@ class ManualEntryViewTests: BitwardenTestCase { func disabletest_snapshot_manualEntryView_empty_landscape() { assertSnapshot( of: ManualEntryView_Previews.empty, - as: .defaultLandscape + as: .defaultLandscape, ) } @@ -150,7 +150,7 @@ class ManualEntryViewTests: BitwardenTestCase { func disabletest_snapshot_manualEntryView_text_dark() { assertSnapshot( of: ManualEntryView_Previews.textAdded, - as: .defaultPortraitDark + as: .defaultPortraitDark, ) } @@ -158,7 +158,7 @@ class ManualEntryViewTests: BitwardenTestCase { func disabletest_snapshot_manualEntryView_text_largeText() { assertSnapshot( of: ManualEntryView_Previews.textAdded, - as: .tallPortraitAX5(heightMultiple: 1.75) + as: .tallPortraitAX5(heightMultiple: 1.75), ) } @@ -166,7 +166,7 @@ class ManualEntryViewTests: BitwardenTestCase { func disabletest_snapshot_manualEntryView_text_light() { assertSnapshot( of: ManualEntryView_Previews.textAdded, - as: .defaultPortrait + as: .defaultPortrait, ) } @@ -175,7 +175,7 @@ class ManualEntryViewTests: BitwardenTestCase { func disabletest_snapshot_manualEntryView_text_dark_syncActive() { assertSnapshot( of: ManualEntryView_Previews.syncActiveNoDefault, - as: .defaultPortraitDark + as: .defaultPortraitDark, ) } @@ -184,7 +184,7 @@ class ManualEntryViewTests: BitwardenTestCase { func disabletest_snapshot_manualEntryView_text_largeText_syncActive() { assertSnapshot( of: ManualEntryView_Previews.syncActiveNoDefault, - as: .tallPortraitAX5(heightMultiple: 1.75) + as: .tallPortraitAX5(heightMultiple: 1.75), ) } @@ -193,7 +193,7 @@ class ManualEntryViewTests: BitwardenTestCase { func disabletest_snapshot_manualEntryView_text_light_syncActive() { assertSnapshot( of: ManualEntryView_Previews.syncActiveNoDefault, - as: .defaultPortrait + as: .defaultPortrait, ) } @@ -207,7 +207,7 @@ class ManualEntryViewTests: BitwardenTestCase { "\(name)-portrait": .defaultPortrait, "\(name)-portraitDark": .defaultPortraitDark, "\(name)-portraitAX5": .defaultPortraitAX5, - ] + ], ) } } diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeProcessor.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeProcessor.swift index 908eb04424..250ea49104 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeProcessor.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeProcessor.swift @@ -44,7 +44,7 @@ final class ScanCodeProcessor: StateProcessor, services: Services, - state: ScanCodeState + state: ScanCodeState, ) { self.coordinator = coordinator self.services = services diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeProcessorTests.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeProcessorTests.swift index c6ad6278bf..dbda4e541f 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeProcessorTests.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeProcessorTests.swift @@ -24,9 +24,9 @@ final class ScanCodeProcessorTests: BitwardenTestCase { coordinator: coordinator.asAnyCoordinator(), services: ServiceContainer.withMocks( cameraService: cameraService, - errorReporter: errorReporter + errorReporter: errorReporter, ), - state: ScanCodeState(showManualEntry: true) + state: ScanCodeState(showManualEntry: true), ) } diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeView.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeView.swift index f00f3c9ef7..e286b36dd4 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeView.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeView.swift @@ -69,7 +69,7 @@ struct ScanCodeView: View { .styleGuide(.body) .multilineTextAlignment(.center) .dynamicTypeSize(...maxDynamicTypeSize) - } + }, ) .buttonStyle(InlineButtonStyle()) } @@ -121,7 +121,7 @@ struct ScanCodeView: View { Rectangle() .frame( width: width, - height: height + height: height, ) .foregroundColor(.black) .opacity(0.5) @@ -137,7 +137,7 @@ struct ScanCodeView: View { .foregroundColor(Asset.Colors.primaryBitwardenLight.swiftUIColor) .frame( width: length * 0.65, - height: length * 0.65 + height: length * 0.65, ) } } @@ -150,9 +150,9 @@ struct ScanCodeView_Previews: PreviewProvider { cameraSession: AVCaptureSession(), store: Store( processor: StateProcessor( - state: ScanCodeState(showManualEntry: true) - ) - ) + state: ScanCodeState(showManualEntry: true), + ), + ), ) } .navigationViewStyle(.stack) diff --git a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeViewTests.swift b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeViewTests.swift index 49453b1972..6121f31dee 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeViewTests.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/AuthenticatorKeyCapture/ScanCodeViewTests.swift @@ -22,7 +22,7 @@ class ScanCodeViewTests: BitwardenTestCase { let store = Store(processor: processor) subject = ScanCodeView( cameraSession: .init(), - store: store + store: store, ) } @@ -53,7 +53,7 @@ class ScanCodeViewTests: BitwardenTestCase { .defaultPortrait, .defaultLandscape, .defaultPortraitAX5, - ] + ], ) } } diff --git a/AuthenticatorShared/UI/Vault/VaultItem/LoginTOTPState.swift b/AuthenticatorShared/UI/Vault/VaultItem/LoginTOTPState.swift index 89f89a6486..08021aec4c 100644 --- a/AuthenticatorShared/UI/Vault/VaultItem/LoginTOTPState.swift +++ b/AuthenticatorShared/UI/Vault/VaultItem/LoginTOTPState.swift @@ -21,10 +21,10 @@ public enum LoginTOTPState: Equatable, Sendable { switch self { case let .codeKeyPair(_, key), let .key(key): - return key + key case .invalid, .none: - return nil + nil } } @@ -33,11 +33,11 @@ public enum LoginTOTPState: Equatable, Sendable { var codeModel: TOTPCodeModel? { switch self { case let .codeKeyPair(code, _): - return code + code case .invalid, .key, .none: - return nil + nil } } @@ -47,11 +47,11 @@ public enum LoginTOTPState: Equatable, Sendable { switch self { case let .codeKeyPair(_, key), let .key(key): - return key.rawAuthenticatorKey + key.rawAuthenticatorKey case let .invalid(rawInvalidKey): - return rawInvalidKey + rawInvalidKey case .none: - return nil + nil } } @@ -63,7 +63,7 @@ public enum LoginTOTPState: Equatable, Sendable { /// init( authKeyModel: TOTPKeyModel, - codeModel: TOTPCodeModel? = nil + codeModel: TOTPCodeModel? = nil, ) { if let code = codeModel { self = .codeKeyPair(code, key: authKeyModel) diff --git a/AuthenticatorShared/UI/Vault/Views/IconImageHelperTests.swift b/AuthenticatorShared/UI/Vault/Views/IconImageHelperTests.swift index d2bca0b710..fcfa44ac2d 100644 --- a/AuthenticatorShared/UI/Vault/Views/IconImageHelperTests.swift +++ b/AuthenticatorShared/UI/Vault/Views/IconImageHelperTests.swift @@ -12,7 +12,7 @@ final class IconImageHelperTests: BitwardenTestCase { func test_getIconImage_emptyURIs() { let loginView = BitwardenSdk.LoginView.fixture( - uris: [] + uris: [], ) let result = IconImageHelper.getIconImage(for: loginView, from: defaultURL) XCTAssertNil(result) @@ -28,7 +28,7 @@ final class IconImageHelperTests: BitwardenTestCase { let loginView = BitwardenSdk.LoginView.fixture( uris: [ .fixture(uri: "bitwarden.com", match: nil), - ] + ], ) let result = IconImageHelper.getIconImage(for: loginView, from: defaultURL) XCTAssertNotNil(result) @@ -42,7 +42,7 @@ final class IconImageHelperTests: BitwardenTestCase { .fixture(uri: "://peanuts", match: nil), .fixture(uri: "://peanuts.yum", match: nil), .fixture(uri: "bitwarden.com", match: nil), - ] + ], ) let result = IconImageHelper.getIconImage(for: loginView, from: defaultURL) XCTAssertNotNil(result) diff --git a/AuthenticatorShared/UI/Vault/Views/ItemListItemRow/ItemListItemRowView.swift b/AuthenticatorShared/UI/Vault/Views/ItemListItemRow/ItemListItemRowView.swift index c942788590..8157c30650 100644 --- a/AuthenticatorShared/UI/Vault/Views/ItemListItemRow/ItemListItemRowView.swift +++ b/AuthenticatorShared/UI/Vault/Views/ItemListItemRow/ItemListItemRowView.swift @@ -13,7 +13,7 @@ struct ItemListItemRowView: View { var store: Store< ItemListItemRowState, ItemListItemRowAction, - ItemListItemRowEffect + ItemListItemRowEffect, > /// The `TimeProvider` used to calculate TOTP expiration. @@ -25,7 +25,7 @@ struct ItemListItemRowView: View { decorativeImage( store.state.item, iconBaseURL: store.state.iconBaseURL, - showWebIcons: store.state.showWebIcons + showWebIcons: store.state.showWebIcons, ) .frame(width: 22, height: 22) .foregroundColor(Asset.Colors.textSecondary.swiftUIColor) @@ -37,7 +37,7 @@ struct ItemListItemRowView: View { totpCodeRow( name: store.state.item.name, accountName: store.state.item.accountName, - model: totpCodeModel + model: totpCodeModel, ) } else { EmptyView() @@ -105,7 +105,7 @@ struct ItemListItemRowView: View { TOTPCountdownTimerView( timeProvider: timeProvider, totpCode: model, - onExpiration: nil + onExpiration: nil, ) Text(model.displayCode) .styleGuide(.bodyMonospaced, weight: .regular, monoSpacedDigit: true) @@ -129,17 +129,17 @@ struct ItemListItemRowView: View { totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), hasDivider: true, - showWebIcons: true - ) - ) + showWebIcons: true, + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) } @@ -158,17 +158,17 @@ struct ItemListItemRowView: View { totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), hasDivider: true, - showWebIcons: true - ) - ) + showWebIcons: true, + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) } @@ -187,17 +187,17 @@ struct ItemListItemRowView: View { totpCode: TOTPCodeModel( code: "123456", codeGenerationDate: Date(), - period: 30 - ) - ) - ) + period: 30, + ), + ), + ), ), hasDivider: true, - showWebIcons: true - ) - ) + showWebIcons: true, + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) } @@ -212,16 +212,16 @@ struct ItemListItemRow_Previews: PreviewProvider { state: ItemListItemRowState( item: item, hasDivider: true, - showWebIcons: true - ) - ) + showWebIcons: true, + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) } } }.previewDisplayName( - "Digits without account" + "Digits without account", ) NavigationView { VStack(spacing: 4) { @@ -232,16 +232,16 @@ struct ItemListItemRow_Previews: PreviewProvider { state: ItemListItemRowState( item: item, hasDivider: true, - showWebIcons: true - ) - ) + showWebIcons: true, + ), + ), ), - timeProvider: PreviewTimeProvider() + timeProvider: PreviewTimeProvider(), ) } } }.previewDisplayName( - "Digits with account" + "Digits with account", ) } } diff --git a/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimer.swift b/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimer.swift index dee822d1fd..8ef02a50f6 100644 --- a/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimer.swift +++ b/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimer.swift @@ -43,7 +43,7 @@ class TOTPCountdownTimer: ObservableObject { private var durationFractionRemaining: CGFloat { let value = TOTPExpirationCalculator.timeRemaining( for: timeProvider.presentTime, - using: TimeInterval(period) + using: TimeInterval(period), ) / TimeInterval(period) return min(max(0.0, value), 1.0) } @@ -73,7 +73,7 @@ class TOTPCountdownTimer: ObservableObject { timeProvider: any TimeProvider, timerInterval: TimeInterval, totpCode: TOTPCodeModel, - onExpiration: (() -> Void)? + onExpiration: (() -> Void)?, ) { totpCodeMode = totpCode self.timeProvider = timeProvider @@ -84,7 +84,7 @@ class TOTPCountdownTimer: ObservableObject { repeats: true, block: { _ in self.updateCountdown() - } + }, ) } @@ -120,7 +120,7 @@ class TOTPCountdownTimer: ObservableObject { } if TOTPExpirationCalculator.hasCodeExpired( totpCodeMode, - timeProvider: timeProvider + timeProvider: timeProvider, ) { onExpiration?() timer?.invalidate() diff --git a/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimerTests.swift b/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimerTests.swift index f6b2c85e88..64a74a2729 100644 --- a/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimerTests.swift +++ b/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimerTests.swift @@ -18,9 +18,9 @@ final class TOTPCountdownTimerTests: BitwardenTestCase { totpCode: .init( code: "123456", codeGenerationDate: .distantPast, - period: 30 + period: 30, ), - onExpiration: {} + onExpiration: {}, ) } @@ -37,11 +37,11 @@ final class TOTPCountdownTimerTests: BitwardenTestCase { totpCode: .init( code: "123456", codeGenerationDate: .distantPast, - period: 3 + period: 3, ), onExpiration: { didExpire = true - } + }, ) waitFor(didExpire) XCTAssertTrue(didExpire) diff --git a/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimerView.swift b/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimerView.swift index 1ca51967cf..15ff9065c6 100644 --- a/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimerView.swift +++ b/AuthenticatorShared/UI/Vault/Views/TOTPCountdownTimerView.swift @@ -38,9 +38,9 @@ struct TOTPCountdownTimerView: View { .foregroundColor(timer.timerColor()) .animation( .smooth( - duration: TOTPCountdownTimerView.timerInterval + duration: TOTPCountdownTimerView.timerInterval, ), - value: timer.remainingFraction + value: timer.remainingFraction, ) } } @@ -56,14 +56,14 @@ struct TOTPCountdownTimerView: View { init( timeProvider: any TimeProvider, totpCode: TOTPCodeModel, - onExpiration: (() -> Void)? + onExpiration: (() -> Void)?, ) { self.totpCode = totpCode timer = .init( timeProvider: timeProvider, timerInterval: TOTPCountdownTimerView.timerInterval, totpCode: totpCode, - onExpiration: onExpiration + onExpiration: onExpiration, ) } } diff --git a/Bitwarden/Application/AppDelegate.swift b/Bitwarden/Application/AppDelegate.swift index cfdc1732c4..707ecc014e 100644 --- a/Bitwarden/Application/AppDelegate.swift +++ b/Bitwarden/Application/AppDelegate.swift @@ -31,7 +31,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD func application( _: UIApplication, - didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil + didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil, ) -> Bool { // Exit early if testing to avoid running any app functionality. guard !isTesting else { return true } @@ -41,7 +41,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD let services = ServiceContainer.shared( application: UIApplication.shared, errorReporter: { ErrorReporterFactory.makeDefaultErrorReporter() }, - nfcReaderService: { DefaultNFCReaderService() } + nfcReaderService: { DefaultNFCReaderService() }, ) let appModule = DefaultAppModule(services: services) appProcessor = AppProcessor(appModule: appModule, services: services) @@ -60,7 +60,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD func application( _ application: UIApplication, - didReceiveRemoteNotification userInfo: [AnyHashable: Any] + didReceiveRemoteNotification userInfo: [AnyHashable: Any], ) async -> UIBackgroundFetchResult { await appProcessor?.messageReceived(userInfo) return .newData @@ -69,19 +69,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD /// Received a response to a push notification alert. func userNotificationCenter( _: UNUserNotificationCenter, - didReceive response: UNNotificationResponse + didReceive response: UNNotificationResponse, ) async { await appProcessor?.messageReceived( response.notification.request.content.userInfo, notificationDismissed: response.actionIdentifier == UNNotificationDismissActionIdentifier, - notificationTapped: response.actionIdentifier == UNNotificationDefaultActionIdentifier + notificationTapped: response.actionIdentifier == UNNotificationDefaultActionIdentifier, ) } /// Received a message in the foreground of the app. func userNotificationCenter( _: UNUserNotificationCenter, - willPresent notification: UNNotification + willPresent notification: UNNotification, ) async -> UNNotificationPresentationOptions { await appProcessor?.messageReceived(notification.request.content.userInfo) return .banner diff --git a/Bitwarden/Application/AppIntents/GeneratePassphraseIntent.swift b/Bitwarden/Application/AppIntents/GeneratePassphraseIntent.swift index 81ecf93c48..a2da3dd48d 100644 --- a/Bitwarden/Application/AppIntents/GeneratePassphraseIntent.swift +++ b/Bitwarden/Application/AppIntents/GeneratePassphraseIntent.swift @@ -15,26 +15,26 @@ struct GeneratePassphraseIntent: AppIntent { title: "Number of words", description: "The number of words to include in the passphrase.", inclusiveRange: (3, 20), - requestValueDialog: "Number of words must be between 3 and 20." + requestValueDialog: "Number of words must be between 3 and 20.", ) var numberOfWords: Int? @Parameter( title: "Capitalize", - description: "Whether to capitalize each word." + description: "Whether to capitalize each word.", ) var capitalize: Bool? @Parameter( title: "Include numbers", - description: "Whether to include numbers." + description: "Whether to include numbers.", ) var includeNumber: Bool? @MainActor func perform() async throws -> some IntentResult & ReturnsValue & ProvidesDialog { let services = ServiceContainer.shared( - errorReporter: { ErrorReporterFactory.makeDefaultErrorReporter() } + errorReporter: { ErrorReporterFactory.makeDefaultErrorReporter() }, ) let appIntentMediator = services.getAppIntentMediator() @@ -51,8 +51,8 @@ struct GeneratePassphraseIntent: AppIntent { numWords: UInt8(numberOfWords), wordSeparator: "-", capitalize: capitalize ?? true, - includeNumber: includeNumber ?? true - ) + includeNumber: includeNumber ?? true, + ), ) return .result(value: passphrase, dialog: "Passphrase: \(passphrase)") diff --git a/Bitwarden/Application/AppIntents/LockAllAccountsIntent.swift b/Bitwarden/Application/AppIntents/LockAllAccountsIntent.swift index f6b261e42c..82de0bcfca 100644 --- a/Bitwarden/Application/AppIntents/LockAllAccountsIntent.swift +++ b/Bitwarden/Application/AppIntents/LockAllAccountsIntent.swift @@ -14,7 +14,7 @@ struct LockAllAccountsIntent: AppIntent { func perform() async throws -> some IntentResult & ProvidesDialog { let errorReporter = ErrorReporterFactory.makeDefaultErrorReporter() let services = ServiceContainer.shared( - errorReporter: { errorReporter } + errorReporter: { errorReporter }, ) let appIntentMediator = services.getAppIntentMediator() diff --git a/Bitwarden/Application/AppIntents/LogoutAllAccountsIntent.swift b/Bitwarden/Application/AppIntents/LogoutAllAccountsIntent.swift index bf9d60d4e5..5d8abac2cd 100644 --- a/Bitwarden/Application/AppIntents/LogoutAllAccountsIntent.swift +++ b/Bitwarden/Application/AppIntents/LogoutAllAccountsIntent.swift @@ -14,7 +14,7 @@ struct LogoutAllAccountsIntent: AppIntent { func perform() async throws -> some IntentResult & ProvidesDialog { let errorReporter = ErrorReporterFactory.makeDefaultErrorReporter() let services = ServiceContainer.shared( - errorReporter: { errorReporter } + errorReporter: { errorReporter }, ) let appIntentMediator = services.getAppIntentMediator() diff --git a/Bitwarden/Application/AppIntents/OpenGeneratorIntent.swift b/Bitwarden/Application/AppIntents/OpenGeneratorIntent.swift index 6ec50092df..67e8f3ca1f 100644 --- a/Bitwarden/Application/AppIntents/OpenGeneratorIntent.swift +++ b/Bitwarden/Application/AppIntents/OpenGeneratorIntent.swift @@ -13,7 +13,7 @@ struct OpenGeneratorIntent: ForegroundContinuableIntent { @MainActor func perform() async throws -> some IntentResult { let services = ServiceContainer.shared( - errorReporter: { ErrorReporterFactory.makeDefaultErrorReporter() } + errorReporter: { ErrorReporterFactory.makeDefaultErrorReporter() }, ) let appIntentMediator = services.getAppIntentMediator() diff --git a/Bitwarden/Application/AppIntents/ShortcutsProvider.swift b/Bitwarden/Application/AppIntents/ShortcutsProvider.swift index 3e6adeb32e..401e67cbc4 100644 --- a/Bitwarden/Application/AppIntents/ShortcutsProvider.swift +++ b/Bitwarden/Application/AppIntents/ShortcutsProvider.swift @@ -21,7 +21,7 @@ struct ShortcutsProvider: AppShortcutsProvider { "Global lock for \(.applicationName)", ], shortTitle: "LockAllAccounts", - systemImageName: "lock.circle.dotted" + systemImageName: "lock.circle.dotted", ) AppShortcut( intent: LogoutAllAccountsIntent(), @@ -39,7 +39,7 @@ struct ShortcutsProvider: AppShortcutsProvider { "Exit every \(.applicationName) account", ], shortTitle: "LogOutAllAccounts", - systemImageName: "person.crop.circle.badge.xmark" + systemImageName: "person.crop.circle.badge.xmark", ) AppShortcut( intent: OpenGeneratorIntent(), @@ -57,7 +57,7 @@ struct ShortcutsProvider: AppShortcutsProvider { "Begin generating passwords with \(.applicationName)", ], shortTitle: "OpenPasswordGenerator", - systemImageName: "arrow.clockwise.square" + systemImageName: "arrow.clockwise.square", ) AppShortcut( intent: GeneratePassphraseIntent(), @@ -75,7 +75,7 @@ struct ShortcutsProvider: AppShortcutsProvider { "\(.applicationName), generate a strong passphrase", ], shortTitle: "GeneratePassphrase", - systemImageName: "arrow.clockwise" + systemImageName: "arrow.clockwise", ) } } diff --git a/Bitwarden/Application/SceneDelegate.swift b/Bitwarden/Application/SceneDelegate.swift index d5bae5508c..08a764b401 100644 --- a/Bitwarden/Application/SceneDelegate.swift +++ b/Bitwarden/Application/SceneDelegate.swift @@ -28,7 +28,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func scene( _ scene: UIScene, willConnectTo session: UISceneSession, - options connectionOptions: UIScene.ConnectionOptions + options connectionOptions: UIScene.ConnectionOptions, ) { guard let windowScene = scene as? UIWindowScene else { return } guard let appProcessor else { @@ -63,7 +63,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { appContext: .mainApp, navigator: rootViewController, splashWindow: splashWindow, - window: appWindow + window: appWindow, ) hideSplash() isStartingUp = false @@ -85,7 +85,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func scene( _ scene: UIScene, - continue userActivity: NSUserActivity + continue userActivity: NSUserActivity, ) { guard let appProcessor else { return @@ -135,7 +135,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { window.isHidden = false window.rootViewController = UIStoryboard( name: "LaunchScreen", - bundle: .main + bundle: .main, ).instantiateInitialViewController() window.windowLevel = UIWindow.Level.alert + 1 return window @@ -166,7 +166,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { private func addTapGestureRecognizer(to window: UIWindow) { let tapGesture = UITapGestureRecognizer( target: self, - action: #selector(handleTapGesture) + action: #selector(handleTapGesture), ) tapGesture.numberOfTapsRequired = 3 tapGesture.numberOfTouchesRequired = 1 @@ -185,7 +185,7 @@ extension SceneDelegate { /// - userActivity: The activity to handle. private func checkAndHandleCredentialExchangeActivity( appProcessor: AppProcessor, - userActivity: NSUserActivity + userActivity: NSUserActivity, ) async { guard userActivity.activityType == ASCredentialExchangeActivity, let token = userActivity.userInfo?[ASCredentialImportToken] as? UUID else { diff --git a/Bitwarden/Application/SceneDelegateTests.swift b/Bitwarden/Application/SceneDelegateTests.swift index 597e76f7e6..484bec23ff 100644 --- a/Bitwarden/Application/SceneDelegateTests.swift +++ b/Bitwarden/Application/SceneDelegateTests.swift @@ -33,7 +33,7 @@ class SceneDelegateTests: BitwardenTestCase { func test_sceneWillConnectTo_withWindowScene() throws { let appProcessor = AppProcessor( appModule: appModule, - services: ServiceContainer(errorReporter: MockErrorReporter()) + services: ServiceContainer(errorReporter: MockErrorReporter()), ) (UIApplication.shared.delegate as? TestingAppDelegate)?.appProcessor = appProcessor @@ -59,7 +59,7 @@ class SceneDelegateTests: BitwardenTestCase { func test_sceneWillConnectTo_withNonWindowScene() throws { let appProcessor = AppProcessor( appModule: appModule, - services: ServiceContainer(errorReporter: MockErrorReporter()) + services: ServiceContainer(errorReporter: MockErrorReporter()), ) (UIApplication.shared.delegate as? TestingAppDelegate)?.appProcessor = appProcessor @@ -82,7 +82,7 @@ class SceneDelegateTests: BitwardenTestCase { func test_sceneWillResignActive() { let appProcessor = AppProcessor( appModule: appModule, - services: ServiceContainer(errorReporter: MockErrorReporter()) + services: ServiceContainer(errorReporter: MockErrorReporter()), ) (UIApplication.shared.delegate as? TestingAppDelegate)?.appProcessor = appProcessor @@ -102,7 +102,7 @@ class SceneDelegateTests: BitwardenTestCase { func test_sceneContinue() { let appProcessor = AppProcessor( appModule: appModule, - services: ServiceContainer(errorReporter: MockErrorReporter()) + services: ServiceContainer(errorReporter: MockErrorReporter()), ) (UIApplication.shared.delegate as? TestingAppDelegate)?.appProcessor = appProcessor diff --git a/Bitwarden/Application/Services/DefaultNFCReaderServiceTests.swift b/Bitwarden/Application/Services/DefaultNFCReaderServiceTests.swift index b7151d7b43..e6f4d9af82 100644 --- a/Bitwarden/Application/Services/DefaultNFCReaderServiceTests.swift +++ b/Bitwarden/Application/Services/DefaultNFCReaderServiceTests.swift @@ -31,9 +31,9 @@ class DefaultNFCReaderServiceTests: BitwardenTestCase { let message = try XCTUnwrap(NFCNDEFMessage( records: [ XCTUnwrap(NFCNDEFPayload.wellKnownTypeURIPayload( - string: "my.yubico.com/yk/#ccccccjlkgjlevtdernkbbnrrvhcvdbljgchbgbdbvgk" + string: "my.yubico.com/yk/#ccccccjlkgjlevtdernkbbnrrvhcvdbljgchbgbdbvgk", )), - ] + ], )) subject.readerSession(session, didDetectNDEFs: [message]) diff --git a/BitwardenActionExtension/ActionViewController.swift b/BitwardenActionExtension/ActionViewController.swift index c5178c7c82..0ecdece4a0 100644 --- a/BitwardenActionExtension/ActionViewController.swift +++ b/BitwardenActionExtension/ActionViewController.swift @@ -36,7 +36,7 @@ class ActionViewController: UIViewController { private func completeRequest(itemData: [String: Any]) { let resultsProvider = NSItemProvider( item: itemData as NSSecureCoding, - typeIdentifier: UTType.propertyList.identifier + typeIdentifier: UTType.propertyList.identifier, ) let resultsItem = NSExtensionItem() resultsItem.attachments = [resultsProvider] @@ -63,7 +63,7 @@ class ActionViewController: UIViewController { appContext: .appExtension, initialRoute: initialRoute, navigator: self, - window: nil + window: nil, ) } } @@ -92,7 +92,7 @@ extension ActionViewController: AppExtensionDelegate { let itemData = actionExtensionHelper.itemDataToCompleteRequest( username: username, password: password, - fields: fields ?? [] + fields: fields ?? [], ) completeRequest(itemData: itemData) } diff --git a/BitwardenAutoFillExtension/CredentialProviderViewController.swift b/BitwardenAutoFillExtension/CredentialProviderViewController.swift index 82ef54530d..dd67df9a47 100644 --- a/BitwardenAutoFillExtension/CredentialProviderViewController.swift +++ b/BitwardenAutoFillExtension/CredentialProviderViewController.swift @@ -37,10 +37,10 @@ class CredentialProviderViewController: ASCredentialProviderViewController { @available(iOSApplicationExtension 17.0, *) override func prepareCredentialList( for serviceIdentifiers: [ASCredentialServiceIdentifier], - requestParameters: ASPasskeyCredentialRequestParameters + requestParameters: ASPasskeyCredentialRequestParameters, ) { initializeApp(with: DefaultCredentialProviderContext( - .autofillFido2VaultList(serviceIdentifiers, requestParameters) + .autofillFido2VaultList(serviceIdentifiers, requestParameters), )) } @@ -58,7 +58,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController { override func prepareInterfaceToProvideCredential(for credentialIdentity: ASPasswordCredentialIdentity) { initializeApp(with: DefaultCredentialProviderContext( - .autofillCredential(credentialIdentity, userInteraction: true) + .autofillCredential(credentialIdentity, userInteraction: true), )) } @@ -70,7 +70,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController { Task { await initializeAppWithoutUserInteraction( - with: DefaultCredentialProviderContext(.autofillCredential(credentialIdentity, userInteraction: false)) + with: DefaultCredentialProviderContext(.autofillCredential(credentialIdentity, userInteraction: false)), ) provideCredential(for: recordIdentifier) } @@ -87,8 +87,8 @@ class CredentialProviderViewController: ASCredentialProviderViewController { Task { await initializeAppWithoutUserInteraction( with: DefaultCredentialProviderContext( - .autofillFido2Credential(passkeyRequest, userInteraction: false) - ) + .autofillFido2Credential(passkeyRequest, userInteraction: false), + ), ) provideFido2Credential(for: passkeyRequest) } @@ -111,15 +111,15 @@ class CredentialProviderViewController: ASCredentialProviderViewController { case let passkeyRequest as ASPasskeyCredentialRequest: initializeApp( with: DefaultCredentialProviderContext( - .autofillFido2Credential(passkeyRequest, userInteraction: true) - ) + .autofillFido2Credential(passkeyRequest, userInteraction: true), + ), ) default: if #available(iOSApplicationExtension 18.0, *), let otpRequest = credentialRequest as? ASOneTimeCodeCredentialRequest, let otpIdentity = otpRequest.credentialIdentity as? ASOneTimeCodeCredentialIdentity { initializeApp(with: DefaultCredentialProviderContext( - .autofillOTPCredential(otpIdentity, userInteraction: true) + .autofillOTPCredential(otpIdentity, userInteraction: true), )) } } @@ -140,8 +140,8 @@ class CredentialProviderViewController: ASCredentialProviderViewController { extensionContext.cancelRequest( withError: NSError( domain: ASExtensionErrorDomain, - code: ASExtensionError.userCanceled.rawValue - ) + code: ASExtensionError.userCanceled.rawValue, + ), ) } } @@ -170,7 +170,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController { /// Sets up and initializes the app without user interaction. /// - Parameter context: The context that describes how the extension is being used. private func initializeAppWithoutUserInteraction( - with context: CredentialProviderContext + with context: CredentialProviderContext, ) async { initializeApp(with: context) await appProcessor?.prepareEnvironmentConfig() @@ -186,7 +186,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController { /// private func provideCredential( for id: String, - repromptPasswordValidated: Bool = false + repromptPasswordValidated: Bool = false, ) { guard let appProcessor else { cancel(error: ASExtensionError(.failed)) @@ -197,7 +197,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController { do { let credential = try await appProcessor.provideCredential( for: id, - repromptPasswordValidated: repromptPasswordValidated + repromptPasswordValidated: repromptPasswordValidated, ) extensionContext.completeRequest(withSelectedCredential: credential) } catch { @@ -213,7 +213,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController { /// - withUserInteraction: Whether this is called in a flow with user interaction. @available(iOSApplicationExtension 17.0, *) private func provideFido2Credential( - for passkeyRequest: ASPasskeyCredentialRequest + for passkeyRequest: ASPasskeyCredentialRequest, ) { guard let appProcessor else { cancel(error: ASExtensionError(.failed)) @@ -223,7 +223,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController { Task { do { let credential = try await appProcessor.provideFido2Credential( - for: passkeyRequest + for: passkeyRequest, ) await extensionContext.completeAssertionRequest(using: credential) } catch Fido2Error.userInteractionRequired { @@ -249,7 +249,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController { @available(iOSApplicationExtension 18.0, *) private func provideOTPCredential( for id: String, - repromptPasswordValidated: Bool = false + repromptPasswordValidated: Bool = false, ) { guard let appProcessor else { cancel(error: ASExtensionError(.failed)) @@ -260,7 +260,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController { do { let credential = try await appProcessor.provideOTPCredential( for: id, - repromptPasswordValidated: repromptPasswordValidated + repromptPasswordValidated: repromptPasswordValidated, ) await extensionContext.completeOneTimeCodeRequest(using: credential) } catch { @@ -279,7 +279,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController { Task { await initializeAppWithoutUserInteraction( - with: DefaultCredentialProviderContext(.autofillOTPCredential(otpIdentity, userInteraction: false)) + with: DefaultCredentialProviderContext(.autofillOTPCredential(otpIdentity, userInteraction: false)), ) provideOTPCredential(for: recordIdentifier) } @@ -379,11 +379,11 @@ extension CredentialProviderViewController: AppExtensionDelegate { Task { do { try await appProcessor.repromptForCredentialIfNecessary( - for: recordIdentifier + for: recordIdentifier, ) { repromptPasswordValidated in self.provideCredential( for: recordIdentifier, - repromptPasswordValidated: repromptPasswordValidated + repromptPasswordValidated: repromptPasswordValidated, ) } } catch { @@ -405,11 +405,11 @@ extension CredentialProviderViewController: AppExtensionDelegate { Task { do { try await appProcessor.repromptForCredentialIfNecessary( - for: recordIdentifier + for: recordIdentifier, ) { repromptPasswordValidated in self.provideOTPCredential( for: recordIdentifier, - repromptPasswordValidated: repromptPasswordValidated + repromptPasswordValidated: repromptPasswordValidated, ) } } catch { diff --git a/BitwardenKit/Core/Auth/Models/Response/ResponseValidationErrorModelTests.swift b/BitwardenKit/Core/Auth/Models/Response/ResponseValidationErrorModelTests.swift index 36175a0e4a..b6b332f2d5 100644 --- a/BitwardenKit/Core/Auth/Models/Response/ResponseValidationErrorModelTests.swift +++ b/BitwardenKit/Core/Auth/Models/Response/ResponseValidationErrorModelTests.swift @@ -14,7 +14,7 @@ class ResponseValidationErrorModelTests: BitwardenTestCase { let subject = ResponseValidationErrorModel( error: "invalid_input", errorDescription: "invalid_username", - errorModel: ErrorModel(message: "error message", object: "error") + errorModel: ErrorModel(message: "error message", object: "error"), ) XCTAssertEqual(subject.errorModel.message, "error message") } @@ -39,7 +39,7 @@ class ResponseValidationErrorModelTests: BitwardenTestCase { """ let subject = try ResponseValidationErrorModel.decoder.decode( ResponseValidationErrorModel.self, - from: XCTUnwrap(json.data(using: .utf8)) + from: XCTUnwrap(json.data(using: .utf8)), ) XCTAssertEqual( subject, @@ -48,9 +48,9 @@ class ResponseValidationErrorModelTests: BitwardenTestCase { errorDescription: nil, errorModel: ErrorModel( message: "Two-step token is invalid. Try again.", - object: "error" - ) - ) + object: "error", + ), + ), ) } } diff --git a/BitwardenKit/Core/Auth/Services/API/Account/Fixtures/APITestData+Account.swift b/BitwardenKit/Core/Auth/Services/API/Account/Fixtures/APITestData+Account.swift index eaaf0bb0fb..855d8b1b1b 100644 --- a/BitwardenKit/Core/Auth/Services/API/Account/Fixtures/APITestData+Account.swift +++ b/BitwardenKit/Core/Auth/Services/API/Account/Fixtures/APITestData+Account.swift @@ -6,7 +6,7 @@ public extension APITestData { /// Test data for an account revision date. static func accountRevisionDate( // swiftlint:disable:this type_contents_order - _ date: Date = Date(timeIntervalSince1970: 1_704_067_200) + _ date: Date = Date(timeIntervalSince1970: 1_704_067_200), ) -> APITestData { APITestData(data: Data(String(date.timeIntervalSince1970 * 1000).utf8)) } @@ -16,26 +16,26 @@ public extension APITestData { /// Test data of an invalid model state with no validation errors. static let createAccountNilValidationErrors = loadFromJsonBundle( resource: "CreateAccountNilValidationErrors", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) /// Test data with a validation error of "User verification failed." static let deleteAccountRequestFailure = loadFromJsonBundle( resource: "DeleteAccountRequestFailure", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) /// Test data with several leaked passwords. static let hibpLeakedPasswords = loadFromBundle( resource: "hibpLeakedPasswords", extension: "txt", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) /// Test data with an invalid username/password error. static let responseValidationError = loadFromJsonBundle( resource: "ResponseValidationError", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) // MARK: Pre-Login @@ -43,7 +43,7 @@ public extension APITestData { /// Test data for prelogin success. static let preLoginSuccess = loadFromJsonBundle( resource: "PreLoginSuccess", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) // MARK: Register Finish @@ -51,32 +51,32 @@ public extension APITestData { /// Test data with a validation error of "Email 'j@a.com' is already taken." static let registerFinishAccountAlreadyExists = loadFromJsonBundle( resource: "RegisterFinishAccountAlreadyExists", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) /// Test data with a validation error of /// "The field MasterPasswordHint must be a string with a maximum length of 50." static let registerFinishHintTooLong = loadFromJsonBundle( resource: "RegisterFinishHintTooLong", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) /// Test data with a validation error of "The Email field is not a supported e-mail address format." static let registerFinishInvalidEmailFormat = loadFromJsonBundle( resource: "RegisterFinishInvalidEmailFormat", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) /// Test data of a request to create an account for `example@email.com` static let registerFinishRequest = loadFromJsonBundle( resource: "RegisterFinishRequest", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) /// Test data of a successful account creation. static let registerFinishSuccess = loadFromJsonBundle( resource: "RegisterFinishSuccess", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) // MARK: Request Password Hint @@ -84,7 +84,7 @@ public extension APITestData { /// Test data for a failure for password hint. static let passwordHintFailure = loadFromJsonBundle( resource: "PasswordHintFailure", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) // MARK: Start Registration @@ -92,26 +92,26 @@ public extension APITestData { /// Test data with a validation error of "Email 'j@a.com' is already taken." static let startRegistrationEmailAlreadyExists = loadFromJsonBundle( resource: "StartRegistrationEmailAlreadyExists", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) /// Test data with a validation error of "The field Email must be a string with a maximum length of 256." static let startRegistrationEmailExceedsMaxLength = loadFromJsonBundle( resource: "StartRegistrationEmailExceedsMaxLength", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) /// Test data with a validation error of static let startRegistrationInvalidEmailFormat = loadFromJsonBundle( resource: "StartRegistrationInvalidEmailFormat", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) /// Test data for success with a registration start. static let startRegistrationSuccess = loadFromBundle( resource: "StartRegistrationSuccess", extension: "txt", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) // MARK: Verify Email Token @@ -119,6 +119,6 @@ public extension APITestData { /// Test data indicating that the verify email token link has expired. static let verifyEmailTokenExpiredLink = loadFromJsonBundle( resource: "VerifyEmailTokenExpiredLink", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) } diff --git a/BitwardenKit/Core/Platform/Extensions/Data.swift b/BitwardenKit/Core/Platform/Extensions/Data.swift index 719234a439..7934fc7e80 100644 --- a/BitwardenKit/Core/Platform/Extensions/Data.swift +++ b/BitwardenKit/Core/Platform/Extensions/Data.swift @@ -9,7 +9,7 @@ public extension Data { /// - Returns: The data as a hash value. /// func generatedHash( - using hashFunction: any HashFunction.Type + using hashFunction: any HashFunction.Type, ) -> String { let digest = hashFunction.hash(data: self) let hashString = digest @@ -26,7 +26,7 @@ public extension Data { /// @_optimize(none) // TODO: PM-25026 Remove when optimization for this is fixed on release config. func generatedHashBase64Encoded( - using hashFunction: any HashFunction.Type + using hashFunction: any HashFunction.Type, ) -> String { let digest = hashFunction.hash(data: self) return Data(digest).base64EncodedString() diff --git a/BitwardenKit/Core/Platform/Extensions/DataTests.swift b/BitwardenKit/Core/Platform/Extensions/DataTests.swift index 8154897ce3..d4a5fadb21 100644 --- a/BitwardenKit/Core/Platform/Extensions/DataTests.swift +++ b/BitwardenKit/Core/Platform/Extensions/DataTests.swift @@ -10,7 +10,7 @@ class DataTests: BitwardenTestCase { let subject = Data(repeating: 1, count: 32) XCTAssertEqual( subject.asHexString(), - "0101010101010101010101010101010101010101010101010101010101010101" + "0101010101010101010101010101010101010101010101010101010101010101", ) } } diff --git a/BitwardenKit/Core/Platform/Extensions/Date.swift b/BitwardenKit/Core/Platform/Extensions/Date.swift index c423de4724..46e9bdff86 100644 --- a/BitwardenKit/Core/Platform/Extensions/Date.swift +++ b/BitwardenKit/Core/Platform/Extensions/Date.swift @@ -25,7 +25,7 @@ public extension Date { minute: Int = 0, second: Int = 0, nanosecond: Int = 0, - timeZone: TimeZone = TimeZone(secondsFromGMT: 0)! + timeZone: TimeZone = TimeZone(secondsFromGMT: 0)!, ) { let calendar = Calendar(identifier: .gregorian) let dateComponents = DateComponents( @@ -37,7 +37,7 @@ public extension Date { hour: hour, minute: minute, second: second, - nanosecond: nanosecond + nanosecond: nanosecond, ) self = dateComponents.date! } diff --git a/BitwardenKit/Core/Platform/Extensions/NSManagedObjectContext+Extensions.swift b/BitwardenKit/Core/Platform/Extensions/NSManagedObjectContext+Extensions.swift index fbce447d31..1c302e304b 100644 --- a/BitwardenKit/Core/Platform/Extensions/NSManagedObjectContext+Extensions.swift +++ b/BitwardenKit/Core/Platform/Extensions/NSManagedObjectContext+Extensions.swift @@ -12,12 +12,12 @@ public extension NSManagedObjectContext { func executeAndMergeChanges( batchDeleteRequest: NSBatchDeleteRequest? = nil, batchInsertRequest: NSBatchInsertRequest? = nil, - additionalContexts: [NSManagedObjectContext] = [] + additionalContexts: [NSManagedObjectContext] = [], ) throws { try executeAndMergeChanges( batchDeleteRequests: batchDeleteRequest.map { [$0] } ?? [], batchInsertRequests: batchInsertRequest.map { [$0] } ?? [], - additionalContexts: additionalContexts + additionalContexts: additionalContexts, ) } @@ -32,7 +32,7 @@ public extension NSManagedObjectContext { func executeAndMergeChanges( batchDeleteRequests: [NSBatchDeleteRequest] = [], batchInsertRequests: [NSBatchInsertRequest] = [], - additionalContexts: [NSManagedObjectContext] = [] + additionalContexts: [NSManagedObjectContext] = [], ) throws { var changes: [AnyHashable: [NSManagedObjectID]] = [:] diff --git a/BitwardenKit/Core/Platform/Extensions/Publisher+Async.swift b/BitwardenKit/Core/Platform/Extensions/Publisher+Async.swift index 567699a398..4479514f08 100644 --- a/BitwardenKit/Core/Platform/Extensions/Publisher+Async.swift +++ b/BitwardenKit/Core/Platform/Extensions/Publisher+Async.swift @@ -10,10 +10,10 @@ public extension Publisher { /// func asyncCompactMap( maxPublishers: Subscribers.Demand = .max(1), - _ transform: @escaping (Output) async -> T? + _ transform: @escaping (Output) async -> T?, ) -> Publishers.CompactMap, Self>, T> { asyncMap(maxPublishers: maxPublishers, transform) - .compactMap { $0 } + .compactMap(\.self) } /// Maps the output of a publisher to a different type. @@ -25,7 +25,7 @@ public extension Publisher { /// func asyncMap( maxPublishers: Subscribers.Demand = .max(1), - _ transform: @escaping (Output) async -> T + _ transform: @escaping (Output) async -> T, ) -> Publishers.FlatMap, Self> { flatMap(maxPublishers: maxPublishers) { value in Future { promise in @@ -48,7 +48,7 @@ public extension Publisher where Failure == Error { /// func asyncTryMap( maxPublishers: Subscribers.Demand = .max(1), - _ transform: @escaping (Output) async throws -> T + _ transform: @escaping (Output) async throws -> T, ) -> Publishers.FlatMap, Self> { flatMap(maxPublishers: maxPublishers) { value in Future { diff --git a/BitwardenKit/Core/Platform/Extensions/Sequence+Async.swift b/BitwardenKit/Core/Platform/Extensions/Sequence+Async.swift index 015f7b8fc4..bdcea8416f 100644 --- a/BitwardenKit/Core/Platform/Extensions/Sequence+Async.swift +++ b/BitwardenKit/Core/Platform/Extensions/Sequence+Async.swift @@ -8,7 +8,7 @@ public extension Sequence { /// - operation: The closure to run on each element. /// func asyncForEach( - _ operation: (Element) async throws -> Void + _ operation: (Element) async throws -> Void, ) async rethrows { for element in self { try await operation(element) @@ -20,7 +20,7 @@ public extension Sequence { /// - Parameter transform: An asynchronous function mapping the sequence element. /// func asyncMap( - _ transform: (Element) async throws -> T + _ transform: (Element) async throws -> T, ) async rethrows -> [T] { var values = [T]() diff --git a/BitwardenKit/Core/Platform/Extensions/String.swift b/BitwardenKit/Core/Platform/Extensions/String.swift index dcc520d564..d899a88bee 100644 --- a/BitwardenKit/Core/Platform/Extensions/String.swift +++ b/BitwardenKit/Core/Platform/Extensions/String.swift @@ -75,11 +75,10 @@ public extension String { var isValidURL: Bool { guard rangeOfCharacter(from: .whitespaces) == nil else { return false } - let urlString: String - if starts(with: "https://") || starts(with: "http://") { - urlString = self + let urlString: String = if starts(with: "https://") || starts(with: "http://") { + self } else { - urlString = "https://" + self + "https://" + self } if #available(iOS 16, *) { @@ -134,9 +133,9 @@ public extension String { /// func leftPadding(toLength: Int, withPad character: Character) -> String { if count < toLength { - return String(repeatElement(character, count: toLength - count)) + self + String(repeatElement(character, count: toLength - count)) + self } else { - return String(suffix(toLength)) + String(suffix(toLength)) } } @@ -164,7 +163,7 @@ public extension String { .replacingOccurrences(of: "_", with: "/") .appending(String( repeating: "=", - count: remainder == 0 ? 0 : 4 - remainder + count: remainder == 0 ? 0 : 4 - remainder, )) } diff --git a/BitwardenKit/Core/Platform/Extensions/StringTests.swift b/BitwardenKit/Core/Platform/Extensions/StringTests.swift index 883b53203a..c53d5f1922 100644 --- a/BitwardenKit/Core/Platform/Extensions/StringTests.swift +++ b/BitwardenKit/Core/Platform/Extensions/StringTests.swift @@ -146,7 +146,6 @@ class StringTests: BitwardenTestCase { XCTAssertEqual(expected, subject.whitespaceRemoved()) } - /// `withoutAutomaticEmailLinks()` returns the string with email addresses appropriately modified. func test_withoutAutomaticEmailLinks() { let subject = "person@example.com" @@ -154,6 +153,4 @@ class StringTests: BitwardenTestCase { XCTAssertEqual(modified, "person\u{2060}@example.com") } - - } diff --git a/BitwardenKit/Core/Platform/Extensions/URLTests.swift b/BitwardenKit/Core/Platform/Extensions/URLTests.swift index b0fd0e87c2..223cf49382 100644 --- a/BitwardenKit/Core/Platform/Extensions/URLTests.swift +++ b/BitwardenKit/Core/Platform/Extensions/URLTests.swift @@ -21,19 +21,19 @@ class URLTests: BitwardenTestCase { func test_sanitized_missingScheme() { XCTAssertEqual( URL(string: "bitwarden.com")?.sanitized, - URL(string: "https://bitwarden.com") + URL(string: "https://bitwarden.com"), ) XCTAssertEqual( URL(string: "example.com")?.sanitized, - URL(string: "https://example.com") + URL(string: "https://example.com"), ) XCTAssertEqual( URL(string: "vault.bitwarden.com/#/vault")?.sanitized, - URL(string: "https://vault.bitwarden.com/#/vault") + URL(string: "https://vault.bitwarden.com/#/vault"), ) XCTAssertEqual( URL(string: "google.com/search?q=bitwarden")?.sanitized, - URL(string: "https://google.com/search?q=bitwarden") + URL(string: "https://google.com/search?q=bitwarden"), ) } @@ -41,11 +41,11 @@ class URLTests: BitwardenTestCase { func test_sanitized_trailingSlash() { XCTAssertEqual( URL(string: "https://bitwarden.com/")?.sanitized, - URL(string: "https://bitwarden.com") + URL(string: "https://bitwarden.com"), ) XCTAssertEqual( URL(string: "example.com/")?.sanitized, - URL(string: "https://example.com") + URL(string: "https://example.com"), ) } @@ -53,19 +53,19 @@ class URLTests: BitwardenTestCase { func test_sanitized_validURL() { XCTAssertEqual( URL(string: "https://bitwarden.com")?.sanitized, - URL(string: "https://bitwarden.com") + URL(string: "https://bitwarden.com"), ) XCTAssertEqual( URL(string: "http://bitwarden.com")?.sanitized, - URL(string: "http://bitwarden.com") + URL(string: "http://bitwarden.com"), ) XCTAssertEqual( URL(string: "https://vault.bitwarden.com/#/vault")?.sanitized, - URL(string: "https://vault.bitwarden.com/#/vault") + URL(string: "https://vault.bitwarden.com/#/vault"), ) XCTAssertEqual( URL(string: "https://google.com/search?q=bitwarden")?.sanitized, - URL(string: "https://google.com/search?q=bitwarden") + URL(string: "https://google.com/search?q=bitwarden"), ) } @@ -75,7 +75,7 @@ class URLTests: BitwardenTestCase { XCTAssertEqual(URL(string: "https://bitwarden.com/vault")?.withoutScheme, "bitwarden.com/vault") XCTAssertEqual( URL(string: "https://bitwarden.com/vault?q=https://bitwarden.com")?.withoutScheme, - "bitwarden.com/vault?q=https://bitwarden.com" + "bitwarden.com/vault?q=https://bitwarden.com", ) XCTAssertEqual(URL(string: "https://send.bitwarden.com/39ngaol3")?.withoutScheme, "send.bitwarden.com/39ngaol3") XCTAssertEqual(URL(string: "send.bitwarden.com/39ngaol3")?.withoutScheme, "send.bitwarden.com/39ngaol3") diff --git a/BitwardenKit/Core/Platform/Models/Data/ManagedObject.swift b/BitwardenKit/Core/Platform/Models/Data/ManagedObject.swift index 669e4115f6..e59954efa7 100644 --- a/BitwardenKit/Core/Platform/Models/Data/ManagedObject.swift +++ b/BitwardenKit/Core/Platform/Models/Data/ManagedObject.swift @@ -24,7 +24,7 @@ public extension ManagedObject where Self: NSManagedObject { /// static func batchInsertRequest( objects: [T], - handler: @escaping (Self, T) throws -> Void + handler: @escaping (Self, T) throws -> Void, ) throws -> NSBatchInsertRequest { var index = 0 var errorToThrow: Error? diff --git a/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLData.swift b/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLData.swift index 1d61839361..1ec672ee77 100644 --- a/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLData.swift +++ b/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLData.swift @@ -46,7 +46,7 @@ public struct EnvironmentURLData: Codable, Equatable, Hashable { icons: URL? = nil, identity: URL? = nil, notifications: URL? = nil, - webVault: URL? = nil + webVault: URL? = nil, ) { self.api = api self.base = base @@ -150,7 +150,7 @@ public extension EnvironmentURLData { icons: URL(string: "https://icons.bitwarden.net")!, identity: URL(string: "https://identity.bitwarden.com")!, notifications: URL(string: "https://notifications.bitwarden.com")!, - webVault: URL(string: "https://vault.bitwarden.com")! + webVault: URL(string: "https://vault.bitwarden.com")!, ) /// The default URLs for the EU region. @@ -161,6 +161,6 @@ public extension EnvironmentURLData { icons: URL(string: "https://icons.bitwarden.eu")!, identity: URL(string: "https://identity.bitwarden.eu")!, notifications: URL(string: "https://notifications.bitwarden.eu")!, - webVault: URL(string: "https://vault.bitwarden.eu")! + webVault: URL(string: "https://vault.bitwarden.eu")!, ) } diff --git a/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLDataTests.swift b/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLDataTests.swift index 61c35be943..afb5ca127e 100644 --- a/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLDataTests.swift +++ b/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLDataTests.swift @@ -21,7 +21,7 @@ class EnvironmentURLDataTests: XCTestCase { func test_changeEmailURL_webVaultURL() { let subject = EnvironmentURLData( base: URL(string: "https://vault.example.com"), - webVault: URL(string: "https://web.vault.example.com") + webVault: URL(string: "https://web.vault.example.com"), ) XCTAssertEqual(subject.changeEmailURL?.absoluteString, "https://web.vault.example.com/#/settings/account") } @@ -38,8 +38,8 @@ class EnvironmentURLDataTests: XCTestCase { icons: URL(string: "https://icons.bitwarden.net")!, identity: URL(string: "https://identity.bitwarden.com")!, notifications: URL(string: "https://notifications.bitwarden.com")!, - webVault: URL(string: "https://vault.bitwarden.com")! - ) + webVault: URL(string: "https://vault.bitwarden.com")!, + ), ) } @@ -55,8 +55,8 @@ class EnvironmentURLDataTests: XCTestCase { icons: URL(string: "https://icons.bitwarden.eu")!, identity: URL(string: "https://identity.bitwarden.eu")!, notifications: URL(string: "https://notifications.bitwarden.eu")!, - webVault: URL(string: "https://vault.bitwarden.eu")! - ) + webVault: URL(string: "https://vault.bitwarden.eu")!, + ), ) } @@ -76,7 +76,7 @@ class EnvironmentURLDataTests: XCTestCase { func test_importItemsURL_webVaultURL() { let subject = EnvironmentURLData( base: URL(string: "https://vault.example.com"), - webVault: URL(string: "https://web.vault.example.com") + webVault: URL(string: "https://web.vault.example.com"), ) XCTAssertEqual(subject.importItemsURL?.absoluteString, "https://web.vault.example.com/#/tools/import") } @@ -113,7 +113,7 @@ class EnvironmentURLDataTests: XCTestCase { func test_recoveryCodeURL_webVaultURL() { let subject = EnvironmentURLData( base: URL(string: "https://vault.example.com"), - webVault: URL(string: "https://web.vault.example.com") + webVault: URL(string: "https://web.vault.example.com"), ) XCTAssertEqual(subject.recoveryCodeURL?.absoluteString, "https://web.vault.example.com/#/recover-2fa") } @@ -164,7 +164,7 @@ class EnvironmentURLDataTests: XCTestCase { func test_sendShareURL_webVaultURL() { let subject = EnvironmentURLData( base: URL(string: "https://vault.example.com"), - webVault: URL(string: "https://web.vault.example.com") + webVault: URL(string: "https://web.vault.example.com"), ) XCTAssertEqual(subject.sendShareURL?.absoluteString, "https://web.vault.example.com/#/send") } @@ -185,7 +185,7 @@ class EnvironmentURLDataTests: XCTestCase { func test_settingsURL_webVaultURL() { let subject = EnvironmentURLData( base: URL(string: "https://vault.example.com"), - webVault: URL(string: "https://web.vault.example.com") + webVault: URL(string: "https://web.vault.example.com"), ) XCTAssertEqual(subject.settingsURL?.absoluteString, "https://web.vault.example.com/#/settings") } @@ -195,7 +195,7 @@ class EnvironmentURLDataTests: XCTestCase { let subject = EnvironmentURLData(base: URL(string: "https://vault.example.com")) XCTAssertEqual( subject.setUpTwoFactorURL?.absoluteString, - "https://vault.example.com/#/settings/security/two-factor" + "https://vault.example.com/#/settings/security/two-factor", ) } @@ -209,11 +209,11 @@ class EnvironmentURLDataTests: XCTestCase { func test_setUpTwoFactorURL_webVaultURL() { let subject = EnvironmentURLData( base: URL(string: "https://vault.example.com"), - webVault: URL(string: "https://web.vault.example.com") + webVault: URL(string: "https://web.vault.example.com"), ) XCTAssertEqual( subject.setUpTwoFactorURL?.absoluteString, - "https://web.vault.example.com/#/settings/security/two-factor" + "https://web.vault.example.com/#/settings/security/two-factor", ) } @@ -227,7 +227,7 @@ class EnvironmentURLDataTests: XCTestCase { func test_webVaultHost_webVaultURL() { let subject = EnvironmentURLData( base: URL(string: "https://vault.bitwarden.com"), - webVault: URL(string: "https://web.vault.bitwarden.com") + webVault: URL(string: "https://web.vault.bitwarden.com"), ) XCTAssertEqual(subject.webVaultHost, "web.vault.bitwarden.com") } diff --git a/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLs.swift b/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLs.swift index 9461af7caa..4a621c41d3 100644 --- a/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLs.swift +++ b/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLs.swift @@ -54,7 +54,7 @@ public struct EnvironmentURLs: Equatable { sendShareURL: URL, settingsURL: URL, setUpTwoFactorURL: URL, - webVaultURL: URL + webVaultURL: URL, ) { self.apiURL = apiURL self.baseURL = baseURL @@ -101,7 +101,7 @@ public extension EnvironmentURLs { } importItemsURL = environmentURLData.importItemsURL ?? URL(string: "https://vault.bitwarden.com/#/tools/import")! recoveryCodeURL = environmentURLData.recoveryCodeURL ?? URL( - string: "https://vault.bitwarden.com/#/recover-2fa" + string: "https://vault.bitwarden.com/#/recover-2fa", )! sendShareURL = environmentURLData.sendShareURL ?? URL(string: "https://send.bitwarden.com/#")! settingsURL = environmentURLData.settingsURL ?? webVaultURL diff --git a/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLsTests.swift b/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLsTests.swift index 3d8b28f3c9..38778f18a4 100644 --- a/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLsTests.swift +++ b/BitwardenKit/Core/Platform/Models/Domain/EnvironmentURLsTests.swift @@ -8,7 +8,7 @@ class EnvironmentURLsTests: BitwardenTestCase { /// `init(environmentURLData:)` sets the URLs from the passed data when such data is the default US. func test_init_environmentURLData_defaultUS() { let subject = EnvironmentURLs( - environmentURLData: EnvironmentURLData.defaultUS + environmentURLData: EnvironmentURLData.defaultUS, ) XCTAssertEqual( subject, @@ -24,15 +24,15 @@ class EnvironmentURLsTests: BitwardenTestCase { sendShareURL: URL(string: "https://send.bitwarden.com/#")!, settingsURL: URL(string: "https://vault.bitwarden.com/#/settings")!, setUpTwoFactorURL: URL(string: "https://vault.bitwarden.com/#/settings/security/two-factor")!, - webVaultURL: URL(string: "https://vault.bitwarden.com")! - ) + webVaultURL: URL(string: "https://vault.bitwarden.com")!, + ), ) } /// `init(environmentURLData:)` sets the URLs from the passed data when such data is the default EU. func test_init_environmentURLData_defaultEU() { let subject = EnvironmentURLs( - environmentURLData: EnvironmentURLData.defaultEU + environmentURLData: EnvironmentURLData.defaultEU, ) XCTAssertEqual( subject, @@ -48,8 +48,8 @@ class EnvironmentURLsTests: BitwardenTestCase { sendShareURL: URL(string: "https://vault.bitwarden.eu/#/send")!, settingsURL: URL(string: "https://vault.bitwarden.eu/#/settings")!, setUpTwoFactorURL: URL(string: "https://vault.bitwarden.eu/#/settings/security/two-factor")!, - webVaultURL: URL(string: "https://vault.bitwarden.eu")! - ) + webVaultURL: URL(string: "https://vault.bitwarden.eu")!, + ), ) } @@ -57,7 +57,7 @@ class EnvironmentURLsTests: BitwardenTestCase { /// `.unitedStates` nor `.europe` region type. func test_init_environmentURLData_baseURL() { let subject = EnvironmentURLs( - environmentURLData: EnvironmentURLData(base: URL(string: "https://example.com")!) + environmentURLData: EnvironmentURLData(base: URL(string: "https://example.com")!), ) XCTAssertEqual( subject, @@ -73,15 +73,15 @@ class EnvironmentURLsTests: BitwardenTestCase { sendShareURL: URL(string: "https://example.com/#/send")!, settingsURL: URL(string: "https://example.com/#/settings")!, setUpTwoFactorURL: URL(string: "https://example.com/#/settings/security/two-factor")!, - webVaultURL: URL(string: "https://example.com")! - ) + webVaultURL: URL(string: "https://example.com")!, + ), ) } /// `init(environmentURLData:)` defaults to the pre-defined EU URLs if the base URL matches the EU environment. func test_init_environmentURLData_baseURL_europe() { let subject = EnvironmentURLs( - environmentURLData: EnvironmentURLData(base: URL(string: "https://vault.bitwarden.eu")!) + environmentURLData: EnvironmentURLData(base: URL(string: "https://vault.bitwarden.eu")!), ) XCTAssertEqual( subject, @@ -97,15 +97,15 @@ class EnvironmentURLsTests: BitwardenTestCase { sendShareURL: URL(string: "https://vault.bitwarden.eu/#/send")!, settingsURL: URL(string: "https://vault.bitwarden.eu/#/settings")!, setUpTwoFactorURL: URL(string: "https://vault.bitwarden.eu/#/settings/security/two-factor")!, - webVaultURL: URL(string: "https://vault.bitwarden.eu")! - ) + webVaultURL: URL(string: "https://vault.bitwarden.eu")!, + ), ) } /// `init(environmentURLData:)` defaults to the pre-defined US URLs if the base URL matches the US environment. func test_init_environmentURLData_baseURL_unitedStates() { let subject = EnvironmentURLs( - environmentURLData: EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")!) + environmentURLData: EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")!), ) XCTAssertEqual( subject, @@ -121,15 +121,15 @@ class EnvironmentURLsTests: BitwardenTestCase { sendShareURL: URL(string: "https://send.bitwarden.com/#")!, settingsURL: URL(string: "https://vault.bitwarden.com/#/settings")!, setUpTwoFactorURL: URL(string: "https://vault.bitwarden.com/#/settings/security/two-factor")!, - webVaultURL: URL(string: "https://vault.bitwarden.com")! - ) + webVaultURL: URL(string: "https://vault.bitwarden.com")!, + ), ) } /// `init(environmentURLData:)` sets the URLs from the base URL which includes a trailing slash. func test_init_environmentURLData_baseURLWithTrailingSlash() { let subject = EnvironmentURLs( - environmentURLData: EnvironmentURLData(base: URL(string: "https://example.com/")!) + environmentURLData: EnvironmentURLData(base: URL(string: "https://example.com/")!), ) XCTAssertEqual( subject, @@ -145,8 +145,8 @@ class EnvironmentURLsTests: BitwardenTestCase { sendShareURL: URL(string: "https://example.com/#/send")!, settingsURL: URL(string: "https://example.com/#/settings")!, setUpTwoFactorURL: URL(string: "https://example.com/#/settings/security/two-factor")!, - webVaultURL: URL(string: "https://example.com/")! - ) + webVaultURL: URL(string: "https://example.com/")!, + ), ) } @@ -158,8 +158,8 @@ class EnvironmentURLsTests: BitwardenTestCase { events: URL(string: "https://events.example.com")!, icons: URL(string: "https://icons.example.com")!, identity: URL(string: "https://identity.example.com")!, - webVault: URL(string: "https://example.com")! - ) + webVault: URL(string: "https://example.com")!, + ), ) XCTAssertEqual( subject, @@ -175,8 +175,8 @@ class EnvironmentURLsTests: BitwardenTestCase { sendShareURL: URL(string: "https://example.com/#/send")!, settingsURL: URL(string: "https://example.com/#/settings")!, setUpTwoFactorURL: URL(string: "https://example.com/#/settings/security/two-factor")!, - webVaultURL: URL(string: "https://example.com")! - ) + webVaultURL: URL(string: "https://example.com")!, + ), ) } @@ -197,8 +197,8 @@ class EnvironmentURLsTests: BitwardenTestCase { sendShareURL: URL(string: "https://send.bitwarden.com/#")!, settingsURL: URL(string: "https://vault.bitwarden.com")!, setUpTwoFactorURL: URL(string: "https://vault.bitwarden.com")!, - webVaultURL: URL(string: "https://vault.bitwarden.com")! - ) + webVaultURL: URL(string: "https://vault.bitwarden.com")!, + ), ) } } diff --git a/BitwardenKit/Core/Platform/Models/Domain/FeatureFlag.swift b/BitwardenKit/Core/Platform/Models/Domain/FeatureFlag.swift index 762d8f56d1..1d815ac577 100644 --- a/BitwardenKit/Core/Platform/Models/Domain/FeatureFlag.swift +++ b/BitwardenKit/Core/Platform/Models/Domain/FeatureFlag.swift @@ -24,7 +24,7 @@ public struct FeatureFlag: Codable, Equatable, Sendable { /// - initialValue: The initial value of the feature flag (if any). public init( rawValue: String, - initialValue: AnyCodable? = nil + initialValue: AnyCodable? = nil, ) { self.initialValue = initialValue self.rawValue = rawValue diff --git a/BitwardenKit/Core/Platform/Models/Domain/Mocks/TestFeatureFlags.swift b/BitwardenKit/Core/Platform/Models/Domain/Mocks/TestFeatureFlags.swift index afd10da094..39002b9e75 100644 --- a/BitwardenKit/Core/Platform/Models/Domain/Mocks/TestFeatureFlags.swift +++ b/BitwardenKit/Core/Platform/Models/Domain/Mocks/TestFeatureFlags.swift @@ -5,25 +5,25 @@ import BitwardenKit extension FeatureFlag: @retroactive CaseIterable { /// A test feature flag that has no initial value. public static let testFeatureFlag = FeatureFlag( - rawValue: "test-feature-flag" + rawValue: "test-feature-flag", ) /// A test feature flag that has an initial boolean value. public static let testInitialBoolFlag = FeatureFlag( rawValue: "test-initial-bool-flag", - initialValue: .bool(true) + initialValue: .bool(true), ) /// A test feature flag that has an initial integer value. public static let testInitialIntFlag = FeatureFlag( rawValue: "test-initial-int-flag", - initialValue: .int(42) + initialValue: .int(42), ) /// A test feature flag that has an initial string value. public static let testInitialStringFlag = FeatureFlag( rawValue: "test-initial-string-flag", - initialValue: .string("Test String") + initialValue: .string("Test String"), ) public static var allCases: [FeatureFlag] { diff --git a/BitwardenKit/Core/Platform/Services/API/Extensions/JSONDecoder+Bitwarden.swift b/BitwardenKit/Core/Platform/Services/API/Extensions/JSONDecoder+Bitwarden.swift index ffed364895..076ac699e9 100644 --- a/BitwardenKit/Core/Platform/Services/API/Extensions/JSONDecoder+Bitwarden.swift +++ b/BitwardenKit/Core/Platform/Services/API/Extensions/JSONDecoder+Bitwarden.swift @@ -28,7 +28,7 @@ public extension JSONDecoder { } else { throw DecodingError.dataCorruptedError( in: container, - debugDescription: "Unable to decode date with value '\(stringValue)'" + debugDescription: "Unable to decode date with value '\(stringValue)'", ) } } diff --git a/BitwardenKit/Core/Platform/Services/API/Extensions/JSONDecoderBitwardenTests.swift b/BitwardenKit/Core/Platform/Services/API/Extensions/JSONDecoderBitwardenTests.swift index 006abafc26..16bd5edbaf 100644 --- a/BitwardenKit/Core/Platform/Services/API/Extensions/JSONDecoderBitwardenTests.swift +++ b/BitwardenKit/Core/Platform/Services/API/Extensions/JSONDecoderBitwardenTests.swift @@ -22,13 +22,13 @@ class JSONDecoderBitwardenTests: BitwardenTestCase { credentialId: "credential", date: Date(year: 2023, month: 10, day: 20, hour: 8, minute: 26, second: 54), otherKey: "other", - rpId: "rp" + rpId: "rp", ) XCTAssertEqual( try subject .decode(JSONBody.self, from: Data(toDecode.utf8)), - body + body, ) } @@ -66,13 +66,13 @@ class JSONDecoderBitwardenTests: BitwardenTestCase { "http://192.168.1.100:8080", "api.example.com/v1/endpoint", "https://secure.example.com/api/v2", - ]) + ]), ) XCTAssertEqual( try subject .decode(JSONBody.self, from: Data(toDecode.utf8)), - body + body, ) } @@ -83,12 +83,12 @@ class JSONDecoderBitwardenTests: BitwardenTestCase { XCTAssertEqual( try subject .decode(Date.self, from: Data(#""2023-08-18T21:33:31.6366667Z""#.utf8)), - Date(timeIntervalSince1970: 1_692_394_411.636) + Date(timeIntervalSince1970: 1_692_394_411.636), ) XCTAssertEqual( try subject .decode(Date.self, from: Data(#""2023-06-14T13:51:24.45Z""#.utf8)), - Date(timeIntervalSince1970: 1_686_750_684.450) + Date(timeIntervalSince1970: 1_686_750_684.450), ) } @@ -99,12 +99,12 @@ class JSONDecoderBitwardenTests: BitwardenTestCase { XCTAssertEqual( try subject .decode(Date.self, from: Data(#""2023-08-25T21:33:00Z""#.utf8)), - Date(timeIntervalSince1970: 1_692_999_180) + Date(timeIntervalSince1970: 1_692_999_180), ) XCTAssertEqual( try subject .decode(Date.self, from: Data(#""2023-07-12T15:46:12Z""#.utf8)), - Date(timeIntervalSince1970: 1_689_176_772) + Date(timeIntervalSince1970: 1_689_176_772), ) } @@ -116,12 +116,12 @@ class JSONDecoderBitwardenTests: BitwardenTestCase { func assertThrowsDataCorruptedError( dateString: String, file: StaticString = #filePath, - line: UInt = #line + line: UInt = #line, ) { XCTAssertThrowsError( try subject.decode(Date.self, from: Data(#""\#(dateString)""#.utf8)), file: file, - line: line + line: line, ) { error in XCTAssertTrue(error is DecodingError, file: file, line: line) guard case let .dataCorrupted(context) = error as? DecodingError else { @@ -131,7 +131,7 @@ class JSONDecoderBitwardenTests: BitwardenTestCase { context.debugDescription, "Unable to decode date with value '\(dateString)'", file: file, - line: line + line: line, ) } } diff --git a/BitwardenKit/Core/Platform/Services/API/Extensions/JSONEncoderBitwardenTests.swift b/BitwardenKit/Core/Platform/Services/API/Extensions/JSONEncoderBitwardenTests.swift index 4cbedaeda7..83dceffb4c 100644 --- a/BitwardenKit/Core/Platform/Services/API/Extensions/JSONEncoderBitwardenTests.swift +++ b/BitwardenKit/Core/Platform/Services/API/Extensions/JSONEncoderBitwardenTests.swift @@ -22,13 +22,13 @@ class JSONEncoderBitwardenTests: BitwardenTestCase { credentialId: "credential", date: Date(year: 2023, month: 10, day: 20, hour: 8, minute: 26, second: 54), otherKey: "other", - rpId: "rp" + rpId: "rp", ) let encodedData = try subject.encode(body) let encodedString = String(data: encodedData, encoding: .utf8) XCTAssertEqual( encodedString, - #"{"credentialId":"credential","date":1697790414,"otherKey":"other","rpId":"rp"}"# + #"{"credentialId":"credential","date":1697790414,"otherKey":"other","rpId":"rp"}"#, ) } @@ -43,7 +43,7 @@ class JSONEncoderBitwardenTests: BitwardenTestCase { let encodedData = try subject.encode(JSONBody(date: Date(year: 2023, month: 10, day: 31))) XCTAssertEqual( String(data: encodedData, encoding: .utf8), - #"{"date":"2023-10-31T00:00:00.000Z"}"# + #"{"date":"2023-10-31T00:00:00.000Z"}"#, ) } @@ -56,12 +56,12 @@ class JSONEncoderBitwardenTests: BitwardenTestCase { } let body = JSONBody( - date: Date(year: 2023, month: 10, day: 20, hour: 8, minute: 26, second: 54, nanosecond: 482_000_000) + date: Date(year: 2023, month: 10, day: 20, hour: 8, minute: 26, second: 54, nanosecond: 482_000_000), ) let encodedData = try subject.encode(body) XCTAssertEqual( String(data: encodedData, encoding: .utf8), - #"{"date":"2023-10-20T08:26:54.482Z"}"# + #"{"date":"2023-10-20T08:26:54.482Z"}"#, ) } } diff --git a/BitwardenKit/Core/Platform/Services/API/Fixtures/APITestData+Config.swift b/BitwardenKit/Core/Platform/Services/API/Fixtures/APITestData+Config.swift index 4bcba81680..db864c1b42 100644 --- a/BitwardenKit/Core/Platform/Services/API/Fixtures/APITestData+Config.swift +++ b/BitwardenKit/Core/Platform/Services/API/Fixtures/APITestData+Config.swift @@ -5,6 +5,6 @@ public extension APITestData { /// A valid server configuration to produce a `ConfigResponseModel`. static let validServerConfig = loadFromJsonBundle( resource: "ValidServerConfig", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) } diff --git a/BitwardenKit/Core/Platform/Services/API/Fixtures/APITestData+Error.swift b/BitwardenKit/Core/Platform/Services/API/Fixtures/APITestData+Error.swift index f56691dd25..e0ec5ed853 100644 --- a/BitwardenKit/Core/Platform/Services/API/Fixtures/APITestData+Error.swift +++ b/BitwardenKit/Core/Platform/Services/API/Fixtures/APITestData+Error.swift @@ -5,6 +5,6 @@ public extension APITestData { /// A standard Bitwarden error message of "You do not have permissions to edit this." static let bitwardenErrorMessage = loadFromJsonBundle( resource: "BitwardenErrorMessage", - bundle: BitwardenKitMocksBundleFinder.bundle + bundle: BitwardenKitMocksBundleFinder.bundle, ) } diff --git a/BitwardenKit/Core/Platform/Services/API/HTTPServiceBuilder.swift b/BitwardenKit/Core/Platform/Services/API/HTTPServiceBuilder.swift index 6d6ca48e25..955ef57d1a 100644 --- a/BitwardenKit/Core/Platform/Services/API/HTTPServiceBuilder.swift +++ b/BitwardenKit/Core/Platform/Services/API/HTTPServiceBuilder.swift @@ -32,7 +32,7 @@ public class HTTPServiceBuilder { public init( client: HTTPClient, defaultHeadersRequestHandler: DefaultHeadersRequestHandler, - loggers: [HTTPLogger] + loggers: [HTTPLogger], ) { self.client = client self.defaultHeadersRequestHandler = defaultHeadersRequestHandler @@ -51,7 +51,7 @@ public class HTTPServiceBuilder { /// public func makeService( baseURLGetter: @escaping @Sendable () -> URL, - tokenProvider: TokenProvider? = nil + tokenProvider: TokenProvider? = nil, ) -> HTTPService { HTTPService( baseURLGetter: baseURLGetter, @@ -59,7 +59,7 @@ public class HTTPServiceBuilder { loggers: loggers, requestHandlers: [defaultHeadersRequestHandler], responseHandlers: [responseValidationHandler], - tokenProvider: tokenProvider + tokenProvider: tokenProvider, ) } } diff --git a/BitwardenKit/Core/Platform/Services/API/Handlers/DefaultHeadersRequestHandler.swift b/BitwardenKit/Core/Platform/Services/API/Handlers/DefaultHeadersRequestHandler.swift index 41b748d286..51e6e1f90f 100644 --- a/BitwardenKit/Core/Platform/Services/API/Handlers/DefaultHeadersRequestHandler.swift +++ b/BitwardenKit/Core/Platform/Services/API/Handlers/DefaultHeadersRequestHandler.swift @@ -32,7 +32,7 @@ public final class DefaultHeadersRequestHandler: RequestHandler { appName: String, appVersion: String, buildNumber: String, - systemDevice: SystemDevice + systemDevice: SystemDevice, ) { self.appName = appName self.appVersion = appVersion diff --git a/BitwardenKit/Core/Platform/Services/API/Handlers/DefaultHeadersRequestHandlerTests.swift b/BitwardenKit/Core/Platform/Services/API/Handlers/DefaultHeadersRequestHandlerTests.swift index c769ba7b5a..c0a529c814 100644 --- a/BitwardenKit/Core/Platform/Services/API/Handlers/DefaultHeadersRequestHandlerTests.swift +++ b/BitwardenKit/Core/Platform/Services/API/Handlers/DefaultHeadersRequestHandlerTests.swift @@ -18,7 +18,7 @@ class DefaultHeadersRequestHandlerTests: BitwardenTestCase { appName: "Bitwarden", appVersion: "2023.8.0", buildNumber: "123", - systemDevice: MockSystemDevice() + systemDevice: MockSystemDevice(), ) } diff --git a/BitwardenKit/Core/Platform/Services/API/Response/ConfigResponseModel.swift b/BitwardenKit/Core/Platform/Services/API/Response/ConfigResponseModel.swift index 05666b7d72..74e9020456 100644 --- a/BitwardenKit/Core/Platform/Services/API/Response/ConfigResponseModel.swift +++ b/BitwardenKit/Core/Platform/Services/API/Response/ConfigResponseModel.swift @@ -31,7 +31,7 @@ public struct ConfigResponseModel: Equatable, JSONResponse { featureStates: [String: AnyCodable]?, gitHash: String?, server: ThirdPartyConfigResponseModel?, - version: String + version: String, ) { self.environment = environment self.featureStates = featureStates @@ -54,7 +54,7 @@ public struct ThirdPartyConfigResponseModel: Equatable, JSONResponse { /// A public version of the standard synthesized initializer. public init( name: String, - url: String + url: String, ) { self.name = name self.url = url @@ -90,7 +90,7 @@ public struct EnvironmentServerConfigResponseModel: Equatable, JSONResponse { identity: String?, notifications: String?, sso: String?, - vault: String? + vault: String?, ) { self.api = api self.cloudRegion = cloudRegion diff --git a/BitwardenKit/Core/Platform/Services/AppInfoService.swift b/BitwardenKit/Core/Platform/Services/AppInfoService.swift index 724cfe27d6..092a06aa02 100644 --- a/BitwardenKit/Core/Platform/Services/AppInfoService.swift +++ b/BitwardenKit/Core/Platform/Services/AppInfoService.swift @@ -83,7 +83,7 @@ public class DefaultAppInfoService: AppInfoService { appAdditionalInfo: AppAdditionalInfo = DefaultAppAdditionalInfo(), bundle: BundleProtocol = Bundle.main, systemDevice: SystemDevice = UIDevice.current, - timeProvider: TimeProvider = CurrentTime() + timeProvider: TimeProvider = CurrentTime(), ) { self.appAdditionalInfo = appAdditionalInfo self.bundle = bundle @@ -109,7 +109,7 @@ public extension DefaultAppInfoService { systemOSString, additionalInfoString, ] - .compactMap { $0 } + .compactMap(\.self) .joined(separator: "\n") } @@ -125,7 +125,7 @@ public extension DefaultAppInfoService { systemOSString, additionalInfoString, ] - .compactMap { $0 } + .compactMap(\.self) .joined(separator: "\n") } diff --git a/BitwardenKit/Core/Platform/Services/AppInfoServiceTests.swift b/BitwardenKit/Core/Platform/Services/AppInfoServiceTests.swift index 689a66d3f4..d193d449de 100644 --- a/BitwardenKit/Core/Platform/Services/AppInfoServiceTests.swift +++ b/BitwardenKit/Core/Platform/Services/AppInfoServiceTests.swift @@ -25,7 +25,7 @@ class AppInfoServiceTests: BitwardenTestCase { appAdditionalInfo: appAdditionalInfo, bundle: bundle, systemDevice: systemDevice, - timeProvider: timeProvider + timeProvider: timeProvider, ) } @@ -53,7 +53,7 @@ class AppInfoServiceTests: BitwardenTestCase { 📦 Bundle: com.8bit.bitwarden 📱 Device: iPhone14,2 🍏 System: iOS 16.4 - """ + """, ) } @@ -70,7 +70,7 @@ class AppInfoServiceTests: BitwardenTestCase { 📦 Bundle: Unknown 📱 Device: iPhone14,2 🍏 System: iOS 16.4 - """ + """, ) } @@ -95,7 +95,7 @@ class AppInfoServiceTests: BitwardenTestCase { 🧱 Commit: bitwarden/ios/main@abc123 💻 Build Source: bitwarden/ios/actions/runs/123/attempts/123 🛠️ Compiler Flags: DEBUG_MENU - """ + """, ) } @@ -120,7 +120,7 @@ class AppInfoServiceTests: BitwardenTestCase { 🍏 System: iOS 16.4 🧱 Commit: bitwarden/ios/main@abc123 💻 Build Source: bitwarden/ios/actions/runs/123/attempts/123 - """ + """, ) } @@ -142,7 +142,7 @@ class AppInfoServiceTests: BitwardenTestCase { 🧱 Commit: bitwarden/ios/main@abc123 💻 Build Source: bitwarden/ios/actions/runs/123/attempts/123 🛠️ Compiler Flags: DEBUG_MENU - """ + """, ) } diff --git a/BitwardenKit/Core/Platform/Services/ConfigService.swift b/BitwardenKit/Core/Platform/Services/ConfigService.swift index e823a23c8b..dfddb49db5 100644 --- a/BitwardenKit/Core/Platform/Services/ConfigService.swift +++ b/BitwardenKit/Core/Platform/Services/ConfigService.swift @@ -36,7 +36,7 @@ public protocol ConfigService { _ flag: FeatureFlag, defaultValue: Bool, forceRefresh: Bool, - isPreAuth: Bool + isPreAuth: Bool, ) async -> Bool /// Retrieves an integer feature flag. This will use the on-disk configuration if available, @@ -53,7 +53,7 @@ public protocol ConfigService { _ flag: FeatureFlag, defaultValue: Int, forceRefresh: Bool, - isPreAuth: Bool + isPreAuth: Bool, ) async -> Int /// Retrieves a string feature flag. This will use the on-disk configuration if available, @@ -70,7 +70,7 @@ public protocol ConfigService { _ flag: FeatureFlag, defaultValue: String?, forceRefresh: Bool, - isPreAuth: Bool + isPreAuth: Bool, ) async -> String? // MARK: Debug Feature Flags @@ -83,7 +83,7 @@ public protocol ConfigService { /// func toggleDebugFeatureFlag( name: String, - newValue: Bool? + newValue: Bool?, ) async /// Refreshes the list of debug feature flags by reloading their values from the settings store. @@ -194,7 +194,7 @@ public class DefaultConfigService: ConfigService { configApiService: ConfigAPIService, errorReporter: ErrorReporter, stateService: ConfigStateService, - timeProvider: TimeProvider + timeProvider: TimeProvider, ) { self.appSettingsStore = appSettingsStore self.configApiService = configApiService @@ -233,7 +233,7 @@ public class DefaultConfigService: ConfigService { _ flag: FeatureFlag, defaultValue: Bool = false, forceRefresh: Bool = false, - isPreAuth: Bool = false + isPreAuth: Bool = false, ) async -> Bool { #if DEBUG_MENU if let userDefaultValue = appSettingsStore.debugFeatureFlag(name: flag.rawValue) { @@ -251,7 +251,7 @@ public class DefaultConfigService: ConfigService { _ flag: FeatureFlag, defaultValue: Int = 0, forceRefresh: Bool = false, - isPreAuth: Bool = false + isPreAuth: Bool = false, ) async -> Int { let configuration = await getConfig(forceRefresh: forceRefresh, isPreAuth: isPreAuth) return configuration?.featureStates[flag.rawValue]?.intValue @@ -263,7 +263,7 @@ public class DefaultConfigService: ConfigService { _ flag: FeatureFlag, defaultValue: String? = nil, forceRefresh: Bool = false, - isPreAuth: Bool = false + isPreAuth: Bool = false, ) async -> String? { let configuration = await getConfig(forceRefresh: forceRefresh, isPreAuth: isPreAuth) return configuration?.featureStates[flag.rawValue]?.stringValue @@ -284,7 +284,7 @@ public class DefaultConfigService: ConfigService { return DebugMenuFeatureFlag( feature: feature, - isEnabled: userDefaultValue ?? remoteFlagValue + isEnabled: userDefaultValue ?? remoteFlagValue, ) } @@ -294,7 +294,7 @@ public class DefaultConfigService: ConfigService { public func toggleDebugFeatureFlag(name: String, newValue: Bool?) async { appSettingsStore.overrideDebugFeatureFlag( name: name, - value: newValue + value: newValue, ) } @@ -302,7 +302,7 @@ public class DefaultConfigService: ConfigService { for flag in flags { appSettingsStore.overrideDebugFeatureFlag( name: flag.rawValue, - value: nil + value: nil, ) } return await getDebugFeatureFlags(flags) @@ -350,7 +350,7 @@ public class DefaultConfigService: ConfigService { let configResponse = try await configApiService.getConfig() let serverConfig = ServerConfig( date: timeProvider.presentTime, - responseModel: configResponse + responseModel: configResponse, ) try? await setStateServerConfig(serverConfig, isPreAuth: isPreAuth, userId: userId) diff --git a/BitwardenKit/Core/Platform/Services/ConfigServiceTests.swift b/BitwardenKit/Core/Platform/Services/ConfigServiceTests.swift index 85a6111bc2..af97349f34 100644 --- a/BitwardenKit/Core/Platform/Services/ConfigServiceTests.swift +++ b/BitwardenKit/Core/Platform/Services/ConfigServiceTests.swift @@ -32,7 +32,7 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty configApiService: configApiService, errorReporter: errorReporter, stateService: stateService, - timeProvider: timeProvider + timeProvider: timeProvider, ) stateService.activeAccountId = "1" } @@ -59,8 +59,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238192", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) configApiService.clientResult = .httpSuccess(testData: .validServerConfig) let response = await subject.getConfig(forceRefresh: true, isPreAuth: false) @@ -79,8 +79,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238192", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) configApiService.clientResult = .failure(BitwardenTestError.example) let response = await subject.getConfig(forceRefresh: true, isPreAuth: false) @@ -99,8 +99,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238192", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) configApiService.clientResult = .httpSuccess(testData: .validServerConfig) let response = await subject.getConfig(forceRefresh: false, isPreAuth: false) @@ -125,8 +125,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238192", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) configApiService.clientResult = .failure(BitwardenTestError.example) let response = await subject.getConfig(forceRefresh: false, isPreAuth: false) @@ -148,8 +148,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238192", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) let response = await subject.getConfig(forceRefresh: false, isPreAuth: false) XCTAssertEqual(configApiService.clientRequestCount, 0) @@ -170,7 +170,7 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty XCTAssertEqual(stateService.serverConfig["1"]?.gitHash, "75238191") XCTAssertEqual( stateService.serverConfig["1"]?.featureStates[FeatureFlag.testFeatureFlag.rawValue], - .bool(true) + .bool(true), ) } @@ -185,8 +185,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238192", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) configApiService.clientResult = .failure(BitwardenTestError.example) let response = await subject.getConfig(forceRefresh: true, isPreAuth: false) @@ -220,8 +220,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238192", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) configApiService.clientResult = .httpSuccess(testData: .validServerConfig) let response = await subject.getConfig(forceRefresh: true, isPreAuth: true) @@ -243,8 +243,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238192", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) configApiService.clientResult = .httpSuccess(testData: .validServerConfig) let response = await subject.getConfig(forceRefresh: false, isPreAuth: true) @@ -270,8 +270,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238192", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) configApiService.clientResult = .failure(BitwardenTestError.example) let response = await subject.getConfig(forceRefresh: false, isPreAuth: true) @@ -294,8 +294,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238192", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) let response = await subject.getConfig(forceRefresh: false, isPreAuth: true) XCTAssertEqual(configApiService.clientRequestCount, 0) @@ -318,7 +318,7 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty XCTAssertEqual(stateService.preAuthServerConfig?.gitHash, "75238191") XCTAssertEqual( stateService.preAuthServerConfig?.featureStates[FeatureFlag.testFeatureFlag.rawValue], - .bool(true) + .bool(true), ) } @@ -329,7 +329,7 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty let value = await subject.getFeatureFlag( .testInitialBoolFlag, defaultValue: false, - forceRefresh: false + forceRefresh: false, ) XCTAssertTrue(value) } @@ -339,7 +339,7 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty let value = await subject.getFeatureFlag( .testInitialIntFlag, defaultValue: 10, - forceRefresh: false + forceRefresh: false, ) XCTAssertEqual(value, 42) } @@ -349,7 +349,7 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty let value = await subject.getFeatureFlag( .testInitialStringFlag, defaultValue: "Default", - forceRefresh: false + forceRefresh: false, ) XCTAssertEqual(value, "Test String") } @@ -365,8 +365,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: ["test-feature-flag": .bool(true)], gitHash: "75238191", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) let value = await subject.getFeatureFlag(.testFeatureFlag, defaultValue: false, forceRefresh: false) XCTAssertTrue(value) @@ -381,8 +381,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238191", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) let value = await subject.getFeatureFlag(.testFeatureFlag, defaultValue: true, forceRefresh: false) XCTAssertTrue(value) @@ -397,8 +397,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: ["test-feature-flag": .int(42)], gitHash: "75238191", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) let value = await subject.getFeatureFlag(.testFeatureFlag, defaultValue: 30, forceRefresh: false) XCTAssertEqual(value, 42) @@ -413,8 +413,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238191", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) let value = await subject.getFeatureFlag(.testFeatureFlag, defaultValue: 30, forceRefresh: false) XCTAssertEqual(value, 30) @@ -429,8 +429,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: ["test-feature-flag": .string("exists")], gitHash: "75238191", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) let value = await subject.getFeatureFlag(.testFeatureFlag, defaultValue: "fallback", forceRefresh: false) XCTAssertEqual(value, "exists") @@ -445,8 +445,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: [:], gitHash: "75238191", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) let value = await subject.getFeatureFlag(.testFeatureFlag, defaultValue: "fallback", forceRefresh: false) XCTAssertEqual(value, "fallback") @@ -461,8 +461,8 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty featureStates: ["test-feature-flag": .bool(true)], gitHash: "75238191", server: nil, - version: "2024.4.0" - ) + version: "2024.4.0", + ), ) appSettingsStore.overrideDebugFeatureFlag(name: "test-feature-flag", value: false) let flags = await subject.getDebugFeatureFlags(FeatureFlag.allCases) @@ -476,7 +476,7 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty func test_toggleDebugFeatureFlag() async throws { await subject.toggleDebugFeatureFlag( name: FeatureFlag.testFeatureFlag.rawValue, - newValue: true + newValue: true, ) let flags = await subject.getDebugFeatureFlags(FeatureFlag.allCases) XCTAssertTrue(appSettingsStore.overrideDebugFeatureFlagCalled) @@ -504,7 +504,7 @@ final class ConfigServiceTests: BitwardenTestCase { // swiftlint:disable:this ty userId: String?, gitHash: String?, file: StaticString = #file, - line: UInt = #line + line: UInt = #line, ) async throws { var publisher = try await subject.configPublisher().makeAsyncIterator() let result = try await publisher.next() diff --git a/BitwardenKit/Core/Platform/Services/Mocks/MockConfigService.swift b/BitwardenKit/Core/Platform/Services/Mocks/MockConfigService.swift index 17480fe57f..a31f66d095 100644 --- a/BitwardenKit/Core/Platform/Services/Mocks/MockConfigService.swift +++ b/BitwardenKit/Core/Platform/Services/Mocks/MockConfigService.swift @@ -37,7 +37,7 @@ public class MockConfigService: ConfigService { _ flag: FeatureFlag, defaultValue: Bool, forceRefresh: Bool, - isPreAuth: Bool + isPreAuth: Bool, ) async -> Bool { let value = isPreAuth ? featureFlagsBoolPreAuth[flag] : featureFlagsBool[flag] return value ?? defaultValue @@ -47,7 +47,7 @@ public class MockConfigService: ConfigService { _ flag: FeatureFlag, defaultValue: Int, forceRefresh: Bool, - isPreAuth: Bool + isPreAuth: Bool, ) async -> Int { let value = isPreAuth ? featureFlagsIntPreAuth[flag] : featureFlagsInt[flag] return value ?? defaultValue @@ -57,7 +57,7 @@ public class MockConfigService: ConfigService { _ flag: FeatureFlag, defaultValue: String?, forceRefresh: Bool, - isPreAuth: Bool + isPreAuth: Bool, ) async -> String? { let value = isPreAuth ? featureFlagsStringPreAuth[flag] : featureFlagsString[flag] return value ?? defaultValue @@ -75,7 +75,7 @@ public class MockConfigService: ConfigService { public func toggleDebugFeatureFlag( name: String, - newValue: Bool? + newValue: Bool?, ) async { toggleDebugFeatureFlagCalled = true } diff --git a/BitwardenKit/Core/Platform/Services/Mocks/MockTimeProvider.swift b/BitwardenKit/Core/Platform/Services/Mocks/MockTimeProvider.swift index 84d56c936c..97a5131539 100644 --- a/BitwardenKit/Core/Platform/Services/Mocks/MockTimeProvider.swift +++ b/BitwardenKit/Core/Platform/Services/Mocks/MockTimeProvider.swift @@ -9,9 +9,9 @@ public class MockTimeProvider: TimeProvider { var date: Date { switch self { case .currentTime: - return .now + .now case let .mockTime(fixedDate): - return fixedDate + fixedDate } } } diff --git a/BitwardenKit/Core/Platform/Utilities/AnyCodable.swift b/BitwardenKit/Core/Platform/Utilities/AnyCodable.swift index 8670db7fc1..e54ed8b201 100644 --- a/BitwardenKit/Core/Platform/Utilities/AnyCodable.swift +++ b/BitwardenKit/Core/Platform/Utilities/AnyCodable.swift @@ -37,7 +37,7 @@ public enum AnyCodable: Codable, Equatable, Sendable { } else { throw DecodingError.dataCorruptedError( in: container, - debugDescription: "Unable to decode AnyCodable value." + debugDescription: "Unable to decode AnyCodable value.", ) } } diff --git a/BitwardenKit/Core/Platform/Utilities/AnyCodableTests.swift b/BitwardenKit/Core/Platform/Utilities/AnyCodableTests.swift index 84fb3697bd..54edb6fdd8 100644 --- a/BitwardenKit/Core/Platform/Utilities/AnyCodableTests.swift +++ b/BitwardenKit/Core/Platform/Utilities/AnyCodableTests.swift @@ -46,7 +46,7 @@ class AnyCodableTests: BitwardenTestCase { "enforceOnLogin": AnyCodable.bool(false), "type": AnyCodable.string("password"), "minutes": AnyCodable.double(1.5), - ] + ], ) } @@ -105,7 +105,7 @@ class AnyCodableTests: BitwardenTestCase { "requireUpper" : false, "type" : "password" } - """ + """, ) } diff --git a/BitwardenKit/Core/Platform/Utilities/DomainName.swift b/BitwardenKit/Core/Platform/Utilities/DomainName.swift index 0453c451bc..79388c36b7 100644 --- a/BitwardenKit/Core/Platform/Utilities/DomainName.swift +++ b/BitwardenKit/Core/Platform/Utilities/DomainName.swift @@ -194,7 +194,7 @@ public class DomainName { return DomainNameResult( topLevelDomain: topLevelDomain, secondLevelDomain: String(secondLevelDomain ?? ""), - subDomain: String(subDomain) + subDomain: String(subDomain), ) } @@ -245,7 +245,7 @@ public class DomainName { return DataSet( exceptions: Set(exceptions), normals: Set(normals), - wildcards: Set(wildcards) + wildcards: Set(wildcards), ) } } diff --git a/BitwardenKit/Core/Platform/Utilities/DomainNameTests.swift b/BitwardenKit/Core/Platform/Utilities/DomainNameTests.swift index c08deeee04..49f5aea83e 100644 --- a/BitwardenKit/Core/Platform/Utilities/DomainNameTests.swift +++ b/BitwardenKit/Core/Platform/Utilities/DomainNameTests.swift @@ -23,8 +23,8 @@ class DomainNameTests: BitwardenTestCase { DomainName.DataSet( exceptions: Set(["city.kobe.jp"]), normals: Set(["com", "co.uk", "com.ai"]), - wildcards: Set(["compute.amazonaws.com"]) - ) + wildcards: Set(["compute.amazonaws.com"]), + ), ) } @@ -53,8 +53,8 @@ class DomainNameTests: BitwardenTestCase { DomainName.DataSet( exceptions: Set(["city.kobe.jp"]), normals: Set(["com", "co.uk", "com.ai"]), - wildcards: Set(["compute.amazonaws.com"]) - ) + wildcards: Set(["compute.amazonaws.com"]), + ), ) } @@ -66,11 +66,11 @@ class DomainNameTests: BitwardenTestCase { // Exception: !city.kobe.jp try XCTAssertEqual( DomainName.parseBaseDomain(url: XCTUnwrap(URL(string: "https://example.city.kobe.jp"))), - "example.city.kobe.jp" + "example.city.kobe.jp", ) try XCTAssertEqual( DomainName.parseBaseDomain(url: XCTUnwrap(URL(string: "https://sub.example.city.kobe.jp"))), - "example.city.kobe.jp" + "example.city.kobe.jp", ) } @@ -92,20 +92,20 @@ class DomainNameTests: BitwardenTestCase { try XCTAssertEqual( DomainName.parseBaseDomain(url: XCTUnwrap(URL(string: "https://example.com"))), - "example.com" + "example.com", ) try XCTAssertEqual( DomainName.parseBaseDomain(url: XCTUnwrap(URL(string: "https://sub.example.com"))), - "example.com" + "example.com", ) try XCTAssertEqual( DomainName.parseBaseDomain(url: XCTUnwrap(URL(string: "https://example.co.uk"))), - "example.co.uk" + "example.co.uk", ) try XCTAssertEqual( DomainName.parseBaseDomain(url: XCTUnwrap(URL(string: "https://sub.example.co.uk"))), - "example.co.uk" + "example.co.uk", ) } @@ -114,11 +114,11 @@ class DomainNameTests: BitwardenTestCase { // Wildcard: *.compute.amazonaws.com try XCTAssertEqual( DomainName.parseBaseDomain(url: XCTUnwrap(URL(string: "https://sub.example.compute.amazonaws.com"))), - "sub.example.compute.amazonaws.com" + "sub.example.compute.amazonaws.com", ) try XCTAssertEqual( DomainName.parseBaseDomain(url: XCTUnwrap(URL(string: "https://foo.sub.example.compute.amazonaws.com"))), - "sub.example.compute.amazonaws.com" + "sub.example.compute.amazonaws.com", ) } @@ -133,16 +133,16 @@ class DomainNameTests: BitwardenTestCase { DomainName.DomainNameResult( topLevelDomain: "city.kobe.jp", secondLevelDomain: "example", - subDomain: "" - ) + subDomain: "", + ), ) try XCTAssertEqual( DomainName.parseURL(XCTUnwrap(URL(string: "https://sub.example.city.kobe.jp"))), DomainName.DomainNameResult( topLevelDomain: "city.kobe.jp", secondLevelDomain: "example", - subDomain: "sub" - ) + subDomain: "sub", + ), ) try XCTAssertNil(DomainName.parseURL(XCTUnwrap(URL(string: "https://city.kobe.jp")))) @@ -158,16 +158,16 @@ class DomainNameTests: BitwardenTestCase { DomainName.DomainNameResult( topLevelDomain: "com", secondLevelDomain: "example", - subDomain: "" - ) + subDomain: "", + ), ) try XCTAssertEqual( DomainName.parseURL(XCTUnwrap(URL(string: "https://sub.example.com"))), DomainName.DomainNameResult( topLevelDomain: "com", secondLevelDomain: "example", - subDomain: "sub" - ) + subDomain: "sub", + ), ) try XCTAssertEqual( @@ -175,16 +175,16 @@ class DomainNameTests: BitwardenTestCase { DomainName.DomainNameResult( topLevelDomain: "co.uk", secondLevelDomain: "example", - subDomain: "" - ) + subDomain: "", + ), ) try XCTAssertEqual( DomainName.parseURL(XCTUnwrap(URL(string: "https://sub.example.co.uk"))), DomainName.DomainNameResult( topLevelDomain: "co.uk", secondLevelDomain: "example", - subDomain: "sub" - ) + subDomain: "sub", + ), ) } @@ -199,16 +199,16 @@ class DomainNameTests: BitwardenTestCase { DomainName.DomainNameResult( topLevelDomain: "example.compute.amazonaws.com", secondLevelDomain: "sub", - subDomain: "" - ) + subDomain: "", + ), ) try XCTAssertEqual( DomainName.parseURL(XCTUnwrap(URL(string: "https://foo.sub.example.compute.amazonaws.com"))), DomainName.DomainNameResult( topLevelDomain: "example.compute.amazonaws.com", secondLevelDomain: "sub", - subDomain: "foo" - ) + subDomain: "foo", + ), ) try XCTAssertNil(DomainName.parseURL(XCTUnwrap(URL(string: "https://compute.amazonaws.com")))) diff --git a/BitwardenKit/Core/Platform/Utilities/FetchedResultsPublisher.swift b/BitwardenKit/Core/Platform/Utilities/FetchedResultsPublisher.swift index d510bfdc2d..9c5d54a1c2 100644 --- a/BitwardenKit/Core/Platform/Utilities/FetchedResultsPublisher.swift +++ b/BitwardenKit/Core/Platform/Utilities/FetchedResultsPublisher.swift @@ -42,7 +42,7 @@ public class FetchedResultsPublisher: Publisher where ResultType: NS subscriber.receive(subscription: FetchedResultsSubscription( context: context, request: request, - subscriber: subscriber + subscriber: subscriber, )) } } @@ -84,13 +84,13 @@ private final class FetchedResultsSubscription: NSOb init( context: NSManagedObjectContext, request: NSFetchRequest, - subscriber: SubscriberType + subscriber: SubscriberType, ) { controller = NSFetchedResultsController( fetchRequest: request, managedObjectContext: context, sectionNameKeyPath: nil, - cacheName: nil + cacheName: nil, ) self.subscriber = subscriber diff --git a/BitwardenKit/Core/Platform/Utilities/Mocks/MockSystemDevice.swift b/BitwardenKit/Core/Platform/Utilities/Mocks/MockSystemDevice.swift index 17693ebedf..d82d6ed5fb 100644 --- a/BitwardenKit/Core/Platform/Utilities/Mocks/MockSystemDevice.swift +++ b/BitwardenKit/Core/Platform/Utilities/Mocks/MockSystemDevice.swift @@ -10,7 +10,7 @@ public class MockSystemDevice: SystemDevice { model: String = "iPhone", modelIdentifier: String = "iPhone14,2", systemName: String = "iOS", - systemVersion: String = "16.4" + systemVersion: String = "16.4", ) { self.model = model self.modelIdentifier = modelIdentifier diff --git a/BitwardenKit/Core/Platform/Utilities/URLFixingJSONDecoderTests.swift b/BitwardenKit/Core/Platform/Utilities/URLFixingJSONDecoderTests.swift index ee185aa07c..527e0b06b1 100644 --- a/BitwardenKit/Core/Platform/Utilities/URLFixingJSONDecoderTests.swift +++ b/BitwardenKit/Core/Platform/Utilities/URLFixingJSONDecoderTests.swift @@ -66,7 +66,7 @@ class URLFixingJSONDecoderTests: BitwardenTestCase { "http://10.0.0.2:4000/example", "api.example.com/v1/endpoint", "https://secure.example.com/api/v2", - ] + ], ) } diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ImageStyle.swift b/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ImageStyle.swift index 93788d1c88..6e36057aee 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ImageStyle.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ImageStyle.swift @@ -43,7 +43,7 @@ public extension ImageStyle { color: SharedAsset.Colors.buttonFilledForeground.swiftUIColor, scaleWithFont: false, width: 32, - height: 32 + height: 32, ) /// An `ImageStyle` for applying common properties for icons within a row. @@ -62,7 +62,7 @@ public extension ImageStyle { color: SharedAsset.Colors.iconSecondary.swiftUIColor, scaleWithFont: false, width: 24, - height: 24 + height: 24, ) /// An `ImageStyle` for applying common properties to a circular accessory icon. @@ -76,7 +76,7 @@ public extension ImageStyle { /// static func accessoryIcon16( color: Color = SharedAsset.Colors.iconPrimary.swiftUIColor, - scaleWithFont: Bool = false + scaleWithFont: Bool = false, ) -> ImageStyle { ImageStyle(color: color, scaleWithFont: scaleWithFont, width: 16, height: 16) } @@ -92,7 +92,7 @@ public extension ImageStyle { /// static func accessoryIcon24( color: Color = SharedAsset.Colors.iconPrimary.swiftUIColor, - scaleWithFont: Bool = false + scaleWithFont: Bool = false, ) -> ImageStyle { ImageStyle(color: color, scaleWithFont: scaleWithFont, width: 24, height: 24) } @@ -108,7 +108,7 @@ public extension ImageStyle { /// static func rowIcon( color: Color = SharedAsset.Colors.iconPrimary.swiftUIColor, - scaleWithFont: Bool = true + scaleWithFont: Bool = true, ) -> ImageStyle { ImageStyle(color: color, scaleWithFont: scaleWithFont, width: 24, height: 24) } @@ -126,7 +126,7 @@ public extension ImageStyle { static func viewIcon( color: Color = SharedAsset.Colors.illustrationOutline.swiftUIColor, scaleWithFont: Bool = true, - size: CGFloat = 36 + size: CGFloat = 36, ) -> ImageStyle { ImageStyle(color: color, scaleWithFont: scaleWithFont, width: size, height: size) } diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ReviewModifier.swift b/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ReviewModifier.swift index edf9936e28..fbc3f56ee1 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ReviewModifier.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ReviewModifier.swift @@ -54,8 +54,8 @@ public extension View { view.modifier( ReviewModifier( isEligible: isEligible, - afterClosure: afterClosure - ) + afterClosure: afterClosure, + ), ) } else { if let windowScene { @@ -63,8 +63,8 @@ public extension View { RequestReviewLegacyModifier( isEligible: isEligible, windowScene: windowScene, - afterClosure: afterClosure - ) + afterClosure: afterClosure, + ), ) } } diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ScaledFrame.swift b/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ScaledFrame.swift index df9af3937a..fb05ba509b 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ScaledFrame.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ScaledFrame.swift @@ -36,7 +36,7 @@ struct ScaledFrame: ViewModifier { /// init( width: CGFloat, - height: CGFloat + height: CGFloat, ) { self.width = width self.height = height diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ScrollViewModifier.swift b/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ScrollViewModifier.swift index 102adea8bd..805ffa1d5f 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ScrollViewModifier.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/ScrollViewModifier.swift @@ -69,14 +69,14 @@ public extension View { backgroundColor: Color = SharedAsset.Colors.backgroundPrimary.swiftUIColor, centerContentVertically: Bool = false, padding: CGFloat = 12, - showsIndicators: Bool = true + showsIndicators: Bool = true, ) -> some View { modifier(ScrollViewModifier( addVerticalPadding: addVerticalPadding, backgroundColor: backgroundColor, centerContentVertically: centerContentVertically, padding: padding, - showsIndicators: showsIndicators + showsIndicators: showsIndicators, )) } } diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/TextFieldConfiguration.swift b/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/TextFieldConfiguration.swift index 8bccb88143..ca4d260141 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/TextFieldConfiguration.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Modifiers/TextFieldConfiguration.swift @@ -27,7 +27,7 @@ public extension TextFieldConfiguration { isAutocorrectionDisabled: true, keyboardType: .emailAddress, textContentType: .emailAddress, - textInputAutocapitalization: .never + textInputAutocapitalization: .never, ) /// A `TextFieldConfiguration` for applying common properties to password text fields. @@ -35,7 +35,7 @@ public extension TextFieldConfiguration { isAutocorrectionDisabled: true, keyboardType: .default, textContentType: .password, - textInputAutocapitalization: .never + textInputAutocapitalization: .never, ) /// A `TextFieldConfiguration` for applying common properties to organization identifier text fields. @@ -43,7 +43,7 @@ public extension TextFieldConfiguration { isAutocorrectionDisabled: true, keyboardType: .asciiCapable, textContentType: nil, - textInputAutocapitalization: .never + textInputAutocapitalization: .never, ) /// A `TextFieldConfiguration` for applying common properties to URL text fields. @@ -51,7 +51,7 @@ public extension TextFieldConfiguration { isAutocorrectionDisabled: true, keyboardType: .URL, textContentType: .URL, - textInputAutocapitalization: .never + textInputAutocapitalization: .never, ) /// A `TextFieldConfiguration` for applying common properties to username text fields. @@ -59,7 +59,7 @@ public extension TextFieldConfiguration { isAutocorrectionDisabled: true, keyboardType: .emailAddress, textContentType: .username, - textInputAutocapitalization: .never + textInputAutocapitalization: .never, ) /// A `TextFieldConfiguration` for applying common properties to numeric text fields. @@ -68,7 +68,7 @@ public extension TextFieldConfiguration { isAutocorrectionDisabled: true, keyboardType: .numberPad, textContentType: textContentType, - textInputAutocapitalization: .never + textInputAutocapitalization: .never, ) } @@ -78,7 +78,7 @@ public extension TextFieldConfiguration { isAutocorrectionDisabled: true, keyboardType: keyboardType, textContentType: .oneTimeCode, - textInputAutocapitalization: .never + textInputAutocapitalization: .never, ) } } diff --git a/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFont.swift b/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFont.swift index 0e7973aa91..8b9702a44b 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFont.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFont.swift @@ -77,7 +77,7 @@ extension StyleGuideFont { font: font, lineHeight: lineHeight, size: size, - textStyle: textStyle + textStyle: textStyle, ) } } @@ -140,7 +140,7 @@ public extension StyleGuideFont { static let caption2Monospaced = StyleGuideFont( font: .system(.caption2, design: .monospaced), lineHeight: 13, - size: 11 + size: 11, ) } @@ -171,13 +171,13 @@ public extension View { func styleGuide( _ style: StyleGuideFont, includeLinePadding: Bool = true, - includeLineSpacing: Bool = true + includeLineSpacing: Bool = true, ) -> some View { font(.styleGuide(style)) .lineHeight( for: style, includeLinePadding: includeLinePadding, - includeLineSpacing: includeLineSpacing + includeLineSpacing: includeLineSpacing, ) } @@ -194,7 +194,7 @@ public extension View { func lineHeight( for style: StyleGuideFont, includeLinePadding: Bool, - includeLineSpacing: Bool + includeLineSpacing: Bool, ) -> some View { if includeLineSpacing { padding(.vertical, (style.lineHeight - style.size) / 2) @@ -230,7 +230,7 @@ public extension Text { isItalic: Bool = false, includeLinePadding: Bool = true, includeLineSpacing: Bool = true, - monoSpacedDigit: Bool = false + monoSpacedDigit: Bool = false, ) -> some View { var textWithFont = font(.styleGuide(style)) .fontWeight(weight) @@ -244,7 +244,7 @@ public extension Text { .lineHeight( for: style, includeLinePadding: includeLinePadding, - includeLineSpacing: includeLineSpacing + includeLineSpacing: includeLineSpacing, ) } } diff --git a/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFontTests.swift b/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFontTests.swift index cbfdb65c48..dff4428497 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFontTests.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFontTests.swift @@ -11,7 +11,7 @@ final class StyleGuideFontTests: BitwardenTestCase { for preview in StyleGuideFont_Previews._allPreviews { assertSnapshots( of: preview.content, - as: [.defaultPortrait] + as: [.defaultPortrait], ) } } @@ -21,7 +21,7 @@ final class StyleGuideFontTests: BitwardenTestCase { for preview in StyleGuideFont_Previews._allPreviews { assertSnapshots( of: preview.content, - as: [.defaultPortraitAX5] + as: [.defaultPortraitAX5], ) } } diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Styles/AccessoryButtonStyle.swift b/BitwardenKit/UI/Platform/Application/Appearance/Styles/AccessoryButtonStyle.swift index fbbb09e1f4..888ab62aae 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Styles/AccessoryButtonStyle.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Styles/AccessoryButtonStyle.swift @@ -15,7 +15,7 @@ public struct AccessoryButtonStyle: ButtonStyle { .foregroundColor( isEnabled ? SharedAsset.Colors.iconPrimary.swiftUIColor - : SharedAsset.Colors.buttonFilledDisabledForeground.swiftUIColor + : SharedAsset.Colors.buttonFilledDisabledForeground.swiftUIColor, ) .opacity(configuration.isPressed ? 0.5 : 1) .contentShape(Rectangle()) diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Styles/BitwardenToggleStyle.swift b/BitwardenKit/UI/Platform/Application/Appearance/Styles/BitwardenToggleStyle.swift index 92bfd7995c..69f0a6fa5d 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Styles/BitwardenToggleStyle.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Styles/BitwardenToggleStyle.swift @@ -15,7 +15,7 @@ public struct BitwardenToggleStyle: ToggleStyle { .foregroundColor( isEnabled ? SharedAsset.Colors.textPrimary.swiftUIColor - : SharedAsset.Colors.buttonFilledDisabledForeground.swiftUIColor + : SharedAsset.Colors.buttonFilledDisabledForeground.swiftUIColor, ) .tint(SharedAsset.Colors.iconSecondary.swiftUIColor) } diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Styles/CircleButtonStyle.swift b/BitwardenKit/UI/Platform/Application/Appearance/Styles/CircleButtonStyle.swift index e0297d742c..72b2dccf99 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Styles/CircleButtonStyle.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Styles/CircleButtonStyle.swift @@ -59,8 +59,8 @@ public struct CircleButtonStyle: ButtonStyle { color: SharedAsset.Colors.buttonFilledForeground.swiftUIColor, scaleWithFont: false, width: 32, - height: 32 - ) + height: 32, + ), ) } .buttonStyle(CircleButtonStyle(diameter: 50)) diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Styles/InlineButtonStyle.swift b/BitwardenKit/UI/Platform/Application/Appearance/Styles/InlineButtonStyle.swift index 7fc82ec659..ed384f3491 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Styles/InlineButtonStyle.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Styles/InlineButtonStyle.swift @@ -5,7 +5,6 @@ import SwiftUI /// The style for all inline buttons in this application. /// public struct InlineButtonStyle: ButtonStyle { - /// Public version of synthesized initializer. public init() {} diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Styles/PrimaryButtonStyle.swift b/BitwardenKit/UI/Platform/Application/Appearance/Styles/PrimaryButtonStyle.swift index 6b6973f7ed..8b5255c480 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Styles/PrimaryButtonStyle.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Styles/PrimaryButtonStyle.swift @@ -64,12 +64,12 @@ public extension ButtonStyle where Self == PrimaryButtonStyle { static func primary( isDestructive: Bool = false, shouldFillWidth: Bool = true, - size: ButtonStyleSize = .large + size: ButtonStyleSize = .large, ) -> PrimaryButtonStyle { PrimaryButtonStyle( isDestructive: isDestructive, size: size, - shouldFillWidth: shouldFillWidth + shouldFillWidth: shouldFillWidth, ) } } diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Styles/PrimaryMenuStyle.swift b/BitwardenKit/UI/Platform/Application/Appearance/Styles/PrimaryMenuStyle.swift index ad2975ce21..9707fce9fd 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Styles/PrimaryMenuStyle.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Styles/PrimaryMenuStyle.swift @@ -59,11 +59,11 @@ public extension MenuStyle where Self == PrimaryMenuStyle { /// static func primary( shouldFillWidth: Bool = true, - size: ButtonStyleSize = .large + size: ButtonStyleSize = .large, ) -> PrimaryMenuStyle { PrimaryMenuStyle( size: size, - shouldFillWidth: shouldFillWidth + shouldFillWidth: shouldFillWidth, ) } } diff --git a/BitwardenKit/UI/Platform/Application/Appearance/Styles/SecondaryButtonStyle.swift b/BitwardenKit/UI/Platform/Application/Appearance/Styles/SecondaryButtonStyle.swift index 8bf00e85ca..a41f914a55 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/Styles/SecondaryButtonStyle.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/Styles/SecondaryButtonStyle.swift @@ -86,13 +86,13 @@ public extension ButtonStyle where Self == SecondaryButtonStyle { isDestructive: Bool = false, isReversed: Bool = false, shouldFillWidth: Bool = true, - size: ButtonStyleSize = .large + size: ButtonStyleSize = .large, ) -> SecondaryButtonStyle { SecondaryButtonStyle( isDestructive: isDestructive, isReversed: isReversed, shouldFillWidth: shouldFillWidth, - size: size + size: size, ) } } diff --git a/BitwardenKit/UI/Platform/Application/Appearance/UI.swift b/BitwardenKit/UI/Platform/Application/Appearance/UI.swift index cd4a2f857e..4c95eabd7a 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/UI.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/UI.swift @@ -58,13 +58,13 @@ public enum UI { /// public static func applyDefaultAppearances() { // swiftlint:disable:this function_body_length let bodyFont = UIFontMetrics(forTextStyle: .body).scaledFont( - for: FontFamily.DMSans.regular.font(size: 15) + for: FontFamily.DMSans.regular.font(size: 15), ) let bodyBoldFont = UIFontMetrics(forTextStyle: .body).scaledFont( - for: FontFamily.DMSans.bold.font(size: 15) + for: FontFamily.DMSans.bold.font(size: 15), ) let largeTitleFont = UIFontMetrics(forTextStyle: .largeTitle).scaledFont( - for: FontFamily.DMSans.bold.font(size: 26) + for: FontFamily.DMSans.bold.font(size: 26), ) let iconBadgeBackground = SharedAsset.Colors.iconBadgeBackground.color let iconBadgeTextAttributes: [NSAttributedString.Key: Any] = [ @@ -124,7 +124,7 @@ public enum UI { UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).title = Localizations.cancel UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes( [.font: FontFamily.DMSans.regular.font(size: 15)], - for: .normal + for: .normal, ) UISearchBar.appearance().tintColor = SharedAsset.Colors.textInteraction.color diff --git a/BitwardenKit/UI/Platform/Application/Extensions/Color.swift b/BitwardenKit/UI/Platform/Application/Extensions/Color.swift index fc50b49edf..b1672d612d 100644 --- a/BitwardenKit/UI/Platform/Application/Extensions/Color.swift +++ b/BitwardenKit/UI/Platform/Application/Extensions/Color.swift @@ -17,7 +17,7 @@ public extension Color { self.init( red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0, green: CGFloat((rgb & 0x00FF00) >> 8) / 255.0, - blue: CGFloat(rgb & 0x0000FF) / 255.0 + blue: CGFloat(rgb & 0x0000FF) / 255.0, ) } else { self.init(red: 0, green: 0, blue: 0) diff --git a/BitwardenKit/UI/Platform/Application/Extensions/ModifiedContent+Conditionals.swift b/BitwardenKit/UI/Platform/Application/Extensions/ModifiedContent+Conditionals.swift index 47755eee44..2712855dda 100644 --- a/BitwardenKit/UI/Platform/Application/Extensions/ModifiedContent+Conditionals.swift +++ b/BitwardenKit/UI/Platform/Application/Extensions/ModifiedContent+Conditionals.swift @@ -14,12 +14,12 @@ extension ModifiedContent where Modifier == AccessibilityAttachmentModifier { func conditionalAccessibilityAction( if condition: Bool = true, named name: S, - _ handler: @escaping () -> Void + _ handler: @escaping () -> Void, ) -> ModifiedContent where S: StringProtocol { if condition { - return accessibilityAction(named: name, handler) + accessibilityAction(named: name, handler) } else { - return self + self } } @@ -36,16 +36,16 @@ extension ModifiedContent where Modifier == AccessibilityAttachmentModifier { func conditionalAccessibilityAsyncAction( if condition: Bool = true, named name: S, - _ asyncHandler: @escaping () async -> Void + _ asyncHandler: @escaping () async -> Void, ) -> ModifiedContent where S: StringProtocol { if condition { - return accessibilityAsyncAction( - named: name + accessibilityAsyncAction( + named: name, ) { await asyncHandler() } } else { - return self + self } } @@ -60,10 +60,10 @@ extension ModifiedContent where Modifier == AccessibilityAttachmentModifier { /// func accessibilityAsyncAction( named name: S, - _ asyncHandler: @escaping () async -> Void + _ asyncHandler: @escaping () async -> Void, ) -> ModifiedContent where S: StringProtocol { accessibilityAction( - named: name, { Task { await asyncHandler() } } + named: name, { Task { await asyncHandler() } }, ) } } diff --git a/BitwardenKit/UI/Platform/Application/Extensions/UIView.swift b/BitwardenKit/UI/Platform/Application/Extensions/UIView.swift index fc9584ec18..66e0464486 100644 --- a/BitwardenKit/UI/Platform/Application/Extensions/UIView.swift +++ b/BitwardenKit/UI/Platform/Application/Extensions/UIView.swift @@ -17,7 +17,7 @@ public extension UIView { top: CGFloat? = 0, leading: CGFloat? = 0, bottom: CGFloat? = 0, - trailing: CGFloat? = 0 + trailing: CGFloat? = 0, ) { subview.translatesAutoresizingMaskIntoConstraints = false addSubview(subview) diff --git a/BitwardenKit/UI/Platform/Application/Extensions/View+Conditionals.swift b/BitwardenKit/UI/Platform/Application/Extensions/View+Conditionals.swift index 15e65a28ff..53794121fd 100644 --- a/BitwardenKit/UI/Platform/Application/Extensions/View+Conditionals.swift +++ b/BitwardenKit/UI/Platform/Application/Extensions/View+Conditionals.swift @@ -15,7 +15,7 @@ public extension View { /// func accessibility( if condition: Bool = true, - addTraits traits: AccessibilityTraits + addTraits traits: AccessibilityTraits, ) -> some View { accessibility(addTraits: condition ? traits : []) } @@ -34,7 +34,7 @@ public extension View { func conditionalAccessibilityAction( if condition: Bool = true, named name: S, - _ handler: @escaping () -> Void + _ handler: @escaping () -> Void, ) -> some View where S: StringProtocol { if condition { accessibilityAction(named: name, handler) @@ -57,11 +57,11 @@ public extension View { func conditionalAccessibilityAsyncAction( if condition: Bool = true, named name: S, - _ asyncHandler: @escaping () async -> Void + _ asyncHandler: @escaping () async -> Void, ) -> some View where S: StringProtocol { if condition { accessibilityAsyncAction( - named: name + named: name, ) { await asyncHandler() } @@ -124,14 +124,14 @@ public extension View { minimumDuration: Double = 0.5, maximumDistance: CGFloat = 10, perform action: @escaping () -> Void, - onPressingChanged: ((Bool) -> Void)? = nil + onPressingChanged: ((Bool) -> Void)? = nil, ) -> some View { if condition { onLongPressGesture( minimumDuration: minimumDuration, maximumDistance: maximumDistance, perform: action, - onPressingChanged: onPressingChanged + onPressingChanged: onPressingChanged, ) } else { self @@ -160,14 +160,14 @@ public extension View { minimumDuration: Double = 0.5, maximumDistance: CGFloat = 10, perform asyncAction: @escaping () async -> Void, - onPressingChanged: ((Bool) -> Void)? = nil + onPressingChanged: ((Bool) -> Void)? = nil, ) -> some View { if condition { onLongPressGesture( minimumDuration: minimumDuration, maximumDistance: maximumDistance, perform: { Task { await asyncAction() } }, - onPressingChanged: onPressingChanged + onPressingChanged: onPressingChanged, ) } else { self diff --git a/BitwardenKit/UI/Platform/Application/Extensions/View+Gestures.swift b/BitwardenKit/UI/Platform/Application/Extensions/View+Gestures.swift index caf9ac945a..c69cbfa7be 100644 --- a/BitwardenKit/UI/Platform/Application/Extensions/View+Gestures.swift +++ b/BitwardenKit/UI/Platform/Application/Extensions/View+Gestures.swift @@ -36,7 +36,7 @@ public extension View { /// - asyncAction: The action to perform. func onTapGesture( count: Int = 1, - performAsync asyncAction: @escaping () async -> Void + performAsync asyncAction: @escaping () async -> Void, ) -> some View { onTapGesture( count: count, @@ -44,7 +44,7 @@ public extension View { Task { await asyncAction() } - } + }, ) } } diff --git a/BitwardenKit/UI/Platform/Application/Extensions/View.swift b/BitwardenKit/UI/Platform/Application/Extensions/View.swift index f4d4998fdf..2f44f884ca 100644 --- a/BitwardenKit/UI/Platform/Application/Extensions/View.swift +++ b/BitwardenKit/UI/Platform/Application/Extensions/View.swift @@ -23,10 +23,10 @@ public extension View { /// func accessibilityAsyncAction( named name: S, - _ asyncHandler: @escaping () async -> Void + _ asyncHandler: @escaping () async -> Void, ) -> some View where S: StringProtocol { accessibilityAction( - named: name, { Task { await asyncHandler() } } + named: name, { Task { await asyncHandler() } }, ) } } diff --git a/BitwardenKit/UI/Platform/Application/Utilities/PreviewTimeProvider.swift b/BitwardenKit/UI/Platform/Application/Utilities/PreviewTimeProvider.swift index 2e7de53f78..b6700ccf04 100644 --- a/BitwardenKit/UI/Platform/Application/Utilities/PreviewTimeProvider.swift +++ b/BitwardenKit/UI/Platform/Application/Utilities/PreviewTimeProvider.swift @@ -13,8 +13,8 @@ public class PreviewTimeProvider: TimeProvider { public init( fixedDate: Date = .init( - timeIntervalSinceReferenceDate: 1_695_000_011 - ) + timeIntervalSinceReferenceDate: 1_695_000_011, + ), ) { self.fixedDate = fixedDate } diff --git a/BitwardenKit/UI/Platform/Application/Views/AccessoryButton.swift b/BitwardenKit/UI/Platform/Application/Views/AccessoryButton.swift index e67216cd8e..36df2e92a7 100644 --- a/BitwardenKit/UI/Platform/Application/Views/AccessoryButton.swift +++ b/BitwardenKit/UI/Platform/Application/Views/AccessoryButton.swift @@ -63,10 +63,12 @@ public struct AccessoryButton: View { /// - accessibilityLabel: The accessibility label of the button. /// - action: The action to perform when the user triggers the button. /// - public init(asset: SharedImageAsset, - accessibilityLabel: String, - accessibilityIdentifier: String = "", - action: @escaping () -> Void) { + public init( + asset: SharedImageAsset, + accessibilityLabel: String, + accessibilityIdentifier: String = "", + action: @escaping () -> Void, + ) { self.accessibilityLabel = accessibilityLabel self.action = .sync(action) self.accessibilityIdentifier = accessibilityIdentifier @@ -82,10 +84,12 @@ public struct AccessoryButton: View { /// - accessibilityIdentifier: The accessibility identifier of the button. /// - action: The action to perform when the user triggers the button. /// - public init(asset: SharedImageAsset, - accessibilityLabel: String, - accessibilityIdentifier: String = "", - action: @escaping () async -> Void) { + public init( + asset: SharedImageAsset, + accessibilityLabel: String, + accessibilityIdentifier: String = "", + action: @escaping () async -> Void, + ) { self.accessibilityLabel = accessibilityLabel self.action = .async(action) self.accessibilityIdentifier = accessibilityIdentifier diff --git a/BitwardenKit/UI/Platform/Application/Views/AsyncButton.swift b/BitwardenKit/UI/Platform/Application/Views/AsyncButton.swift index a3e5c2a365..8329622d97 100644 --- a/BitwardenKit/UI/Platform/Application/Views/AsyncButton.swift +++ b/BitwardenKit/UI/Platform/Application/Views/AsyncButton.swift @@ -29,7 +29,7 @@ public struct AsyncButton