Rename properties and arguments

This commit is contained in:
Andy Uhnak
2022-02-22 16:44:22 +00:00
parent a5af0dcc9f
commit 75d3d30c12
6 changed files with 25 additions and 29 deletions

View File

@@ -19,11 +19,11 @@ import XCTest
class UserIndicatorQueueTests: XCTestCase {
var indicators: [UserIndicator]!
var center: UserIndicatorQueue!
var queue: UserIndicatorQueue!
override func setUp() {
indicators = []
center = UserIndicatorQueue()
queue = UserIndicatorQueue()
}
func makeRequest() -> UserIndicatorRequest {
@@ -34,19 +34,19 @@ class UserIndicatorQueueTests: XCTestCase {
}
func testStartsIndicatorWhenAdded() {
let indicator = center.add(makeRequest())
let indicator = queue.add(makeRequest())
XCTAssertEqual(indicator.state, .executing)
}
func testSecondIndicatorIsPending() {
center.add(makeRequest()).store(in: &indicators)
let indicator = center.add(makeRequest())
queue.add(makeRequest()).store(in: &indicators)
let indicator = queue.add(makeRequest())
XCTAssertEqual(indicator.state, .pending)
}
func testSecondIndicatorIsExecutingWhenFirstCompleted() {
let first = center.add(makeRequest())
let second = center.add(makeRequest())
let first = queue.add(makeRequest())
let second = queue.add(makeRequest())
first.cancel()

View File

@@ -211,7 +211,7 @@ final class BuildSettings: NSObject {
static let allowInviteExernalUsers: Bool = true
/// Whether a screen uses legacy local activity indicators or improved app-wide indicators
static var appActivityIndicators: Bool {
static var useAppUserIndicators: Bool {
#if DEBUG
return true
#else

View File

@@ -29,18 +29,18 @@ import UIKit
private weak var viewController: UIViewController?
private var indicator: UserIndicator?
init(label: String, on viewController: UIViewController) {
init(label: String, viewController: UIViewController) {
self.label = label
self.viewController = viewController
}
func presentActivityIndicator(on view: UIView, animated: Bool, completion: (() -> Void)?) {
guard let vc = viewController else {
guard let viewController = viewController else {
return
}
let request = UserIndicatorRequest(
presenter: FullscreenLoadingIndicatorPresenter(label: label, on: vc),
presenter: FullscreenLoadingIndicatorPresenter(label: label, viewController: viewController),
dismissal: .manual
)

View File

@@ -25,18 +25,18 @@ class FullscreenLoadingIndicatorPresenter: UserIndicatorPresentable {
private weak var viewController: UIViewController?
private weak var view: UIView?
init(label: String, on viewController: UIViewController) {
init(label: String, viewController: UIViewController) {
self.label = label
self.viewController = viewController
}
func present() {
// Find the current top navigation controller
var vc: UIViewController? = viewController
while vc?.navigationController != nil {
vc = vc?.navigationController
var presentingController: UIViewController? = viewController
while presentingController?.navigationController != nil {
presentingController = presentingController?.navigationController
}
guard let presentingVC = vc else {
guard let presentingController = presentingController else {
return
}
@@ -45,12 +45,12 @@ class FullscreenLoadingIndicatorPresenter: UserIndicatorPresentable {
self.view = view
view.translatesAutoresizingMaskIntoConstraints = false
presentingVC.view.addSubview(view)
presentingController.view.addSubview(view)
NSLayoutConstraint.activate([
view.topAnchor.constraint(equalTo: presentingVC.view.topAnchor),
view.bottomAnchor.constraint(equalTo: presentingVC.view.bottomAnchor),
view.leadingAnchor.constraint(equalTo: presentingVC.view.leadingAnchor),
view.trailingAnchor.constraint(equalTo: presentingVC.view.trailingAnchor)
view.topAnchor.constraint(equalTo: presentingController.view.topAnchor),
view.bottomAnchor.constraint(equalTo: presentingController.view.bottomAnchor),
view.leadingAnchor.constraint(equalTo: presentingController.view.leadingAnchor),
view.trailingAnchor.constraint(equalTo: presentingController.view.trailingAnchor)
])
view.alpha = 0

View File

@@ -116,10 +116,10 @@ final class RoomInfoListViewController: UIViewController {
// Do any additional setup after loading the view.
self.setupViews()
if BuildSettings.appActivityIndicators {
if BuildSettings.useAppUserIndicators {
self.activityPresenter = FullscreenActivityIndicatorPresenter(
label: VectorL10n.roomParticipantsLeaveProcessing,
on: self
viewController: self
)
} else {
self.activityPresenter = ActivityIndicatorPresenter()

View File

@@ -76,10 +76,6 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
self.activityIndicatorPresenter = ActivityIndicatorPresenter()
}
deinit {
indicators.cancelAll()
}
// MARK: - Public methods
func start() {
@@ -234,7 +230,7 @@ final class TabBarCoordinator: NSObject, TabBarCoordinatorType {
homeViewController.tabBarItem.image = homeViewController.tabBarItem.image
homeViewController.accessibilityLabel = VectorL10n.titleHome
if BuildSettings.appActivityIndicators {
if BuildSettings.useAppUserIndicators {
homeViewController.userIndicatorPresenter = AppUserIndicatorPresenter(appNavigator: parameters.appNavigator)
}
@@ -709,7 +705,7 @@ 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.appActivityIndicators {
if BuildSettings.useAppUserIndicators {
parameters.appNavigator
.addUserIndicator(.success(VectorL10n.roomParticipantsLeaveSuccess))
.store(in: &indicators)