Huge refactor to add better structure to the project. Separating features with their associated view and model structure. This should be better organization and will allow us to improve the overall architecture in the future. I forsee many more improvements that can follow this change. e.g. MVVM Arch As well as cleaning up duplicate, unused, functionality. Many files have global functions that can also be moved or be renamed. damus/ ├── Features/ │ ├── <Feature>/ │ │ ├── Views/ │ │ └── Models/ ├── Shared/ │ ├── Components/ │ ├── Media/ │ ├── Buttons/ │ ├── Extensions/ │ ├── Empty Views/ │ ├── ErrorHandling/ │ ├── Modifiers/ │ └── Utilities/ ├── Core/ │ ├── Nostr/ │ ├── NIPs/ │ ├── DIPs/ │ ├── Types/ │ ├── Networking/ │ └── Storage/ Signed-off-by: ericholguin <ericholguin@apache.org>
71 lines
2.6 KiB
Swift
71 lines
2.6 KiB
Swift
//
|
|
// ReplyQuoteView.swift
|
|
// damus
|
|
//
|
|
// Created by William Casarin on 2022-04-19.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ReplyQuoteView: View {
|
|
let keypair: Keypair
|
|
let quoter: NostrEvent
|
|
let event_id: NoteId
|
|
let state: DamusState
|
|
@ObservedObject var thread: ThreadModel
|
|
let options: EventViewOptions
|
|
|
|
func content(event: NdbNote) -> some View {
|
|
ZStack(alignment: .leading) {
|
|
VStack(alignment: .leading) {
|
|
HStack(alignment: .center) {
|
|
if should_show_event(event: event, damus_state: state) {
|
|
ProfilePicView(pubkey: event.pubkey, size: 14, highlight: .reply, profiles: state.profiles, disable_animation: false)
|
|
let blur_images = should_blur_images(settings: state.settings, contacts: state.contacts, ev: event, our_pubkey: state.pubkey)
|
|
NoteContentView(damus_state: state, event: event, blur_images: blur_images, size: .small, options: options)
|
|
.font(.callout)
|
|
.lineLimit(1)
|
|
.padding(.bottom, -7)
|
|
.padding(.top, -5)
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.frame(height: 20)
|
|
.clipped()
|
|
}
|
|
else {
|
|
Text("Note you've muted", comment: "Label indicating note has been muted")
|
|
.italic()
|
|
.font(.caption)
|
|
.opacity(0.5)
|
|
.padding(.bottom, -7)
|
|
.padding(.top, -5)
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.frame(height: 20)
|
|
.clipped()
|
|
}
|
|
}
|
|
}
|
|
.padding(5)
|
|
.padding(.leading, 5+3)
|
|
Rectangle()
|
|
.foregroundStyle(.accent)
|
|
.frame(width: 3)
|
|
}
|
|
}
|
|
|
|
var body: some View {
|
|
Group {
|
|
if let event = state.events.lookup(event_id) {
|
|
self.content(event: event)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct ReplyQuoteView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
let s = test_damus_state
|
|
let quoter = test_note
|
|
ReplyQuoteView(keypair: s.keypair, quoter: quoter, event_id: test_note.id, state: s, thread: ThreadModel(event: quoter, damus_state: s), options: [.no_previews, .no_action_bar, .truncate_content_very_short, .no_show_more, .no_translate])
|
|
}
|
|
}
|