From ee0f982e938317abfa79318e03531b59ec486323 Mon Sep 17 00:00:00 2001 From: Michele Volpato Date: Mon, 2 Mar 2020 22:33:59 +0100 Subject: [PATCH] Remove unneeded whitespaces --- iOS/MasterFeed/RefreshProgressView.swift | 32 ++++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/iOS/MasterFeed/RefreshProgressView.swift b/iOS/MasterFeed/RefreshProgressView.swift index 2d1ddc7ab..ab2e61a84 100644 --- a/iOS/MasterFeed/RefreshProgressView.swift +++ b/iOS/MasterFeed/RefreshProgressView.swift @@ -17,52 +17,52 @@ class RefreshProgressView: UIView { override func awakeFromNib() { NotificationCenter.default.addObserver(self, selector: #selector(progressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil) - + if !AccountManager.shared.combinedRefreshProgress.isComplete { progressChanged() } else { updateRefreshLabel() } - + scheduleUpdateRefreshLabel() } - + override func didMoveToSuperview() { progressChanged() } - + func updateRefreshLabel() { if let accountLastArticleFetchEndTime = AccountManager.shared.lastArticleFetchEndTime { - + if Date() > accountLastArticleFetchEndTime.addingTimeInterval(60) { - + let relativeDateTimeFormatter = RelativeDateTimeFormatter() relativeDateTimeFormatter.dateTimeStyle = .named let refreshed = relativeDateTimeFormatter.localizedString(for: accountLastArticleFetchEndTime, relativeTo: Date()) let localizedRefreshText = NSLocalizedString("Updated %@", comment: "Updated") let refreshText = NSString.localizedStringWithFormat(localizedRefreshText as NSString, refreshed) as String label.text = refreshText - + } else { label.text = NSLocalizedString("Updated Just Now", comment: "Updated Just Now") } - + } else { label.text = "" } - + } - + @objc func progressDidChange(_ note: Notification) { progressChanged() } - + @objc func contentSizeCategoryDidChange(_ note: Notification) { // This hack is probably necessary because custom views in the toolbar don't get // notifications that the content size changed. label.font = UIFont.preferredFont(forTextStyle: .footnote) } - + deinit { NotificationCenter.default.removeObserver(self) } @@ -72,14 +72,14 @@ class RefreshProgressView: UIView { // MARK: Private private extension RefreshProgressView { - + func progressChanged() { // Layout may crash if not in the view hierarchy. // https://github.com/Ranchero-Software/NetNewsWire/issues/1764 let isInViewHierarchy = self.superview != nil - + let progress = AccountManager.shared.combinedRefreshProgress - + if progress.isComplete { if isInViewHierarchy { progressView.setProgress(1, animated: true) @@ -100,7 +100,7 @@ private extension RefreshProgressView { progressView.isHidden = false if isInViewHierarchy { let percent = Float(progress.numberCompleted) / Float(progress.numberOfTasks) - + // Don't let the progress bar go backwards unless we need to go back more than 25% if percent > progressView.progress || progressView.progress - percent > 0.25 { progressView.setProgress(percent, animated: true)