Skip to content

Commit

Permalink
Merge pull request #5716 from vector-im/andy/5696_enable_indicators
Browse files Browse the repository at this point in the history
Enable home and room user indicators
  • Loading branch information
Anderas authored Mar 1, 2022
2 parents 7649bec + a6f3167 commit a47713d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 37 deletions.
9 changes: 0 additions & 9 deletions Config/BuildSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,6 @@ final class BuildSettings: NSObject {

static let allowInviteExernalUsers: Bool = true

/// Whether a screen uses legacy local activity indicators or improved app-wide indicators
static var useAppUserIndicators: Bool {
#if DEBUG
return true
#else
return false
#endif
}

// MARK: - Side Menu
static let enableSideMenu: Bool = true
static let sideMenuShowInviteFriends: Bool = true
Expand Down
6 changes: 4 additions & 2 deletions Riot/Modules/Room/RoomCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ final class RoomCoordinator: NSObject, RoomCoordinatorProtocol {

private func startLoading() {
if let presenter = parameters.userIndicatorPresenter {
loadingIndicator = presenter.present(.loading(label: VectorL10n.homeSyncing, isInteractionBlocking: false))
if loadingIndicator == nil {
loadingIndicator = presenter.present(.loading(label: VectorL10n.homeSyncing, isInteractionBlocking: false))
}
} else {
activityIndicatorPresenter.presentActivityIndicator(on: roomViewController.view, animated: true)
}
Expand Down Expand Up @@ -438,7 +440,7 @@ extension RoomCoordinator: RoomViewControllerDelegate {
}

func roomViewControllerCanDelegateUserIndicators(_ roomViewController: RoomViewController) -> Bool {
return BuildSettings.useAppUserIndicators
return parameters.userIndicatorPresenter != nil
}

func roomViewControllerDidStartLoading(_ roomViewController: RoomViewController) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ final class RoomInfoListViewController: UIViewController {
private var viewModel: RoomInfoListViewModelType!
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
Expand Down Expand Up @@ -119,7 +118,6 @@ final class RoomInfoListViewController: UIViewController {

self.setupViews()

self.activityPresenter = ActivityIndicatorPresenter()
self.indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: self)

self.errorPresenter = MXKErrorAlertPresentation()
Expand Down Expand Up @@ -270,16 +268,12 @@ final class RoomInfoListViewController: UIViewController {
}

private func renderLoading() {
if BuildSettings.useAppUserIndicators {
loadingIndicator = indicatorPresenter.present(
.loading(
label: VectorL10n.roomParticipantsLeaveProcessing,
isInteractionBlocking: true
)
loadingIndicator = indicatorPresenter.present(
.loading(
label: VectorL10n.roomParticipantsLeaveProcessing,
isInteractionBlocking: true
)
} else {
activityPresenter.presentActivityIndicator(on: self.view, animated: true)
}
)
}

private func renderLoaded(viewData: RoomInfoListViewData) {
Expand All @@ -293,11 +287,7 @@ final class RoomInfoListViewController: UIViewController {
}

private func stopLoading() {
if BuildSettings.useAppUserIndicators {
loadingIndicator?.cancel()
} else {
activityPresenter.removeCurrentActivityIndicator(animated: true)
}
loadingIndicator?.cancel()
}

// MARK: - Actions
Expand Down
15 changes: 5 additions & 10 deletions Riot/Modules/TabBar/TabBarCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
homeViewController.tabBarItem.tag = Int(TABBAR_HOME_INDEX)
homeViewController.tabBarItem.image = homeViewController.tabBarItem.image
homeViewController.accessibilityLabel = VectorL10n.titleHome

if BuildSettings.useAppUserIndicators {
homeViewController.indicatorPresenter = UserIndicatorPresenterWrapper(presenter: indicatorPresenter)
}
homeViewController.indicatorPresenter = UserIndicatorPresenterWrapper(presenter: indicatorPresenter)

let wrapperViewController = HomeViewControllerWithBannerWrapperViewController(viewController: homeViewController)
return wrapperViewController
Expand Down Expand Up @@ -416,7 +413,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
}

var indicatorPresenter: UserIndicatorTypePresenterProtocol?
if BuildSettings.useAppUserIndicators, let detailNavigation = splitViewMasterPresentableDelegate?.detailNavigationRouter?.toPresentable() {
if let detailNavigation = splitViewMasterPresentableDelegate?.detailNavigationRouter?.toPresentable() {
indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: detailNavigation)
}

Expand Down Expand Up @@ -690,11 +687,9 @@ extension TabBarCoordinator: RoomCoordinatorDelegate {
func roomCoordinatorDidLeaveRoom(_ coordinator: RoomCoordinatorProtocol) {
// For the moment when a room is left, reset the split detail with placeholder
self.resetSplitViewDetails()
if BuildSettings.useAppUserIndicators {
indicatorPresenter
.present(.success(label: VectorL10n.roomParticipantsLeaveSuccess))
.store(in: &indicators)
}
indicatorPresenter
.present(.success(label: VectorL10n.roomParticipantsLeaveSuccess))
.store(in: &indicators)
}

func roomCoordinatorDidCancelRoomPreview(_ coordinator: RoomCoordinatorProtocol) {
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5696.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Activity Indicators: Enable updated UI for activity indicators and success messages

0 comments on commit a47713d

Please sign in to comment.