Fixes vector-im/element-x-ios/issues/117 - Event permalink timeline action

* moved NSRegularExpression outside of the AttributedString builder into the MatrixEntityRegex
* fixed eventId v3 regex
* added permalink builders for users, room identifiers and aliases, and events
* added timeline item permalink contextual menu actions and error alerts
* added an app wide ServiceLocator and moved the top level userIndicatorPresenter to it.
* added URL constructor that takes a StaticString and returns an non-optional
* Include Unit and UI tests in the swiftlint search paths
This commit is contained in:
Stefan Ceriu
2022-09-12 21:34:53 +03:00
committed by GitHub
parent 4006cc6b80
commit 4660f096f8
25 changed files with 414 additions and 103 deletions
@@ -34,8 +34,7 @@ class OIDCService {
private var metadata: OIDServiceConfiguration?
/// Redirect URI for the request. Must match the `client_uri` in reverse DNS format.
private let redirectURI = URL(string: "io.element:/callback")!
// swiftlint:disable:previous force_unwrapping
private var redirectURI = URL(staticString: "io.element:/callback")
/// Maintains a strong ref to the authorization session that's in progress.
private var session: OIDExternalUserAgentSession?
@@ -20,40 +20,29 @@ import MatrixRustSDK
import Sentry
import UIKit
enum BugReportServiceError: Error {
case invalidBaseUrlString
case invalidSentryEndpoint
}
class BugReportService: BugReportServiceProtocol {
private let baseURL: URL
private let sentryEndpoint: String
private let sentryURL: URL
private let applicationId: String
private let session: URLSession
private var lastCrashEventId: String?
init(withBaseUrlString baseUrlString: String,
sentryEndpoint: String,
init(withBaseURL baseURL: URL,
sentryURL: URL,
applicationId: String = BuildSettings.bugReportApplicationId,
session: URLSession = .shared) throws {
guard let url = URL(string: baseUrlString) else {
throw BugReportServiceError.invalidBaseUrlString
}
guard !sentryEndpoint.isEmpty else {
throw BugReportServiceError.invalidSentryEndpoint
}
baseURL = url
self.sentryEndpoint = sentryEndpoint
session: URLSession = .shared) {
self.baseURL = baseURL
self.sentryURL = sentryURL
self.applicationId = applicationId
self.session = session
// enable SentrySDK
SentrySDK.start { options in
#if DEBUG
options.enabled = false
#endif
options.dsn = sentryEndpoint
options.dsn = sentryURL.absoluteString
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
@@ -18,6 +18,8 @@ import Combine
import Foundation
class MockRoomTimelineController: RoomTimelineControllerProtocol {
let roomId = "MockRoomIdentifier"
let callbacks = PassthroughSubject<RoomTimelineControllerCallback, Never>()
var timelineItems: [RoomTimelineItemProtocol] = [SeparatorRoomTimelineItem(id: UUID().uuidString,
@@ -32,16 +32,19 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
}
}
let roomId: String
let callbacks = PassthroughSubject<RoomTimelineControllerCallback, Never>()
private(set) var timelineItems = [RoomTimelineItemProtocol]()
init(userId: String,
roomId: String,
timelineProvider: RoomTimelineProviderProtocol,
timelineItemFactory: RoomTimelineItemFactoryProtocol,
mediaProvider: MediaProviderProtocol,
memberDetailProvider: MemberDetailProviderProtocol) {
self.userId = userId
self.roomId = roomId
self.timelineProvider = timelineProvider
self.timelineItemFactory = timelineItemFactory
self.mediaProvider = mediaProvider
@@ -28,6 +28,8 @@ enum RoomTimelineControllerError: Error {
@MainActor
protocol RoomTimelineControllerProtocol {
var roomId: String { get }
var timelineItems: [RoomTimelineItemProtocol] { get }
var callbacks: PassthroughSubject<RoomTimelineControllerCallback, Never> { get }