add network pull date to PersistedProfile model for staleness checking
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21513" systemVersion="21G72" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21513" systemVersion="22E261" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
||||
<entity name="PersistedProfile" representedClassName="PersistedProfile" syncable="YES">
|
||||
<attribute name="about" optional="YES" attributeType="String"/>
|
||||
<attribute name="banner" optional="YES" attributeType="String"/>
|
||||
@@ -9,6 +9,7 @@
|
||||
<attribute name="lud06" optional="YES" attributeType="String"/>
|
||||
<attribute name="lud16" optional="YES" attributeType="String"/>
|
||||
<attribute name="name" optional="YES" attributeType="String"/>
|
||||
<attribute name="network_pull_date" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
||||
<attribute name="nip05" optional="YES" attributeType="String"/>
|
||||
<attribute name="picture" optional="YES" attributeType="String"/>
|
||||
<attribute name="website" optional="YES" attributeType="String"/>
|
||||
|
||||
@@ -20,7 +20,8 @@ final class PersistedProfile: NSManagedObject {
|
||||
@NSManaged var lud06: String?
|
||||
@NSManaged var lud16: String?
|
||||
@NSManaged var nip05: String?
|
||||
@NSManaged var last_update: Date?
|
||||
@NSManaged var last_update: Date? // The date that the profile was last updated by the user
|
||||
@NSManaged var network_pull_date: Date? // The date we got this profile from a relay (for staleness checking)
|
||||
|
||||
func copyValues(from profile: Profile) {
|
||||
name = profile.name
|
||||
|
||||
@@ -99,6 +99,7 @@ final class ProfileDatabase {
|
||||
}
|
||||
persisted_profile?.copyValues(from: profile)
|
||||
persisted_profile?.last_update = last_update
|
||||
persisted_profile?.network_pull_date = Date.now
|
||||
|
||||
try context.save()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user