Don't nest embedded notes

This commit is contained in:
William Casarin
2023-04-18 12:43:26 -07:00
parent d6d996e84b
commit 2ff12823f2
2 changed files with 14 additions and 5 deletions

View File

@@ -2008,7 +2008,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements; CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\"";
DEVELOPMENT_TEAM = XK7H4JAB3D; DEVELOPMENT_TEAM = XK7H4JAB3D;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -2055,7 +2055,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements; CODE_SIGN_ENTITLEMENTS = damus/damus.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\"";
DEVELOPMENT_TEAM = XK7H4JAB3D; DEVELOPMENT_TEAM = XK7H4JAB3D;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;

View File

@@ -18,8 +18,9 @@ struct EventViewOptions: OptionSet {
static let pad_content = EventViewOptions(rawValue: 1 << 5) static let pad_content = EventViewOptions(rawValue: 1 << 5)
static let no_translate = EventViewOptions(rawValue: 1 << 6) static let no_translate = EventViewOptions(rawValue: 1 << 6)
static let small_pfp = EventViewOptions(rawValue: 1 << 7) 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 { struct TextEvent: View {
@@ -86,7 +87,7 @@ struct TextEvent: View {
EvBody(options: self.options.union(.pad_content)) 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) Mention(mention)
.padding(.horizontal) .padding(.horizontal)
} }
@@ -139,6 +140,14 @@ struct TextEvent: View {
return Rectangle().frame(height: 2).opacity(0) 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 { var ThreadedStyle: some View {
HStack(alignment: .top) { HStack(alignment: .top) {
@@ -155,7 +164,7 @@ struct TextEvent: View {
ReplyPart ReplyPart
EvBody(options: self.options) EvBody(options: self.options)
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) { if let mention = get_mention() {
Mention(mention) Mention(mention)
} }