Files
letro-ios/ElementX/Sources/Services/Room/MockRoomProxy.swift
Stefan Ceriu 03dd2cd84d Add retry decryption encrypted timeline item debug menu option (#384)
* Fixed a couple of warnings (+2 squashed commits)
Squashed commits:
[21fbc3b0] Add changelog
[abb092c6] Add retry decryption encrypted timeline item debug menu option

* Cleanup room list state computations

* Bump the RustSDK to v1.0.25-alpha

* Fix brew CI errors: remove imagemagick and brew lock file entirely

* Fix release script version bumping

* Bump ruby dependencies
2022-12-22 13:59:38 +02:00

87 lines
2.8 KiB
Swift

//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Combine
import Foundation
import MatrixRustSDK
struct MockRoomProxy: RoomProxyProtocol {
let id = UUID().uuidString
let name: String? = nil
let displayName: String?
var topic: String?
var avatarURL: String?
var isDirect = Bool.random()
var isSpace = Bool.random()
var isPublic = Bool.random()
var isEncrypted = Bool.random()
var isTombstoned = Bool.random()
var members: [RoomMemberProxy]?
let timelineProvider: RoomTimelineProviderProtocol = MockRoomTimelineProvider()
func loadDisplayNameForUserId(_ userId: String) async -> Result<String?, RoomProxyError> {
.failure(.failedRetrievingMemberDisplayName)
}
func avatarURLStringForUserId(_ userId: String) -> String? {
nil
}
func loadAvatarURLForUserId(_ userId: String) async -> Result<String?, RoomProxyError> {
.failure(.failedRetrievingMemberAvatarURL)
}
func displayNameForUserId(_ userId: String) -> String? {
nil
}
func startLiveEventListener() { }
func addTimelineListener(listener: TimelineListener) -> Result<Void, RoomProxyError> {
.failure(.failedAddingTimelineListener)
}
func paginateBackwards(count: UInt) async -> Result<Void, RoomProxyError> {
.failure(.failedPaginatingBackwards)
}
func sendMessage(_ message: String, inReplyToEventId: String? = nil) async -> Result<Void, RoomProxyError> {
.failure(.failedSendingMessage)
}
func sendReaction(_ reaction: String, for eventId: String) async -> Result<Void, RoomProxyError> {
.failure(.failedSendingMessage)
}
func editMessage(_ newMessage: String, originalEventId: String) async -> Result<Void, RoomProxyError> {
.failure(.failedSendingMessage)
}
func redact(_ eventID: String) async -> Result<Void, RoomProxyError> {
.failure(.failedRedactingEvent)
}
func members() async -> Result<[RoomMemberProxy], RoomProxyError> {
if let members {
return .success(members)
}
return .failure(.failedRetrievingMembers)
}
func retryDecryption(forSessionId sessionId: String) async { }
}