mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Add support for media uploading progress
- replace the ProgressTracker with a combination of currentValueSubjects and currentValuePublishers
This commit is contained in:
committed by
Stefan Ceriu
parent
9cf2aba16d
commit
8b11a0a5ec
@@ -30,13 +30,13 @@ struct UserIndicator: Equatable, Identifiable {
|
||||
static func == (lhs: UserIndicator.Progress, rhs: UserIndicator.Progress) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (.indeterminate, .indeterminate): return true
|
||||
case (.published(let lhsPublisher), .published(let rhsPublisher)): return lhsPublisher === rhsPublisher
|
||||
case (.published(let lhsPublisher), .published(let rhsPublisher)): return lhsPublisher.value == rhsPublisher.value
|
||||
default: return false
|
||||
}
|
||||
}
|
||||
|
||||
case indeterminate
|
||||
case published(ProgressPublisher)
|
||||
case published(CurrentValuePublisher<Double, Never>)
|
||||
}
|
||||
|
||||
var id: String = UUID().uuidString
|
||||
@@ -54,14 +54,14 @@ struct UserIndicator: Equatable, Identifiable {
|
||||
}
|
||||
}
|
||||
|
||||
var progressPublisher: AnyPublisher<Double, Never> {
|
||||
var progressPublisher: CurrentValuePublisher<Double, Never> {
|
||||
switch type {
|
||||
case .toast(let progress), .modal(let progress, _):
|
||||
switch progress {
|
||||
case .none, .indeterminate:
|
||||
return Empty().eraseToAnyPublisher()
|
||||
case .some(.published(let progress)):
|
||||
return progress.publisher.eraseToAnyPublisher()
|
||||
return CurrentValueSubject<Double, Never>(0.0).asCurrentValuePublisher()
|
||||
case .some(.published(let publisher)):
|
||||
return publisher
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user