mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 03:48:27 +00:00
Update the SDK. (#3565)
* Update the SDK. * Add mockMXC URLs to fix all the crashes during tests. * Refactor Voice Messages to not use a MediaSource for local files.
This commit is contained in:
@@ -1200,12 +1200,7 @@ class AudioConverterMock: AudioConverterProtocol {
|
||||
}
|
||||
}
|
||||
class AudioPlayerMock: AudioPlayerProtocol {
|
||||
var actions: AnyPublisher<AudioPlayerAction, Never> {
|
||||
get { return underlyingActions }
|
||||
set(value) { underlyingActions = value }
|
||||
}
|
||||
var underlyingActions: AnyPublisher<AudioPlayerAction, Never>!
|
||||
var mediaSource: MediaSourceProxy?
|
||||
var sourceURL: URL?
|
||||
var duration: TimeInterval {
|
||||
get { return underlyingDuration }
|
||||
set(value) { underlyingDuration = value }
|
||||
@@ -1216,24 +1211,29 @@ class AudioPlayerMock: AudioPlayerProtocol {
|
||||
set(value) { underlyingCurrentTime = value }
|
||||
}
|
||||
var underlyingCurrentTime: TimeInterval!
|
||||
var url: URL?
|
||||
var playbackURL: URL?
|
||||
var state: MediaPlayerState {
|
||||
get { return underlyingState }
|
||||
set(value) { underlyingState = value }
|
||||
}
|
||||
var underlyingState: MediaPlayerState!
|
||||
var actions: AnyPublisher<AudioPlayerAction, Never> {
|
||||
get { return underlyingActions }
|
||||
set(value) { underlyingActions = value }
|
||||
}
|
||||
var underlyingActions: AnyPublisher<AudioPlayerAction, Never>!
|
||||
|
||||
//MARK: - load
|
||||
|
||||
var loadMediaSourceUsingAutoplayUnderlyingCallsCount = 0
|
||||
var loadMediaSourceUsingAutoplayCallsCount: Int {
|
||||
var loadSourceURLPlaybackURLAutoplayUnderlyingCallsCount = 0
|
||||
var loadSourceURLPlaybackURLAutoplayCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return loadMediaSourceUsingAutoplayUnderlyingCallsCount
|
||||
return loadSourceURLPlaybackURLAutoplayUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = loadMediaSourceUsingAutoplayUnderlyingCallsCount
|
||||
returnValue = loadSourceURLPlaybackURLAutoplayUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
@@ -1241,28 +1241,28 @@ class AudioPlayerMock: AudioPlayerProtocol {
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
loadMediaSourceUsingAutoplayUnderlyingCallsCount = newValue
|
||||
loadSourceURLPlaybackURLAutoplayUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
loadMediaSourceUsingAutoplayUnderlyingCallsCount = newValue
|
||||
loadSourceURLPlaybackURLAutoplayUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var loadMediaSourceUsingAutoplayCalled: Bool {
|
||||
return loadMediaSourceUsingAutoplayCallsCount > 0
|
||||
var loadSourceURLPlaybackURLAutoplayCalled: Bool {
|
||||
return loadSourceURLPlaybackURLAutoplayCallsCount > 0
|
||||
}
|
||||
var loadMediaSourceUsingAutoplayReceivedArguments: (mediaSource: MediaSourceProxy, url: URL, autoplay: Bool)?
|
||||
var loadMediaSourceUsingAutoplayReceivedInvocations: [(mediaSource: MediaSourceProxy, url: URL, autoplay: Bool)] = []
|
||||
var loadMediaSourceUsingAutoplayClosure: ((MediaSourceProxy, URL, Bool) -> Void)?
|
||||
var loadSourceURLPlaybackURLAutoplayReceivedArguments: (sourceURL: URL, playbackURL: URL, autoplay: Bool)?
|
||||
var loadSourceURLPlaybackURLAutoplayReceivedInvocations: [(sourceURL: URL, playbackURL: URL, autoplay: Bool)] = []
|
||||
var loadSourceURLPlaybackURLAutoplayClosure: ((URL, URL, Bool) -> Void)?
|
||||
|
||||
func load(mediaSource: MediaSourceProxy, using url: URL, autoplay: Bool) {
|
||||
loadMediaSourceUsingAutoplayCallsCount += 1
|
||||
loadMediaSourceUsingAutoplayReceivedArguments = (mediaSource: mediaSource, url: url, autoplay: autoplay)
|
||||
func load(sourceURL: URL, playbackURL: URL, autoplay: Bool) {
|
||||
loadSourceURLPlaybackURLAutoplayCallsCount += 1
|
||||
loadSourceURLPlaybackURLAutoplayReceivedArguments = (sourceURL: sourceURL, playbackURL: playbackURL, autoplay: autoplay)
|
||||
DispatchQueue.main.async {
|
||||
self.loadMediaSourceUsingAutoplayReceivedInvocations.append((mediaSource: mediaSource, url: url, autoplay: autoplay))
|
||||
self.loadSourceURLPlaybackURLAutoplayReceivedInvocations.append((sourceURL: sourceURL, playbackURL: playbackURL, autoplay: autoplay))
|
||||
}
|
||||
loadMediaSourceUsingAutoplayClosure?(mediaSource, url, autoplay)
|
||||
loadSourceURLPlaybackURLAutoplayClosure?(sourceURL, playbackURL, autoplay)
|
||||
}
|
||||
//MARK: - reset
|
||||
|
||||
@@ -9812,320 +9812,13 @@ class MediaLoaderMock: MediaLoaderProtocol {
|
||||
}
|
||||
}
|
||||
}
|
||||
class MediaPlayerMock: MediaPlayerProtocol {
|
||||
var mediaSource: MediaSourceProxy?
|
||||
var duration: TimeInterval {
|
||||
get { return underlyingDuration }
|
||||
set(value) { underlyingDuration = value }
|
||||
}
|
||||
var underlyingDuration: TimeInterval!
|
||||
var currentTime: TimeInterval {
|
||||
get { return underlyingCurrentTime }
|
||||
set(value) { underlyingCurrentTime = value }
|
||||
}
|
||||
var underlyingCurrentTime: TimeInterval!
|
||||
var url: URL?
|
||||
var state: MediaPlayerState {
|
||||
get { return underlyingState }
|
||||
set(value) { underlyingState = value }
|
||||
}
|
||||
var underlyingState: MediaPlayerState!
|
||||
|
||||
//MARK: - load
|
||||
|
||||
var loadMediaSourceUsingAutoplayUnderlyingCallsCount = 0
|
||||
var loadMediaSourceUsingAutoplayCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return loadMediaSourceUsingAutoplayUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = loadMediaSourceUsingAutoplayUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
loadMediaSourceUsingAutoplayUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
loadMediaSourceUsingAutoplayUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var loadMediaSourceUsingAutoplayCalled: Bool {
|
||||
return loadMediaSourceUsingAutoplayCallsCount > 0
|
||||
}
|
||||
var loadMediaSourceUsingAutoplayReceivedArguments: (mediaSource: MediaSourceProxy, url: URL, autoplay: Bool)?
|
||||
var loadMediaSourceUsingAutoplayReceivedInvocations: [(mediaSource: MediaSourceProxy, url: URL, autoplay: Bool)] = []
|
||||
var loadMediaSourceUsingAutoplayClosure: ((MediaSourceProxy, URL, Bool) -> Void)?
|
||||
|
||||
func load(mediaSource: MediaSourceProxy, using url: URL, autoplay: Bool) {
|
||||
loadMediaSourceUsingAutoplayCallsCount += 1
|
||||
loadMediaSourceUsingAutoplayReceivedArguments = (mediaSource: mediaSource, url: url, autoplay: autoplay)
|
||||
DispatchQueue.main.async {
|
||||
self.loadMediaSourceUsingAutoplayReceivedInvocations.append((mediaSource: mediaSource, url: url, autoplay: autoplay))
|
||||
}
|
||||
loadMediaSourceUsingAutoplayClosure?(mediaSource, url, autoplay)
|
||||
}
|
||||
//MARK: - reset
|
||||
|
||||
var resetUnderlyingCallsCount = 0
|
||||
var resetCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return resetUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = resetUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
resetUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
resetUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var resetCalled: Bool {
|
||||
return resetCallsCount > 0
|
||||
}
|
||||
var resetClosure: (() -> Void)?
|
||||
|
||||
func reset() {
|
||||
resetCallsCount += 1
|
||||
resetClosure?()
|
||||
}
|
||||
//MARK: - play
|
||||
|
||||
var playUnderlyingCallsCount = 0
|
||||
var playCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return playUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = playUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
playUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
playUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var playCalled: Bool {
|
||||
return playCallsCount > 0
|
||||
}
|
||||
var playClosure: (() -> Void)?
|
||||
|
||||
func play() {
|
||||
playCallsCount += 1
|
||||
playClosure?()
|
||||
}
|
||||
//MARK: - pause
|
||||
|
||||
var pauseUnderlyingCallsCount = 0
|
||||
var pauseCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return pauseUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = pauseUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
pauseUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
pauseUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var pauseCalled: Bool {
|
||||
return pauseCallsCount > 0
|
||||
}
|
||||
var pauseClosure: (() -> Void)?
|
||||
|
||||
func pause() {
|
||||
pauseCallsCount += 1
|
||||
pauseClosure?()
|
||||
}
|
||||
//MARK: - stop
|
||||
|
||||
var stopUnderlyingCallsCount = 0
|
||||
var stopCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return stopUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = stopUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
stopUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
stopUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var stopCalled: Bool {
|
||||
return stopCallsCount > 0
|
||||
}
|
||||
var stopClosure: (() -> Void)?
|
||||
|
||||
func stop() {
|
||||
stopCallsCount += 1
|
||||
stopClosure?()
|
||||
}
|
||||
//MARK: - seek
|
||||
|
||||
var seekToUnderlyingCallsCount = 0
|
||||
var seekToCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return seekToUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = seekToUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
seekToUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
seekToUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var seekToCalled: Bool {
|
||||
return seekToCallsCount > 0
|
||||
}
|
||||
var seekToReceivedProgress: Double?
|
||||
var seekToReceivedInvocations: [Double] = []
|
||||
var seekToClosure: ((Double) async -> Void)?
|
||||
|
||||
func seek(to progress: Double) async {
|
||||
seekToCallsCount += 1
|
||||
seekToReceivedProgress = progress
|
||||
DispatchQueue.main.async {
|
||||
self.seekToReceivedInvocations.append(progress)
|
||||
}
|
||||
await seekToClosure?(progress)
|
||||
}
|
||||
}
|
||||
class MediaPlayerProviderMock: MediaPlayerProviderProtocol {
|
||||
|
||||
//MARK: - player
|
||||
|
||||
var playerForUnderlyingCallsCount = 0
|
||||
var playerForCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return playerForUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = playerForUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
playerForUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
playerForUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
var player: AudioPlayerProtocol {
|
||||
get { return underlyingPlayer }
|
||||
set(value) { underlyingPlayer = value }
|
||||
}
|
||||
var playerForCalled: Bool {
|
||||
return playerForCallsCount > 0
|
||||
}
|
||||
var playerForReceivedMediaSource: MediaSourceProxy?
|
||||
var playerForReceivedInvocations: [MediaSourceProxy] = []
|
||||
var underlyingPlayer: AudioPlayerProtocol!
|
||||
|
||||
var playerForUnderlyingReturnValue: Result<MediaPlayerProtocol, MediaPlayerProviderError>!
|
||||
var playerForReturnValue: Result<MediaPlayerProtocol, MediaPlayerProviderError>! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return playerForUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: Result<MediaPlayerProtocol, MediaPlayerProviderError>? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = playerForUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
playerForUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
playerForUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var playerForClosure: ((MediaSourceProxy) -> Result<MediaPlayerProtocol, MediaPlayerProviderError>)?
|
||||
|
||||
func player(for mediaSource: MediaSourceProxy) -> Result<MediaPlayerProtocol, MediaPlayerProviderError> {
|
||||
playerForCallsCount += 1
|
||||
playerForReceivedMediaSource = mediaSource
|
||||
DispatchQueue.main.async {
|
||||
self.playerForReceivedInvocations.append(mediaSource)
|
||||
}
|
||||
if let playerForClosure = playerForClosure {
|
||||
return playerForClosure(mediaSource)
|
||||
} else {
|
||||
return playerForReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - playerState
|
||||
|
||||
var playerStateForUnderlyingCallsCount = 0
|
||||
|
||||
@@ -18,7 +18,8 @@ extension MediaProviderMock {
|
||||
return nil
|
||||
}
|
||||
|
||||
if mediaSource?.url == .picturesDirectory {
|
||||
// At some stage it would be nice to return different images, but for now they can be the same.
|
||||
if mediaSource?.url == .mockMXCImage || mediaSource?.url == .mockMXCAvatar {
|
||||
return Asset.Images.appLogo.image
|
||||
}
|
||||
|
||||
|
||||
@@ -43,14 +43,14 @@ extension RoomMemberProxyMock {
|
||||
static var mockMe: RoomMemberProxyMock {
|
||||
RoomMemberProxyMock(with: .init(userID: "@me:matrix.org",
|
||||
displayName: "Me",
|
||||
avatarURL: URL.picturesDirectory,
|
||||
avatarURL: .mockMXCAvatar,
|
||||
membership: .join))
|
||||
}
|
||||
|
||||
static var mockMeAdmin: RoomMemberProxyMock {
|
||||
RoomMemberProxyMock(with: .init(userID: "@me:matrix.org",
|
||||
displayName: "Me",
|
||||
avatarURL: URL.picturesDirectory,
|
||||
avatarURL: .mockMXCAvatar,
|
||||
membership: .join,
|
||||
powerLevel: 100,
|
||||
role: .administrator))
|
||||
@@ -83,7 +83,7 @@ extension RoomMemberProxyMock {
|
||||
static var mockDan: RoomMemberProxyMock {
|
||||
RoomMemberProxyMock(with: .init(userID: "@dan:matrix.org",
|
||||
displayName: "Dan",
|
||||
avatarURL: URL.picturesDirectory,
|
||||
avatarURL: .mockMXCAvatar,
|
||||
membership: .join))
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ extension Array where Element == RoomSummary {
|
||||
joinRequestType: nil,
|
||||
name: "Foundation and Empire",
|
||||
isDirect: false,
|
||||
avatarURL: URL.picturesDirectory,
|
||||
avatarURL: .mockMXCAvatar,
|
||||
heroes: [],
|
||||
lastMessage: AttributedString("How do you see the Emperor then? You think he keeps office hours?"),
|
||||
lastMessageFormattedTimestamp: "2:56 PM",
|
||||
@@ -226,7 +226,7 @@ extension Array where Element == RoomSummary {
|
||||
joinRequestType: .invite(inviter: RoomMemberProxyMock.mockCharlie),
|
||||
name: "First room",
|
||||
isDirect: false,
|
||||
avatarURL: URL.picturesDirectory,
|
||||
avatarURL: .mockMXCAvatar,
|
||||
heroes: [],
|
||||
lastMessage: nil,
|
||||
lastMessageFormattedTimestamp: nil,
|
||||
|
||||
@@ -100,4 +100,12 @@ extension URL: @retroactive ExpressibleByStringLiteral {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MARK: Mocks
|
||||
|
||||
static var mockMXCAudio: URL { "mxc://matrix.org/1234567890FiLe" }
|
||||
static var mockMXCFile: URL { "mxc://matrix.org/1234567890FiLe" }
|
||||
static var mockMXCImage: URL { "mxc://matrix.org/1234567890ImAgE" }
|
||||
static var mockMXCVideo: URL { "mxc://matrix.org/1234567890ViDeO" }
|
||||
static var mockMXCAvatar: URL { "mxc://matrix.org/1234567890AvAtAr" }
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ struct AvatarHeaderView_Previews: PreviewProvider, TestablePreview {
|
||||
name: "Test Room",
|
||||
avatar: .room(id: "@test:matrix.org",
|
||||
name: "Test Room",
|
||||
avatarURL: .picturesDirectory),
|
||||
avatarURL: .mockMXCAvatar),
|
||||
canonicalAlias: "#test:matrix.org",
|
||||
isEncrypted: true,
|
||||
isPublic: true),
|
||||
|
||||
@@ -97,7 +97,7 @@ struct RoomAvatarImage_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
RoomAvatarImage(avatar: .room(id: "!2:server.com",
|
||||
name: "Room",
|
||||
avatarURL: .picturesDirectory),
|
||||
avatarURL: .mockMXCAvatar),
|
||||
avatarSize: .room(on: .home),
|
||||
mediaProvider: MediaProviderMock(configuration: .init()))
|
||||
|
||||
@@ -109,7 +109,7 @@ struct RoomAvatarImage_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
RoomAvatarImage(avatar: .heroes([.init(userID: "@user:server.com",
|
||||
displayName: "User",
|
||||
avatarURL: .picturesDirectory)]),
|
||||
avatarURL: .mockMXCAvatar)]),
|
||||
avatarSize: .room(on: .home),
|
||||
mediaProvider: MediaProviderMock(configuration: .init()))
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ struct RoomHeaderView_Previews: PreviewProvider, TestablePreview {
|
||||
RoomHeaderView(roomName: "Some Room name",
|
||||
roomAvatar: .room(id: "1",
|
||||
name: "Some Room Name",
|
||||
avatarURL: URL.picturesDirectory),
|
||||
avatarURL: .mockMXCAvatar),
|
||||
mediaProvider: MediaProviderMock(configuration: .init()))
|
||||
.previewLayout(.sizeThatFits)
|
||||
.padding()
|
||||
|
||||
@@ -46,7 +46,7 @@ struct GlobalSearchScreenListRow_Previews: PreviewProvider, TestablePreview {
|
||||
description: "The best place in the whole wide world",
|
||||
avatar: .room(id: "123",
|
||||
name: "Tech central",
|
||||
avatarURL: .picturesDirectory)),
|
||||
avatarURL: .mockMXCAvatar)),
|
||||
context: viewModel.context)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ struct HomeScreenInviteCell_Previews: PreviewProvider, TestablePreview {
|
||||
HomeScreenInviteCell(room: .roomInvite(),
|
||||
context: viewModel().context)
|
||||
|
||||
HomeScreenInviteCell(room: .roomInvite(alias: "#footest:somewhere.org", avatarURL: .picturesDirectory),
|
||||
HomeScreenInviteCell(room: .roomInvite(alias: "#footest:somewhere.org", avatarURL: .mockMXCAvatar),
|
||||
context: viewModel().context)
|
||||
|
||||
HomeScreenInviteCell(room: .roomInvite(alias: "#footest:somewhere.org"),
|
||||
|
||||
@@ -119,7 +119,7 @@ struct HomeScreenKnockedCell_Previews: PreviewProvider, TestablePreview {
|
||||
HomeScreenKnockedCell(room: .roomKnocked(),
|
||||
context: viewModel().context)
|
||||
|
||||
HomeScreenKnockedCell(room: .roomKnocked(alias: "#footest:somewhere.org", avatarURL: .picturesDirectory),
|
||||
HomeScreenKnockedCell(room: .roomKnocked(alias: "#footest:somewhere.org", avatarURL: .mockMXCAvatar),
|
||||
context: viewModel().context)
|
||||
|
||||
HomeScreenKnockedCell(room: .roomKnocked(alias: "#footest:somewhere.org"),
|
||||
|
||||
@@ -237,11 +237,11 @@ struct JoinRoomScreen_Previews: PreviewProvider, TestablePreview {
|
||||
switch mode {
|
||||
case .knocked:
|
||||
clientProxy.roomForIdentifierClosure = { _ in
|
||||
.knocked(KnockedRoomProxyMock(.init(avatarURL: URL.homeDirectory)))
|
||||
.knocked(KnockedRoomProxyMock(.init(avatarURL: .mockMXCAvatar)))
|
||||
}
|
||||
case .invited:
|
||||
clientProxy.roomForIdentifierClosure = { _ in
|
||||
.invited(InvitedRoomProxyMock(.init(avatarURL: URL.homeDirectory)))
|
||||
.invited(InvitedRoomProxyMock(.init(avatarURL: .mockMXCAvatar)))
|
||||
}
|
||||
default:
|
||||
break
|
||||
@@ -251,7 +251,7 @@ struct JoinRoomScreen_Previews: PreviewProvider, TestablePreview {
|
||||
canonicalAlias: "#3🌞problem:matrix.org",
|
||||
// swiftlint:disable:next line_length
|
||||
topic: "“Science and technology were the only keys to opening the door to the future, and people approached science with the faith and sincerity of elementary school students.”",
|
||||
avatarURL: URL.homeDirectory,
|
||||
avatarURL: .mockMXCAvatar,
|
||||
memberCount: UInt(100),
|
||||
isHistoryWorldReadable: false,
|
||||
isJoined: membership.isJoined,
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ struct RoomDirectorySearchScreen_Previews: PreviewProvider, TestablePreview {
|
||||
topic: nil,
|
||||
avatar: .room(id: "test_2",
|
||||
name: "Test 2",
|
||||
avatarURL: .documentsDirectory),
|
||||
avatarURL: .mockMXCAvatar),
|
||||
canBeJoined: false)]
|
||||
|
||||
let roomDirectorySearchProxy = RoomDirectorySearchProxyMock(configuration: .init(results: results))
|
||||
|
||||
+2
-2
@@ -88,13 +88,13 @@ struct RoomMembersListMemberCell_Previews: PreviewProvider, TestablePreview {
|
||||
.mockAdmin,
|
||||
.mockModerator,
|
||||
.init(with: .init(userID: "@nodisplayname:matrix.org", membership: .join)),
|
||||
.init(with: .init(userID: "@avatar:matrix.org", displayName: "Avatar", avatarURL: .picturesDirectory, membership: .join))
|
||||
.init(with: .init(userID: "@avatar:matrix.org", displayName: "Avatar", avatarURL: .mockMXCAvatar, membership: .join))
|
||||
]
|
||||
|
||||
static let bannedMembers: [RoomMemberProxyMock] = [
|
||||
.init(with: .init(userID: "@nodisplayname:matrix.org", membership: .ban)),
|
||||
.init(with: .init(userID: "@fake:matrix.org", displayName: "President", membership: .ban)),
|
||||
.init(with: .init(userID: "@badavatar:matrix.org", avatarURL: .picturesDirectory, membership: .ban))
|
||||
.init(with: .init(userID: "@badavatar:matrix.org", avatarURL: .mockMXCAvatar, membership: .ban))
|
||||
]
|
||||
|
||||
static let viewModel = RoomMembersListScreenViewModel(roomProxy: JoinedRoomProxyMock(.init(name: "Some room",
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ struct CompletionSuggestion_Previews: PreviewProvider, TestablePreview {
|
||||
VStack(spacing: 8) {
|
||||
CompletionSuggestionView(mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
items: [.user(item: MentionSuggestionItem(id: "@user_mention_1:matrix.org", displayName: "User 1", avatarURL: nil, range: .init())),
|
||||
.user(item: MentionSuggestionItem(id: "@user_mention_2:matrix.org", displayName: "User 2", avatarURL: URL.documentsDirectory, range: .init()))]) { _ in }
|
||||
.user(item: MentionSuggestionItem(id: "@user_mention_2:matrix.org", displayName: "User 2", avatarURL: .mockMXCAvatar, range: .init()))]) { _ in }
|
||||
}
|
||||
VStack(spacing: 8) {
|
||||
CompletionSuggestionView(mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
|
||||
@@ -304,7 +304,7 @@ struct ComposerToolbar_Previews: PreviewProvider, TestablePreview {
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
static let suggestions: [SuggestionItem] = [.user(item: MentionSuggestionItem(id: "@user_mention_1:matrix.org", displayName: "User 1", avatarURL: nil, range: .init())),
|
||||
.user(item: MentionSuggestionItem(id: "@user_mention_2:matrix.org", displayName: "User 2", avatarURL: URL.documentsDirectory, range: .init()))]
|
||||
.user(item: MentionSuggestionItem(id: "@user_mention_2:matrix.org", displayName: "User 2", avatarURL: .mockMXCAvatar, range: .init()))]
|
||||
|
||||
static var previews: some View {
|
||||
ComposerToolbar.mock(focused: true)
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ struct MentionSuggestionItemView_Previews: PreviewProvider, TestablePreview {
|
||||
static let mockMediaProvider = MediaProviderMock(configuration: .init())
|
||||
|
||||
static var previews: some View {
|
||||
MentionSuggestionItemView(mediaProvider: mockMediaProvider, item: .init(id: "test", displayName: "Test", avatarURL: URL.documentsDirectory, range: .init()))
|
||||
MentionSuggestionItemView(mediaProvider: mockMediaProvider, item: .init(id: "test", displayName: "Test", avatarURL: .mockMXCAvatar, range: .init()))
|
||||
MentionSuggestionItemView(mediaProvider: mockMediaProvider, item: .init(id: "test2", displayName: nil, avatarURL: nil, range: .init()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,10 +408,7 @@ class TimelineInteractionHandler {
|
||||
return
|
||||
}
|
||||
|
||||
guard case .success(let mediaPlayer) = mediaPlayerProvider.player(for: source), let audioPlayer = mediaPlayer as? AudioPlayerProtocol else {
|
||||
MXLog.error("Cannot play a voice message without an audio player")
|
||||
return
|
||||
}
|
||||
let audioPlayer = mediaPlayerProvider.player
|
||||
|
||||
// Stop any recording in progress
|
||||
if voiceMessageRecorder.isRecording {
|
||||
@@ -430,7 +427,7 @@ class TimelineInteractionHandler {
|
||||
// Detach all other states
|
||||
await mediaPlayerProvider.detachAllStates(except: audioPlayerState)
|
||||
|
||||
guard audioPlayer.mediaSource == source, audioPlayer.state != .error else {
|
||||
guard audioPlayer.sourceURL == source.url, audioPlayer.state != .error else {
|
||||
// Load content
|
||||
do {
|
||||
MXLog.info("Loading voice message audio content from source for itemID \(itemID)")
|
||||
@@ -438,7 +435,7 @@ class TimelineInteractionHandler {
|
||||
|
||||
// Make sure that the player is still attached, as it may have been detached while waiting for the voice message to be loaded.
|
||||
if audioPlayerState.isAttached {
|
||||
audioPlayer.load(mediaSource: source, using: url, autoplay: true)
|
||||
audioPlayer.load(sourceURL: source.url, playbackURL: url, autoplay: true)
|
||||
}
|
||||
} catch {
|
||||
MXLog.error("Failed to load voice message: \(error)")
|
||||
|
||||
@@ -66,7 +66,7 @@ struct ReadReceiptCell_Previews: PreviewProvider, TestablePreview {
|
||||
ReadReceiptCell(readReceipt: .init(userID: "@test:matrix.org",
|
||||
formattedTimestamp: "10:00"),
|
||||
memberState: .init(displayName: "Test",
|
||||
avatarURL: URL.documentsDirectory),
|
||||
avatarURL: .mockMXCAvatar),
|
||||
mediaProvider: MediaProviderMock(configuration: .init()))
|
||||
.previewDisplayName("With Image")
|
||||
ReadReceiptCell(readReceipt: .init(userID: "@test:matrix.org",
|
||||
|
||||
@@ -22,7 +22,7 @@ private enum InternalAudioPlayerState {
|
||||
}
|
||||
|
||||
class AudioPlayer: NSObject, AudioPlayerProtocol {
|
||||
var mediaSource: MediaSourceProxy?
|
||||
var sourceURL: URL?
|
||||
|
||||
private var playerItem: AVPlayerItem?
|
||||
private var internalAudioPlayer: AVQueuePlayer?
|
||||
@@ -46,7 +46,7 @@ class AudioPlayer: NSObject, AudioPlayerProtocol {
|
||||
|
||||
private let releaseAudioSessionTimeoutInterval = 5.0
|
||||
|
||||
private(set) var url: URL?
|
||||
private(set) var playbackURL: URL?
|
||||
|
||||
private var deinitInProgress = false
|
||||
|
||||
@@ -86,13 +86,13 @@ class AudioPlayer: NSObject, AudioPlayerProtocol {
|
||||
unloadContent()
|
||||
}
|
||||
|
||||
func load(mediaSource: MediaSourceProxy, using url: URL, autoplay: Bool) {
|
||||
func load(sourceURL: URL, playbackURL: URL, autoplay: Bool) {
|
||||
unloadContent()
|
||||
setInternalState(.loading)
|
||||
self.mediaSource = mediaSource
|
||||
self.url = url
|
||||
self.sourceURL = sourceURL
|
||||
self.playbackURL = playbackURL
|
||||
self.autoplay = autoplay
|
||||
playerItem = AVPlayerItem(url: url)
|
||||
playerItem = AVPlayerItem(url: playbackURL)
|
||||
internalAudioPlayer = AVQueuePlayer(playerItem: playerItem)
|
||||
addObservers()
|
||||
}
|
||||
@@ -162,8 +162,8 @@ class AudioPlayer: NSObject, AudioPlayerProtocol {
|
||||
}
|
||||
|
||||
private func unloadContent() {
|
||||
mediaSource = nil
|
||||
url = nil
|
||||
sourceURL = nil
|
||||
playbackURL = nil
|
||||
internalAudioPlayer?.replaceCurrentItem(with: nil)
|
||||
internalAudioPlayer = nil
|
||||
playerItem = nil
|
||||
|
||||
@@ -12,6 +12,17 @@ enum AudioPlayerError: Error {
|
||||
case genericError
|
||||
}
|
||||
|
||||
// There used to be a MediaPlayerProtocol that AudioPlayerProtocol inherited from.
|
||||
// This should be called something else but we already have an AudioPlayerState,
|
||||
// AudioPlayerPlaybackState and InternalAudioPlayerState so who knows what to call this.
|
||||
enum MediaPlayerState {
|
||||
case loading
|
||||
case playing
|
||||
case paused
|
||||
case stopped
|
||||
case error
|
||||
}
|
||||
|
||||
enum AudioPlayerAction {
|
||||
case didStartLoading
|
||||
case didFinishLoading
|
||||
@@ -22,8 +33,21 @@ enum AudioPlayerAction {
|
||||
case didFailWithError(error: Error)
|
||||
}
|
||||
|
||||
protocol AudioPlayerProtocol: MediaPlayerProtocol {
|
||||
protocol AudioPlayerProtocol: AnyObject {
|
||||
var sourceURL: URL? { get }
|
||||
var duration: TimeInterval { get }
|
||||
var currentTime: TimeInterval { get }
|
||||
var playbackURL: URL? { get }
|
||||
var state: MediaPlayerState { get }
|
||||
|
||||
var actions: AnyPublisher<AudioPlayerAction, Never> { get }
|
||||
|
||||
func load(sourceURL: URL, playbackURL: URL, autoplay: Bool)
|
||||
func reset()
|
||||
func play()
|
||||
func pause()
|
||||
func stop()
|
||||
func seek(to progress: Double) async
|
||||
}
|
||||
|
||||
// sourcery: AutoMockable
|
||||
|
||||
@@ -134,7 +134,7 @@ class AudioPlayerState: ObservableObject, Identifiable {
|
||||
MXLog.info("updating duration: \(duration) -> \(audioPlayerDuration)")
|
||||
duration = audioPlayerDuration
|
||||
}
|
||||
fileURL = audioPlayer?.url
|
||||
fileURL = audioPlayer?.playbackURL
|
||||
playbackState = .readyToPlay
|
||||
case .didStartPlaying:
|
||||
if let audioPlayer {
|
||||
|
||||
@@ -68,7 +68,7 @@ struct RoomPreviewDetails {
|
||||
let topic: String?
|
||||
let avatarURL: URL?
|
||||
let memberCount: UInt
|
||||
let isHistoryWorldReadable: Bool
|
||||
let isHistoryWorldReadable: Bool?
|
||||
let isJoined: Bool
|
||||
let isInvited: Bool
|
||||
let isPublic: Bool
|
||||
|
||||
@@ -24,7 +24,10 @@ struct MediaSourceProxy: Hashable {
|
||||
}
|
||||
|
||||
init(url: URL, mimeType: String?) {
|
||||
underlyingSource = mediaSourceFromUrl(url: url.absoluteString)
|
||||
guard let mediaSource = try? MediaSource.fromUrl(url: url.absoluteString) else {
|
||||
fatalError("Unable to create MediaSource from URL: \(url.absoluteString)")
|
||||
}
|
||||
underlyingSource = mediaSource
|
||||
self.url = URL(string: underlyingSource.url())
|
||||
self.mimeType = mimeType
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
//
|
||||
// Copyright 2023, 2024 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
// Please see LICENSE in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum MediaPlayerState {
|
||||
case loading
|
||||
case playing
|
||||
case paused
|
||||
case stopped
|
||||
case error
|
||||
}
|
||||
|
||||
protocol MediaPlayerProtocol: AnyObject {
|
||||
var mediaSource: MediaSourceProxy? { get }
|
||||
var duration: TimeInterval { get }
|
||||
var currentTime: TimeInterval { get }
|
||||
var url: URL? { get }
|
||||
var state: MediaPlayerState { get }
|
||||
|
||||
func load(mediaSource: MediaSourceProxy, using url: URL, autoplay: Bool)
|
||||
func reset()
|
||||
func play()
|
||||
func pause()
|
||||
func stop()
|
||||
func seek(to progress: Double) async
|
||||
}
|
||||
|
||||
// sourcery: AutoMockable
|
||||
extension MediaPlayerProtocol { }
|
||||
@@ -11,24 +11,12 @@ class MediaPlayerProvider: MediaPlayerProviderProtocol {
|
||||
private lazy var audioPlayer = AudioPlayer()
|
||||
private var audioPlayerStates: [String: AudioPlayerState] = [:]
|
||||
|
||||
var player: AudioPlayerProtocol { audioPlayer }
|
||||
|
||||
deinit {
|
||||
audioPlayerStates = [:]
|
||||
}
|
||||
|
||||
func player(for mediaSource: MediaSourceProxy) -> Result<MediaPlayerProtocol, MediaPlayerProviderError> {
|
||||
guard let mimeType = mediaSource.mimeType else {
|
||||
MXLog.error("Unknown mime type")
|
||||
return .failure(.unsupportedMediaType)
|
||||
}
|
||||
|
||||
if mimeType.starts(with: "audio/") {
|
||||
return .success(audioPlayer)
|
||||
} else {
|
||||
MXLog.error("Unsupported media type: \(mediaSource.mimeType ?? "unknown")")
|
||||
return .failure(.unsupportedMediaType)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - AudioPlayer
|
||||
|
||||
func playerState(for id: AudioPlayerStateIdentifier) -> AudioPlayerState? {
|
||||
|
||||
@@ -13,7 +13,7 @@ enum MediaPlayerProviderError: Error {
|
||||
|
||||
@MainActor
|
||||
protocol MediaPlayerProviderProtocol {
|
||||
func player(for mediaSource: MediaSourceProxy) -> Result<MediaPlayerProtocol, MediaPlayerProviderError>
|
||||
var player: AudioPlayerProtocol { get }
|
||||
|
||||
func playerState(for id: AudioPlayerStateIdentifier) -> AudioPlayerState?
|
||||
func register(audioPlayerState: AudioPlayerState)
|
||||
|
||||
@@ -243,7 +243,7 @@ struct VideoInfoProxy: Hashable {
|
||||
}
|
||||
|
||||
static var mockVideo: VideoInfoProxy {
|
||||
.init(source: .init(url: .picturesDirectory, mimeType: nil),
|
||||
.init(source: .init(url: .mockMXCVideo, mimeType: nil),
|
||||
duration: 100,
|
||||
size: .init(width: 1920, height: 1080),
|
||||
aspectRatio: 1.78,
|
||||
@@ -292,14 +292,14 @@ struct ImageInfoProxy: Hashable {
|
||||
}
|
||||
|
||||
static var mockImage: ImageInfoProxy {
|
||||
.init(source: .init(url: .picturesDirectory, mimeType: "image/png"),
|
||||
.init(source: .init(url: .mockMXCImage, mimeType: "image/png"),
|
||||
size: .init(width: 100, height: 100),
|
||||
aspectRatio: 1,
|
||||
mimeType: "image/png")
|
||||
}
|
||||
|
||||
static var mockThumbnail: ImageInfoProxy {
|
||||
.init(source: .init(url: .picturesDirectory, mimeType: nil),
|
||||
.init(source: .init(url: .mockMXCImage, mimeType: nil),
|
||||
size: nil,
|
||||
aspectRatio: nil,
|
||||
mimeType: nil)
|
||||
|
||||
@@ -101,13 +101,12 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol {
|
||||
await previewAudioPlayerState.attachAudioPlayer(audioPlayer)
|
||||
}
|
||||
|
||||
if audioPlayer.url == url {
|
||||
if audioPlayer.playbackURL == url {
|
||||
audioPlayer.play()
|
||||
return .success(())
|
||||
}
|
||||
|
||||
let pendingMediaSource = MediaSourceProxy(url: url, mimeType: mp4accMimeType)
|
||||
audioPlayer.load(mediaSource: pendingMediaSource, using: url, autoplay: true)
|
||||
audioPlayer.load(sourceURL: url, playbackURL: url, autoplay: true)
|
||||
return .success(())
|
||||
}
|
||||
|
||||
@@ -242,10 +241,7 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol {
|
||||
previewAudioPlayerState = await AudioPlayerState(id: .recorderPreview, title: L10n.commonVoiceMessage, duration: recordingDuration, waveform: EstimatedWaveform(data: []))
|
||||
|
||||
// Build the preview audio player
|
||||
let mediaSource = MediaSourceProxy(url: url, mimeType: mp4accMimeType)
|
||||
guard case .success(let mediaPlayer) = await mediaPlayerProvider.player(for: mediaSource), let audioPlayer = mediaPlayer as? AudioPlayerProtocol else {
|
||||
return .failure(.previewNotAvailable)
|
||||
}
|
||||
let audioPlayer = await mediaPlayerProvider.player
|
||||
previewAudioPlayer = audioPlayer
|
||||
|
||||
return .success(())
|
||||
|
||||
@@ -253,7 +253,7 @@ class MockScreen: Identifiable {
|
||||
let timelineController = MockRoomTimelineController()
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.smallChunk
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "New room", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "New room", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
@@ -272,7 +272,7 @@ class MockScreen: Identifiable {
|
||||
let timelineController = MockRoomTimelineController()
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.default
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "New room", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "New room", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
@@ -291,7 +291,7 @@ class MockScreen: Identifiable {
|
||||
let timelineController = MockRoomTimelineController()
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.smallChunkWithReadReceipts
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "New room", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "New room", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
@@ -313,7 +313,7 @@ class MockScreen: Identifiable {
|
||||
timelineController.backPaginationResponses = [RoomTimelineItemFixtures.singleMessageChunk]
|
||||
timelineController.incomingItems = [RoomTimelineItemFixtures.incomingMessage]
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Small timeline", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Small timeline", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
@@ -335,7 +335,7 @@ class MockScreen: Identifiable {
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.smallChunk
|
||||
timelineController.backPaginationResponses = [RoomTimelineItemFixtures.largeChunk]
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Small timeline, paginating", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Small timeline, paginating", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
@@ -357,7 +357,7 @@ class MockScreen: Identifiable {
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.largeChunk
|
||||
timelineController.backPaginationResponses = [RoomTimelineItemFixtures.largeChunk]
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Large timeline", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Large timeline", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
@@ -380,7 +380,7 @@ class MockScreen: Identifiable {
|
||||
timelineController.backPaginationResponses = [RoomTimelineItemFixtures.largeChunk]
|
||||
timelineController.incomingItems = [RoomTimelineItemFixtures.incomingMessage]
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Large timeline", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Large timeline", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
@@ -402,7 +402,7 @@ class MockScreen: Identifiable {
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.largeChunk
|
||||
timelineController.incomingItems = [RoomTimelineItemFixtures.incomingMessage]
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Large timeline", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Large timeline", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
@@ -423,7 +423,7 @@ class MockScreen: Identifiable {
|
||||
let timelineController = MockRoomTimelineController()
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.permalinkChunk
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Timeline highlight", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Timeline highlight", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
@@ -458,7 +458,7 @@ class MockScreen: Identifiable {
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.disclosedPolls
|
||||
timelineController.incomingItems = []
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Polls timeline", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Polls timeline", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
@@ -480,7 +480,7 @@ class MockScreen: Identifiable {
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.undisclosedPolls
|
||||
timelineController.incomingItems = []
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Polls timeline", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Polls timeline", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
@@ -502,7 +502,7 @@ class MockScreen: Identifiable {
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.outgoingPolls
|
||||
timelineController.incomingItems = []
|
||||
let parameters = RoomScreenCoordinatorParameters(clientProxy: ClientProxyMock(),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Polls timeline", avatarURL: URL.picturesDirectory)),
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Polls timeline", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
|
||||
Reference in New Issue
Block a user