diff --git a/Package.swift b/Package.swift index 0e0466924..1d10f802a 100644 --- a/Package.swift +++ b/Package.swift @@ -105,7 +105,7 @@ let package = Package( "Common" ], resources: [ - .process("BrowsingHistory.xcdatamodeld") + .process("CoreData/BrowsingHistory.xcdatamodeld") ], swiftSettings: [ .define("DEBUG", .when(configuration: .debug)) diff --git a/Sources/History/BrowsingHistory.xcdatamodeld/BrowsingHistory.xcdatamodel/contents b/Sources/History/CoreData/BrowsingHistory.xcdatamodeld/BrowsingHistory.xcdatamodel/contents similarity index 92% rename from Sources/History/BrowsingHistory.xcdatamodeld/BrowsingHistory.xcdatamodel/contents rename to Sources/History/CoreData/BrowsingHistory.xcdatamodeld/BrowsingHistory.xcdatamodel/contents index 76dc8c737..44668813f 100644 --- a/Sources/History/BrowsingHistory.xcdatamodeld/BrowsingHistory.xcdatamodel/contents +++ b/Sources/History/CoreData/BrowsingHistory.xcdatamodeld/BrowsingHistory.xcdatamodel/contents @@ -1,6 +1,6 @@ - + @@ -12,7 +12,7 @@ - + diff --git a/Sources/History/CoreData/BrowsingHistoryEntryManagedObject.swift b/Sources/History/CoreData/BrowsingHistoryEntryManagedObject.swift new file mode 100644 index 000000000..33eaf639e --- /dev/null +++ b/Sources/History/CoreData/BrowsingHistoryEntryManagedObject.swift @@ -0,0 +1,65 @@ +// +// BrowsingHistoryEntryManagedObject.swift +// +// Copyright © 2024 DuckDuckGo. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Foundation +import CoreData + +@objc(BrowsingHistoryEntryManagedObject) +public class BrowsingHistoryEntryManagedObject: NSManagedObject { + +} + +extension BrowsingHistoryEntryManagedObject { + + @nonobjc public class func fetchRequest() -> NSFetchRequest { + return NSFetchRequest(entityName: "BrowsingHistoryEntryManagedObject") + } + + @NSManaged public var blockedTrackingEntities: String? + @NSManaged public var failedToLoad: Bool + @NSManaged public var identifier: UUID? + @NSManaged public var lastVisit: Date? + @NSManaged public var numberOfTotalVisits: Int64 + @NSManaged public var numberOfTrackersBlocked: Int64 + @NSManaged public var title: String? + @NSManaged public var trackersFound: Bool + @NSManaged public var url: URL? + @NSManaged public var visits: NSSet? + +} + +// MARK: Generated accessors for visits +extension BrowsingHistoryEntryManagedObject { + + @objc(addVisitsObject:) + @NSManaged public func addToVisits(_ value: PageVisitManagedObject) + + @objc(removeVisitsObject:) + @NSManaged public func removeFromVisits(_ value: PageVisitManagedObject) + + @objc(addVisits:) + @NSManaged public func addToVisits(_ values: NSSet) + + @objc(removeVisits:) + @NSManaged public func removeFromVisits(_ values: NSSet) + +} + +extension BrowsingHistoryEntryManagedObject : Identifiable { + +} diff --git a/Sources/History/CoreData/PageVisitManagedObject.swift b/Sources/History/CoreData/PageVisitManagedObject.swift new file mode 100644 index 000000000..34c0e630f --- /dev/null +++ b/Sources/History/CoreData/PageVisitManagedObject.swift @@ -0,0 +1,40 @@ +// +// PageVisitManagedObject.swift +// +// Copyright © 2024 DuckDuckGo. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Foundation +import CoreData + +@objc(PageVisitManagedObject) +public class PageVisitManagedObject: NSManagedObject { + +} + +extension PageVisitManagedObject { + + @nonobjc public class func fetchRequest() -> NSFetchRequest { + return NSFetchRequest(entityName: "PageVisitManagedObject") + } + + @NSManaged public var date: Date? + @NSManaged public var historyEntry: BrowsingHistoryEntryManagedObject? + +} + +extension PageVisitManagedObject : Identifiable { + +}