From 008f74bd89b1e1c5898664bc059af6a6ae0a0433 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Fri, 9 Oct 2020 09:50:15 +1100 Subject: [PATCH] Update UI for new path maintenance approach --- Signal/src/Loki/Utilities/IP2Country.swift | 4 ++-- Signal/src/Loki/View Controllers/PathVC.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Signal/src/Loki/Utilities/IP2Country.swift b/Signal/src/Loki/Utilities/IP2Country.swift index bc8309df1..fe67cfa7c 100644 --- a/Signal/src/Loki/Utilities/IP2Country.swift +++ b/Signal/src/Loki/Utilities/IP2Country.swift @@ -51,11 +51,11 @@ final class IP2Country { } func populateCacheIfNeeded() -> Bool { - if OnionRequestAPI.paths.count < OnionRequestAPI.pathCount { + if OnionRequestAPI.paths.isEmpty { OnionRequestAPI.paths = Storage.getOnionRequestPaths() } let paths = OnionRequestAPI.paths - guard paths.count >= OnionRequestAPI.pathCount else { return false } + guard !paths.isEmpty else { return false } let pathToDisplay = paths.first! pathToDisplay.forEach { snode in let _ = self.cacheCountry(for: snode.ip) // Preload if needed diff --git a/Signal/src/Loki/View Controllers/PathVC.swift b/Signal/src/Loki/View Controllers/PathVC.swift index 3924a856a..57e3d7bb5 100644 --- a/Signal/src/Loki/View Controllers/PathVC.swift +++ b/Signal/src/Loki/View Controllers/PathVC.swift @@ -105,7 +105,7 @@ final class PathVC : BaseVC { private func update() { pathStackView.arrangedSubviews.forEach { $0.removeFromSuperview() } - if OnionRequestAPI.paths.count >= OnionRequestAPI.pathCount { + if !OnionRequestAPI.paths.isEmpty { let pathToDisplay = OnionRequestAPI.paths.first! let dotAnimationRepeatInterval = Double(pathToDisplay.count) + 2 let snodeRows: [UIStackView] = pathToDisplay.enumerated().map { index, snode in