From 51cb7c3edf1c8fffde3e9854b61f74de7fa6a9d0 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 23 Jan 2022 10:57:32 -0500 Subject: [PATCH] Store local only post data --- Pachyderm/Model/Status.swift | 4 ++++ Tusker/CoreData/StatusMO.swift | 2 ++ .../Tusker.xcdatamodeld/Tusker.xcdatamodel/contents | 7 ++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Pachyderm/Model/Status.swift b/Pachyderm/Model/Status.swift index 241d267fb6..e8b817e88a 100644 --- a/Pachyderm/Model/Status.swift +++ b/Pachyderm/Model/Status.swift @@ -38,6 +38,9 @@ public final class Status: /*StatusProtocol,*/ Decodable { public let bookmarked: Bool? public let card: Card? public let poll: Poll? + // Hometown only + // TODO: glitch too? + public let localOnly: Bool? public var applicationName: String? { application?.name } @@ -134,6 +137,7 @@ public final class Status: /*StatusProtocol,*/ Decodable { case bookmarked case card case poll + case localOnly = "local_only" } } diff --git a/Tusker/CoreData/StatusMO.swift b/Tusker/CoreData/StatusMO.swift index 7fe8235739..bb316fa540 100644 --- a/Tusker/CoreData/StatusMO.swift +++ b/Tusker/CoreData/StatusMO.swift @@ -45,6 +45,7 @@ public final class StatusMO: NSManagedObject, StatusProtocol { @NSManaged private var pollData: Data? @NSManaged public var account: AccountMO @NSManaged public var reblog: StatusMO? + @NSManaged public var localOnly: Bool @LazilyDecoding(arrayFrom: \StatusMO.attachmentsData) public var attachments: [Attachment] @@ -134,6 +135,7 @@ extension StatusMO { self.url = status.url self.visibility = status.visibility self.poll = status.poll + self.localOnly = status.localOnly ?? false if let existing = container.account(for: status.account.id, in: context) { existing.updateFrom(apiAccount: status.account, container: container) diff --git a/Tusker/CoreData/Tusker.xcdatamodeld/Tusker.xcdatamodel/contents b/Tusker/CoreData/Tusker.xcdatamodeld/Tusker.xcdatamodel/contents index db91c52664..bfe62da709 100644 --- a/Tusker/CoreData/Tusker.xcdatamodeld/Tusker.xcdatamodel/contents +++ b/Tusker/CoreData/Tusker.xcdatamodeld/Tusker.xcdatamodel/contents @@ -1,5 +1,5 @@ - + @@ -43,7 +43,7 @@ - + @@ -54,6 +54,7 @@ + @@ -77,6 +78,6 @@ - + \ No newline at end of file