mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Use the maxUploadSize in the media upload screen. (#4359)
* Fix a bug where some files sizes were sent as 0. * Make FileManger.sizeForItem(at:) a UInt. The docs specifically say that FileAttributeKey.size returns an unsigned long long so I have no idea why we were returning a Double here… * Add the maxMediaUploadSize property on ClientProxy. * Use the maxUploadSize to set a target video size and to show a file too big error. * Refactor media upload parameter order.
This commit is contained in:
@@ -20,6 +20,8 @@ struct ClientProxyMockConfiguration {
|
||||
|
||||
var timelineMediaVisibility = TimelineMediaVisibility.always
|
||||
var hideInviteAvatars = false
|
||||
|
||||
var maxMediaUploadSize: UInt = 100 * 1024 * 1024
|
||||
}
|
||||
|
||||
enum ClientProxyMockError: Error {
|
||||
@@ -101,5 +103,7 @@ extension ClientProxyMock {
|
||||
|
||||
underlyingTimelineMediaVisibilityPublisher = CurrentValueSubject<TimelineMediaVisibility, Never>(configuration.timelineMediaVisibility).asCurrentValuePublisher()
|
||||
underlyingHideInviteAvatarsPublisher = CurrentValueSubject<Bool, Never>(configuration.hideInviteAvatars).asCurrentValuePublisher()
|
||||
|
||||
underlyingMaxMediaUploadSize = .success(configuration.maxMediaUploadSize)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2200,6 +2200,23 @@ class ClientProxyMock: ClientProxyProtocol, @unchecked Sendable {
|
||||
}
|
||||
var underlyingIsLiveKitRTCSupported: Bool!
|
||||
var isLiveKitRTCSupportedClosure: (() async -> Bool)?
|
||||
var maxMediaUploadSizeCallsCount = 0
|
||||
var maxMediaUploadSizeCalled: Bool {
|
||||
return maxMediaUploadSizeCallsCount > 0
|
||||
}
|
||||
|
||||
var maxMediaUploadSize: Result<UInt, ClientProxyError> {
|
||||
get async {
|
||||
maxMediaUploadSizeCallsCount += 1
|
||||
if let maxMediaUploadSizeClosure = maxMediaUploadSizeClosure {
|
||||
return await maxMediaUploadSizeClosure()
|
||||
} else {
|
||||
return underlyingMaxMediaUploadSize
|
||||
}
|
||||
}
|
||||
}
|
||||
var underlyingMaxMediaUploadSize: Result<UInt, ClientProxyError>!
|
||||
var maxMediaUploadSizeClosure: (() async -> Result<UInt, ClientProxyError>)?
|
||||
|
||||
//MARK: - isOnlyDeviceLeft
|
||||
|
||||
|
||||
Reference in New Issue
Block a user