mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Add SwiftFormat to the project. (#129)
* Run swiftformat for whitespace. * Run swiftformat with some rules.
This commit is contained in:
@@ -15,7 +15,7 @@ class AuthenticationService: AuthenticationServiceProtocol {
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private(set) var homeserver: LoginHomeserver = LoginHomeserver(address: BuildSettings.defaultHomeserverURLString)
|
||||
private(set) var homeserver = LoginHomeserver(address: BuildSettings.defaultHomeserverURLString)
|
||||
private let userSessionStore: UserSessionStoreProtocol
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
@@ -21,4 +21,4 @@ protocol ApplicationProtocol {
|
||||
var applicationState: UIApplication.State { get }
|
||||
}
|
||||
|
||||
extension UIApplication: ApplicationProtocol {}
|
||||
extension UIApplication: ApplicationProtocol { }
|
||||
|
||||
@@ -19,22 +19,22 @@ protocol BackgroundTaskServiceProtocol {
|
||||
extension BackgroundTaskServiceProtocol {
|
||||
|
||||
func startBackgroundTask(withName name: String) -> BackgroundTaskProtocol? {
|
||||
return startBackgroundTask(withName: name,
|
||||
expirationHandler: nil)
|
||||
startBackgroundTask(withName: name,
|
||||
expirationHandler: nil)
|
||||
}
|
||||
|
||||
func startBackgroundTask(withName name: String,
|
||||
isReusable: Bool) -> BackgroundTaskProtocol? {
|
||||
return startBackgroundTask(withName: name,
|
||||
isReusable: isReusable,
|
||||
expirationHandler: nil)
|
||||
startBackgroundTask(withName: name,
|
||||
isReusable: isReusable,
|
||||
expirationHandler: nil)
|
||||
}
|
||||
|
||||
func startBackgroundTask(withName name: String,
|
||||
expirationHandler: (() -> Void)?) -> BackgroundTaskProtocol? {
|
||||
return startBackgroundTask(withName: name,
|
||||
isReusable: false,
|
||||
expirationHandler: expirationHandler)
|
||||
startBackgroundTask(withName: name,
|
||||
isReusable: false,
|
||||
expirationHandler: expirationHandler)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,16 +15,17 @@ class UIKitBackgroundTask: BackgroundTaskProtocol {
|
||||
var isRunning: Bool {
|
||||
identifier != .invalid
|
||||
}
|
||||
|
||||
let isReusable: Bool
|
||||
let expirationHandler: BackgroundTaskExpirationHandler?
|
||||
var elapsedTime: TimeInterval {
|
||||
return Date().timeIntervalSince(startDate) * 1000
|
||||
Date().timeIntervalSince(startDate) * 1000
|
||||
}
|
||||
|
||||
private let application: ApplicationProtocol
|
||||
private var identifier: UIBackgroundTaskIdentifier = .invalid
|
||||
private var useCounter: Int = 0
|
||||
private let startDate: Date = Date()
|
||||
private var useCounter = 0
|
||||
private let startDate = Date()
|
||||
|
||||
/// Initializes and starts a new background task
|
||||
/// - Parameters:
|
||||
|
||||
@@ -35,7 +35,7 @@ class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol {
|
||||
expirationHandler?()
|
||||
return nil
|
||||
}
|
||||
var created: Bool = false
|
||||
var created = false
|
||||
var result: BackgroundTaskProtocol?
|
||||
|
||||
if isReusable {
|
||||
@@ -47,10 +47,10 @@ class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol {
|
||||
isReusable: isReusable,
|
||||
application: application,
|
||||
expirationHandler: { [weak self] task in
|
||||
guard let self = self else { return }
|
||||
self.reusableTasks[task.name] = nil
|
||||
expirationHandler?()
|
||||
}) {
|
||||
guard let self = self else { return }
|
||||
self.reusableTasks[task.name] = nil
|
||||
expirationHandler?()
|
||||
}) {
|
||||
created = true
|
||||
reusableTasks[name] = newTask
|
||||
result = newTask
|
||||
@@ -61,8 +61,8 @@ class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol {
|
||||
isReusable: isReusable,
|
||||
application: application,
|
||||
expirationHandler: { _ in
|
||||
expirationHandler?()
|
||||
}) {
|
||||
expirationHandler?()
|
||||
}) {
|
||||
result = newTask
|
||||
created = true
|
||||
}
|
||||
@@ -85,8 +85,8 @@ class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol {
|
||||
}
|
||||
|
||||
private func avoidStartingNewTasks(for application: ApplicationProtocol) -> Bool {
|
||||
if application.applicationState == .background
|
||||
&& application.backgroundTimeRemaining < .backgroundTimeRemainingThresholdToStartTasks {
|
||||
if application.applicationState == .background,
|
||||
application.backgroundTimeRemaining < .backgroundTimeRemainingThresholdToStartTasks {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
import UIKit
|
||||
import GZIP
|
||||
import MatrixRustSDK
|
||||
import Sentry
|
||||
import UIKit
|
||||
|
||||
enum BugReportServiceError: Error {
|
||||
case invalidBaseUrlString
|
||||
@@ -33,7 +33,7 @@ class BugReportService: BugReportServiceProtocol {
|
||||
guard !sentryEndpoint.isEmpty else {
|
||||
throw BugReportServiceError.invalidSentryEndpoint
|
||||
}
|
||||
self.baseURL = url
|
||||
baseURL = url
|
||||
self.sentryEndpoint = sentryEndpoint
|
||||
self.applicationId = applicationId
|
||||
self.session = session
|
||||
@@ -69,7 +69,7 @@ class BugReportService: BugReportServiceProtocol {
|
||||
// MARK: - BugReportServiceProtocol
|
||||
|
||||
var crashedLastRun: Bool {
|
||||
return SentrySDK.crashedLastRun
|
||||
SentrySDK.crashedLastRun
|
||||
}
|
||||
|
||||
func crash() {
|
||||
@@ -182,8 +182,8 @@ class BugReportService: BugReportServiceProtocol {
|
||||
filesToCompress.append(URL(fileURLWithPath: crashLogFile))
|
||||
}
|
||||
|
||||
var totalSize: Int = 0
|
||||
var totalZippedSize: Int = 0
|
||||
var totalSize = 0
|
||||
var totalZippedSize = 0
|
||||
var zippedFiles: [URL] = []
|
||||
|
||||
for url in filesToCompress {
|
||||
|
||||
@@ -16,10 +16,10 @@ class MockBugReportService: BugReportServiceProtocol {
|
||||
includeCrashLog: Bool,
|
||||
githubLabels: [String],
|
||||
files: [URL]) async throws -> SubmitBugReportResponse {
|
||||
return SubmitBugReportResponse(reportUrl: "https://www.example/com/123")
|
||||
SubmitBugReportResponse(reportUrl: "https://www.example/com/123")
|
||||
}
|
||||
|
||||
var crashedLastRun: Bool = false
|
||||
var crashedLastRun = false
|
||||
|
||||
func crash() {
|
||||
// no-op
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Photos
|
||||
import UIKit
|
||||
|
||||
enum ScreenshotDetectorError: String, Error {
|
||||
case loadFailed
|
||||
@@ -18,7 +18,7 @@ enum ScreenshotDetectorError: String, Error {
|
||||
@MainActor
|
||||
class ScreenshotDetector {
|
||||
|
||||
var callback: (@MainActor (UIImage?, Error?) -> Void)?
|
||||
var callback: (@MainActor(UIImage?, Error?) -> Void)?
|
||||
|
||||
/// Flag to whether ask for photos authorization by default if needed.
|
||||
var autoRequestPHAuthorization = true
|
||||
@@ -38,7 +38,7 @@ class ScreenshotDetector {
|
||||
let authStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite)
|
||||
if authStatus == .authorized {
|
||||
findScreenshot()
|
||||
} else if authStatus == .notDetermined && autoRequestPHAuthorization {
|
||||
} else if authStatus == .notDetermined, autoRequestPHAuthorization {
|
||||
Task {
|
||||
self.handleAuthStatus(await PHPhotoLibrary.requestAuthorization(for: .readWrite))
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
import Combine
|
||||
import UIKit
|
||||
|
||||
private class WeakClientProxyWrapper: ClientDelegate {
|
||||
@@ -128,7 +128,7 @@ class ClientProxy: ClientProxyProtocol {
|
||||
Benchmark.endTrackingForIdentifier("ClientRooms", message: "Retrieved \(sdkRooms.count) rooms")
|
||||
|
||||
Benchmark.startTrackingForIdentifier("ProcessingRooms", message: "Started processing \(sdkRooms.count) rooms")
|
||||
let diff = sdkRooms.map({ $0.id() }).difference(from: currentRooms.map(\.id))
|
||||
let diff = sdkRooms.map { $0.id() }.difference(from: currentRooms.map(\.id))
|
||||
|
||||
for change in diff {
|
||||
switch change {
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
import Combine
|
||||
|
||||
enum ClientProxyCallback {
|
||||
case updatedRoomsList
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Kingfisher
|
||||
import UIKit
|
||||
|
||||
struct MediaProvider: MediaProviderProtocol {
|
||||
private let clientProxy: ClientProxyProtocol
|
||||
@@ -21,7 +21,7 @@ struct MediaProvider: MediaProviderProtocol {
|
||||
self.clientProxy = clientProxy
|
||||
self.imageCache = imageCache
|
||||
self.backgroundTaskService = backgroundTaskService
|
||||
self.processingQueue = DispatchQueue(label: "MediaProviderProcessingQueue", attributes: .concurrent)
|
||||
processingQueue = DispatchQueue(label: "MediaProviderProcessingQueue", attributes: .concurrent)
|
||||
}
|
||||
|
||||
func imageFromSource(_ source: MediaSource?) -> UIImage? {
|
||||
|
||||
@@ -23,6 +23,6 @@ struct MediaSource: Equatable {
|
||||
// MARK: - Equatable
|
||||
|
||||
static func == (lhs: MediaSource, rhs: MediaSource) -> Bool {
|
||||
return lhs.underlyingSource.url() == rhs.underlyingSource.url()
|
||||
lhs.underlyingSource.url() == rhs.underlyingSource.url()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,18 +12,18 @@ import UIKit
|
||||
struct MockMediaProvider: MediaProviderProtocol {
|
||||
|
||||
func imageFromSource(_ source: MediaSource?) -> UIImage? {
|
||||
return nil
|
||||
nil
|
||||
}
|
||||
|
||||
func loadImageFromSource(_ source: MediaSource) async -> Result<UIImage, MediaProviderError> {
|
||||
return .failure(.failedRetrievingImage)
|
||||
.failure(.failedRetrievingImage)
|
||||
}
|
||||
|
||||
func imageFromURLString(_ urlString: String?) -> UIImage? {
|
||||
return nil
|
||||
nil
|
||||
}
|
||||
|
||||
func loadImageFromURLString(_ urlString: String) async -> Result<UIImage, MediaProviderError> {
|
||||
return .failure(.failedRetrievingImage)
|
||||
.failure(.failedRetrievingImage)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import MatrixRustSDK
|
||||
import UIKit
|
||||
|
||||
struct EmoteRoomMessage: RoomMessageProtocol {
|
||||
private let message: MatrixRustSDK.EmoteMessage
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MatrixRustSDK
|
||||
import UIKit
|
||||
|
||||
struct ImageRoomMessage: RoomMessageProtocol {
|
||||
private let message: MatrixRustSDK.ImageMessage
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import MatrixRustSDK
|
||||
import UIKit
|
||||
|
||||
struct NoticeRoomMessage: RoomMessageProtocol {
|
||||
private let message: MatrixRustSDK.NoticeMessage
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import MatrixRustSDK
|
||||
import UIKit
|
||||
|
||||
struct TextRoomMessage: RoomMessageProtocol {
|
||||
private let message: MatrixRustSDK.TextMessage
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Combine
|
||||
|
||||
struct MockRoomProxy: RoomProxyProtocol {
|
||||
let id = UUID().uuidString
|
||||
@@ -29,26 +29,24 @@ struct MockRoomProxy: RoomProxyProtocol {
|
||||
var callbacks = PassthroughSubject<RoomProxyCallback, Never>()
|
||||
|
||||
func loadDisplayNameForUserId(_ userId: String) async -> Result<String?, RoomProxyError> {
|
||||
return .failure(.failedRetrievingMemberDisplayName)
|
||||
.failure(.failedRetrievingMemberDisplayName)
|
||||
}
|
||||
|
||||
func loadAvatarURLForUserId(_ userId: String) async -> Result<String?, RoomProxyError> {
|
||||
return .failure(.failedRetrievingMemberAvatarURL)
|
||||
.failure(.failedRetrievingMemberAvatarURL)
|
||||
}
|
||||
|
||||
func loadDisplayName() async -> Result<String, RoomProxyError> {
|
||||
return .failure(.failedRetrievingDisplayName)
|
||||
.failure(.failedRetrievingDisplayName)
|
||||
}
|
||||
|
||||
func startLiveEventListener() {
|
||||
|
||||
}
|
||||
func startLiveEventListener() { }
|
||||
|
||||
func paginateBackwards(count: UInt) async -> Result<Void, RoomProxyError> {
|
||||
return .failure(.backwardStreamNotAvailable)
|
||||
.failure(.backwardStreamNotAvailable)
|
||||
}
|
||||
|
||||
func sendMessage(_ message: String) async -> Result<Void, RoomProxyError> {
|
||||
return .failure(.failedSendingMessage)
|
||||
.failure(.failedSendingMessage)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Combine
|
||||
|
||||
import MatrixRustSDK
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Combine
|
||||
import UIKit
|
||||
|
||||
enum RoomProxyError: Error {
|
||||
case failedRetrievingDisplayName
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Combine
|
||||
import UIKit
|
||||
|
||||
struct MockRoomSummary: RoomSummaryProtocol {
|
||||
var id: String = UUID().uuidString
|
||||
@@ -18,21 +18,19 @@ struct MockRoomSummary: RoomSummaryProtocol {
|
||||
|
||||
var topic: String?
|
||||
|
||||
var isDirect: Bool = false
|
||||
var isDirect = false
|
||||
|
||||
var isEncrypted: Bool = false
|
||||
var isEncrypted = false
|
||||
|
||||
var isSpace: Bool = false
|
||||
var isSpace = false
|
||||
|
||||
var isTombstoned: Bool = false
|
||||
var isTombstoned = false
|
||||
|
||||
var lastMessage: EventBrief?
|
||||
|
||||
var avatar: UIImage?
|
||||
|
||||
func loadDetails() async {
|
||||
|
||||
}
|
||||
func loadDetails() async { }
|
||||
|
||||
var callbacks = PassthroughSubject<RoomSummaryCallback, Never>()
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Combine
|
||||
|
||||
class RoomSummary: RoomSummaryProtocol {
|
||||
private let roomProxy: RoomProxyProtocol
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Combine
|
||||
import UIKit
|
||||
|
||||
enum RoomSummaryCallback {
|
||||
case updatedData
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
class UserSession: UserSessionProtocol {
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
enum UserSessionCallback {
|
||||
case sessionVerificationNeeded
|
||||
|
||||
+10
-9
@@ -6,14 +6,14 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
import Combine
|
||||
|
||||
struct MockSessionVerificationControllerProxy: SessionVerificationControllerProxyProtocol {
|
||||
var callbacks = PassthroughSubject<SessionVerificationControllerProxyCallback, Never>()
|
||||
|
||||
var isVerified: Bool = false
|
||||
var isVerified = false
|
||||
|
||||
func requestVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||
DispatchQueue.global(qos: .background).asyncAfter(deadline: .now() + 2.0) {
|
||||
@@ -50,13 +50,14 @@ struct MockSessionVerificationControllerProxy: SessionVerificationControllerProx
|
||||
// MARK: - Private
|
||||
|
||||
static var emojis: [SessionVerificationEmoji] {
|
||||
[SessionVerificationEmoji(symbol: "🦋", description: "Butterfly"),
|
||||
SessionVerificationEmoji(symbol: "🐘", description: "Elephant"),
|
||||
SessionVerificationEmoji(symbol: "🦋", description: "Butterfly"),
|
||||
SessionVerificationEmoji(symbol: "🎂", description: "Cake"),
|
||||
SessionVerificationEmoji(symbol: "🎂", description: "Cake"),
|
||||
SessionVerificationEmoji(symbol: "🏁", description: "Flag"),
|
||||
SessionVerificationEmoji(symbol: "🌏", description: "Globe")
|
||||
[
|
||||
SessionVerificationEmoji(symbol: "🦋", description: "Butterfly"),
|
||||
SessionVerificationEmoji(symbol: "🐘", description: "Elephant"),
|
||||
SessionVerificationEmoji(symbol: "🦋", description: "Butterfly"),
|
||||
SessionVerificationEmoji(symbol: "🎂", description: "Cake"),
|
||||
SessionVerificationEmoji(symbol: "🎂", description: "Cake"),
|
||||
SessionVerificationEmoji(symbol: "🏁", description: "Flag"),
|
||||
SessionVerificationEmoji(symbol: "🌏", description: "Globe")
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,9 +6,9 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
import Combine
|
||||
|
||||
private class WeakSessionVerificationControllerProxy: SessionVerificationControllerDelegate {
|
||||
private weak var proxy: SessionVerificationControllerProxy?
|
||||
|
||||
+1
-1
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
enum SessionVerificationControllerProxyError: Error {
|
||||
case failedRequestingVerification
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
class MockRoomTimelineController: RoomTimelineControllerProtocol {
|
||||
|
||||
@@ -40,18 +40,12 @@ class MockRoomTimelineController: RoomTimelineControllerProtocol {
|
||||
senderDisplayName: "Bob")]
|
||||
|
||||
func paginateBackwards(_ count: UInt) async -> Result<Void, RoomTimelineControllerError> {
|
||||
return .failure(.generic)
|
||||
.failure(.generic)
|
||||
}
|
||||
|
||||
func processItemAppearance(_ itemId: String) async {
|
||||
|
||||
}
|
||||
func processItemAppearance(_ itemId: String) async { }
|
||||
|
||||
func processItemDisappearance(_ itemId: String) async {
|
||||
|
||||
}
|
||||
func processItemDisappearance(_ itemId: String) async { }
|
||||
|
||||
func sendMessage(_ message: String) async {
|
||||
|
||||
}
|
||||
func sendMessage(_ message: String) async { }
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
@@ -79,9 +79,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func processItemDisappearance(_ itemId: String) {
|
||||
|
||||
}
|
||||
func processItemDisappearance(_ itemId: String) { }
|
||||
|
||||
func sendMessage(_ message: String) async {
|
||||
switch await timelineProvider.sendMessage(message) {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
enum RoomTimelineControllerCallback {
|
||||
case updatedTimelineItems
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
class RoomTimelineProvider: RoomTimelineProviderProtocol {
|
||||
private let roomProxy: RoomProxyProtocol
|
||||
@@ -21,13 +21,13 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
|
||||
self.roomProxy.callbacks
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] callback in
|
||||
guard let self = self else { return }
|
||||
guard let self = self else { return }
|
||||
|
||||
switch callback {
|
||||
case .updatedMessages:
|
||||
self.callbacks.send(.updatedMessages)
|
||||
}
|
||||
}.store(in: &cancellables)
|
||||
switch callback {
|
||||
case .updatedMessages:
|
||||
self.callbacks.send(.updatedMessages)
|
||||
}
|
||||
}.store(in: &cancellables)
|
||||
}
|
||||
|
||||
var messages: [RoomMessageProtocol] {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2022 Element. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
enum RoomTimelineProviderCallback {
|
||||
case updatedMessages
|
||||
@@ -26,5 +26,5 @@ protocol RoomTimelineProviderProtocol {
|
||||
|
||||
func paginateBackwards(_ count: UInt) async -> Result<Void, RoomTimelineProviderError>
|
||||
|
||||
func sendMessage(_ message: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
func sendMessage(_ message: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
}
|
||||
|
||||
+1
-3
@@ -8,6 +8,4 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol DecorationTimelineItemProtocol: RoomTimelineItemProtocol {
|
||||
|
||||
}
|
||||
protocol DecorationTimelineItemProtocol: RoomTimelineItemProtocol { }
|
||||
|
||||
@@ -42,6 +42,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func buildTextTimelineItemFromMessage(_ message: TextRoomMessage,
|
||||
_ isOutgoing: Bool,
|
||||
_ showSenderDetails: Bool,
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
import Kingfisher
|
||||
import MatrixRustSDK
|
||||
|
||||
class UserSessionStore: UserSessionStoreProtocol {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user