Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable home and room user indicators #5716

Merged
merged 1 commit into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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