element-x-ios/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift

1125 lines
43 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 submitBugReportProgressListenerCallsCount = 0
var submitBugReportProgressListenerCalled: Bool {
return submitBugReportProgressListenerCallsCount > 0
}
var submitBugReportProgressListenerReceivedArguments: (bugReport: BugReport, progressListener: ProgressListener?)?
var submitBugReportProgressListenerReceivedInvocations: [(bugReport: BugReport, progressListener: ProgressListener?)] = []
var submitBugReportProgressListenerReturnValue: Result<SubmitBugReportResponse, BugReportServiceError>!
var submitBugReportProgressListenerClosure: ((BugReport, ProgressListener?) async -> Result<SubmitBugReportResponse, BugReportServiceError>)?
func submitBugReport(_ bugReport: BugReport, progressListener: ProgressListener?) async -> Result<SubmitBugReportResponse, BugReportServiceError> {
submitBugReportProgressListenerCallsCount += 1
submitBugReportProgressListenerReceivedArguments = (bugReport: bugReport, progressListener: progressListener)
submitBugReportProgressListenerReceivedInvocations.append((bugReport: bugReport, progressListener: progressListener))
if let submitBugReportProgressListenerClosure = submitBugReportProgressListenerClosure {
return 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: - setUserSession
var setUserSessionCallsCount = 0
var setUserSessionCalled: Bool {
return setUserSessionCallsCount > 0
}
var setUserSessionReceivedUserSession: UserSessionProtocol?
var setUserSessionReceivedInvocations: [UserSessionProtocol?] = []
var setUserSessionClosure: ((UserSessionProtocol?) -> Void)?
func setUserSession(_ userSession: UserSessionProtocol?) {
setUserSessionCallsCount += 1
setUserSessionReceivedUserSession = userSession
setUserSessionReceivedInvocations.append(userSession)
setUserSessionClosure?(userSession)
}
//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!
var canInviteUsers: Bool {
get { return underlyingCanInviteUsers }
set(value) { underlyingCanInviteUsers = value }
}
var underlyingCanInviteUsers: 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
}
}
//MARK: - canSendStateEvent
var canSendStateEventTypeCallsCount = 0
var canSendStateEventTypeCalled: Bool {
return canSendStateEventTypeCallsCount > 0
}
var canSendStateEventTypeReceivedType: StateEventType?
var canSendStateEventTypeReceivedInvocations: [StateEventType] = []
var canSendStateEventTypeReturnValue: Bool!
var canSendStateEventTypeClosure: ((StateEventType) -> Bool)?
func canSendStateEvent(type: StateEventType) -> Bool {
canSendStateEventTypeCallsCount += 1
canSendStateEventTypeReceivedType = type
canSendStateEventTypeReceivedInvocations.append(type)
if let canSendStateEventTypeClosure = canSendStateEventTypeClosure {
return canSendStateEventTypeClosure(type)
} else {
return canSendStateEventTypeReturnValue
}
}
}
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>!
var invitedMembersCount: UInt {
get { return underlyingInvitedMembersCount }
set(value) { underlyingInvitedMembersCount = value }
}
var underlyingInvitedMembersCount: UInt!
var joinedMembersCount: UInt {
get { return underlyingJoinedMembersCount }
set(value) { underlyingJoinedMembersCount = value }
}
var underlyingJoinedMembersCount: UInt!
var activeMembersCount: UInt {
get { return underlyingActiveMembersCount }
set(value) { underlyingActiveMembersCount = value }
}
var underlyingActiveMembersCount: UInt!
var updatesPublisher: AnyPublisher<TimelineDiff, Never> {
get { return underlyingUpdatesPublisher }
set(value) { underlyingUpdatesPublisher = value }
}
var underlyingUpdatesPublisher: AnyPublisher<TimelineDiff, 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: - registerTimelineListenerIfNeeded
var registerTimelineListenerIfNeededCallsCount = 0
var registerTimelineListenerIfNeededCalled: Bool {
return registerTimelineListenerIfNeededCallsCount > 0
}
var registerTimelineListenerIfNeededReturnValue: Result<[TimelineItem], RoomProxyError>!
var registerTimelineListenerIfNeededClosure: (() -> Result<[TimelineItem], RoomProxyError>)?
func registerTimelineListenerIfNeeded() -> Result<[TimelineItem], RoomProxyError> {
registerTimelineListenerIfNeededCallsCount += 1
if let registerTimelineListenerIfNeededClosure = registerTimelineListenerIfNeededClosure {
return registerTimelineListenerIfNeededClosure()
} else {
return registerTimelineListenerIfNeededReturnValue
}
}
//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 sendImageUrlThumbnailURLImageInfoCallsCount = 0
var sendImageUrlThumbnailURLImageInfoCalled: Bool {
return sendImageUrlThumbnailURLImageInfoCallsCount > 0
}
var sendImageUrlThumbnailURLImageInfoReceivedArguments: (url: URL, thumbnailURL: URL, imageInfo: ImageInfo)?
var sendImageUrlThumbnailURLImageInfoReceivedInvocations: [(url: URL, thumbnailURL: URL, imageInfo: ImageInfo)] = []
var sendImageUrlThumbnailURLImageInfoReturnValue: Result<Void, RoomProxyError>!
var sendImageUrlThumbnailURLImageInfoClosure: ((URL, URL, ImageInfo) async -> Result<Void, RoomProxyError>)?
func sendImage(url: URL, thumbnailURL: URL, imageInfo: ImageInfo) async -> Result<Void, RoomProxyError> {
sendImageUrlThumbnailURLImageInfoCallsCount += 1
sendImageUrlThumbnailURLImageInfoReceivedArguments = (url: url, thumbnailURL: thumbnailURL, imageInfo: imageInfo)
sendImageUrlThumbnailURLImageInfoReceivedInvocations.append((url: url, thumbnailURL: thumbnailURL, imageInfo: imageInfo))
if let sendImageUrlThumbnailURLImageInfoClosure = sendImageUrlThumbnailURLImageInfoClosure {
return await sendImageUrlThumbnailURLImageInfoClosure(url, thumbnailURL, imageInfo)
} else {
return sendImageUrlThumbnailURLImageInfoReturnValue
}
}
//MARK: - sendVideo
var sendVideoUrlThumbnailURLVideoInfoCallsCount = 0
var sendVideoUrlThumbnailURLVideoInfoCalled: Bool {
return sendVideoUrlThumbnailURLVideoInfoCallsCount > 0
}
var sendVideoUrlThumbnailURLVideoInfoReceivedArguments: (url: URL, thumbnailURL: URL, videoInfo: VideoInfo)?
var sendVideoUrlThumbnailURLVideoInfoReceivedInvocations: [(url: URL, thumbnailURL: URL, videoInfo: VideoInfo)] = []
var sendVideoUrlThumbnailURLVideoInfoReturnValue: Result<Void, RoomProxyError>!
var sendVideoUrlThumbnailURLVideoInfoClosure: ((URL, URL, VideoInfo) async -> Result<Void, RoomProxyError>)?
func sendVideo(url: URL, thumbnailURL: URL, videoInfo: VideoInfo) async -> Result<Void, RoomProxyError> {
sendVideoUrlThumbnailURLVideoInfoCallsCount += 1
sendVideoUrlThumbnailURLVideoInfoReceivedArguments = (url: url, thumbnailURL: thumbnailURL, videoInfo: videoInfo)
sendVideoUrlThumbnailURLVideoInfoReceivedInvocations.append((url: url, thumbnailURL: thumbnailURL, videoInfo: videoInfo))
if let sendVideoUrlThumbnailURLVideoInfoClosure = sendVideoUrlThumbnailURLVideoInfoClosure {
return await sendVideoUrlThumbnailURLVideoInfoClosure(url, thumbnailURL, videoInfo)
} else {
return sendVideoUrlThumbnailURLVideoInfoReturnValue
}
}
//MARK: - sendAudio
var sendAudioUrlAudioInfoCallsCount = 0
var sendAudioUrlAudioInfoCalled: Bool {
return sendAudioUrlAudioInfoCallsCount > 0
}
var sendAudioUrlAudioInfoReceivedArguments: (url: URL, audioInfo: AudioInfo)?
var sendAudioUrlAudioInfoReceivedInvocations: [(url: URL, audioInfo: AudioInfo)] = []
var sendAudioUrlAudioInfoReturnValue: Result<Void, RoomProxyError>!
var sendAudioUrlAudioInfoClosure: ((URL, AudioInfo) async -> Result<Void, RoomProxyError>)?
func sendAudio(url: URL, audioInfo: AudioInfo) async -> Result<Void, RoomProxyError> {
sendAudioUrlAudioInfoCallsCount += 1
sendAudioUrlAudioInfoReceivedArguments = (url: url, audioInfo: audioInfo)
sendAudioUrlAudioInfoReceivedInvocations.append((url: url, audioInfo: audioInfo))
if let sendAudioUrlAudioInfoClosure = sendAudioUrlAudioInfoClosure {
return await sendAudioUrlAudioInfoClosure(url, audioInfo)
} else {
return sendAudioUrlAudioInfoReturnValue
}
}
//MARK: - sendFile
var sendFileUrlFileInfoCallsCount = 0
var sendFileUrlFileInfoCalled: Bool {
return sendFileUrlFileInfoCallsCount > 0
}
var sendFileUrlFileInfoReceivedArguments: (url: URL, fileInfo: FileInfo)?
var sendFileUrlFileInfoReceivedInvocations: [(url: URL, fileInfo: FileInfo)] = []
var sendFileUrlFileInfoReturnValue: Result<Void, RoomProxyError>!
var sendFileUrlFileInfoClosure: ((URL, FileInfo) async -> Result<Void, RoomProxyError>)?
func sendFile(url: URL, fileInfo: FileInfo) async -> Result<Void, RoomProxyError> {
sendFileUrlFileInfoCallsCount += 1
sendFileUrlFileInfoReceivedArguments = (url: url, fileInfo: fileInfo)
sendFileUrlFileInfoReceivedInvocations.append((url: url, fileInfo: fileInfo))
if let sendFileUrlFileInfoClosure = sendFileUrlFileInfoClosure {
return await sendFileUrlFileInfoClosure(url, fileInfo)
} else {
return sendFileUrlFileInfoReturnValue
}
}
//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
}
}
//MARK: - rejectInvitation
var rejectInvitationCallsCount = 0
var rejectInvitationCalled: Bool {
return rejectInvitationCallsCount > 0
}
var rejectInvitationReturnValue: Result<Void, RoomProxyError>!
var rejectInvitationClosure: (() async -> Result<Void, RoomProxyError>)?
func rejectInvitation() async -> Result<Void, RoomProxyError> {
rejectInvitationCallsCount += 1
if let rejectInvitationClosure = rejectInvitationClosure {
return await rejectInvitationClosure()
} else {
return rejectInvitationReturnValue
}
}
//MARK: - acceptInvitation
var acceptInvitationCallsCount = 0
var acceptInvitationCalled: Bool {
return acceptInvitationCallsCount > 0
}
var acceptInvitationReturnValue: Result<Void, RoomProxyError>!
var acceptInvitationClosure: (() async -> Result<Void, RoomProxyError>)?
func acceptInvitation() async -> Result<Void, RoomProxyError> {
acceptInvitationCallsCount += 1
if let acceptInvitationClosure = acceptInvitationClosure {
return await acceptInvitationClosure()
} else {
return acceptInvitationReturnValue
}
}
//MARK: - fetchDetails
var fetchDetailsForCallsCount = 0
var fetchDetailsForCalled: Bool {
return fetchDetailsForCallsCount > 0
}
var fetchDetailsForReceivedEventID: String?
var fetchDetailsForReceivedInvocations: [String] = []
var fetchDetailsForClosure: ((String) -> Void)?
func fetchDetails(for eventID: String) {
fetchDetailsForCallsCount += 1
fetchDetailsForReceivedEventID = eventID
fetchDetailsForReceivedInvocations.append(eventID)
fetchDetailsForClosure?(eventID)
}
//MARK: - invite
var inviteUserIDCallsCount = 0
var inviteUserIDCalled: Bool {
return inviteUserIDCallsCount > 0
}
var inviteUserIDReceivedUserID: String?
var inviteUserIDReceivedInvocations: [String] = []
var inviteUserIDReturnValue: Result<Void, RoomProxyError>!
var inviteUserIDClosure: ((String) async -> Result<Void, RoomProxyError>)?
func invite(userID: String) async -> Result<Void, RoomProxyError> {
inviteUserIDCallsCount += 1
inviteUserIDReceivedUserID = userID
inviteUserIDReceivedInvocations.append(userID)
if let inviteUserIDClosure = inviteUserIDClosure {
return await inviteUserIDClosure(userID)
} else {
return inviteUserIDReturnValue
}
}
//MARK: - setName
var setNameCallsCount = 0
var setNameCalled: Bool {
return setNameCallsCount > 0
}
var setNameReceivedName: String?
var setNameReceivedInvocations: [String?] = []
var setNameReturnValue: Result<Void, RoomProxyError>!
var setNameClosure: ((String?) async -> Result<Void, RoomProxyError>)?
func setName(_ name: String?) async -> Result<Void, RoomProxyError> {
setNameCallsCount += 1
setNameReceivedName = name
setNameReceivedInvocations.append(name)
if let setNameClosure = setNameClosure {
return await setNameClosure(name)
} else {
return setNameReturnValue
}
}
//MARK: - setTopic
var setTopicCallsCount = 0
var setTopicCalled: Bool {
return setTopicCallsCount > 0
}
var setTopicReceivedTopic: String?
var setTopicReceivedInvocations: [String] = []
var setTopicReturnValue: Result<Void, RoomProxyError>!
var setTopicClosure: ((String) async -> Result<Void, RoomProxyError>)?
func setTopic(_ topic: String) async -> Result<Void, RoomProxyError> {
setTopicCallsCount += 1
setTopicReceivedTopic = topic
setTopicReceivedInvocations.append(topic)
if let setTopicClosure = setTopicClosure {
return await setTopicClosure(topic)
} else {
return setTopicReturnValue
}
}
//MARK: - removeAvatar
var removeAvatarCallsCount = 0
var removeAvatarCalled: Bool {
return removeAvatarCallsCount > 0
}
var removeAvatarReturnValue: Result<Void, RoomProxyError>!
var removeAvatarClosure: (() async -> Result<Void, RoomProxyError>)?
func removeAvatar() async -> Result<Void, RoomProxyError> {
removeAvatarCallsCount += 1
if let removeAvatarClosure = removeAvatarClosure {
return await removeAvatarClosure()
} else {
return removeAvatarReturnValue
}
}
//MARK: - uploadAvatar
var uploadAvatarMediaCallsCount = 0
var uploadAvatarMediaCalled: Bool {
return uploadAvatarMediaCallsCount > 0
}
var uploadAvatarMediaReceivedMedia: MediaInfo?
var uploadAvatarMediaReceivedInvocations: [MediaInfo] = []
var uploadAvatarMediaReturnValue: Result<Void, RoomProxyError>!
var uploadAvatarMediaClosure: ((MediaInfo) async -> Result<Void, RoomProxyError>)?
func uploadAvatar(media: MediaInfo) async -> Result<Void, RoomProxyError> {
uploadAvatarMediaCallsCount += 1
uploadAvatarMediaReceivedMedia = media
uploadAvatarMediaReceivedInvocations.append(media)
if let uploadAvatarMediaClosure = uploadAvatarMediaClosure {
return await uploadAvatarMediaClosure(media)
} else {
return uploadAvatarMediaReturnValue
}
}
}
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
}
}
}
class UserDiscoveryServiceMock: UserDiscoveryServiceProtocol {
//MARK: - searchProfiles
var searchProfilesWithCallsCount = 0
var searchProfilesWithCalled: Bool {
return searchProfilesWithCallsCount > 0
}
var searchProfilesWithReceivedSearchQuery: String?
var searchProfilesWithReceivedInvocations: [String] = []
var searchProfilesWithReturnValue: Result<[UserProfileProxy], UserDiscoveryErrorType>!
var searchProfilesWithClosure: ((String) async -> Result<[UserProfileProxy], UserDiscoveryErrorType>)?
func searchProfiles(with searchQuery: String) async -> Result<[UserProfileProxy], UserDiscoveryErrorType> {
searchProfilesWithCallsCount += 1
searchProfilesWithReceivedSearchQuery = searchQuery
searchProfilesWithReceivedInvocations.append(searchQuery)
if let searchProfilesWithClosure = searchProfilesWithClosure {
return await searchProfilesWithClosure(searchQuery)
} else {
return searchProfilesWithReturnValue
}
}
//MARK: - fetchSuggestions
var fetchSuggestionsCallsCount = 0
var fetchSuggestionsCalled: Bool {
return fetchSuggestionsCallsCount > 0
}
var fetchSuggestionsReturnValue: Result<[UserProfileProxy], UserDiscoveryErrorType>!
var fetchSuggestionsClosure: (() async -> Result<[UserProfileProxy], UserDiscoveryErrorType>)?
func fetchSuggestions() async -> Result<[UserProfileProxy], UserDiscoveryErrorType> {
fetchSuggestionsCallsCount += 1
if let fetchSuggestionsClosure = fetchSuggestionsClosure {
return await fetchSuggestionsClosure()
} else {
return fetchSuggestionsReturnValue
}
}
}
// swiftlint:enable all