@@ -225,8 +225,6 @@
|
|||||||
4CFF8F6329CC9AD7008DB934 /* ImageContextMenuModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFF8F6229CC9AD7008DB934 /* ImageContextMenuModifier.swift */; };
|
4CFF8F6329CC9AD7008DB934 /* ImageContextMenuModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFF8F6229CC9AD7008DB934 /* ImageContextMenuModifier.swift */; };
|
||||||
4CFF8F6729CC9E3A008DB934 /* ImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFF8F6629CC9E3A008DB934 /* ImageView.swift */; };
|
4CFF8F6729CC9E3A008DB934 /* ImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFF8F6629CC9E3A008DB934 /* ImageView.swift */; };
|
||||||
4CFF8F6929CC9ED1008DB934 /* ImageContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFF8F6829CC9ED1008DB934 /* ImageContainerView.swift */; };
|
4CFF8F6929CC9ED1008DB934 /* ImageContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFF8F6829CC9ED1008DB934 /* ImageContainerView.swift */; };
|
||||||
4CFF8F6B29CD0079008DB934 /* RepostedEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFF8F6A29CD0079008DB934 /* RepostedEvent.swift */; };
|
|
||||||
4CFF8F6D29CD022E008DB934 /* WideEventView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFF8F6C29CD022E008DB934 /* WideEventView.swift */; };
|
|
||||||
4FE60CDD295E1C5E00105A1F /* Wallet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FE60CDC295E1C5E00105A1F /* Wallet.swift */; };
|
4FE60CDD295E1C5E00105A1F /* Wallet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FE60CDC295E1C5E00105A1F /* Wallet.swift */; };
|
||||||
50A50A8D29A09E1C00C01BE7 /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A50A8C29A09E1C00C01BE7 /* RequestTests.swift */; };
|
50A50A8D29A09E1C00C01BE7 /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A50A8C29A09E1C00C01BE7 /* RequestTests.swift */; };
|
||||||
5C513FBA297F72980072348F /* CustomPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C513FB9297F72980072348F /* CustomPicker.swift */; };
|
5C513FBA297F72980072348F /* CustomPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C513FB9297F72980072348F /* CustomPicker.swift */; };
|
||||||
@@ -603,8 +601,6 @@
|
|||||||
4CFF8F6229CC9AD7008DB934 /* ImageContextMenuModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageContextMenuModifier.swift; sourceTree = "<group>"; };
|
4CFF8F6229CC9AD7008DB934 /* ImageContextMenuModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageContextMenuModifier.swift; sourceTree = "<group>"; };
|
||||||
4CFF8F6629CC9E3A008DB934 /* ImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageView.swift; sourceTree = "<group>"; };
|
4CFF8F6629CC9E3A008DB934 /* ImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageView.swift; sourceTree = "<group>"; };
|
||||||
4CFF8F6829CC9ED1008DB934 /* ImageContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageContainerView.swift; sourceTree = "<group>"; };
|
4CFF8F6829CC9ED1008DB934 /* ImageContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageContainerView.swift; sourceTree = "<group>"; };
|
||||||
4CFF8F6A29CD0079008DB934 /* RepostedEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepostedEvent.swift; sourceTree = "<group>"; };
|
|
||||||
4CFF8F6C29CD022E008DB934 /* WideEventView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WideEventView.swift; sourceTree = "<group>"; };
|
|
||||||
4FE60CDC295E1C5E00105A1F /* Wallet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Wallet.swift; sourceTree = "<group>"; };
|
4FE60CDC295E1C5E00105A1F /* Wallet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Wallet.swift; sourceTree = "<group>"; };
|
||||||
50A50A8C29A09E1C00C01BE7 /* RequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestTests.swift; sourceTree = "<group>"; };
|
50A50A8C29A09E1C00C01BE7 /* RequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestTests.swift; sourceTree = "<group>"; };
|
||||||
5C513FB9297F72980072348F /* CustomPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomPicker.swift; sourceTree = "<group>"; };
|
5C513FB9297F72980072348F /* CustomPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomPicker.swift; sourceTree = "<group>"; };
|
||||||
@@ -676,7 +672,6 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
3AA24801297E3DC20090C62D /* RepostView.swift */,
|
3AA24801297E3DC20090C62D /* RepostView.swift */,
|
||||||
4CFF8F6A29CD0079008DB934 /* RepostedEvent.swift */,
|
|
||||||
);
|
);
|
||||||
path = Reposts;
|
path = Reposts;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -992,7 +987,6 @@
|
|||||||
4CF0ABE6298444FC00D66079 /* MutedEventView.swift */,
|
4CF0ABE6298444FC00D66079 /* MutedEventView.swift */,
|
||||||
4C3D52B5298DB4E6001C5831 /* ZapEvent.swift */,
|
4C3D52B5298DB4E6001C5831 /* ZapEvent.swift */,
|
||||||
4C3D52B7298DB5C6001C5831 /* TextEvent.swift */,
|
4C3D52B7298DB5C6001C5831 /* TextEvent.swift */,
|
||||||
4CFF8F6C29CD022E008DB934 /* WideEventView.swift */,
|
|
||||||
);
|
);
|
||||||
path = Events;
|
path = Events;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -1508,7 +1502,6 @@
|
|||||||
4CE879582996C45300F758CC /* ZapsView.swift in Sources */,
|
4CE879582996C45300F758CC /* ZapsView.swift in Sources */,
|
||||||
4C30AC7429A5680900E2BD5A /* EventGroupView.swift in Sources */,
|
4C30AC7429A5680900E2BD5A /* EventGroupView.swift in Sources */,
|
||||||
4C633352283D419F00B1C9C3 /* SignalModel.swift in Sources */,
|
4C633352283D419F00B1C9C3 /* SignalModel.swift in Sources */,
|
||||||
4CFF8F6D29CD022E008DB934 /* WideEventView.swift in Sources */,
|
|
||||||
9609F058296E220800069BF3 /* BannerImageView.swift in Sources */,
|
9609F058296E220800069BF3 /* BannerImageView.swift in Sources */,
|
||||||
4C363A94282704FA006E126D /* Post.swift in Sources */,
|
4C363A94282704FA006E126D /* Post.swift in Sources */,
|
||||||
4C216F32286E388800040376 /* DMChatView.swift in Sources */,
|
4C216F32286E388800040376 /* DMChatView.swift in Sources */,
|
||||||
@@ -1537,7 +1530,6 @@
|
|||||||
4C3EA64F28FF59F200C48A62 /* tal.c in Sources */,
|
4C3EA64F28FF59F200C48A62 /* tal.c in Sources */,
|
||||||
4CB88393296F798300DC99E7 /* ReactionsModel.swift in Sources */,
|
4CB88393296F798300DC99E7 /* ReactionsModel.swift in Sources */,
|
||||||
4CB88396296F7F8B00DC99E7 /* ReactionView.swift in Sources */,
|
4CB88396296F7F8B00DC99E7 /* ReactionView.swift in Sources */,
|
||||||
4CFF8F6B29CD0079008DB934 /* RepostedEvent.swift in Sources */,
|
|
||||||
4C8682872814DE470026224F /* ProfileView.swift in Sources */,
|
4C8682872814DE470026224F /* ProfileView.swift in Sources */,
|
||||||
4C5F9114283D694D0052CD1C /* FollowTarget.swift in Sources */,
|
4C5F9114283D694D0052CD1C /* FollowTarget.swift in Sources */,
|
||||||
4CF0ABD629817F5B00D66079 /* ReportView.swift in Sources */,
|
4CF0ABD629817F5B00D66079 /* ReportView.swift in Sources */,
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ struct ShareSheet: UIViewControllerRepresentable {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct ImageCarousel: View {
|
struct ImageCarousel: View {
|
||||||
var urls: [URL]
|
var urls: [URL]
|
||||||
|
|
||||||
@@ -51,8 +53,8 @@ struct ImageCarousel: View {
|
|||||||
.configure { view in
|
.configure { view in
|
||||||
view.framePreloadCount = 3
|
view.framePreloadCount = 3
|
||||||
}
|
}
|
||||||
.aspectRatio(contentMode: .fill)
|
.aspectRatio(contentMode: .fit)
|
||||||
//.cornerRadius(10)
|
.cornerRadius(10)
|
||||||
.tabItem {
|
.tabItem {
|
||||||
Text(url.absoluteString)
|
Text(url.absoluteString)
|
||||||
}
|
}
|
||||||
@@ -68,7 +70,8 @@ struct ImageCarousel: View {
|
|||||||
.fullScreenCover(isPresented: $open_sheet) {
|
.fullScreenCover(isPresented: $open_sheet) {
|
||||||
ImageView(urls: urls)
|
ImageView(urls: urls)
|
||||||
}
|
}
|
||||||
.frame(height: 350)
|
.frame(height: 200)
|
||||||
|
.clipped()
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
open_sheet = true
|
open_sheet = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,12 @@ struct Reposted: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(alignment: .center) {
|
HStack(alignment: .center) {
|
||||||
Image(systemName: "arrow.2.squarepath")
|
Image(systemName: "arrow.2.squarepath")
|
||||||
|
.font(.system(size: 13, weight: .heavy))
|
||||||
.foregroundColor(Color.gray)
|
.foregroundColor(Color.gray)
|
||||||
ProfileName(pubkey: pubkey, profile: profile, damus: damus, show_friend_confirmed: true, show_nip5_domain: false)
|
ProfileName(pubkey: pubkey, profile: profile, damus: damus, show_friend_confirmed: true, show_nip5_domain: false)
|
||||||
.foregroundColor(Color.gray)
|
.foregroundColor(Color.gray)
|
||||||
Text("Reposted", comment: "Text indicating that the post was reposted (i.e. re-shared).")
|
Text("Reposted", comment: "Text indicating that the post was reposted (i.e. re-shared).")
|
||||||
|
.font(.system(size: 14, weight: .heavy))
|
||||||
.foregroundColor(Color.gray)
|
.foregroundColor(Color.gray)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ struct ChatView: View {
|
|||||||
show_images: show_images,
|
show_images: show_images,
|
||||||
size: .normal,
|
size: .normal,
|
||||||
artifacts: .just_content(event.content),
|
artifacts: .just_content(event.content),
|
||||||
options: [])
|
truncate: false)
|
||||||
|
|
||||||
if is_active || next_ev == nil || next_ev!.pubkey != event.pubkey {
|
if is_active || next_ev == nil || next_ev!.pubkey != event.pubkey {
|
||||||
let bar = make_actionbar_model(ev: event.id, damus: damus_state)
|
let bar = make_actionbar_model(ev: event.id, damus: damus_state)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ struct DMView: View {
|
|||||||
|
|
||||||
let should_show_img = should_show_images(settings: damus_state.settings, contacts: damus_state.contacts, ev: event, our_pubkey: damus_state.pubkey)
|
let should_show_img = should_show_images(settings: damus_state.settings, contacts: damus_state.contacts, ev: event, our_pubkey: damus_state.pubkey)
|
||||||
|
|
||||||
NoteContentView(damus_state: damus_state, event: event, show_images: should_show_img, size: .normal, artifacts: .just_content(event.get_content(damus_state.keypair.privkey)), options: [])
|
NoteContentView(damus_state: damus_state, event: event, show_images: should_show_img, size: .normal, artifacts: .just_content(event.get_content(damus_state.keypair.privkey)), truncate: false)
|
||||||
.padding([.top, .leading, .trailing], 10)
|
.padding([.top, .leading, .trailing], 10)
|
||||||
.padding([.bottom], 25)
|
.padding([.bottom], 25)
|
||||||
.background(VisualEffectView(effect: UIBlurEffect(style: .prominent))
|
.background(VisualEffectView(effect: UIBlurEffect(style: .prominent))
|
||||||
|
|||||||
@@ -60,7 +60,17 @@ struct EventView: View {
|
|||||||
VStack {
|
VStack {
|
||||||
if event.known_kind == .boost {
|
if event.known_kind == .boost {
|
||||||
if let inner_ev = event.inner_event {
|
if let inner_ev = event.inner_event {
|
||||||
RepostedEvent(damus: damus, event: event, inner_ev: inner_ev, options: options)
|
VStack(alignment: .leading) {
|
||||||
|
let prof = damus.profiles.lookup(id: event.pubkey)
|
||||||
|
let booster_profile = ProfileView(damus_state: damus, pubkey: event.pubkey)
|
||||||
|
|
||||||
|
NavigationLink(destination: booster_profile) {
|
||||||
|
Reposted(damus: damus, pubkey: event.pubkey, profile: prof)
|
||||||
|
}
|
||||||
|
.buttonStyle(PlainButtonStyle())
|
||||||
|
TextEvent(damus: damus, event: inner_ev, pubkey: inner_ev.pubkey, options: options)
|
||||||
|
.padding([.top], 1)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
EmptyView()
|
EmptyView()
|
||||||
}
|
}
|
||||||
@@ -72,7 +82,7 @@ struct EventView: View {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TextEvent(damus: damus, event: event, pubkey: pubkey, options: options)
|
TextEvent(damus: damus, event: event, pubkey: pubkey, options: options)
|
||||||
//.padding([.top], 6)
|
.padding([.top], 6)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ struct EmbeddedEventView: View {
|
|||||||
.minimumScaleFactor(0.75)
|
.minimumScaleFactor(0.75)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
|
|
||||||
EventBody(damus_state: damus_state, event: event, size: .small, options: [.truncate_content])
|
EventBody(damus_state: damus_state, event: event, size: .small)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,13 +12,11 @@ struct EventBody: View {
|
|||||||
let event: NostrEvent
|
let event: NostrEvent
|
||||||
let size: EventViewKind
|
let size: EventViewKind
|
||||||
let should_show_img: Bool
|
let should_show_img: Bool
|
||||||
let options: EventViewOptions
|
|
||||||
|
|
||||||
init(damus_state: DamusState, event: NostrEvent, size: EventViewKind, should_show_img: Bool? = nil, options: EventViewOptions) {
|
init(damus_state: DamusState, event: NostrEvent, size: EventViewKind, should_show_img: Bool? = nil) {
|
||||||
self.damus_state = damus_state
|
self.damus_state = damus_state
|
||||||
self.event = event
|
self.event = event
|
||||||
self.size = size
|
self.size = size
|
||||||
self.options = options
|
|
||||||
self.should_show_img = should_show_img ?? should_show_images(settings: damus_state.settings, contacts: damus_state.contacts, ev: event, our_pubkey: damus_state.pubkey)
|
self.should_show_img = should_show_img ?? should_show_images(settings: damus_state.settings, contacts: damus_state.contacts, ev: event, our_pubkey: damus_state.pubkey)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,13 +25,17 @@ struct EventBody: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NoteContentView(damus_state: damus_state, event: event, show_images: should_show_img, size: size, artifacts: .just_content(content), options: options)
|
if event_is_reply(event, privkey: damus_state.keypair.privkey) {
|
||||||
|
ReplyDescription(event: event, profiles: damus_state.profiles)
|
||||||
|
}
|
||||||
|
|
||||||
|
NoteContentView(damus_state: damus_state, event: event, show_images: should_show_img, size: size, artifacts: .just_content(content), truncate: true)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct EventBody_Previews: PreviewProvider {
|
struct EventBody_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
EventBody(damus_state: test_damus_state(), event: test_event, size: .normal, options: [])
|
EventBody(damus_state: test_damus_state(), event: test_event, size: .normal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ struct MutedEventView: View {
|
|||||||
var Event: some View {
|
var Event: some View {
|
||||||
Group {
|
Group {
|
||||||
if selected {
|
if selected {
|
||||||
SelectedEventView(damus: damus_state, event: event, size: .selected)
|
SelectedEventView(damus: damus_state, event: event)
|
||||||
} else {
|
} else {
|
||||||
EventView(damus: damus_state, event: event)
|
EventView(damus: damus_state, event: event)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import SwiftUI
|
|||||||
struct SelectedEventView: View {
|
struct SelectedEventView: View {
|
||||||
let damus: DamusState
|
let damus: DamusState
|
||||||
let event: NostrEvent
|
let event: NostrEvent
|
||||||
let size: EventViewKind
|
|
||||||
|
|
||||||
var pubkey: String {
|
var pubkey: String {
|
||||||
event.pubkey
|
event.pubkey
|
||||||
@@ -18,10 +17,9 @@ struct SelectedEventView: View {
|
|||||||
|
|
||||||
@StateObject var bar: ActionBarModel
|
@StateObject var bar: ActionBarModel
|
||||||
|
|
||||||
init(damus: DamusState, event: NostrEvent, size: EventViewKind) {
|
init(damus: DamusState, event: NostrEvent) {
|
||||||
self.damus = damus
|
self.damus = damus
|
||||||
self.event = event
|
self.event = event
|
||||||
self.size = size
|
|
||||||
self._bar = StateObject(wrappedValue: make_actionbar_model(ev: event.id, damus: damus))
|
self._bar = StateObject(wrappedValue: make_actionbar_model(ev: event.id, damus: damus))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +40,7 @@ struct SelectedEventView: View {
|
|||||||
.minimumScaleFactor(0.75)
|
.minimumScaleFactor(0.75)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
|
|
||||||
EventBody(damus_state: damus, event: event, size: size, options: [])
|
EventBody(damus_state: damus, event: event, size: .selected)
|
||||||
|
|
||||||
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
|
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
|
||||||
BuilderEventView(damus: damus, event_id: mention.ref.id)
|
BuilderEventView(damus: damus, event_id: mention.ref.id)
|
||||||
@@ -80,7 +78,7 @@ struct SelectedEventView: View {
|
|||||||
|
|
||||||
struct SelectedEventView_Previews: PreviewProvider {
|
struct SelectedEventView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
SelectedEventView(damus: test_damus_state(), event: test_event, size: .selected)
|
SelectedEventView(damus: test_damus_state(), event: test_event)
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ struct EventViewOptions: OptionSet {
|
|||||||
static let no_action_bar = EventViewOptions(rawValue: 1 << 0)
|
static let no_action_bar = EventViewOptions(rawValue: 1 << 0)
|
||||||
static let no_replying_to = EventViewOptions(rawValue: 1 << 1)
|
static let no_replying_to = EventViewOptions(rawValue: 1 << 1)
|
||||||
static let no_images = EventViewOptions(rawValue: 1 << 2)
|
static let no_images = EventViewOptions(rawValue: 1 << 2)
|
||||||
static let wide = EventViewOptions(rawValue: 1 << 3)
|
|
||||||
static let truncate_content = EventViewOptions(rawValue: 1 << 4)
|
|
||||||
static let pad_content = EventViewOptions(rawValue: 1 << 5)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TextEvent: View {
|
struct TextEvent: View {
|
||||||
@@ -28,12 +25,51 @@ struct TextEvent: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Group {
|
HStack(alignment: .top) {
|
||||||
if options.contains(.wide) {
|
let profile = damus.profiles.lookup(id: pubkey)
|
||||||
WideStyle
|
|
||||||
} else {
|
let is_anon = event_is_anonymous(ev: event)
|
||||||
ThreadedStyle
|
VStack {
|
||||||
|
MaybeAnonPfpView(state: damus, is_anon: is_anon, pubkey: pubkey)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
HStack(alignment: .center, spacing: 0) {
|
||||||
|
let pk = is_anon ? "anon" : pubkey
|
||||||
|
EventProfileName(pubkey: pk, profile: profile, damus: damus, show_friend_confirmed: true, size: .normal)
|
||||||
|
|
||||||
|
Text(verbatim: "⋅")
|
||||||
|
.font(.footnote)
|
||||||
|
.foregroundColor(.gray)
|
||||||
|
Text(verbatim: "\(format_relative_time(event.created_at))")
|
||||||
|
.font(.system(size: 16))
|
||||||
|
.foregroundColor(.gray)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
EventMenuContext(event: event, keypair: damus.keypair, target_pubkey: event.pubkey, bookmarks: damus.bookmarks)
|
||||||
|
.padding([.bottom], 4)
|
||||||
|
|
||||||
|
}
|
||||||
|
.minimumScaleFactor(0.75)
|
||||||
|
.lineLimit(1)
|
||||||
|
|
||||||
|
EventBody(damus_state: damus, event: event, size: .normal)
|
||||||
|
|
||||||
|
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
|
||||||
|
BuilderEventView(damus: damus, event_id: mention.ref.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
if has_action_bar {
|
||||||
|
Rectangle().frame(height: 2).opacity(0)
|
||||||
|
|
||||||
|
EventActionBar(damus_state: damus, event: event)
|
||||||
|
.padding([.top], 4)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding([.leading], 2)
|
||||||
}
|
}
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
.background(event_validity_color(event.validity))
|
.background(event_validity_color(event.validity))
|
||||||
@@ -41,127 +77,11 @@ struct TextEvent: View {
|
|||||||
.frame(maxWidth: .infinity, minHeight: PFP_SIZE)
|
.frame(maxWidth: .infinity, minHeight: PFP_SIZE)
|
||||||
.padding([.bottom], 2)
|
.padding([.bottom], 2)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
func Pfp(is_anon: Bool) -> some View {
|
|
||||||
MaybeAnonPfpView(state: damus, is_anon: is_anon, pubkey: pubkey)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TopPart(is_anon: Bool) -> some View {
|
|
||||||
HStack(alignment: .center, spacing: 0) {
|
|
||||||
ProfileName(is_anon: is_anon)
|
|
||||||
TimeDot
|
|
||||||
Time
|
|
||||||
Spacer()
|
|
||||||
ContextButton
|
|
||||||
}
|
|
||||||
.lineLimit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
var ReplyPart: some View {
|
|
||||||
Group {
|
|
||||||
if event_is_reply(event, privkey: damus.keypair.privkey) {
|
|
||||||
ReplyDescription(event: event, profiles: damus.profiles)
|
|
||||||
} else {
|
|
||||||
EmptyView()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var WideStyle: some View {
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
let is_anon = event_is_anonymous(ev: event)
|
|
||||||
|
|
||||||
HStack(spacing: 10) {
|
|
||||||
Pfp(is_anon: is_anon)
|
|
||||||
VStack {
|
|
||||||
TopPart(is_anon: is_anon)
|
|
||||||
ReplyPart
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding(.horizontal)
|
|
||||||
|
|
||||||
EvBody(options: [.truncate_content, .pad_content])
|
struct TextEvent_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
|
TextEvent(damus: test_damus_state(), event: test_event, pubkey: "pk", options: [])
|
||||||
Mention(mention)
|
|
||||||
.padding(.horizontal)
|
|
||||||
}
|
|
||||||
|
|
||||||
if has_action_bar {
|
|
||||||
//EmptyRect
|
|
||||||
ActionBar
|
|
||||||
.padding(.horizontal)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var TimeDot: some View {
|
|
||||||
Text(verbatim: "⋅")
|
|
||||||
.font(.footnote)
|
|
||||||
.foregroundColor(.gray)
|
|
||||||
}
|
|
||||||
|
|
||||||
var Time: some View {
|
|
||||||
Text(verbatim: "\(format_relative_time(event.created_at))")
|
|
||||||
.font(.system(size: 16))
|
|
||||||
.foregroundColor(.gray)
|
|
||||||
}
|
|
||||||
|
|
||||||
var ContextButton: some View {
|
|
||||||
EventMenuContext(event: event, keypair: damus.keypair, target_pubkey: event.pubkey, bookmarks: damus.bookmarks)
|
|
||||||
.padding([.bottom], 4)
|
|
||||||
}
|
|
||||||
|
|
||||||
func ProfileName(is_anon: Bool) -> some View {
|
|
||||||
let profile = damus.profiles.lookup(id: pubkey)
|
|
||||||
let pk = is_anon ? "anon" : pubkey
|
|
||||||
return EventProfileName(pubkey: pk, profile: profile, damus: damus, show_friend_confirmed: true, size: .normal)
|
|
||||||
}
|
|
||||||
|
|
||||||
func EvBody(options: EventViewOptions) -> some View {
|
|
||||||
return EventBody(damus_state: damus, event: event, size: .normal, options: options)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Mention(_ mention: Mention) -> some View {
|
|
||||||
return BuilderEventView(damus: damus, event_id: mention.ref.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
var ActionBar: some View {
|
|
||||||
return EventActionBar(damus_state: damus, event: event)
|
|
||||||
.padding([.top], 4)
|
|
||||||
}
|
|
||||||
|
|
||||||
var EmptyRect: some View {
|
|
||||||
return Rectangle().frame(height: 2).opacity(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
var ThreadedStyle: some View {
|
|
||||||
HStack(alignment: .top) {
|
|
||||||
|
|
||||||
let is_anon = event_is_anonymous(ev: event)
|
|
||||||
VStack {
|
|
||||||
Pfp(is_anon: is_anon)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
TopPart(is_anon: is_anon)
|
|
||||||
|
|
||||||
ReplyPart
|
|
||||||
EvBody(options: [])
|
|
||||||
|
|
||||||
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
|
|
||||||
Mention(mention)
|
|
||||||
}
|
|
||||||
|
|
||||||
if has_action_bar {
|
|
||||||
EmptyRect
|
|
||||||
ActionBar
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.padding([.leading], 2)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,16 +99,3 @@ func event_has_tag(ev: NostrEvent, tag: String) -> Bool {
|
|||||||
func event_is_anonymous(ev: NostrEvent) -> Bool {
|
func event_is_anonymous(ev: NostrEvent) -> Bool {
|
||||||
return ev.known_kind == .zap_request && event_has_tag(ev: ev, tag: "anon")
|
return ev.known_kind == .zap_request && event_has_tag(ev: ev, tag: "anon")
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TextEvent_Previews: PreviewProvider {
|
|
||||||
static var previews: some View {
|
|
||||||
VStack(spacing: 20) {
|
|
||||||
TextEvent(damus: test_damus_state(), event: test_event, pubkey: "pk", options: [])
|
|
||||||
.frame(height: 400)
|
|
||||||
|
|
||||||
TextEvent(damus: test_damus_state(), event: test_event, pubkey: "pk", options: [.wide])
|
|
||||||
.frame(height: 400)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
//
|
|
||||||
// WideEventView.swift
|
|
||||||
// damus
|
|
||||||
//
|
|
||||||
// Created by William Casarin on 2023-03-23.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct WideEventView: View {
|
|
||||||
let event: NostrEvent
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
EmptyView()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct WideEventView_Previews: PreviewProvider {
|
|
||||||
static var previews: some View {
|
|
||||||
WideEventView(event: test_event)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,48 +28,32 @@ struct NoteContentView: View {
|
|||||||
let show_images: Bool
|
let show_images: Bool
|
||||||
let size: EventViewKind
|
let size: EventViewKind
|
||||||
let preview_height: CGFloat?
|
let preview_height: CGFloat?
|
||||||
let options: EventViewOptions
|
let truncate: Bool
|
||||||
|
|
||||||
@State var artifacts: NoteArtifacts
|
@State var artifacts: NoteArtifacts
|
||||||
@State var preview: LinkViewRepresentable?
|
@State var preview: LinkViewRepresentable?
|
||||||
|
|
||||||
init(damus_state: DamusState, event: NostrEvent, show_images: Bool, size: EventViewKind, artifacts: NoteArtifacts, options: EventViewOptions) {
|
init(damus_state: DamusState, event: NostrEvent, show_images: Bool, size: EventViewKind, artifacts: NoteArtifacts, truncate: Bool) {
|
||||||
self.damus_state = damus_state
|
self.damus_state = damus_state
|
||||||
self.event = event
|
self.event = event
|
||||||
self.show_images = show_images
|
self.show_images = show_images
|
||||||
self.size = size
|
self.size = size
|
||||||
self.options = options
|
|
||||||
self._artifacts = State(initialValue: artifacts)
|
self._artifacts = State(initialValue: artifacts)
|
||||||
self.preview_height = lookup_cached_preview_size(previews: damus_state.previews, evid: event.id)
|
self.preview_height = lookup_cached_preview_size(previews: damus_state.previews, evid: event.id)
|
||||||
self._preview = State(initialValue: load_cached_preview(previews: damus_state.previews, evid: event.id))
|
self._preview = State(initialValue: load_cached_preview(previews: damus_state.previews, evid: event.id))
|
||||||
self._artifacts = State(initialValue: render_note_content(ev: event, profiles: damus_state.profiles, privkey: damus_state.keypair.privkey))
|
self._artifacts = State(initialValue: render_note_content(ev: event, profiles: damus_state.profiles, privkey: damus_state.keypair.privkey))
|
||||||
}
|
self.truncate = truncate
|
||||||
|
|
||||||
var truncate: Bool {
|
|
||||||
return options.contains(.truncate_content)
|
|
||||||
}
|
|
||||||
|
|
||||||
var with_padding: Bool {
|
|
||||||
return options.contains(.pad_content)
|
|
||||||
}
|
|
||||||
|
|
||||||
var truncatedText: some View {
|
|
||||||
TruncatedText(text: artifacts.content, maxChars: (truncate ? 280 : nil))
|
|
||||||
.font(eventviewsize_to_font(size))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func MainContent() -> some View {
|
func MainContent() -> some View {
|
||||||
return VStack(alignment: .leading) {
|
return VStack(alignment: .leading) {
|
||||||
|
|
||||||
if size == .selected {
|
if size == .selected {
|
||||||
SelectableText(attributedString: artifacts.content)
|
SelectableText(attributedString: artifacts.content)
|
||||||
TranslateView(damus_state: damus_state, event: event)
|
TranslateView(damus_state: damus_state, event: event)
|
||||||
} else {
|
} else {
|
||||||
if with_padding {
|
TruncatedText(text: artifacts.content, maxChars: (truncate ? 280 : nil))
|
||||||
truncatedText
|
.font(eventviewsize_to_font(size))
|
||||||
.padding(.horizontal)
|
|
||||||
} else {
|
|
||||||
truncatedText
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if show_images && artifacts.images.count > 0 {
|
if show_images && artifacts.images.count > 0 {
|
||||||
@@ -80,7 +64,7 @@ struct NoteContentView: View {
|
|||||||
Blur()
|
Blur()
|
||||||
.disabled(true)
|
.disabled(true)
|
||||||
}
|
}
|
||||||
//.cornerRadius(10)
|
.cornerRadius(10)
|
||||||
}
|
}
|
||||||
|
|
||||||
if artifacts.invoices.count > 0 {
|
if artifacts.invoices.count > 0 {
|
||||||
@@ -193,7 +177,7 @@ struct NoteContentView_Previews: PreviewProvider {
|
|||||||
let state = test_damus_state()
|
let state = test_damus_state()
|
||||||
let content = "hi there ¯\\_(ツ)_/¯ https://jb55.com/s/Oct12-150217.png 5739a762ef6124dd.jpg"
|
let content = "hi there ¯\\_(ツ)_/¯ https://jb55.com/s/Oct12-150217.png 5739a762ef6124dd.jpg"
|
||||||
let artifacts = NoteArtifacts(content: AttributedString(stringLiteral: content), images: [], invoices: [], links: [])
|
let artifacts = NoteArtifacts(content: AttributedString(stringLiteral: content), images: [], invoices: [], links: [])
|
||||||
NoteContentView(damus_state: state, event: NostrEvent(content: content, pubkey: "pk"), show_images: true, size: .normal, artifacts: artifacts, options: [])
|
NoteContentView(damus_state: state, event: NostrEvent(content: content, pubkey: "pk"), show_images: true, size: .normal, artifacts: artifacts, truncate: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
//
|
|
||||||
// RepostedEvent.swift
|
|
||||||
// damus
|
|
||||||
//
|
|
||||||
// Created by William Casarin on 2023-03-23.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct RepostedEvent: View {
|
|
||||||
let damus: DamusState
|
|
||||||
let event: NostrEvent
|
|
||||||
let inner_ev: NostrEvent
|
|
||||||
let options: EventViewOptions
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
VStack(alignment: .leading) {
|
|
||||||
let prof = damus.profiles.lookup(id: event.pubkey)
|
|
||||||
let booster_profile = ProfileView(damus_state: damus, pubkey: event.pubkey)
|
|
||||||
|
|
||||||
NavigationLink(destination: booster_profile) {
|
|
||||||
Reposted(damus: damus, pubkey: event.pubkey, profile: prof)
|
|
||||||
.padding(.horizontal)
|
|
||||||
}
|
|
||||||
.buttonStyle(PlainButtonStyle())
|
|
||||||
|
|
||||||
//SelectedEventView(damus: damus, event: inner_ev, size: .normal)
|
|
||||||
TextEvent(damus: damus, event: inner_ev, pubkey: inner_ev.pubkey, options: options)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct RepostedEvent_Previews: PreviewProvider {
|
|
||||||
static var previews: some View {
|
|
||||||
RepostedEvent(damus: test_damus_state(), event: test_event, inner_ev: test_event, options: [])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -37,7 +37,7 @@ struct InnerTimelineView: View {
|
|||||||
EmptyTimelineView()
|
EmptyTimelineView()
|
||||||
} else {
|
} else {
|
||||||
ForEach(events.filter(filter), id: \.id) { (ev: NostrEvent) in
|
ForEach(events.filter(filter), id: \.id) { (ev: NostrEvent) in
|
||||||
EventView(damus: damus, event: ev, options: [.wide])
|
EventView(damus: damus, event: ev)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
nav_target = ev.inner_event ?? ev
|
nav_target = ev.inner_event ?? ev
|
||||||
navigating = true
|
navigating = true
|
||||||
@@ -49,7 +49,7 @@ struct InnerTimelineView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user