From 382121de2e79303845331d699adcdd777f8f062a Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Tue, 9 Jan 2024 10:30:44 -0800 Subject: Split view in News saves position and hiding when an article isn't selected. Some code cleanup. Some plumbing for news posting though it's not hooked up yet. --- Hotline/Models/Hotline.swift | 2 +- Hotline/Models/NewsArticle.swift | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Hotline/Models/NewsArticle.swift (limited to 'Hotline/Models') diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift index e88c267..c018e55 100644 --- a/Hotline/Models/Hotline.swift +++ b/Hotline/Models/Hotline.swift @@ -246,7 +246,7 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate { self.username = username self.iconID = iconID - print("CLIENT LOGIN: '\(server.login)' '\(server.password == nil)'") + print("CLIENT LOGIN: '\(server.login)' '\(server.password)'") self.client.login(server.address, port: UInt16(server.port), login: server.login, password: server.password, username: username, iconID: UInt16(iconID)) { [weak self] err, serverName, serverVersion in self?.serverVersion = serverVersion diff --git a/Hotline/Models/NewsArticle.swift b/Hotline/Models/NewsArticle.swift new file mode 100644 index 0000000..067d6b6 --- /dev/null +++ b/Hotline/Models/NewsArticle.swift @@ -0,0 +1,21 @@ +import Foundation + +struct NewsArticle: Identifiable, Codable { + var id: UUID = UUID() + var parentID: UInt32? + var path: [String] + var title: String + var body: String +} + +extension NewsArticle: Equatable { + static func == (lhs: NewsArticle, rhs: NewsArticle) -> Bool { + return lhs.id == rhs.id && lhs.parentID == rhs.parentID + } +} + +extension NewsArticle: Hashable { + func hash(into hasher: inout Hasher) { + hasher.combine(self.id) + } +} -- cgit