Update UI for new path maintenance approach

pull/296/head
nielsandriesse 5 years ago
parent 60552eac2d
commit 008f74bd89

@ -51,11 +51,11 @@ final class IP2Country {
} }
func populateCacheIfNeeded() -> Bool { func populateCacheIfNeeded() -> Bool {
if OnionRequestAPI.paths.count < OnionRequestAPI.pathCount { if OnionRequestAPI.paths.isEmpty {
OnionRequestAPI.paths = Storage.getOnionRequestPaths() OnionRequestAPI.paths = Storage.getOnionRequestPaths()
} }
let paths = OnionRequestAPI.paths let paths = OnionRequestAPI.paths
guard paths.count >= OnionRequestAPI.pathCount else { return false } guard !paths.isEmpty else { return false }
let pathToDisplay = paths.first! let pathToDisplay = paths.first!
pathToDisplay.forEach { snode in pathToDisplay.forEach { snode in
let _ = self.cacheCountry(for: snode.ip) // Preload if needed let _ = self.cacheCountry(for: snode.ip) // Preload if needed

@ -105,7 +105,7 @@ final class PathVC : BaseVC {
private func update() { private func update() {
pathStackView.arrangedSubviews.forEach { $0.removeFromSuperview() } pathStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
if OnionRequestAPI.paths.count >= OnionRequestAPI.pathCount { if !OnionRequestAPI.paths.isEmpty {
let pathToDisplay = OnionRequestAPI.paths.first! let pathToDisplay = OnionRequestAPI.paths.first!
let dotAnimationRepeatInterval = Double(pathToDisplay.count) + 2 let dotAnimationRepeatInterval = Double(pathToDisplay.count) + 2
let snodeRows: [UIStackView] = pathToDisplay.enumerated().map { index, snode in let snodeRows: [UIStackView] = pathToDisplay.enumerated().map { index, snode in

Loading…
Cancel
Save