Files
element-x-ios/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift
T
2023-04-18 07:33:32 +00:00

844 lines
31 KiB
Swift

// Generated using Sourcery 2.0.2 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT
// swiftlint:disable all
import Combine
import Foundation
import MatrixRustSDK
import AnalyticsEvents
class AnalyticsClientMock: AnalyticsClientProtocol {
var isRunning: Bool {
get { return underlyingIsRunning }
set(value) { underlyingIsRunning = value }
}
var underlyingIsRunning: Bool!
//MARK: - start
var startCallsCount = 0
var startCalled: Bool {
return startCallsCount > 0
}
var startClosure: (() -> Void)?
func start() {
startCallsCount += 1
startClosure?()
}
//MARK: - reset
var resetCallsCount = 0
var resetCalled: Bool {
return resetCallsCount > 0
}
var resetClosure: (() -> Void)?
func reset() {
resetCallsCount += 1
resetClosure?()
}
//MARK: - stop
var stopCallsCount = 0
var stopCalled: Bool {
return stopCallsCount > 0
}
var stopClosure: (() -> Void)?
func stop() {
stopCallsCount += 1
stopClosure?()
}
//MARK: - flush
var flushCallsCount = 0
var flushCalled: Bool {
return flushCallsCount > 0
}
var flushClosure: (() -> Void)?
func flush() {
flushCallsCount += 1
flushClosure?()
}
//MARK: - capture
var captureCallsCount = 0
var captureCalled: Bool {
return captureCallsCount > 0
}
var captureReceivedEvent: AnalyticsEventProtocol?
var captureReceivedInvocations: [AnalyticsEventProtocol] = []
var captureClosure: ((AnalyticsEventProtocol) -> Void)?
func capture(_ event: AnalyticsEventProtocol) {
captureCallsCount += 1
captureReceivedEvent = event
captureReceivedInvocations.append(event)
captureClosure?(event)
}
//MARK: - screen
var screenCallsCount = 0
var screenCalled: Bool {
return screenCallsCount > 0
}
var screenReceivedEvent: AnalyticsScreenProtocol?
var screenReceivedInvocations: [AnalyticsScreenProtocol] = []
var screenClosure: ((AnalyticsScreenProtocol) -> Void)?
func screen(_ event: AnalyticsScreenProtocol) {
screenCallsCount += 1
screenReceivedEvent = event
screenReceivedInvocations.append(event)
screenClosure?(event)
}
//MARK: - updateUserProperties
var updateUserPropertiesCallsCount = 0
var updateUserPropertiesCalled: Bool {
return updateUserPropertiesCallsCount > 0
}
var updateUserPropertiesReceivedUserProperties: AnalyticsEvent.UserProperties?
var updateUserPropertiesReceivedInvocations: [AnalyticsEvent.UserProperties] = []
var updateUserPropertiesClosure: ((AnalyticsEvent.UserProperties) -> Void)?
func updateUserProperties(_ userProperties: AnalyticsEvent.UserProperties) {
updateUserPropertiesCallsCount += 1
updateUserPropertiesReceivedUserProperties = userProperties
updateUserPropertiesReceivedInvocations.append(userProperties)
updateUserPropertiesClosure?(userProperties)
}
}
class BugReportServiceMock: BugReportServiceProtocol {
var isRunning: Bool {
get { return underlyingIsRunning }
set(value) { underlyingIsRunning = value }
}
var underlyingIsRunning: Bool!
var crashedLastRun: Bool {
get { return underlyingCrashedLastRun }
set(value) { underlyingCrashedLastRun = value }
}
var underlyingCrashedLastRun: Bool!
//MARK: - start
var startCallsCount = 0
var startCalled: Bool {
return startCallsCount > 0
}
var startClosure: (() -> Void)?
func start() {
startCallsCount += 1
startClosure?()
}
//MARK: - stop
var stopCallsCount = 0
var stopCalled: Bool {
return stopCallsCount > 0
}
var stopClosure: (() -> Void)?
func stop() {
stopCallsCount += 1
stopClosure?()
}
//MARK: - reset
var resetCallsCount = 0
var resetCalled: Bool {
return resetCallsCount > 0
}
var resetClosure: (() -> Void)?
func reset() {
resetCallsCount += 1
resetClosure?()
}
//MARK: - crash
var crashCallsCount = 0
var crashCalled: Bool {
return crashCallsCount > 0
}
var crashClosure: (() -> Void)?
func crash() {
crashCallsCount += 1
crashClosure?()
}
//MARK: - submitBugReport
var submitBugReportProgressListenerThrowableError: Error?
var submitBugReportProgressListenerCallsCount = 0
var submitBugReportProgressListenerCalled: Bool {
return submitBugReportProgressListenerCallsCount > 0
}
var submitBugReportProgressListenerReceivedArguments: (bugReport: BugReport, progressListener: ProgressListener?)?
var submitBugReportProgressListenerReceivedInvocations: [(bugReport: BugReport, progressListener: ProgressListener?)] = []
var submitBugReportProgressListenerReturnValue: SubmitBugReportResponse!
var submitBugReportProgressListenerClosure: ((BugReport, ProgressListener?) async throws -> SubmitBugReportResponse)?
func submitBugReport(_ bugReport: BugReport, progressListener: ProgressListener?) async throws -> SubmitBugReportResponse {
if let error = submitBugReportProgressListenerThrowableError {
throw error
}
submitBugReportProgressListenerCallsCount += 1
submitBugReportProgressListenerReceivedArguments = (bugReport: bugReport, progressListener: progressListener)
submitBugReportProgressListenerReceivedInvocations.append((bugReport: bugReport, progressListener: progressListener))
if let submitBugReportProgressListenerClosure = submitBugReportProgressListenerClosure {
return try await submitBugReportProgressListenerClosure(bugReport, progressListener)
} else {
return submitBugReportProgressListenerReturnValue
}
}
}
class NotificationManagerMock: NotificationManagerProtocol {
var delegate: NotificationManagerDelegate?
//MARK: - start
var startCallsCount = 0
var startCalled: Bool {
return startCallsCount > 0
}
var startClosure: (() -> Void)?
func start() {
startCallsCount += 1
startClosure?()
}
//MARK: - register
var registerWithCallsCount = 0
var registerWithCalled: Bool {
return registerWithCallsCount > 0
}
var registerWithReceivedDeviceToken: Data?
var registerWithReceivedInvocations: [Data] = []
var registerWithReturnValue: Bool!
var registerWithClosure: ((Data) async -> Bool)?
func register(with deviceToken: Data) async -> Bool {
registerWithCallsCount += 1
registerWithReceivedDeviceToken = deviceToken
registerWithReceivedInvocations.append(deviceToken)
if let registerWithClosure = registerWithClosure {
return await registerWithClosure(deviceToken)
} else {
return registerWithReturnValue
}
}
//MARK: - registrationFailed
var registrationFailedWithCallsCount = 0
var registrationFailedWithCalled: Bool {
return registrationFailedWithCallsCount > 0
}
var registrationFailedWithReceivedError: Error?
var registrationFailedWithReceivedInvocations: [Error] = []
var registrationFailedWithClosure: ((Error) -> Void)?
func registrationFailed(with error: Error) {
registrationFailedWithCallsCount += 1
registrationFailedWithReceivedError = error
registrationFailedWithReceivedInvocations.append(error)
registrationFailedWithClosure?(error)
}
//MARK: - showLocalNotification
var showLocalNotificationWithSubtitleCallsCount = 0
var showLocalNotificationWithSubtitleCalled: Bool {
return showLocalNotificationWithSubtitleCallsCount > 0
}
var showLocalNotificationWithSubtitleReceivedArguments: (title: String, subtitle: String?)?
var showLocalNotificationWithSubtitleReceivedInvocations: [(title: String, subtitle: String?)] = []
var showLocalNotificationWithSubtitleClosure: ((String, String?) async -> Void)?
func showLocalNotification(with title: String, subtitle: String?) async {
showLocalNotificationWithSubtitleCallsCount += 1
showLocalNotificationWithSubtitleReceivedArguments = (title: title, subtitle: subtitle)
showLocalNotificationWithSubtitleReceivedInvocations.append((title: title, subtitle: subtitle))
await showLocalNotificationWithSubtitleClosure?(title, subtitle)
}
//MARK: - setClientProxy
var setClientProxyCallsCount = 0
var setClientProxyCalled: Bool {
return setClientProxyCallsCount > 0
}
var setClientProxyReceivedClientProxy: ClientProxyProtocol?
var setClientProxyReceivedInvocations: [ClientProxyProtocol?] = []
var setClientProxyClosure: ((ClientProxyProtocol?) -> Void)?
func setClientProxy(_ clientProxy: ClientProxyProtocol?) {
setClientProxyCallsCount += 1
setClientProxyReceivedClientProxy = clientProxy
setClientProxyReceivedInvocations.append(clientProxy)
setClientProxyClosure?(clientProxy)
}
//MARK: - requestAuthorization
var requestAuthorizationCallsCount = 0
var requestAuthorizationCalled: Bool {
return requestAuthorizationCallsCount > 0
}
var requestAuthorizationClosure: (() -> Void)?
func requestAuthorization() {
requestAuthorizationCallsCount += 1
requestAuthorizationClosure?()
}
}
class RoomMemberProxyMock: RoomMemberProxyProtocol {
var userID: String {
get { return underlyingUserID }
set(value) { underlyingUserID = value }
}
var underlyingUserID: String!
var displayName: String?
var avatarURL: URL?
var membership: MembershipState {
get { return underlyingMembership }
set(value) { underlyingMembership = value }
}
var underlyingMembership: MembershipState!
var isNameAmbiguous: Bool {
get { return underlyingIsNameAmbiguous }
set(value) { underlyingIsNameAmbiguous = value }
}
var underlyingIsNameAmbiguous: Bool!
var powerLevel: Int {
get { return underlyingPowerLevel }
set(value) { underlyingPowerLevel = value }
}
var underlyingPowerLevel: Int!
var normalizedPowerLevel: Int {
get { return underlyingNormalizedPowerLevel }
set(value) { underlyingNormalizedPowerLevel = value }
}
var underlyingNormalizedPowerLevel: Int!
var isAccountOwner: Bool {
get { return underlyingIsAccountOwner }
set(value) { underlyingIsAccountOwner = value }
}
var underlyingIsAccountOwner: Bool!
var isIgnored: Bool {
get { return underlyingIsIgnored }
set(value) { underlyingIsIgnored = value }
}
var underlyingIsIgnored: Bool!
//MARK: - ignoreUser
var ignoreUserCallsCount = 0
var ignoreUserCalled: Bool {
return ignoreUserCallsCount > 0
}
var ignoreUserReturnValue: Result<Void, RoomMemberProxyError>!
var ignoreUserClosure: (() async -> Result<Void, RoomMemberProxyError>)?
func ignoreUser() async -> Result<Void, RoomMemberProxyError> {
ignoreUserCallsCount += 1
if let ignoreUserClosure = ignoreUserClosure {
return await ignoreUserClosure()
} else {
return ignoreUserReturnValue
}
}
//MARK: - unignoreUser
var unignoreUserCallsCount = 0
var unignoreUserCalled: Bool {
return unignoreUserCallsCount > 0
}
var unignoreUserReturnValue: Result<Void, RoomMemberProxyError>!
var unignoreUserClosure: (() async -> Result<Void, RoomMemberProxyError>)?
func unignoreUser() async -> Result<Void, RoomMemberProxyError> {
unignoreUserCallsCount += 1
if let unignoreUserClosure = unignoreUserClosure {
return await unignoreUserClosure()
} else {
return unignoreUserReturnValue
}
}
}
class RoomProxyMock: RoomProxyProtocol {
var id: String {
get { return underlyingId }
set(value) { underlyingId = value }
}
var underlyingId: String!
var isDirect: Bool {
get { return underlyingIsDirect }
set(value) { underlyingIsDirect = value }
}
var underlyingIsDirect: Bool!
var isPublic: Bool {
get { return underlyingIsPublic }
set(value) { underlyingIsPublic = value }
}
var underlyingIsPublic: Bool!
var isSpace: Bool {
get { return underlyingIsSpace }
set(value) { underlyingIsSpace = value }
}
var underlyingIsSpace: Bool!
var isEncrypted: Bool {
get { return underlyingIsEncrypted }
set(value) { underlyingIsEncrypted = value }
}
var underlyingIsEncrypted: Bool!
var isTombstoned: Bool {
get { return underlyingIsTombstoned }
set(value) { underlyingIsTombstoned = value }
}
var underlyingIsTombstoned: Bool!
var canonicalAlias: String?
var alternativeAliases: [String] = []
var hasUnreadNotifications: Bool {
get { return underlyingHasUnreadNotifications }
set(value) { underlyingHasUnreadNotifications = value }
}
var underlyingHasUnreadNotifications: Bool!
var name: String?
var displayName: String?
var topic: String?
var avatarURL: URL?
var membersPublisher: AnyPublisher<[RoomMemberProxyProtocol], Never> {
get { return underlyingMembersPublisher }
set(value) { underlyingMembersPublisher = value }
}
var underlyingMembersPublisher: AnyPublisher<[RoomMemberProxyProtocol], Never>!
//MARK: - loadAvatarURLForUserId
var loadAvatarURLForUserIdCallsCount = 0
var loadAvatarURLForUserIdCalled: Bool {
return loadAvatarURLForUserIdCallsCount > 0
}
var loadAvatarURLForUserIdReceivedUserId: String?
var loadAvatarURLForUserIdReceivedInvocations: [String] = []
var loadAvatarURLForUserIdReturnValue: Result<URL?, RoomProxyError>!
var loadAvatarURLForUserIdClosure: ((String) async -> Result<URL?, RoomProxyError>)?
func loadAvatarURLForUserId(_ userId: String) async -> Result<URL?, RoomProxyError> {
loadAvatarURLForUserIdCallsCount += 1
loadAvatarURLForUserIdReceivedUserId = userId
loadAvatarURLForUserIdReceivedInvocations.append(userId)
if let loadAvatarURLForUserIdClosure = loadAvatarURLForUserIdClosure {
return await loadAvatarURLForUserIdClosure(userId)
} else {
return loadAvatarURLForUserIdReturnValue
}
}
//MARK: - loadDisplayNameForUserId
var loadDisplayNameForUserIdCallsCount = 0
var loadDisplayNameForUserIdCalled: Bool {
return loadDisplayNameForUserIdCallsCount > 0
}
var loadDisplayNameForUserIdReceivedUserId: String?
var loadDisplayNameForUserIdReceivedInvocations: [String] = []
var loadDisplayNameForUserIdReturnValue: Result<String?, RoomProxyError>!
var loadDisplayNameForUserIdClosure: ((String) async -> Result<String?, RoomProxyError>)?
func loadDisplayNameForUserId(_ userId: String) async -> Result<String?, RoomProxyError> {
loadDisplayNameForUserIdCallsCount += 1
loadDisplayNameForUserIdReceivedUserId = userId
loadDisplayNameForUserIdReceivedInvocations.append(userId)
if let loadDisplayNameForUserIdClosure = loadDisplayNameForUserIdClosure {
return await loadDisplayNameForUserIdClosure(userId)
} else {
return loadDisplayNameForUserIdReturnValue
}
}
//MARK: - addTimelineListener
var addTimelineListenerListenerCallsCount = 0
var addTimelineListenerListenerCalled: Bool {
return addTimelineListenerListenerCallsCount > 0
}
var addTimelineListenerListenerReceivedListener: TimelineListener?
var addTimelineListenerListenerReceivedInvocations: [TimelineListener] = []
var addTimelineListenerListenerReturnValue: Result<[TimelineItem], RoomProxyError>!
var addTimelineListenerListenerClosure: ((TimelineListener) -> Result<[TimelineItem], RoomProxyError>)?
func addTimelineListener(listener: TimelineListener) -> Result<[TimelineItem], RoomProxyError> {
addTimelineListenerListenerCallsCount += 1
addTimelineListenerListenerReceivedListener = listener
addTimelineListenerListenerReceivedInvocations.append(listener)
if let addTimelineListenerListenerClosure = addTimelineListenerListenerClosure {
return addTimelineListenerListenerClosure(listener)
} else {
return addTimelineListenerListenerReturnValue
}
}
//MARK: - removeTimelineListener
var removeTimelineListenerCallsCount = 0
var removeTimelineListenerCalled: Bool {
return removeTimelineListenerCallsCount > 0
}
var removeTimelineListenerClosure: (() -> Void)?
func removeTimelineListener() {
removeTimelineListenerCallsCount += 1
removeTimelineListenerClosure?()
}
//MARK: - paginateBackwards
var paginateBackwardsRequestSizeUntilNumberOfItemsCallsCount = 0
var paginateBackwardsRequestSizeUntilNumberOfItemsCalled: Bool {
return paginateBackwardsRequestSizeUntilNumberOfItemsCallsCount > 0
}
var paginateBackwardsRequestSizeUntilNumberOfItemsReceivedArguments: (requestSize: UInt, untilNumberOfItems: UInt)?
var paginateBackwardsRequestSizeUntilNumberOfItemsReceivedInvocations: [(requestSize: UInt, untilNumberOfItems: UInt)] = []
var paginateBackwardsRequestSizeUntilNumberOfItemsReturnValue: Result<Void, RoomProxyError>!
var paginateBackwardsRequestSizeUntilNumberOfItemsClosure: ((UInt, UInt) async -> Result<Void, RoomProxyError>)?
func paginateBackwards(requestSize: UInt, untilNumberOfItems: UInt) async -> Result<Void, RoomProxyError> {
paginateBackwardsRequestSizeUntilNumberOfItemsCallsCount += 1
paginateBackwardsRequestSizeUntilNumberOfItemsReceivedArguments = (requestSize: requestSize, untilNumberOfItems: untilNumberOfItems)
paginateBackwardsRequestSizeUntilNumberOfItemsReceivedInvocations.append((requestSize: requestSize, untilNumberOfItems: untilNumberOfItems))
if let paginateBackwardsRequestSizeUntilNumberOfItemsClosure = paginateBackwardsRequestSizeUntilNumberOfItemsClosure {
return await paginateBackwardsRequestSizeUntilNumberOfItemsClosure(requestSize, untilNumberOfItems)
} else {
return paginateBackwardsRequestSizeUntilNumberOfItemsReturnValue
}
}
//MARK: - sendReadReceipt
var sendReadReceiptForCallsCount = 0
var sendReadReceiptForCalled: Bool {
return sendReadReceiptForCallsCount > 0
}
var sendReadReceiptForReceivedEventID: String?
var sendReadReceiptForReceivedInvocations: [String] = []
var sendReadReceiptForReturnValue: Result<Void, RoomProxyError>!
var sendReadReceiptForClosure: ((String) async -> Result<Void, RoomProxyError>)?
func sendReadReceipt(for eventID: String) async -> Result<Void, RoomProxyError> {
sendReadReceiptForCallsCount += 1
sendReadReceiptForReceivedEventID = eventID
sendReadReceiptForReceivedInvocations.append(eventID)
if let sendReadReceiptForClosure = sendReadReceiptForClosure {
return await sendReadReceiptForClosure(eventID)
} else {
return sendReadReceiptForReturnValue
}
}
//MARK: - sendMessage
var sendMessageInReplyToCallsCount = 0
var sendMessageInReplyToCalled: Bool {
return sendMessageInReplyToCallsCount > 0
}
var sendMessageInReplyToReceivedArguments: (message: String, eventID: String?)?
var sendMessageInReplyToReceivedInvocations: [(message: String, eventID: String?)] = []
var sendMessageInReplyToReturnValue: Result<Void, RoomProxyError>!
var sendMessageInReplyToClosure: ((String, String?) async -> Result<Void, RoomProxyError>)?
func sendMessage(_ message: String, inReplyTo eventID: String?) async -> Result<Void, RoomProxyError> {
sendMessageInReplyToCallsCount += 1
sendMessageInReplyToReceivedArguments = (message: message, eventID: eventID)
sendMessageInReplyToReceivedInvocations.append((message: message, eventID: eventID))
if let sendMessageInReplyToClosure = sendMessageInReplyToClosure {
return await sendMessageInReplyToClosure(message, eventID)
} else {
return sendMessageInReplyToReturnValue
}
}
//MARK: - sendReaction
var sendReactionToCallsCount = 0
var sendReactionToCalled: Bool {
return sendReactionToCallsCount > 0
}
var sendReactionToReceivedArguments: (reaction: String, eventID: String)?
var sendReactionToReceivedInvocations: [(reaction: String, eventID: String)] = []
var sendReactionToReturnValue: Result<Void, RoomProxyError>!
var sendReactionToClosure: ((String, String) async -> Result<Void, RoomProxyError>)?
func sendReaction(_ reaction: String, to eventID: String) async -> Result<Void, RoomProxyError> {
sendReactionToCallsCount += 1
sendReactionToReceivedArguments = (reaction: reaction, eventID: eventID)
sendReactionToReceivedInvocations.append((reaction: reaction, eventID: eventID))
if let sendReactionToClosure = sendReactionToClosure {
return await sendReactionToClosure(reaction, eventID)
} else {
return sendReactionToReturnValue
}
}
//MARK: - sendImage
var sendImageUrlCallsCount = 0
var sendImageUrlCalled: Bool {
return sendImageUrlCallsCount > 0
}
var sendImageUrlReceivedUrl: URL?
var sendImageUrlReceivedInvocations: [URL] = []
var sendImageUrlReturnValue: Result<Void, RoomProxyError>!
var sendImageUrlClosure: ((URL) async -> Result<Void, RoomProxyError>)?
func sendImage(url: URL) async -> Result<Void, RoomProxyError> {
sendImageUrlCallsCount += 1
sendImageUrlReceivedUrl = url
sendImageUrlReceivedInvocations.append(url)
if let sendImageUrlClosure = sendImageUrlClosure {
return await sendImageUrlClosure(url)
} else {
return sendImageUrlReturnValue
}
}
//MARK: - editMessage
var editMessageOriginalCallsCount = 0
var editMessageOriginalCalled: Bool {
return editMessageOriginalCallsCount > 0
}
var editMessageOriginalReceivedArguments: (newMessage: String, eventID: String)?
var editMessageOriginalReceivedInvocations: [(newMessage: String, eventID: String)] = []
var editMessageOriginalReturnValue: Result<Void, RoomProxyError>!
var editMessageOriginalClosure: ((String, String) async -> Result<Void, RoomProxyError>)?
func editMessage(_ newMessage: String, original eventID: String) async -> Result<Void, RoomProxyError> {
editMessageOriginalCallsCount += 1
editMessageOriginalReceivedArguments = (newMessage: newMessage, eventID: eventID)
editMessageOriginalReceivedInvocations.append((newMessage: newMessage, eventID: eventID))
if let editMessageOriginalClosure = editMessageOriginalClosure {
return await editMessageOriginalClosure(newMessage, eventID)
} else {
return editMessageOriginalReturnValue
}
}
//MARK: - redact
var redactCallsCount = 0
var redactCalled: Bool {
return redactCallsCount > 0
}
var redactReceivedEventID: String?
var redactReceivedInvocations: [String] = []
var redactReturnValue: Result<Void, RoomProxyError>!
var redactClosure: ((String) async -> Result<Void, RoomProxyError>)?
func redact(_ eventID: String) async -> Result<Void, RoomProxyError> {
redactCallsCount += 1
redactReceivedEventID = eventID
redactReceivedInvocations.append(eventID)
if let redactClosure = redactClosure {
return await redactClosure(eventID)
} else {
return redactReturnValue
}
}
//MARK: - reportContent
var reportContentReasonCallsCount = 0
var reportContentReasonCalled: Bool {
return reportContentReasonCallsCount > 0
}
var reportContentReasonReceivedArguments: (eventID: String, reason: String?)?
var reportContentReasonReceivedInvocations: [(eventID: String, reason: String?)] = []
var reportContentReasonReturnValue: Result<Void, RoomProxyError>!
var reportContentReasonClosure: ((String, String?) async -> Result<Void, RoomProxyError>)?
func reportContent(_ eventID: String, reason: String?) async -> Result<Void, RoomProxyError> {
reportContentReasonCallsCount += 1
reportContentReasonReceivedArguments = (eventID: eventID, reason: reason)
reportContentReasonReceivedInvocations.append((eventID: eventID, reason: reason))
if let reportContentReasonClosure = reportContentReasonClosure {
return await reportContentReasonClosure(eventID, reason)
} else {
return reportContentReasonReturnValue
}
}
//MARK: - ignoreUser
var ignoreUserCallsCount = 0
var ignoreUserCalled: Bool {
return ignoreUserCallsCount > 0
}
var ignoreUserReceivedUserID: String?
var ignoreUserReceivedInvocations: [String] = []
var ignoreUserReturnValue: Result<Void, RoomProxyError>!
var ignoreUserClosure: ((String) async -> Result<Void, RoomProxyError>)?
func ignoreUser(_ userID: String) async -> Result<Void, RoomProxyError> {
ignoreUserCallsCount += 1
ignoreUserReceivedUserID = userID
ignoreUserReceivedInvocations.append(userID)
if let ignoreUserClosure = ignoreUserClosure {
return await ignoreUserClosure(userID)
} else {
return ignoreUserReturnValue
}
}
//MARK: - retryDecryption
var retryDecryptionForCallsCount = 0
var retryDecryptionForCalled: Bool {
return retryDecryptionForCallsCount > 0
}
var retryDecryptionForReceivedSessionID: String?
var retryDecryptionForReceivedInvocations: [String] = []
var retryDecryptionForClosure: ((String) async -> Void)?
func retryDecryption(for sessionID: String) async {
retryDecryptionForCallsCount += 1
retryDecryptionForReceivedSessionID = sessionID
retryDecryptionForReceivedInvocations.append(sessionID)
await retryDecryptionForClosure?(sessionID)
}
//MARK: - leaveRoom
var leaveRoomCallsCount = 0
var leaveRoomCalled: Bool {
return leaveRoomCallsCount > 0
}
var leaveRoomReturnValue: Result<Void, RoomProxyError>!
var leaveRoomClosure: (() async -> Result<Void, RoomProxyError>)?
func leaveRoom() async -> Result<Void, RoomProxyError> {
leaveRoomCallsCount += 1
if let leaveRoomClosure = leaveRoomClosure {
return await leaveRoomClosure()
} else {
return leaveRoomReturnValue
}
}
//MARK: - updateMembers
var updateMembersCallsCount = 0
var updateMembersCalled: Bool {
return updateMembersCallsCount > 0
}
var updateMembersClosure: (() async -> Void)?
func updateMembers() async {
updateMembersCallsCount += 1
await updateMembersClosure?()
}
//MARK: - inviter
var inviterCallsCount = 0
var inviterCalled: Bool {
return inviterCallsCount > 0
}
var inviterReturnValue: RoomMemberProxyProtocol?
var inviterClosure: (() async -> RoomMemberProxyProtocol?)?
func inviter() async -> RoomMemberProxyProtocol? {
inviterCallsCount += 1
if let inviterClosure = inviterClosure {
return await inviterClosure()
} else {
return inviterReturnValue
}
}
}
class SessionVerificationControllerProxyMock: SessionVerificationControllerProxyProtocol {
var callbacks: PassthroughSubject<SessionVerificationControllerProxyCallback, Never> {
get { return underlyingCallbacks }
set(value) { underlyingCallbacks = value }
}
var underlyingCallbacks: PassthroughSubject<SessionVerificationControllerProxyCallback, Never>!
var isVerified: Bool {
get { return underlyingIsVerified }
set(value) { underlyingIsVerified = value }
}
var underlyingIsVerified: Bool!
//MARK: - requestVerification
var requestVerificationCallsCount = 0
var requestVerificationCalled: Bool {
return requestVerificationCallsCount > 0
}
var requestVerificationReturnValue: Result<Void, SessionVerificationControllerProxyError>!
var requestVerificationClosure: (() async -> Result<Void, SessionVerificationControllerProxyError>)?
func requestVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
requestVerificationCallsCount += 1
if let requestVerificationClosure = requestVerificationClosure {
return await requestVerificationClosure()
} else {
return requestVerificationReturnValue
}
}
//MARK: - startSasVerification
var startSasVerificationCallsCount = 0
var startSasVerificationCalled: Bool {
return startSasVerificationCallsCount > 0
}
var startSasVerificationReturnValue: Result<Void, SessionVerificationControllerProxyError>!
var startSasVerificationClosure: (() async -> Result<Void, SessionVerificationControllerProxyError>)?
func startSasVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
startSasVerificationCallsCount += 1
if let startSasVerificationClosure = startSasVerificationClosure {
return await startSasVerificationClosure()
} else {
return startSasVerificationReturnValue
}
}
//MARK: - approveVerification
var approveVerificationCallsCount = 0
var approveVerificationCalled: Bool {
return approveVerificationCallsCount > 0
}
var approveVerificationReturnValue: Result<Void, SessionVerificationControllerProxyError>!
var approveVerificationClosure: (() async -> Result<Void, SessionVerificationControllerProxyError>)?
func approveVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
approveVerificationCallsCount += 1
if let approveVerificationClosure = approveVerificationClosure {
return await approveVerificationClosure()
} else {
return approveVerificationReturnValue
}
}
//MARK: - declineVerification
var declineVerificationCallsCount = 0
var declineVerificationCalled: Bool {
return declineVerificationCallsCount > 0
}
var declineVerificationReturnValue: Result<Void, SessionVerificationControllerProxyError>!
var declineVerificationClosure: (() async -> Result<Void, SessionVerificationControllerProxyError>)?
func declineVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
declineVerificationCallsCount += 1
if let declineVerificationClosure = declineVerificationClosure {
return await declineVerificationClosure()
} else {
return declineVerificationReturnValue
}
}
//MARK: - cancelVerification
var cancelVerificationCallsCount = 0
var cancelVerificationCalled: Bool {
return cancelVerificationCallsCount > 0
}
var cancelVerificationReturnValue: Result<Void, SessionVerificationControllerProxyError>!
var cancelVerificationClosure: (() async -> Result<Void, SessionVerificationControllerProxyError>)?
func cancelVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
cancelVerificationCallsCount += 1
if let cancelVerificationClosure = cancelVerificationClosure {
return await cancelVerificationClosure()
} else {
return cancelVerificationReturnValue
}
}
}
// swiftlint:enable all