commit 2ff12823f2b9a80645fd2090689928c5d027cb92
parent d6d996e84b87cb881c7e248a2e8fa3989d71107a
Author: William Casarin <jb55@jb55.com>
Date: Tue, 18 Apr 2023 12:43:26 -0700
Don't nest embedded notes
Diffstat:
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj
@@ -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;
@@ -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;
diff --git a/damus/Views/Events/TextEvent.swift b/damus/Views/Events/TextEvent.swift
@@ -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 {
@@ -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)
}
@@ -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) {
@@ -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)
}