Skip to content

Commit

Permalink
Merge pull request #1695 from planetary-social/pronouns
Browse files Browse the repository at this point in the history
Add Pronouns Support to Author Metadata and User Profiles
  • Loading branch information
joshuatbrown authored Nov 27, 2024
2 parents b409610 + 4fbf349 commit 36a61e9
Show file tree
Hide file tree
Showing 20 changed files with 346 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Release Notes
- Added support for user setting and displaying pronouns.
- Added display of website urls for user profiles.

## [1.0.2] - 2024-11-26Z

### Release Notes
Expand Down
28 changes: 15 additions & 13 deletions Nos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@
04C9D7982CC29EDD00EAAD4D /* FeaturedAuthor+Cohort5.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FeaturedAuthor+Cohort5.swift"; sourceTree = "<group>"; };
04F16AA62CBDBD91003AD693 /* DeleteConfirmationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteConfirmationView.swift; sourceTree = "<group>"; };
2D06BB9C2AE249D70085F509 /* ThreadRootView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThreadRootView.swift; sourceTree = "<group>"; };
2D3C71A52CEE6F7100625BCB /* Nos 20.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Nos 20.xcdatamodel"; sourceTree = "<group>"; };
2D4010A12AD87DF300F93AD4 /* KnownFollowersView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KnownFollowersView.swift; sourceTree = "<group>"; };
3A1C296E2B2A537C0020B753 /* Moderation.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Moderation.xcstrings; sourceTree = "<group>"; };
3A67449B2B294712002B8DE0 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2164,7 +2165,7 @@
C9B737702AB24D5F00398BE7 /* XCRemoteSwiftPackageReference "SwiftGenPlugin" */,
C91565BF2B2368FA0068EECA /* XCRemoteSwiftPackageReference "ViewInspector" */,
3AD3185B2B294E6200026B07 /* XCRemoteSwiftPackageReference "xcstrings-tool-plugin" */,
C9FD34F42BCEC89C008F8D95 /* XCRemoteSwiftPackageReference "secp256k1.swift" */,
C9FD34F42BCEC89C008F8D95 /* XCRemoteSwiftPackageReference "secp256k1" */,
C9FD35112BCED5A6008F8D95 /* XCRemoteSwiftPackageReference "nostr-sdk-ios" */,
03C49ABE2C938A9C00502321 /* XCRemoteSwiftPackageReference "SwiftSoup" */,
039389212CA4985C00698978 /* XCRemoteSwiftPackageReference "SDWebImageWebPCoder" */,
Expand Down Expand Up @@ -2799,11 +2800,11 @@
/* Begin PBXTargetDependency section */
3AD3185D2B294E9000026B07 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = 3AD3185C2B294E9000026B07 /* plugin:XCStringsToolPlugin */;
productRef = 3AD3185C2B294E9000026B07 /* XCStringsToolPlugin */;
};
3AEABEF32B2BF806001BC933 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = 3AEABEF22B2BF806001BC933 /* plugin:XCStringsToolPlugin */;
productRef = 3AEABEF22B2BF806001BC933 /* XCStringsToolPlugin */;
};
C90862C229E9804B00C35A71 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
Expand All @@ -2812,11 +2813,11 @@
};
C9A6C7442AD83F7A001F9500 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = C9A6C7432AD83F7A001F9500 /* plugin:SwiftGenPlugin */;
productRef = C9A6C7432AD83F7A001F9500 /* SwiftGenPlugin */;
};
C9D573402AB24A3700E06BB4 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = C9D5733F2AB24A3700E06BB4 /* plugin:SwiftGenPlugin */;
productRef = C9D5733F2AB24A3700E06BB4 /* SwiftGenPlugin */;
};
C9DEBFE6298941020078B43A /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
Expand Down Expand Up @@ -3673,7 +3674,7 @@
minimumVersion = 4.0.0;
};
};
C9FD34F42BCEC89C008F8D95 /* XCRemoteSwiftPackageReference "secp256k1.swift" */ = {
C9FD34F42BCEC89C008F8D95 /* XCRemoteSwiftPackageReference "secp256k1" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/GigaBitcoin/secp256k1.swift";
requirement = {
Expand Down Expand Up @@ -3712,12 +3713,12 @@
package = 03C49ABE2C938A9C00502321 /* XCRemoteSwiftPackageReference "SwiftSoup" */;
productName = SwiftSoup;
};
3AD3185C2B294E9000026B07 /* plugin:XCStringsToolPlugin */ = {
3AD3185C2B294E9000026B07 /* XCStringsToolPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 3AD3185B2B294E6200026B07 /* XCRemoteSwiftPackageReference "xcstrings-tool-plugin" */;
productName = "plugin:XCStringsToolPlugin";
};
3AEABEF22B2BF806001BC933 /* plugin:XCStringsToolPlugin */ = {
3AEABEF22B2BF806001BC933 /* XCStringsToolPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 3AD3185B2B294E6200026B07 /* XCRemoteSwiftPackageReference "xcstrings-tool-plugin" */;
productName = "plugin:XCStringsToolPlugin";
Expand Down Expand Up @@ -3791,7 +3792,7 @@
package = C99DBF7C2A9E81CF00F7068F /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */;
productName = SDWebImageSwiftUI;
};
C9A6C7432AD83F7A001F9500 /* plugin:SwiftGenPlugin */ = {
C9A6C7432AD83F7A001F9500 /* SwiftGenPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = C9B737702AB24D5F00398BE7 /* XCRemoteSwiftPackageReference "SwiftGenPlugin" */;
productName = "plugin:SwiftGenPlugin";
Expand All @@ -3811,7 +3812,7 @@
package = C9B71DBC2A8E9BAD0031ED9F /* XCRemoteSwiftPackageReference "sentry-cocoa" */;
productName = Sentry;
};
C9D5733F2AB24A3700E06BB4 /* plugin:SwiftGenPlugin */ = {
C9D5733F2AB24A3700E06BB4 /* SwiftGenPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = C9C8450C2AB249DB00654BC1 /* XCRemoteSwiftPackageReference "SwiftGenPlugin" */;
productName = "plugin:SwiftGenPlugin";
Expand All @@ -3823,12 +3824,12 @@
};
C9FD34F52BCEC89C008F8D95 /* secp256k1 */ = {
isa = XCSwiftPackageProductDependency;
package = C9FD34F42BCEC89C008F8D95 /* XCRemoteSwiftPackageReference "secp256k1.swift" */;
package = C9FD34F42BCEC89C008F8D95 /* XCRemoteSwiftPackageReference "secp256k1" */;
productName = secp256k1;
};
C9FD34F72BCEC8B5008F8D95 /* secp256k1 */ = {
isa = XCSwiftPackageProductDependency;
package = C9FD34F42BCEC89C008F8D95 /* XCRemoteSwiftPackageReference "secp256k1.swift" */;
package = C9FD34F42BCEC89C008F8D95 /* XCRemoteSwiftPackageReference "secp256k1" */;
productName = secp256k1;
};
C9FD35122BCED5A6008F8D95 /* NostrSDK */ = {
Expand All @@ -3852,6 +3853,7 @@
C936B4572A4C7B7C00DF1EB9 /* Nos.xcdatamodeld */ = {
isa = XCVersionGroup;
children = (
2D3C71A52CEE6F7100625BCB /* Nos 20.xcdatamodel */,
C95057C62CC69FD70024EC9C /* Nos 19.xcdatamodel */,
C9BB9FE32CBEFF560045DC5A /* Nos 18.xcdatamodel */,
C9D2839E2CB9B177007ADCB9 /* Nos 17.xcdatamodel */,
Expand All @@ -3864,7 +3866,7 @@
C9C547562A4F1D1A006B0741 /* Nos 9.xcdatamodel */,
5BFF66AF2A4B55FC00AA79DD /* Nos 10.xcdatamodel */,
);
currentVersion = C95057C62CC69FD70024EC9C /* Nos 19.xcdatamodel */;
currentVersion = 2D3C71A52CEE6F7100625BCB /* Nos 20.xcdatamodel */;
path = Nos.xcdatamodeld;
sourceTree = "<group>";
versionGroupType = wrapper.xcdatamodel;
Expand Down
11 changes: 11 additions & 0 deletions Nos/Assets/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -14352,6 +14352,17 @@
}
}
},
"pronouns" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Pronouns"
}
}
}
},
"pubkey" : {
"extractionState" : "manual",
"localizations" : {
Expand Down
1 change: 1 addition & 0 deletions Nos/Models/CoreData/Event+Hydration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ extension Event {
newAuthor.profilePhotoURL = metadata.profilePhotoURL
newAuthor.website = metadata.website
newAuthor.nip05 = metadata.nip05
newAuthor.pronouns = metadata.pronouns
} catch {
print("Failed to decode metaData event with ID \(String(describing: identifier))")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extension Author {
@NSManaged public var name: String?
@NSManaged public var website: String?
@NSManaged public var nip05: String?
@NSManaged public var pronouns: String?
@NSManaged public var profilePhotoURL: URL?
@NSManaged public var rawMetadata: Data?
@NSManaged public var events: Set<Event>
Expand Down
2 changes: 1 addition & 1 deletion Nos/Models/CoreData/Nos.xcdatamodeld/.xccurrentversion
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>Nos 19.xcdatamodel</string>
<string>Nos 20.xcdatamodel</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>Nos.xcdatamodel</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21513" systemVersion="22D68" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Author" representedClassName=".Author" syncable="YES" codeGenerationType="category">
<attribute name="about" optional="YES" attributeType="String"/>
<attribute name="displayName" optional="YES" attributeType="String"/>
<attribute name="hexadecimalPublicKey" attributeType="String"/>
<attribute name="lastUpdatedContactList" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="lastUpdatedMetadata" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="muted" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="name" optional="YES" attributeType="String"/>
<attribute name="nip05" optional="YES" attributeType="String"/>
<attribute name="profilePhotoURL" optional="YES" attributeType="URI"/>
<attribute name="rawMetadata" optional="YES" attributeType="Binary"/>
<relationship name="events" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Event" inverseName="author" inverseEntity="Event"/>
<relationship name="followers" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Follow" inverseName="destination" inverseEntity="Follow"/>
<relationship name="follows" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="Follow" inverseName="source" inverseEntity="Follow"/>
<relationship name="relays" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Relay"/>
</entity>
<entity name="AuthorReference" representedClassName="AuthorReference" syncable="YES" codeGenerationType="category">
<attribute name="pubkey" optional="YES" attributeType="String"/>
<attribute name="recommendedRelayUrl" optional="YES" attributeType="String"/>
<relationship name="event" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Event" inverseName="authorReferences" inverseEntity="Event"/>
</entity>
<entity name="Event" representedClassName=".Event" syncable="YES" codeGenerationType="category">
<attribute name="allTags" optional="YES" attributeType="Transformable" valueTransformerName="NSSecureUnarchiveFromDataTransformerName"/>
<attribute name="content" optional="YES" attributeType="String"/>
<attribute name="createdAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="identifier" attributeType="String"/>
<attribute name="kind" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="sendAttempts" optional="YES" attributeType="Integer 16" usesScalarValueType="YES"/>
<attribute name="signature" optional="YES" attributeType="String"/>
<relationship name="author" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Author" inverseName="events" inverseEntity="Author"/>
<relationship name="authorReferences" optional="YES" toMany="YES" deletionRule="Nullify" ordered="YES" destinationEntity="AuthorReference" inverseName="event" inverseEntity="AuthorReference"/>
<relationship name="deletedOn" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Relay"/>
<relationship name="eventReferences" optional="YES" toMany="YES" deletionRule="Nullify" ordered="YES" destinationEntity="EventReference" inverseName="referencingEvent" inverseEntity="EventReference"/>
<relationship name="publishedTo" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Relay"/>
<relationship name="referencingEvents" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="EventReference" inverseName="referencedEvent" inverseEntity="EventReference"/>
</entity>
<entity name="EventReference" representedClassName="EventReference" syncable="YES" codeGenerationType="category">
<attribute name="eventId" optional="YES" attributeType="String"/>
<attribute name="marker" optional="YES" attributeType="String"/>
<attribute name="recommendedRelayUrl" optional="YES" attributeType="String"/>
<relationship name="referencedEvent" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Event" inverseName="referencingEvents" inverseEntity="Event"/>
<relationship name="referencingEvent" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Event" inverseName="eventReferences" inverseEntity="Event"/>
</entity>
<entity name="Follow" representedClassName=".Follow" syncable="YES" codeGenerationType="category">
<attribute name="lastUpdated" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="petName" optional="YES" attributeType="String"/>
<relationship name="destination" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Author" inverseName="followers" inverseEntity="Author"/>
<relationship name="source" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Author" inverseName="follows" inverseEntity="Author"/>
</entity>
<entity name="Relay" representedClassName=".Relay" syncable="YES" codeGenerationType="category">
<attribute name="address" attributeType="String"/>
<attribute name="createdAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
</entity>
</model>
Loading

0 comments on commit 36a61e9

Please sign in to comment.