diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index c8e3a4817..c73084897 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -3,7 +3,7 @@ { "identity" : "compound-design-tokens", "kind" : "remoteSourceControl", - "location" : "https://github.com/element-hq/compound-design-tokens.git", + "location" : "https://github.com/element-hq/compound-design-tokens", "state" : { "revision" : "c3fff1f2b042295cd5f4bcf8d4fe68ec47ca4061", "version" : "1.2.0" @@ -191,7 +191,7 @@ { "identity" : "sfsafesymbols", "kind" : "remoteSourceControl", - "location" : "https://github.com/SFSafeSymbols/SFSafeSymbols.git", + "location" : "https://github.com/SFSafeSymbols/SFSafeSymbols", "state" : { "revision" : "7cca2d60925876b5953a2cf7341cd80fbeac983c", "version" : "4.1.1" diff --git a/ElementX/Sources/Other/UserAgentBuilder.swift b/ElementX/Sources/Other/UserAgentBuilder.swift index 637206fe4..09c56f30c 100644 --- a/ElementX/Sources/Other/UserAgentBuilder.swift +++ b/ElementX/Sources/Other/UserAgentBuilder.swift @@ -21,12 +21,12 @@ import UIKit import DeviceKit #endif -final class UserAgentBuilder { - class func makeASCIIUserAgent() -> String { +enum UserAgentBuilder { + static func makeASCIIUserAgent() -> String { makeUserAgent()?.asciified() ?? "unknown" } - private class func makeUserAgent() -> String? { + static func makeUserAgent() -> String? { let clientName = InfoPlistReader.app.bundleDisplayName let clientVersion = InfoPlistReader.app.bundleShortVersionString diff --git a/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift b/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift index 2c11217c8..c957c952c 100644 --- a/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift +++ b/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift @@ -502,7 +502,7 @@ class RoomScreenInteractionHandler { } guard let audioPlayerState = audioPlayerState(for: itemID) else { - fatalError("Audio player not found for \(itemID)") + fatalError("Audio player state not found for \(itemID)") } // Ensure this one is attached diff --git a/ElementX/Sources/UITests/UITestsAppCoordinator.swift b/ElementX/Sources/UITests/UITestsAppCoordinator.swift index cfe7b31ec..9397ecff1 100644 --- a/ElementX/Sources/UITests/UITestsAppCoordinator.swift +++ b/ElementX/Sources/UITests/UITestsAppCoordinator.swift @@ -160,7 +160,7 @@ class MockScreen: Identifiable { let context = LAContextMock() context.biometryTypeValue = UIDevice.current.isPhone ? .faceID : .touchID // (iPhone 14 & iPad 9th gen) context.evaluatePolicyReturnValue = true - context.evaluatedPolicyDomainStateValue = "😎".data(using: .utf8) + context.evaluatedPolicyDomainStateValue = Data("😎".utf8) let appLockService = AppLockService(keychainController: keychainController, appSettings: ServiceLocator.shared.settings, @@ -215,7 +215,7 @@ class MockScreen: Identifiable { let context = LAContextMock() context.biometryTypeValue = UIDevice.current.isPhone ? .faceID : .touchID // (iPhone 14 & iPad 9th gen) context.evaluatePolicyReturnValue = true - context.evaluatedPolicyDomainStateValue = "😎".data(using: .utf8) + context.evaluatedPolicyDomainStateValue = Data("😎".utf8) let appLockService = AppLockService(keychainController: keychainController, appSettings: ServiceLocator.shared.settings, diff --git a/UnitTests/Sources/AppLock/AppLockServiceTests.swift b/UnitTests/Sources/AppLock/AppLockServiceTests.swift index 7048bdcac..2084aad3d 100644 --- a/UnitTests/Sources/AppLock/AppLockServiceTests.swift +++ b/UnitTests/Sources/AppLock/AppLockServiceTests.swift @@ -185,7 +185,7 @@ class AppLockServiceTests: XCTestCase { // Given a service with the PIN code already set. let context = LAContextMock() context.biometryTypeValue = .touchID - context.evaluatedPolicyDomainStateValue = "👆".data(using: .utf8) + context.evaluatedPolicyDomainStateValue = Data("👆".utf8) service = AppLockService(keychainController: keychainController, appSettings: appSettings, context: context) guard case .success = service.setupPINCode("2023") else { XCTFail("The PIN should be valid.") @@ -217,7 +217,7 @@ class AppLockServiceTests: XCTestCase { // Given a service with the PIN code already set. let context = LAContextMock() context.biometryTypeValue = .touchID - context.evaluatedPolicyDomainStateValue = "👆".data(using: .utf8) + context.evaluatedPolicyDomainStateValue = Data("👆".utf8) service = AppLockService(keychainController: keychainController, appSettings: appSettings, context: context) let pinCode = "2023" guard case .success = service.setupPINCode(pinCode) else { @@ -234,7 +234,7 @@ class AppLockServiceTests: XCTestCase { XCTAssertTrue(service.biometricUnlockTrusted, "Biometric unlock should be trusted.") // When the user changes biometric data. - context.evaluatedPolicyDomainStateValue = "👈".data(using: .utf8) + context.evaluatedPolicyDomainStateValue = Data("👈".utf8) // Then biometric lock should remain enabled but untrusted. XCTAssertTrue(service.isEnabled, "The service should remain enabled.") @@ -256,7 +256,7 @@ class AppLockServiceTests: XCTestCase { // Given a service with the PIN code already set. let context = LAContextMock() context.biometryTypeValue = .touchID - context.evaluatedPolicyDomainStateValue = "👆".data(using: .utf8) + context.evaluatedPolicyDomainStateValue = Data("👆".utf8) service = AppLockService(keychainController: keychainController, appSettings: appSettings, context: context) guard case .success = service.setupPINCode("2023") else { XCTFail("The PIN should be valid.") @@ -285,7 +285,7 @@ class AppLockServiceTests: XCTestCase { // Given a service with the PIN code already set. let context = LAContextMock() context.biometryTypeValue = .touchID - context.evaluatedPolicyDomainStateValue = "👆".data(using: .utf8) + context.evaluatedPolicyDomainStateValue = Data("👆".utf8) service = AppLockService(keychainController: keychainController, appSettings: appSettings, context: context) guard case .success = service.setupPINCode("2023") else { XCTFail("The PIN should be valid.") diff --git a/UnitTests/Sources/KeychainControllerTests.swift b/UnitTests/Sources/KeychainControllerTests.swift index c5b4d34a8..c008579cf 100644 --- a/UnitTests/Sources/KeychainControllerTests.swift +++ b/UnitTests/Sources/KeychainControllerTests.swift @@ -170,7 +170,7 @@ class KeychainControllerTests: XCTestCase { XCTAssertNil(keychain.pinCodeBiometricState(), "A new keychain shouldn't return biometric state.") // When setting the state. - let data: Data! = "Face ID".data(using: .utf8) + let data = Data("Face ID".utf8) try keychain.setPINCodeBiometricState(data) // Then the state should be stored. @@ -180,13 +180,13 @@ class KeychainControllerTests: XCTestCase { func testUpdatePINCodeBiometricState() throws { // Given a keychain that contains PIN code biometric state. - let data: Data! = "😃".data(using: .utf8) + let data = Data("😃".utf8) try keychain.setPINCodeBiometricState(data) XCTAssertTrue(keychain.containsPINCodeBiometricState(), "The keychain should contain the biometric state.") XCTAssertEqual(keychain.pinCodeBiometricState(), data, "The stored biometric state should match what was set.") // When setting different state. - let newData: Data! = "😎".data(using: .utf8) + let newData = Data("😎".utf8) try keychain.setPINCodeBiometricState(newData) // Then the state should be updated. @@ -197,7 +197,7 @@ class KeychainControllerTests: XCTestCase { func testRemovePINCodeBiometricState() throws { // Given a keychain that contains PIN code biometric state. - let data: Data! = "Face ID".data(using: .utf8) + let data = Data("Face ID".utf8) try keychain.setPINCodeBiometricState(data) XCTAssertTrue(keychain.containsPINCodeBiometricState(), "The keychain should contain the biometric state.") XCTAssertEqual(keychain.pinCodeBiometricState(), data, "The stored biometric state should match what was set.") diff --git a/UnitTests/Sources/LoggingTests.swift b/UnitTests/Sources/LoggingTests.swift index e479c565c..31f1a0ccd 100644 --- a/UnitTests/Sources/LoggingTests.swift +++ b/UnitTests/Sources/LoggingTests.swift @@ -294,12 +294,7 @@ class LoggingTests: XCTestCase { let currentLogFile = logsFileDirectory.appending(path: "console.1.log") let fileHandle = try FileHandle(forWritingTo: currentLogFile) try fileHandle.seekToEnd() - guard let newLineData = "newline".data(using: .utf8) else { - XCTFail("Couldn't create data to write to disk.") - return - } - - try fileHandle.write(contentsOf: newLineData) + try fileHandle.write(contentsOf: Data("newline".utf8)) try fileHandle.close() // Then that file should now be the first log file.