Skip to content

Commit

Permalink
Don't nest embedded notes
Browse files Browse the repository at this point in the history
  • Loading branch information
jb55 committed Apr 18, 2023
1 parent d6d996e commit 2ff1282
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions damus.xcodeproj/project.pbxproj
Expand Up @@ -2008,7 +2008,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\"";
DEVELOPMENT_TEAM = XK7H4JAB3D;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -2055,7 +2055,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\"";
DEVELOPMENT_TEAM = XK7H4JAB3D;
ENABLE_PREVIEWS = YES;
Expand Down
15 changes: 12 additions & 3 deletions damus/Views/Events/TextEvent.swift
Expand Up @@ -18,8 +18,9 @@ struct EventViewOptions: OptionSet {
static let pad_content = EventViewOptions(rawValue: 1 << 5)
static let no_translate = EventViewOptions(rawValue: 1 << 6)
static let small_pfp = EventViewOptions(rawValue: 1 << 7)
static let nested = EventViewOptions(rawValue: 1 << 8)

static let embedded: EventViewOptions = [.no_action_bar, .small_pfp, .wide, .truncate_content]
static let embedded: EventViewOptions = [.no_action_bar, .small_pfp, .wide, .truncate_content, .nested]
}

struct TextEvent: View {
Expand Down Expand Up @@ -86,7 +87,7 @@ struct TextEvent: View {

EvBody(options: self.options.union(.pad_content))

if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
if let mention = get_mention() {
Mention(mention)
.padding(.horizontal)
}
Expand Down Expand Up @@ -139,6 +140,14 @@ struct TextEvent: View {
return Rectangle().frame(height: 2).opacity(0)
}

func get_mention() -> Mention? {
if self.options.contains(.nested) {
return nil
}

return first_eref_mention(ev: event, privkey: damus.keypair.privkey)
}

var ThreadedStyle: some View {
HStack(alignment: .top) {

Expand All @@ -155,7 +164,7 @@ struct TextEvent: View {
ReplyPart
EvBody(options: self.options)

if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
if let mention = get_mention() {
Mention(mention)
}

Expand Down

0 comments on commit 2ff1282

Please sign in to comment.