Room user indicators

Signed-off-by: Andy Uhnak <andyuhnak@gmail.com>
This commit is contained in:
Andy Uhnak
2022-02-23 09:47:35 +00:00
parent bbc33ed0cf
commit 4617b3ed69
28 changed files with 458 additions and 329 deletions

View File

@@ -41,6 +41,8 @@ final class RoomInfoListViewController: UIViewController {
private var theme: Theme!
private var errorPresenter: MXKErrorPresentation!
private var activityPresenter: ActivityIndicatorPresenterType!
private var indicatorPresenter: UserIndicatorTypePresenterProtocol!
private var loadingIndicator: UserIndicator?
private var isRoomDirect: Bool = false
private var screenTimer = AnalyticsScreenTimer(screen: .roomDetails)
@@ -116,14 +118,10 @@ final class RoomInfoListViewController: UIViewController {
// Do any additional setup after loading the view.
self.setupViews()
if BuildSettings.useAppUserIndicators {
self.activityPresenter = FullscreenActivityIndicatorPresenter(
label: VectorL10n.roomParticipantsLeaveProcessing,
viewController: self
)
} else {
self.activityPresenter = ActivityIndicatorPresenter()
}
self.activityPresenter = ActivityIndicatorPresenter()
self.indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: self)
self.errorPresenter = MXKErrorAlertPresentation()
self.registerThemeServiceDidChangeThemeNotification()
@@ -152,7 +150,7 @@ final class RoomInfoListViewController: UIViewController {
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
screenTimer.stop()
activityPresenter.removeCurrentActivityIndicator(animated: animated)
stopLoading()
}
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
@@ -272,19 +270,36 @@ final class RoomInfoListViewController: UIViewController {
}
private func renderLoading() {
self.activityPresenter.presentActivityIndicator(on: self.view, animated: true)
if BuildSettings.useAppUserIndicators {
loadingIndicator = indicatorPresenter.present(
.loading(
label: VectorL10n.roomParticipantsLeaveProcessing,
isInteractionBlocking: true
)
)
} else {
activityPresenter.presentActivityIndicator(on: self.view, animated: true)
}
}
private func renderLoaded(viewData: RoomInfoListViewData) {
self.activityPresenter.removeCurrentActivityIndicator(animated: true)
stopLoading()
self.updateSections(with: viewData)
}
private func render(error: Error) {
self.activityPresenter.removeCurrentActivityIndicator(animated: true)
stopLoading()
self.errorPresenter.presentError(from: self, forError: error, animated: true, handler: nil)
}
private func stopLoading() {
if BuildSettings.useAppUserIndicators {
loadingIndicator?.cancel()
} else {
activityPresenter.removeCurrentActivityIndicator(animated: true)
}
}
// MARK: - Actions
@objc private func closeButtonTapped(_ sender: Any) {