From 038281b19ca94fd735330e859f9eabf142eb6657 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 3 Jan 2021 15:01:08 +0100 Subject: [PATCH] Take area out of PoolGroup Retain in Pool only, do not contribute to group keying. --- Passepartout/App/macOS/Menu/StatusMenu.swift | 5 +---- .../Core/Sources/Services/PoolGroup.swift | 19 +++---------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/Passepartout/App/macOS/Menu/StatusMenu.swift b/Passepartout/App/macOS/Menu/StatusMenu.swift index ec75ddf8..b1603d7d 100644 --- a/Passepartout/App/macOS/Menu/StatusMenu.swift +++ b/Passepartout/App/macOS/Menu/StatusMenu.swift @@ -312,10 +312,7 @@ class StatusMenu: NSObject { item.indentationLevel = 1 for group in category.groups.sorted() { - var title = group.localizedCountry - if let area = group.area?.uppercased() { - title = "\(title) - \(area)" - } + let title = group.localizedCountry let itemGroup = NSMenuItem(title: title, action: #selector(connectToPool(_:)), keyEquivalent: "") itemGroup.image = group.logo diff --git a/Passepartout/Core/Sources/Services/PoolGroup.swift b/Passepartout/Core/Sources/Services/PoolGroup.swift index 0d8a7ee0..2cb123f2 100644 --- a/Passepartout/Core/Sources/Services/PoolGroup.swift +++ b/Passepartout/Core/Sources/Services/PoolGroup.swift @@ -28,24 +28,14 @@ import Foundation public class PoolGroup: Codable, Hashable, Comparable, CustomStringConvertible { public let country: String - public let area: String? - public let pools: [Pool] private var id: String { - var id = country - if let area = area { - id += area - } - return id + return country } private var localizedId: String { - var localizedId = Utils.localizedCountry(country) - if let area = area { - localizedId += area - } - return localizedId + return Utils.localizedCountry(country) } // MARK: Equatable @@ -69,7 +59,7 @@ public class PoolGroup: Codable, Hashable, Comparable, CustomStringConvertible { // MARK: CustomStringConvertible public var description: String { - return "{\(country), \(area ?? "--")}" + return country } } @@ -84,9 +74,6 @@ extension PoolGroup { var components: [String] = [] components.append(category.name) components.append(country) - if let area = area { - components.append(area) - } return components.joined(separator: "/") } }