aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models
diff options
context:
space:
mode:
authorDustin Mierau <mierau@users.noreply.github.com>2024-01-09 14:44:14 -0800
committerGitHub <noreply@github.com>2024-01-09 14:44:14 -0800
commita2b7946804f5ab17ef1aebc4b5bb72e7cf14e83b (patch)
tree218012a1565033fa89a862a34a0683a9fad3d39b /Hotline/Models
parentf198d4d59b922e9cb872fe6831d3475c570fa56f (diff)
parent60f90281bf971600733b2d72b747bcb6be9b1c31 (diff)
Merge branch 'main' into patch-1
Diffstat (limited to 'Hotline/Models')
-rw-r--r--Hotline/Models/Hotline.swift8
-rw-r--r--Hotline/Models/NewsArticle.swift21
2 files changed, 21 insertions, 8 deletions
diff --git a/Hotline/Models/Hotline.swift b/Hotline/Models/Hotline.swift
index e88c267..e62ac15 100644
--- a/Hotline/Models/Hotline.swift
+++ b/Hotline/Models/Hotline.swift
@@ -246,8 +246,6 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate {
self.username = username
self.iconID = iconID
- print("CLIENT LOGIN: '\(server.login)' '\(server.password == nil)'")
-
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
if serverName != nil {
@@ -335,8 +333,6 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate {
continuation.resume(returning: nil)
return
}
-
- print("GET NEWS CATS FROM \(path)")
}, reply: { articleText in
// let parentNews = self?.findNews(in: self?.news ?? [], at: path)
@@ -376,8 +372,6 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate {
continuation.resume(returning: [])
return
}
-
- print("GET NEWS CATS FROM \(path)")
}, reply: { [weak self] categories in
// let parentNews = self?.findNews(in: self?.news ?? [], at: path)
@@ -445,8 +439,6 @@ final class Hotline: HotlineClientDelegate, HotlineFileClientDelegate {
}
return
}
-
- print("GET NEWS CATS FROM \(path)")
}, reply: { [weak self] categories in
let parentNews = self?.findNews(in: self?.news ?? [], at: path)
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)
+ }
+}