Add indicator after leaving a room (#981)

* Refactor UserIndicatorModalView to support no progress

* Add room left indicator in HomeScreenViewModel

* Apply PR suggestion
This commit is contained in:
Alfonso Grillo
2023-05-30 12:32:07 +02:00
committed by GitHub
parent 74b36ce870
commit eba0fe5ce3
4 changed files with 34 additions and 7 deletions
@@ -14,6 +14,7 @@
// limitations under the License.
//
import Combine
import Foundation
enum UserIndicatorType {
@@ -30,10 +31,24 @@ struct UserIndicator: Equatable, Identifiable {
lhs.persistent == rhs.persistent
}
enum LoaderType {
case unknownProgress
case progress(ProgressPublisher)
}
var id: String = UUID().uuidString
var type = UserIndicatorType.toast
var title: String
var iconName: String?
var persistent = false
var progressPublisher: ProgressPublisher?
var loaderType: LoaderType? = .unknownProgress
var progressPublisher: AnyPublisher<Double, Never> {
switch loaderType {
case .none, .unknownProgress:
return Empty().eraseToAnyPublisher()
case .some(.progress(let progress)):
return progress.publisher.eraseToAnyPublisher()
}
}
}