diff --git a/Config/BuildSettings.swift b/Config/BuildSettings.swift index 035c49065b..d072b0e8cd 100644 --- a/Config/BuildSettings.swift +++ b/Config/BuildSettings.swift @@ -228,7 +228,7 @@ final class BuildSettings: NSObject { /// Whether a screen uses legacy local activity indicators or improved app-wide indicators static var useAppUserIndicators: Bool { #if DEBUG - return false + return true #else return false #endif diff --git a/Riot/Modules/Common/ActivityPresenters/ToastUserIndicatorPresenter.swift b/Riot/Modules/Common/ActivityPresenters/ToastUserIndicatorPresenter.swift index 6f7973b3d0..504b4600ce 100644 --- a/Riot/Modules/Common/ActivityPresenters/ToastUserIndicatorPresenter.swift +++ b/Riot/Modules/Common/ActivityPresenters/ToastUserIndicatorPresenter.swift @@ -43,8 +43,8 @@ class ToastUserIndicatorPresenter: UserIndicatorPresentable { view.translatesAutoresizingMaskIntoConstraints = false navigationController.view.addSubview(view) NSLayoutConstraint.activate([ - view.centerXAnchor.constraint(equalTo: navigationController.navigationBar.centerXAnchor), - view.topAnchor.constraint(equalTo: navigationController.navigationBar.bottomAnchor) + view.centerXAnchor.constraint(equalTo: navigationController.view.centerXAnchor), + view.topAnchor.constraint(equalTo: navigationController.navigationBar.safeAreaLayoutGuide.bottomAnchor) ]) view.alpha = 0 diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 722b706a2a..10ef43a4c0 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -314,6 +314,8 @@ - (void)viewWillDisappear:(BOOL)animated [[NSNotificationCenter defaultCenter] removeObserver:kMXNotificationCenterDidUpdateRulesObserver]; kMXNotificationCenterDidUpdateRulesObserver = nil; } + + [self stopActivityIndicator]; } - (void)viewDidAppear:(BOOL)animated diff --git a/Riot/Modules/Common/Toasts/RoundedToastView.swift b/Riot/Modules/Common/Toasts/RoundedToastView.swift index 927c608f76..4774eadd00 100644 --- a/Riot/Modules/Common/Toasts/RoundedToastView.swift +++ b/Riot/Modules/Common/Toasts/RoundedToastView.swift @@ -19,13 +19,18 @@ import UIKit import DesignKit class RoundedToastView: UIView, Themable { + private struct ShadowStyle { + let offset: CGSize + let radius: CGFloat + let opacity: Float + } + private struct Constants { static let padding = UIEdgeInsets(top: 10, left: 12, bottom: 10, right: 12) static let activityIndicatorScale = CGFloat(0.75) static let imageViewSize = CGFloat(15) - static let shadowOffset = CGSize(width: 0, height: 4) - static let shadowRadius = CGFloat(12) - static let shadowOpacity = Float(0.1) + static let lightShadow = ShadowStyle(offset: .init(width: 0, height: 4), radius: 12, opacity: 0.1) + static let darkShadow = ShadowStyle(offset: .init(width: 0, height: 4), radius: 4, opacity: 0.2) } private lazy var activityIndicator: UIActivityIndicatorView = { @@ -49,6 +54,7 @@ class RoundedToastView: UIView, Themable { private let stackView: UIStackView = { let stack = UIStackView() stack.axis = .horizontal + stack.alignment = .center stack.spacing = 5 return stack }() @@ -67,7 +73,6 @@ class RoundedToastView: UIView, Themable { } private func setup(viewState: ToastViewState) { - setupLayer() setupStackView() stackView.addArrangedSubview(toastView(for: viewState.style)) stackView.addArrangedSubview(label) @@ -85,13 +90,6 @@ class RoundedToastView: UIView, Themable { ]) } - private func setupLayer() { - layer.shadowColor = UIColor.black.cgColor - layer.shadowOffset = Constants.shadowOffset - layer.shadowRadius = Constants.shadowRadius - layer.shadowOpacity = Constants.shadowOpacity - } - override func layoutSubviews() { super.layoutSubviews() layer.cornerRadius = layer.frame.height / 2 @@ -102,6 +100,12 @@ class RoundedToastView: UIView, Themable { stackView.arrangedSubviews.first?.tintColor = theme.colors.primaryContent label.font = theme.fonts.subheadline label.textColor = theme.colors.primaryContent + + let shadowStyle = theme.identifier == ThemeIdentifier.dark.rawValue ? Constants.darkShadow : Constants.lightShadow + layer.shadowColor = UIColor.black.cgColor + layer.shadowOffset = shadowStyle.offset + layer.shadowRadius = shadowStyle.radius + layer.shadowOpacity = shadowStyle.opacity } private func toastView(for style: ToastViewState.Style) -> UIView { diff --git a/changelog.d/5663.change b/changelog.d/5663.change new file mode 100644 index 0000000000..97878df12a --- /dev/null +++ b/changelog.d/5663.change @@ -0,0 +1 @@ +Enable activity indicators on the home screen