mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
# Conflicts: # Session.xcodeproj/project.pbxproj # Session/Calls/CallVC.swift # Session/Conversations/Input View/MentionSelectionView.swift # Session/Conversations/Message Cells/Content Views/MediaView.swift # Session/Conversations/Message Cells/Content Views/QuoteView.swift # Session/Conversations/Settings/ThreadSettingsViewModel.swift # Session/Meta/AppDelegate.swift # Session/Settings/SettingsViewModel.swift # Session/Utilities/ImageLoading+Convenience.swift # SessionMessagingKit/Configuration.swift # SessionMessagingKit/Database/Models/Interaction.swift # SessionMessagingKit/Database/Models/Profile.swift # SessionMessagingKit/Jobs/DisplayPictureDownloadJob.swift # SessionMessagingKit/LibSession/LibSession+SessionMessagingKit.swift # SessionMessagingKit/Messages/Visible Messages/VisibleMessage.swift # SessionMessagingKit/Sending & Receiving/MessageSender+Convenience.swift # SessionMessagingKit/Utilities/DisplayPictureManager.swift # SessionMessagingKit/Utilities/ProfilePictureView+Convenience.swift # SessionMessagingKitTests/Jobs/DisplayPictureDownloadJobSpec.swift # SessionMessagingKitTests/Jobs/MessageSendJobSpec.swift # SessionMessagingKitTests/LibSession/LibSessionGroupInfoSpec.swift # SessionMessagingKitTests/Open Groups/OpenGroupManagerSpec.swift # SessionMessagingKitTests/Sending & Receiving/MessageReceiverGroupsSpec.swift # SessionMessagingKitTests/_TestUtilities/CommonSMKMockExtensions.swift # SessionMessagingKitTests/_TestUtilities/MockImageDataManager.swift # SessionTests/Conversations/Settings/ThreadNotificationSettingsViewModelSpec.swift # SessionTests/Conversations/Settings/ThreadSettingsViewModelSpec.swift # SessionTests/Settings/NotificationContentViewModelSpec.swift # SessionUIKit/Components/SessionHostingViewController.swift # SessionUIKit/Components/SwiftUI/AttributedText.swift # SessionUIKit/Style Guide/ThemeManager.swift # SessionUIKit/Style Guide/Themes/SwiftUI+Theme.swift # SessionUIKit/Style Guide/Themes/Theme.swift # SessionUIKit/Style Guide/Themes/UIKit+Theme.swift # SessionUIKit/Types/ImageDataManager.swift # SessionUIKit/Utilities/MentionUtilities.swift # SignalUtilitiesKit/Media Viewing & Editing/Attachment Approval/AttachmentApprovalViewController.swift
167 lines
4.3 KiB
Swift
167 lines
4.3 KiB
Swift
// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
import SessionUtil
|
|
import SessionUIKit
|
|
import SessionUtilitiesKit
|
|
|
|
@testable import SessionMessagingKit
|
|
|
|
extension Message.Destination: Mocked {
|
|
static var mock: Message.Destination = .contact(publicKey: "")
|
|
}
|
|
|
|
extension LibSession.Config: Mocked {
|
|
static var mock: LibSession.Config = {
|
|
var conf = config_object()
|
|
return withUnsafeMutablePointer(to: &conf) { .contacts($0) }
|
|
}()
|
|
}
|
|
|
|
extension ConfigDump.Variant: Mocked {
|
|
static var mock: ConfigDump.Variant = .userProfile
|
|
}
|
|
|
|
extension LibSession.CacheBehaviour: Mocked {
|
|
static var mock: LibSession.CacheBehaviour = .skipAutomaticConfigSync
|
|
}
|
|
|
|
extension LibSession.OpenGroupUrlInfo: Mocked {
|
|
static var mock: LibSession.OpenGroupUrlInfo = LibSession.OpenGroupUrlInfo(
|
|
threadId: .mock,
|
|
server: .mock,
|
|
roomToken: .mock,
|
|
publicKey: .mock
|
|
)
|
|
}
|
|
|
|
extension ObservableKey: Mocked {
|
|
static var mock: ObservableKey = "mockObservableKey"
|
|
}
|
|
|
|
extension SessionThread: Mocked {
|
|
static var mock: SessionThread = SessionThread(
|
|
id: .mock,
|
|
variant: .contact,
|
|
creationDateTimestamp: 0,
|
|
shouldBeVisible: false,
|
|
isPinned: false,
|
|
messageDraft: nil,
|
|
notificationSound: nil,
|
|
mutedUntilTimestamp: nil,
|
|
onlyNotifyForMentions: false,
|
|
markedAsUnread: nil,
|
|
pinnedPriority: nil
|
|
)
|
|
}
|
|
|
|
extension SessionThread.Variant: Mocked {
|
|
static var mock: SessionThread.Variant = .contact
|
|
}
|
|
|
|
extension Interaction.Variant: Mocked {
|
|
static var mock: Interaction.Variant = .standardIncoming
|
|
}
|
|
|
|
extension Interaction: Mocked {
|
|
static var mock: Interaction = Interaction(
|
|
id: 123456,
|
|
serverHash: .mock,
|
|
messageUuid: nil,
|
|
threadId: .mock,
|
|
authorId: .mock,
|
|
variant: .mock,
|
|
body: .mock,
|
|
timestampMs: 1234567890,
|
|
receivedAtTimestampMs: 1234567890,
|
|
wasRead: false,
|
|
hasMention: false,
|
|
expiresInSeconds: nil,
|
|
expiresStartedAtMs: nil,
|
|
linkPreviewUrl: nil,
|
|
openGroupServerMessageId: nil,
|
|
openGroupWhisper: false,
|
|
openGroupWhisperMods: false,
|
|
openGroupWhisperTo: nil,
|
|
state: .sent,
|
|
recipientReadTimestampMs: nil,
|
|
mostRecentFailureText: nil,
|
|
isProMessage: false
|
|
)
|
|
}
|
|
|
|
extension VisibleMessage: Mocked {
|
|
static var mock: VisibleMessage = VisibleMessage(text: "mock")
|
|
}
|
|
|
|
extension KeychainStorage.DataKey: Mocked {
|
|
static var mock: KeychainStorage.DataKey = .dbCipherKeySpec
|
|
}
|
|
|
|
extension NotificationCategory: Mocked {
|
|
static var mock: NotificationCategory = .incomingMessage
|
|
}
|
|
|
|
extension NotificationContent: Mocked {
|
|
static var mock: NotificationContent = NotificationContent(
|
|
threadId: .mock,
|
|
threadVariant: .mock,
|
|
identifier: .mock,
|
|
category: .mock,
|
|
applicationState: .any
|
|
)
|
|
}
|
|
|
|
extension Preferences.NotificationSettings: Mocked {
|
|
static var mock: Preferences.NotificationSettings = Preferences.NotificationSettings(
|
|
previewType: .mock,
|
|
sound: .mock,
|
|
mentionsOnly: false,
|
|
mutedUntil: nil
|
|
)
|
|
}
|
|
|
|
extension ImageDataManager.DataSource: Mocked {
|
|
static var mock: ImageDataManager.DataSource = ImageDataManager.DataSource.data("mock", Data([1, 2, 3]))
|
|
}
|
|
|
|
enum MockLibSessionConvertible: Int, Codable, LibSessionConvertibleEnum, Mocked {
|
|
typealias LibSessionType = Int
|
|
|
|
static var mock: MockLibSessionConvertible = .mockValue
|
|
|
|
case mockValue = 0
|
|
|
|
public static var defaultLibSessionValue: LibSessionType { 0 }
|
|
public var libSessionValue: LibSessionType { 0 }
|
|
|
|
public init(_ libSessionValue: LibSessionType) {
|
|
self = .mockValue
|
|
}
|
|
}
|
|
|
|
extension Preferences.Sound: Mocked {
|
|
static var mock: Preferences.Sound = .defaultNotificationSound
|
|
}
|
|
|
|
extension Preferences.NotificationPreviewType: Mocked {
|
|
static var mock: Preferences.NotificationPreviewType = .defaultPreviewType
|
|
}
|
|
|
|
extension Theme: Mocked {
|
|
static var mock: Theme = .defaultTheme
|
|
}
|
|
|
|
extension Theme.PrimaryColor: Mocked {
|
|
static var mock: Theme.PrimaryColor = .defaultPrimaryColor
|
|
}
|
|
|
|
extension ConfigDump: Mocked {
|
|
static var mock: ConfigDump = ConfigDump(
|
|
variant: .invalid,
|
|
sessionId: "",
|
|
data: Data(),
|
|
timestampMs: 1234567890
|
|
)
|
|
}
|