mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Fix various small errors when running in the Swift 6 language mode (#4109)
* Fix various small errors when running in the Swift 6 language mode * Make the `TargetConfiguration` run on the main actor. * Fixed a comment * Add a comment as to why we can't make the whole NSE a main actor. * Fix the unit tests * Fix `blankLinesAtStartOfScope` swiftformat error.
This commit is contained in:
@@ -11,7 +11,7 @@ enum ExpiringTaskRunnerError: Error {
|
||||
case timeout
|
||||
}
|
||||
|
||||
actor ExpiringTaskRunner<T> {
|
||||
actor ExpiringTaskRunner<T: Sendable> {
|
||||
private var continuation: CheckedContinuation<T, Error>?
|
||||
|
||||
private var task: () async throws -> T
|
||||
|
||||
@@ -9,34 +9,34 @@ import Foundation
|
||||
|
||||
enum BlockquoteAttribute: AttributedStringKey {
|
||||
typealias Value = Bool
|
||||
static var name = "MXBlockquoteAttribute"
|
||||
static let name = "MXBlockquoteAttribute"
|
||||
}
|
||||
|
||||
enum UserIDAttribute: AttributedStringKey {
|
||||
typealias Value = String
|
||||
static var name = "MXUserIDAttribute"
|
||||
static let name = "MXUserIDAttribute"
|
||||
}
|
||||
|
||||
/// This attribute is used to help the composer convert a mention into to a markdown link before sending
|
||||
/// the message. It doesn't interact mention pills, as these fetch display names live from the room.
|
||||
enum UserDisplayNameAttribute: AttributedStringKey {
|
||||
typealias Value = String
|
||||
static var name = "MXUserDisplayNameAttribute"
|
||||
static let name = "MXUserDisplayNameAttribute"
|
||||
}
|
||||
|
||||
enum RoomDisplayNameAttribute: AttributedStringKey {
|
||||
typealias Value = String
|
||||
static var name = "MXRoomDisplayNameAttribute"
|
||||
static let name = "MXRoomDisplayNameAttribute"
|
||||
}
|
||||
|
||||
enum RoomIDAttribute: AttributedStringKey {
|
||||
typealias Value = String
|
||||
static var name = "MXRoomIDAttribute"
|
||||
static let name = "MXRoomIDAttribute"
|
||||
}
|
||||
|
||||
enum RoomAliasAttribute: AttributedStringKey {
|
||||
typealias Value = String
|
||||
static var name = "MXRoomAliasAttribute"
|
||||
static let name = "MXRoomAliasAttribute"
|
||||
}
|
||||
|
||||
enum EventOnRoomIDAttribute: AttributedStringKey {
|
||||
@@ -45,7 +45,7 @@ enum EventOnRoomIDAttribute: AttributedStringKey {
|
||||
let eventID: String
|
||||
}
|
||||
|
||||
static var name = "MXEventOnRoomIDAttribute"
|
||||
static let name = "MXEventOnRoomIDAttribute"
|
||||
}
|
||||
|
||||
enum EventOnRoomAliasAttribute: AttributedStringKey {
|
||||
@@ -54,12 +54,12 @@ enum EventOnRoomAliasAttribute: AttributedStringKey {
|
||||
let eventID: String
|
||||
}
|
||||
|
||||
static var name = "MXEventOnRoomAliasAttribute"
|
||||
static let name = "MXEventOnRoomAliasAttribute"
|
||||
}
|
||||
|
||||
enum AllUsersMentionAttribute: AttributedStringKey {
|
||||
typealias Value = Bool
|
||||
static var name = "MXAllUsersMentionAttribute"
|
||||
static let name = "MXAllUsersMentionAttribute"
|
||||
}
|
||||
|
||||
// periphery: ignore - required to make NSAttributedString to AttributedString conversion even if not used directly
|
||||
|
||||
@@ -9,13 +9,11 @@
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
/**
|
||||
Logging utility that provies multiple logging levels as well as file output and rolling.
|
||||
Its purpose is to provide a common entry for customizing logging and should be used throughout the code.
|
||||
*/
|
||||
/// Logging utility that provies multiple logging levels as well as file output and rolling.
|
||||
/// Its purpose is to provide a common entry for customizing logging and should be used throughout the code.
|
||||
enum MXLog {
|
||||
private static var rootSpan: Span!
|
||||
private static var currentTarget: String!
|
||||
private nonisolated(unsafe) static var rootSpan: Span!
|
||||
private nonisolated(unsafe) static var currentTarget: String!
|
||||
|
||||
static func configure(currentTarget: String) {
|
||||
self.currentTarget = currentTarget
|
||||
|
||||
@@ -32,12 +32,12 @@ enum MatrixEntityRegex: String {
|
||||
}
|
||||
|
||||
// swiftlint:disable force_try
|
||||
static var homeserverRegex = try! NSRegularExpression(pattern: MatrixEntityRegex.homeserver.rawValue, options: .caseInsensitive)
|
||||
static var userIdentifierRegex = try! NSRegularExpression(pattern: MatrixEntityRegex.userID.rawValue, options: .caseInsensitive)
|
||||
static var roomAliasRegex = try! NSRegularExpression(pattern: MatrixEntityRegex.roomAlias.rawValue, options: .caseInsensitive)
|
||||
static var uriRegex = try! NSRegularExpression(pattern: MatrixEntityRegex.uri.rawValue, options: .caseInsensitive)
|
||||
static var allUsersRegex = try! NSRegularExpression(pattern: MatrixEntityRegex.allUsers.rawValue)
|
||||
static var linkRegex = try! NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue)
|
||||
static let homeserverRegex = try! NSRegularExpression(pattern: MatrixEntityRegex.homeserver.rawValue, options: .caseInsensitive)
|
||||
static let userIdentifierRegex = try! NSRegularExpression(pattern: MatrixEntityRegex.userID.rawValue, options: .caseInsensitive)
|
||||
static let roomAliasRegex = try! NSRegularExpression(pattern: MatrixEntityRegex.roomAlias.rawValue, options: .caseInsensitive)
|
||||
static let uriRegex = try! NSRegularExpression(pattern: MatrixEntityRegex.uri.rawValue, options: .caseInsensitive)
|
||||
static let allUsersRegex = try! NSRegularExpression(pattern: MatrixEntityRegex.allUsers.rawValue)
|
||||
static let linkRegex = try! NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue)
|
||||
// swiftlint:enable force_try
|
||||
|
||||
static func isMatrixHomeserver(_ homeserver: String) -> Bool {
|
||||
|
||||
Reference in New Issue
Block a user