Skip to content

Commit

Permalink
Update the SDK and use media filename and caption internally. (#3375
Browse files Browse the repository at this point in the history
)

Doesn't render captions (other than in fallback places).
  • Loading branch information
pixlwave authored Oct 8, 2024
1 parent 794d0ee commit 6e51969
Show file tree
Hide file tree
Showing 42 changed files with 581 additions and 358 deletions.
5 changes: 5 additions & 0 deletions ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1921,6 +1921,7 @@
A84D413BF49F0E980F010A6B /* LogViewerScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewerScreenCoordinator.swift; sourceTree = "<group>"; };
A861DA5932B128FE1DCB5CE2 /* InviteUsersScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InviteUsersScreenCoordinator.swift; sourceTree = "<group>"; };
A8DF55467ED4CE76B7AE9A33 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
A9873374E72AA53260AE90A2 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/Localizable.strings; sourceTree = "<group>"; };
A9B069D7772DDF6513E0F1B8 /* AuthenticationFlowCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationFlowCoordinator.swift; sourceTree = "<group>"; };
A9E6065FC6BC4A1B4C629E08 /* TimelineItemMenuActionProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineItemMenuActionProvider.swift; sourceTree = "<group>"; };
A9FAFE1C2149E6AC8156ED2B /* Collection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Collection.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2065,6 +2066,7 @@
C6A9F49B3EE59147AF2F70BB /* SeparatorRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeparatorRoomTimelineItem.swift; sourceTree = "<group>"; };
C6FEA87EA3752203065ECE27 /* BugReportUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BugReportUITests.swift; sourceTree = "<group>"; };
C705E605EF57C19DBE86FFA1 /* PlaceholderAvatarImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceholderAvatarImage.swift; sourceTree = "<group>"; };
C715CFE00686DACA59D836EA /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/SAS.strings; sourceTree = "<group>"; };
C729D95CB4588D4D9AAC3DFA /* RoomChangePermissionsScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomChangePermissionsScreenModels.swift; sourceTree = "<group>"; };
C733D11B421CFE3A657EF230 /* test_image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = test_image.png; sourceTree = "<group>"; };
C75EF87651B00A176AB08E97 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5755,6 +5757,7 @@
en,
es,
et,
fa,
fr,
hu,
id,
Expand Down Expand Up @@ -7119,6 +7122,7 @@
7447C0AD7EF302CD027D6230 /* en */,
6722709BD6178E10B70C9641 /* es */,
F3C7252B3461D06175D975A4 /* et */,
C715CFE00686DACA59D836EA /* fa */,
CEE20623EB4A9B88FB29F2BA /* fr */,
D196116D2DD3F2757D45FCB7 /* hu */,
330AF4D121C3396F7A14B21D /* id */,
Expand Down Expand Up @@ -7178,6 +7182,7 @@
CACA846B3E3E9A521D98B178 /* en */,
CBBCC6E74774E79B599625D0 /* es */,
A443FAE2EE820A5790C35C8D /* et */,
A9873374E72AA53260AE90A2 /* fa */,
CC680E0E79D818706CB28CF8 /* fr */,
624244C398804ADC885239AA /* hu */,
EF98A02DED04075F7CF0C721 /* id */,
Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Mocks/ClientProxyMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ extension ClientProxyMock {

loadMediaContentForSourceThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic)
loadMediaThumbnailForSourceWidthHeightThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic)
loadMediaFileForSourceBodyThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic)
loadMediaFileForSourceFilenameThrowableError = ClientProxyError.sdkError(ClientProxyMockError.generic)

secureBackupController = {
let secureBackupController = SecureBackupControllerMock()
Expand Down
152 changes: 76 additions & 76 deletions ElementX/Sources/Mocks/Generated/GeneratedMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4710,76 +4710,76 @@ class ClientProxyMock: ClientProxyProtocol {
}
//MARK: - loadMediaFileForSource

var loadMediaFileForSourceBodyThrowableError: Error?
var loadMediaFileForSourceBodyUnderlyingCallsCount = 0
var loadMediaFileForSourceBodyCallsCount: Int {
var loadMediaFileForSourceFilenameThrowableError: Error?
var loadMediaFileForSourceFilenameUnderlyingCallsCount = 0
var loadMediaFileForSourceFilenameCallsCount: Int {
get {
if Thread.isMainThread {
return loadMediaFileForSourceBodyUnderlyingCallsCount
return loadMediaFileForSourceFilenameUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = loadMediaFileForSourceBodyUnderlyingCallsCount
returnValue = loadMediaFileForSourceFilenameUnderlyingCallsCount
}

return returnValue!
}
}
set {
if Thread.isMainThread {
loadMediaFileForSourceBodyUnderlyingCallsCount = newValue
loadMediaFileForSourceFilenameUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
loadMediaFileForSourceBodyUnderlyingCallsCount = newValue
loadMediaFileForSourceFilenameUnderlyingCallsCount = newValue
}
}
}
}
var loadMediaFileForSourceBodyCalled: Bool {
return loadMediaFileForSourceBodyCallsCount > 0
var loadMediaFileForSourceFilenameCalled: Bool {
return loadMediaFileForSourceFilenameCallsCount > 0
}
var loadMediaFileForSourceBodyReceivedArguments: (source: MediaSourceProxy, body: String?)?
var loadMediaFileForSourceBodyReceivedInvocations: [(source: MediaSourceProxy, body: String?)] = []
var loadMediaFileForSourceFilenameReceivedArguments: (source: MediaSourceProxy, filename: String?)?
var loadMediaFileForSourceFilenameReceivedInvocations: [(source: MediaSourceProxy, filename: String?)] = []

var loadMediaFileForSourceBodyUnderlyingReturnValue: MediaFileHandleProxy!
var loadMediaFileForSourceBodyReturnValue: MediaFileHandleProxy! {
var loadMediaFileForSourceFilenameUnderlyingReturnValue: MediaFileHandleProxy!
var loadMediaFileForSourceFilenameReturnValue: MediaFileHandleProxy! {
get {
if Thread.isMainThread {
return loadMediaFileForSourceBodyUnderlyingReturnValue
return loadMediaFileForSourceFilenameUnderlyingReturnValue
} else {
var returnValue: MediaFileHandleProxy? = nil
DispatchQueue.main.sync {
returnValue = loadMediaFileForSourceBodyUnderlyingReturnValue
returnValue = loadMediaFileForSourceFilenameUnderlyingReturnValue
}

return returnValue!
}
}
set {
if Thread.isMainThread {
loadMediaFileForSourceBodyUnderlyingReturnValue = newValue
loadMediaFileForSourceFilenameUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
loadMediaFileForSourceBodyUnderlyingReturnValue = newValue
loadMediaFileForSourceFilenameUnderlyingReturnValue = newValue
}
}
}
}
var loadMediaFileForSourceBodyClosure: ((MediaSourceProxy, String?) async throws -> MediaFileHandleProxy)?
var loadMediaFileForSourceFilenameClosure: ((MediaSourceProxy, String?) async throws -> MediaFileHandleProxy)?

func loadMediaFileForSource(_ source: MediaSourceProxy, body: String?) async throws -> MediaFileHandleProxy {
if let error = loadMediaFileForSourceBodyThrowableError {
func loadMediaFileForSource(_ source: MediaSourceProxy, filename: String?) async throws -> MediaFileHandleProxy {
if let error = loadMediaFileForSourceFilenameThrowableError {
throw error
}
loadMediaFileForSourceBodyCallsCount += 1
loadMediaFileForSourceBodyReceivedArguments = (source: source, body: body)
loadMediaFileForSourceFilenameCallsCount += 1
loadMediaFileForSourceFilenameReceivedArguments = (source: source, filename: filename)
DispatchQueue.main.async {
self.loadMediaFileForSourceBodyReceivedInvocations.append((source: source, body: body))
self.loadMediaFileForSourceFilenameReceivedInvocations.append((source: source, filename: filename))
}
if let loadMediaFileForSourceBodyClosure = loadMediaFileForSourceBodyClosure {
return try await loadMediaFileForSourceBodyClosure(source, body)
if let loadMediaFileForSourceFilenameClosure = loadMediaFileForSourceFilenameClosure {
return try await loadMediaFileForSourceFilenameClosure(source, filename)
} else {
return loadMediaFileForSourceBodyReturnValue
return loadMediaFileForSourceFilenameReturnValue
}
}
}
Expand Down Expand Up @@ -9693,76 +9693,76 @@ class MediaLoaderMock: MediaLoaderProtocol {
}
//MARK: - loadMediaFileForSource

var loadMediaFileForSourceBodyThrowableError: Error?
var loadMediaFileForSourceBodyUnderlyingCallsCount = 0
var loadMediaFileForSourceBodyCallsCount: Int {
var loadMediaFileForSourceFilenameThrowableError: Error?
var loadMediaFileForSourceFilenameUnderlyingCallsCount = 0
var loadMediaFileForSourceFilenameCallsCount: Int {
get {
if Thread.isMainThread {
return loadMediaFileForSourceBodyUnderlyingCallsCount
return loadMediaFileForSourceFilenameUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = loadMediaFileForSourceBodyUnderlyingCallsCount
returnValue = loadMediaFileForSourceFilenameUnderlyingCallsCount
}

return returnValue!
}
}
set {
if Thread.isMainThread {
loadMediaFileForSourceBodyUnderlyingCallsCount = newValue
loadMediaFileForSourceFilenameUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
loadMediaFileForSourceBodyUnderlyingCallsCount = newValue
loadMediaFileForSourceFilenameUnderlyingCallsCount = newValue
}
}
}
}
var loadMediaFileForSourceBodyCalled: Bool {
return loadMediaFileForSourceBodyCallsCount > 0
var loadMediaFileForSourceFilenameCalled: Bool {
return loadMediaFileForSourceFilenameCallsCount > 0
}
var loadMediaFileForSourceBodyReceivedArguments: (source: MediaSourceProxy, body: String?)?
var loadMediaFileForSourceBodyReceivedInvocations: [(source: MediaSourceProxy, body: String?)] = []
var loadMediaFileForSourceFilenameReceivedArguments: (source: MediaSourceProxy, filename: String?)?
var loadMediaFileForSourceFilenameReceivedInvocations: [(source: MediaSourceProxy, filename: String?)] = []

var loadMediaFileForSourceBodyUnderlyingReturnValue: MediaFileHandleProxy!
var loadMediaFileForSourceBodyReturnValue: MediaFileHandleProxy! {
var loadMediaFileForSourceFilenameUnderlyingReturnValue: MediaFileHandleProxy!
var loadMediaFileForSourceFilenameReturnValue: MediaFileHandleProxy! {
get {
if Thread.isMainThread {
return loadMediaFileForSourceBodyUnderlyingReturnValue
return loadMediaFileForSourceFilenameUnderlyingReturnValue
} else {
var returnValue: MediaFileHandleProxy? = nil
DispatchQueue.main.sync {
returnValue = loadMediaFileForSourceBodyUnderlyingReturnValue
returnValue = loadMediaFileForSourceFilenameUnderlyingReturnValue
}

return returnValue!
}
}
set {
if Thread.isMainThread {
loadMediaFileForSourceBodyUnderlyingReturnValue = newValue
loadMediaFileForSourceFilenameUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
loadMediaFileForSourceBodyUnderlyingReturnValue = newValue
loadMediaFileForSourceFilenameUnderlyingReturnValue = newValue
}
}
}
}
var loadMediaFileForSourceBodyClosure: ((MediaSourceProxy, String?) async throws -> MediaFileHandleProxy)?
var loadMediaFileForSourceFilenameClosure: ((MediaSourceProxy, String?) async throws -> MediaFileHandleProxy)?

func loadMediaFileForSource(_ source: MediaSourceProxy, body: String?) async throws -> MediaFileHandleProxy {
if let error = loadMediaFileForSourceBodyThrowableError {
func loadMediaFileForSource(_ source: MediaSourceProxy, filename: String?) async throws -> MediaFileHandleProxy {
if let error = loadMediaFileForSourceFilenameThrowableError {
throw error
}
loadMediaFileForSourceBodyCallsCount += 1
loadMediaFileForSourceBodyReceivedArguments = (source: source, body: body)
loadMediaFileForSourceFilenameCallsCount += 1
loadMediaFileForSourceFilenameReceivedArguments = (source: source, filename: filename)
DispatchQueue.main.async {
self.loadMediaFileForSourceBodyReceivedInvocations.append((source: source, body: body))
self.loadMediaFileForSourceFilenameReceivedInvocations.append((source: source, filename: filename))
}
if let loadMediaFileForSourceBodyClosure = loadMediaFileForSourceBodyClosure {
return try await loadMediaFileForSourceBodyClosure(source, body)
if let loadMediaFileForSourceFilenameClosure = loadMediaFileForSourceFilenameClosure {
return try await loadMediaFileForSourceFilenameClosure(source, filename)
} else {
return loadMediaFileForSourceBodyReturnValue
return loadMediaFileForSourceFilenameReturnValue
}
}
}
Expand Down Expand Up @@ -10628,72 +10628,72 @@ class MediaProviderMock: MediaProviderProtocol {
}
//MARK: - loadFileFromSource

var loadFileFromSourceBodyUnderlyingCallsCount = 0
var loadFileFromSourceBodyCallsCount: Int {
var loadFileFromSourceFilenameUnderlyingCallsCount = 0
var loadFileFromSourceFilenameCallsCount: Int {
get {
if Thread.isMainThread {
return loadFileFromSourceBodyUnderlyingCallsCount
return loadFileFromSourceFilenameUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = loadFileFromSourceBodyUnderlyingCallsCount
returnValue = loadFileFromSourceFilenameUnderlyingCallsCount
}

return returnValue!
}
}
set {
if Thread.isMainThread {
loadFileFromSourceBodyUnderlyingCallsCount = newValue
loadFileFromSourceFilenameUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
loadFileFromSourceBodyUnderlyingCallsCount = newValue
loadFileFromSourceFilenameUnderlyingCallsCount = newValue
}
}
}
}
var loadFileFromSourceBodyCalled: Bool {
return loadFileFromSourceBodyCallsCount > 0
var loadFileFromSourceFilenameCalled: Bool {
return loadFileFromSourceFilenameCallsCount > 0
}
var loadFileFromSourceBodyReceivedArguments: (source: MediaSourceProxy, body: String?)?
var loadFileFromSourceBodyReceivedInvocations: [(source: MediaSourceProxy, body: String?)] = []
var loadFileFromSourceFilenameReceivedArguments: (source: MediaSourceProxy, filename: String?)?
var loadFileFromSourceFilenameReceivedInvocations: [(source: MediaSourceProxy, filename: String?)] = []

var loadFileFromSourceBodyUnderlyingReturnValue: Result<MediaFileHandleProxy, MediaProviderError>!
var loadFileFromSourceBodyReturnValue: Result<MediaFileHandleProxy, MediaProviderError>! {
var loadFileFromSourceFilenameUnderlyingReturnValue: Result<MediaFileHandleProxy, MediaProviderError>!
var loadFileFromSourceFilenameReturnValue: Result<MediaFileHandleProxy, MediaProviderError>! {
get {
if Thread.isMainThread {
return loadFileFromSourceBodyUnderlyingReturnValue
return loadFileFromSourceFilenameUnderlyingReturnValue
} else {
var returnValue: Result<MediaFileHandleProxy, MediaProviderError>? = nil
DispatchQueue.main.sync {
returnValue = loadFileFromSourceBodyUnderlyingReturnValue
returnValue = loadFileFromSourceFilenameUnderlyingReturnValue
}

return returnValue!
}
}
set {
if Thread.isMainThread {
loadFileFromSourceBodyUnderlyingReturnValue = newValue
loadFileFromSourceFilenameUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
loadFileFromSourceBodyUnderlyingReturnValue = newValue
loadFileFromSourceFilenameUnderlyingReturnValue = newValue
}
}
}
}
var loadFileFromSourceBodyClosure: ((MediaSourceProxy, String?) async -> Result<MediaFileHandleProxy, MediaProviderError>)?
var loadFileFromSourceFilenameClosure: ((MediaSourceProxy, String?) async -> Result<MediaFileHandleProxy, MediaProviderError>)?

func loadFileFromSource(_ source: MediaSourceProxy, body: String?) async -> Result<MediaFileHandleProxy, MediaProviderError> {
loadFileFromSourceBodyCallsCount += 1
loadFileFromSourceBodyReceivedArguments = (source: source, body: body)
func loadFileFromSource(_ source: MediaSourceProxy, filename: String?) async -> Result<MediaFileHandleProxy, MediaProviderError> {
loadFileFromSourceFilenameCallsCount += 1
loadFileFromSourceFilenameReceivedArguments = (source: source, filename: filename)
DispatchQueue.main.async {
self.loadFileFromSourceBodyReceivedInvocations.append((source: source, body: body))
self.loadFileFromSourceFilenameReceivedInvocations.append((source: source, filename: filename))
}
if let loadFileFromSourceBodyClosure = loadFileFromSourceBodyClosure {
return await loadFileFromSourceBodyClosure(source, body)
if let loadFileFromSourceFilenameClosure = loadFileFromSourceFilenameClosure {
return await loadFileFromSourceFilenameClosure(source, filename)
} else {
return loadFileFromSourceBodyReturnValue
return loadFileFromSourceFilenameReturnValue
}
}
}
Expand Down
Loading

0 comments on commit 6e51969

Please sign in to comment.