Skip to content

Commit

Permalink
noting: users are now notified when you quote repost them
Browse files Browse the repository at this point in the history
Changelog-Changed: Users are now notified when you quote repost them

update project file

add CameraView
  • Loading branch information
jb55 authored and suhailsaqan committed Oct 29, 2023
1 parent c80d9c2 commit 2882679
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 4 additions & 3 deletions damus.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@
BA4AB0AE2A63B9270070A32A /* AddEmojiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA4AB0AD2A63B9270070A32A /* AddEmojiView.swift */; };
BA4AB0B02A63B94D0070A32A /* EmojiListItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA4AB0AF2A63B94D0070A32A /* EmojiListItemView.swift */; };
BA693074295D649800ADDB87 /* UserSettingsStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA693073295D649800ADDB87 /* UserSettingsStore.swift */; };
BAA578D52AED7F4000EA8BE3 /* CameraView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAA578D42AED7F4000EA8BE3 /* CameraView.swift */; };
BAB68BED29543FA3007BA466 /* SelectWalletView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB68BEC29543FA3007BA466 /* SelectWalletView.swift */; };
D2277EEA2A089BD5006C3807 /* Router.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2277EE92A089BD5006C3807 /* Router.swift */; };
D71DC1EC2A9129C3006E207C /* PostViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71DC1EB2A9129C3006E207C /* PostViewTests.swift */; };
Expand Down Expand Up @@ -1128,7 +1129,7 @@
BA4AB0AD2A63B9270070A32A /* AddEmojiView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddEmojiView.swift; sourceTree = "<group>"; };
BA4AB0AF2A63B94D0070A32A /* EmojiListItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiListItemView.swift; sourceTree = "<group>"; };
BA693073295D649800ADDB87 /* UserSettingsStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSettingsStore.swift; sourceTree = "<group>"; };
BAA8C3262AEC570800696158 /* CameraView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraView.swift; sourceTree = "<group>"; };
BAA578D42AED7F4000EA8BE3 /* CameraView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraView.swift; sourceTree = "<group>"; };
BAB68BEC29543FA3007BA466 /* SelectWalletView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectWalletView.swift; sourceTree = "<group>"; };
D2277EE92A089BD5006C3807 /* Router.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Router.swift; sourceTree = "<group>"; };
D71DC1EB2A9129C3006E207C /* PostViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostViewTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2326,7 +2327,7 @@
BA3759952ABCCF360018D73B /* Camera */ = {
isa = PBXGroup;
children = (
BAA8C3262AEC570800696158 /* CameraView.swift */,
BAA578D42AED7F4000EA8BE3 /* CameraView.swift */,
BA3759962ABCCF360018D73B /* CameraPreview.swift */,
);
path = Camera;
Expand Down Expand Up @@ -2759,6 +2760,7 @@
4CC7AAF8297F1CEE00430951 /* EventProfile.swift in Sources */,
5CF2DCCC2AA3AF0B00984B8D /* RelayPicView.swift in Sources */,
4C687C242A5FA86D0092C550 /* SearchHeaderView.swift in Sources */,
BAA578D52AED7F4000EA8BE3 /* CameraView.swift in Sources */,
64FBD06F296255C400D9D3B2 /* Theme.swift in Sources */,
4C1A9A2329DDDB8100516EAC /* IconLabel.swift in Sources */,
4CA352AC2A76C07F003BB08B /* NewUnmutesNotify.swift in Sources */,
Expand Down Expand Up @@ -2801,7 +2803,6 @@
4C1D4FB12A7958E60024F453 /* VersionInfo.swift in Sources */,
D7FF94002AC7AC5300FD969D /* RelayURL.swift in Sources */,
4C64305C2A945AFF00B0C0E9 /* MusicController.swift in Sources */,
BAA8C3272AEC570800696158 /* CameraView.swift in Sources */,
5053ACA72A56DF3B00851AE3 /* DeveloperSettingsView.swift in Sources */,
F79C7FAD29D5E9620000F946 /* EditPictureControl.swift in Sources */,
4C9F18E229AA9B6C008C55EC /* CustomizeZapView.swift in Sources */,
Expand Down
13 changes: 9 additions & 4 deletions damus/Views/PostView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct PostView: View {
}
return true
}
let new_post = build_post(post: self.post, action: action, uploadedMedias: uploadedMedias, references: refs)
let new_post = build_post(state: damus_state, post: self.post, action: action, uploadedMedias: uploadedMedias, references: refs)

notify(.post(.post(new_post)))

Expand Down Expand Up @@ -633,7 +633,7 @@ func load_draft_for_post(drafts: Drafts, action: PostAction) -> DraftArtifacts?
}


func build_post(post: NSMutableAttributedString, action: PostAction, uploadedMedias: [UploadedMedia], references: [RefId]) -> NostrPost {
func build_post(state: DamusState, post: NSMutableAttributedString, action: PostAction, uploadedMedias: [UploadedMedia], references: [RefId]) -> NostrPost {
post.enumerateAttributes(in: NSRange(location: 0, length: post.length), options: []) { attributes, range, stop in
if let link = attributes[.link] as? String {
let normalized_link: String
Expand All @@ -656,15 +656,20 @@ func build_post(post: NSMutableAttributedString, action: PostAction, uploadedMed

let imagesString = uploadedMedias.map { $0.uploadedURL.absoluteString }.joined(separator: " ")

let img_meta_tags = uploadedMedias.compactMap { $0.metadata?.to_tag() }
var tags = uploadedMedias.compactMap { $0.metadata?.to_tag() }

if !imagesString.isEmpty {
content.append(" " + imagesString + " ")
}

if case .quoting(let ev) = action {
content.append(" nostr:" + bech32_note_id(ev.id))

if let quoted_ev = state.events.lookup(ev.id) {
tags.append(["p", quoted_ev.pubkey.hex()])
}
}

return NostrPost(content: content, references: references, kind: .text, tags: img_meta_tags)
return NostrPost(content: content, references: references, kind: .text, tags: tags)
}

0 comments on commit 2882679

Please sign in to comment.