diff --git a/Nos.xcodeproj/project.pbxproj b/Nos.xcodeproj/project.pbxproj index 68adf2237..8482bc574 100644 --- a/Nos.xcodeproj/project.pbxproj +++ b/Nos.xcodeproj/project.pbxproj @@ -946,6 +946,7 @@ C9CDBBA329A8FA2900C555C7 /* GoldenPostView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GoldenPostView.swift; sourceTree = ""; }; C9CE5B132A0172CF008E198C /* WebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = ""; }; C9CF23162A38A58B00EBEC31 /* ParseQueue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseQueue.swift; sourceTree = ""; }; + C9D2839E2CB9B177007ADCB9 /* Nos 17.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Nos 17.xcdatamodel"; sourceTree = ""; }; C9D573482AB24B7300E06BB4 /* custom-xcassets.stencil */ = {isa = PBXFileReference; lastKnownFileType = text; name = "custom-xcassets.stencil"; path = "Nos/Assets/SwiftGen Stencils/custom-xcassets.stencil"; sourceTree = SOURCE_ROOT; }; C9DC6CB92C1739AD00E1CFB3 /* View+HandleURLsInRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+HandleURLsInRouter.swift"; sourceTree = ""; }; C9DEBFCE298941000078B43A /* Nos.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Nos.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -3817,6 +3818,7 @@ C936B4572A4C7B7C00DF1EB9 /* Nos.xcdatamodeld */ = { isa = XCVersionGroup; children = ( + C9D2839E2CB9B177007ADCB9 /* Nos 17.xcdatamodel */, 033B288D2C419E7600E325E8 /* Nos 16.xcdatamodel */, 5B810DD62B55BA44008FE8A9 /* Nos 15.xcdatamodel */, 5B960D2C2B34B1B900C52C45 /* Nos 14.xcdatamodel */, @@ -3826,7 +3828,7 @@ C9C547562A4F1D1A006B0741 /* Nos 9.xcdatamodel */, 5BFF66AF2A4B55FC00AA79DD /* Nos 10.xcdatamodel */, ); - currentVersion = 033B288D2C419E7600E325E8 /* Nos 16.xcdatamodel */; + currentVersion = C9D2839E2CB9B177007ADCB9 /* Nos 17.xcdatamodel */; path = Nos.xcdatamodeld; sourceTree = ""; versionGroupType = wrapper.xcdatamodel; diff --git a/Nos/Models/CoreData/Generated/Author+CoreDataProperties.swift b/Nos/Models/CoreData/Generated/Author+CoreDataProperties.swift index 9e8f5a37e..3ee36d934 100644 --- a/Nos/Models/CoreData/Generated/Author+CoreDataProperties.swift +++ b/Nos/Models/CoreData/Generated/Author+CoreDataProperties.swift @@ -21,9 +21,15 @@ extension Author { @NSManaged public var uns: String? @NSManaged public var events: Set @NSManaged public var followers: Set + + /// All follow notifications ("This user is now following you") where this Author is the follower. + @NSManaged public var followNotifications: NSSet @NSManaged public var follows: Set @NSManaged public var relays: Set - @NSManaged public var notifications: Set + + /// All notifications that should notify this Author if they are the logged in user. + /// The notifications are intended for the current author to be received. + @NSManaged public var incomingNotifications: Set } // MARK: Generated accessors for events @@ -74,6 +80,22 @@ extension Author { @NSManaged public func removeFromFollows(_ values: NSSet) } +// MARK: Generated accessors for followNotifications +extension Author { + + @objc(addFollowNotificationsObject:) + @NSManaged public func addToFollowNotifications(_ value: NosNotification) + + @objc(removeFollowNotificationsObject:) + @NSManaged public func removeFromFollowNotifications(_ value: NosNotification) + + @objc(addFollowNotifications:) + @NSManaged public func addToFollowNotifications(_ values: NSSet) + + @objc(removeFollowNotifications:) + @NSManaged public func removeFromFollowNotifications(_ values: NSSet) +} + // MARK: Generated accessors for relays extension Author { diff --git a/Nos/Models/CoreData/Generated/NosNotification+CoreDataProperties.swift b/Nos/Models/CoreData/Generated/NosNotification+CoreDataProperties.swift index 7fe4b3f09..3eecc9be3 100644 --- a/Nos/Models/CoreData/Generated/NosNotification+CoreDataProperties.swift +++ b/Nos/Models/CoreData/Generated/NosNotification+CoreDataProperties.swift @@ -10,6 +10,7 @@ extension NosNotification { @NSManaged public var isRead: Bool @NSManaged public var eventID: String? @NSManaged public var user: Author? + @NSManaged public var follower: Author? @NSManaged public var createdAt: Date? } diff --git a/Nos/Models/CoreData/Nos.xcdatamodeld/.xccurrentversion b/Nos/Models/CoreData/Nos.xcdatamodeld/.xccurrentversion index c25252740..37217a71f 100644 --- a/Nos/Models/CoreData/Nos.xcdatamodeld/.xccurrentversion +++ b/Nos/Models/CoreData/Nos.xcdatamodeld/.xccurrentversion @@ -3,6 +3,6 @@ _XCCurrentVersionName - Nos 16.xcdatamodel + Nos 17.xcdatamodel diff --git a/Nos/Models/CoreData/Nos.xcdatamodeld/Nos 17.xcdatamodel/.xccurrentversion b/Nos/Models/CoreData/Nos.xcdatamodeld/Nos 17.xcdatamodel/.xccurrentversion new file mode 100644 index 000000000..6c8a1eef9 --- /dev/null +++ b/Nos/Models/CoreData/Nos.xcdatamodeld/Nos 17.xcdatamodel/.xccurrentversion @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + Nos.xcdatamodel + + diff --git a/Nos/Models/CoreData/Nos.xcdatamodeld/Nos 17.xcdatamodel/Nos.xcdatamodel/contents b/Nos/Models/CoreData/Nos.xcdatamodeld/Nos 17.xcdatamodel/Nos.xcdatamodel/contents new file mode 100644 index 000000000..1a418ef2c --- /dev/null +++ b/Nos/Models/CoreData/Nos.xcdatamodeld/Nos 17.xcdatamodel/Nos.xcdatamodel/contents @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Nos/Models/CoreData/Nos.xcdatamodeld/Nos 17.xcdatamodel/contents b/Nos/Models/CoreData/Nos.xcdatamodeld/Nos 17.xcdatamodel/contents new file mode 100644 index 000000000..82fa7db41 --- /dev/null +++ b/Nos/Models/CoreData/Nos.xcdatamodeld/Nos 17.xcdatamodel/contents @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Nos/Models/NotificationViewModel.swift b/Nos/Models/NotificationViewModel.swift index 86dc8e9a6..121541c78 100644 --- a/Nos/Models/NotificationViewModel.swift +++ b/Nos/Models/NotificationViewModel.swift @@ -18,7 +18,7 @@ class NotificationViewModel: ObservableObject, Identifiable { var id: RawEventID { noteID } - + /// Generates a notification request that can be sent to the UNNotificationCenter to display a banner notification. /// You probably want to call `loadContent(in:)` before accessing this. var notificationCenterRequest: UNNotificationRequest { @@ -30,8 +30,8 @@ class NotificationViewModel: ObservableObject, Identifiable { content.userInfo = ["eventID": id] let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false) return UNNotificationRequest( - identifier: noteID, - content: content, + identifier: noteID, + content: content, trigger: trigger ) } @@ -42,7 +42,7 @@ class NotificationViewModel: ObservableObject, Identifiable { let user = coreDataModel.user else { return nil } - + self.init(note: note, user: user) } @@ -85,7 +85,7 @@ class NotificationViewModel: ObservableObject, Identifiable { /// Populates the `content` variable. This is not done at init in order to keep /// it synchronous for use in a View. @MainActor @discardableResult func loadContent(in context: NSManagedObjectContext) async -> AttributedString? { - content = await Event.attributedContent(noteID: id, context: context) + content = await Event.attributedContent(noteID: noteID, context: context) return content } }