Everything looking really clean. tested and working in dark mode as well
This commit is contained in:
@@ -189,7 +189,11 @@ func convert_invoice_block(_ b: invoice_block) -> Block? {
|
||||
return nil
|
||||
}
|
||||
|
||||
let description = String(cString: b11.description)
|
||||
var description = ""
|
||||
if b11.description != nil {
|
||||
description = String(cString: b11.description)
|
||||
}
|
||||
|
||||
guard let msat = maybe_pointee(b11.msat) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -485,7 +485,10 @@ func make_first_contact_event(keypair: Keypair) -> NostrEvent? {
|
||||
}
|
||||
|
||||
let rw_relay_info = RelayInfo(read: true, write: true)
|
||||
let relays: [String: RelayInfo] = ["wss://relay.damus.io": rw_relay_info]
|
||||
var relays: [String: RelayInfo] = [:]
|
||||
for relay in BOOTSTRAP_RELAYS {
|
||||
relays[relay] = rw_relay_info
|
||||
}
|
||||
let relay_json = encode_json(relays)!
|
||||
let damus_pubkey = "3efdaebb1d8923ebd99c9e7ace3b4194ab45512e2be79c1b7d68d9243e0d2681"
|
||||
let tags = [
|
||||
|
||||
@@ -106,7 +106,7 @@ struct ChatView: View {
|
||||
}
|
||||
}
|
||||
|
||||
NoteContentView(privkey: damus_state.keypair.privkey, event: event, profiles: damus_state.profiles, show_images: true, artifacts: .just_content(event.content))
|
||||
NoteContentView(privkey: damus_state.keypair.privkey, event: event, profiles: damus_state.profiles, show_images: should_show_images(contacts: damus_state.contacts, ev: event), artifacts: .just_content(event.content))
|
||||
|
||||
if is_active || next_ev == nil || next_ev!.pubkey != event.pubkey {
|
||||
let bar = make_actionbar_model(ev: event, damus: damus_state)
|
||||
|
||||
@@ -83,6 +83,7 @@ struct CreateAccountView: View {
|
||||
.padding(.trailing, 20.0)
|
||||
|
||||
}
|
||||
.dismissKeyboardOnTap()
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarBackButtonHidden(true)
|
||||
.navigationBarItems(leading: BackNav())
|
||||
|
||||
@@ -21,7 +21,7 @@ struct DMView: View {
|
||||
Spacer()
|
||||
}
|
||||
|
||||
NoteContentView(privkey: damus_state.keypair.privkey, event: event, profiles: damus_state.profiles, show_images: true, artifacts: .just_content(event.get_content(damus_state.keypair.privkey)))
|
||||
NoteContentView(privkey: damus_state.keypair.privkey, event: event, profiles: damus_state.profiles, show_images: should_show_images(contacts: damus_state.contacts, ev: event), artifacts: .just_content(event.get_content(damus_state.keypair.privkey)))
|
||||
.foregroundColor(is_ours ? Color.white : Color.primary)
|
||||
.padding(10)
|
||||
.background(is_ours ? Color.accentColor : Color.secondary.opacity(0.15))
|
||||
|
||||
@@ -14,8 +14,12 @@ struct DirectMessagesView: View {
|
||||
var MainContent: some View {
|
||||
ScrollView {
|
||||
LazyVStack {
|
||||
ForEach(model.dms, id: \.0) { tup in
|
||||
MaybeEvent(tup)
|
||||
if model.dms.isEmpty, !model.loading {
|
||||
EmptyTimelineView()
|
||||
} else {
|
||||
ForEach(model.dms, id: \.0) { tup in
|
||||
MaybeEvent(tup)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
|
||||
29
damus/Views/Empty Views/EmptyTimelineView.swift
Normal file
29
damus/Views/Empty Views/EmptyTimelineView.swift
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// EmptyNotificationsView.swift
|
||||
// damus
|
||||
//
|
||||
// Created by Sam DuBois on 12/17/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct EmptyTimelineView: View {
|
||||
var body: some View {
|
||||
VStack {
|
||||
Image(systemName: "tray.fill")
|
||||
.font(.system(size: 35))
|
||||
.padding()
|
||||
Text("Nothing to see here. Check back later!")
|
||||
.multilineTextAlignment(.center)
|
||||
.font(.callout.weight(.medium))
|
||||
}
|
||||
.foregroundColor(.gray)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
struct EmptyTimelineView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
EmptyTimelineView()
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ struct EventView: View {
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
NoteContentView(privkey: damus.keypair.privkey, event: event, profiles: damus.profiles, show_images: true, artifacts: .just_content(content))
|
||||
NoteContentView(privkey: damus.keypair.privkey, event: event, profiles: damus.profiles, show_images: should_show_images(contacts: damus.contacts, ev: event), artifacts: .just_content(content))
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
if has_action_bar {
|
||||
@@ -159,6 +159,14 @@ struct EventView: View {
|
||||
}
|
||||
}
|
||||
|
||||
// blame the porn bots for this code
|
||||
func should_show_images(contacts: Contacts, ev: NostrEvent) -> Bool {
|
||||
if contacts.is_friend(ev.pubkey) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func event_validity_color(_ validation: ValidationResult) -> some View {
|
||||
Group {
|
||||
switch validation {
|
||||
|
||||
@@ -80,7 +80,10 @@ struct SaveKeysView: View {
|
||||
}
|
||||
|
||||
func complete_account_creation(_ account: CreateAccountModel) {
|
||||
add_rw_relay(self.pool, "wss://relay.damus.io")
|
||||
for relay in BOOTSTRAP_RELAYS {
|
||||
add_rw_relay(self.pool, relay)
|
||||
}
|
||||
|
||||
self.pool.register_handler(sub_id: "signup", handler: handle_event)
|
||||
|
||||
self.loading = true
|
||||
|
||||
@@ -21,16 +21,20 @@ struct InnerTimelineView: View {
|
||||
|
||||
var body: some View {
|
||||
LazyVStack {
|
||||
ForEach(events.filter(filter), id: \.id) { (ev: NostrEvent) in
|
||||
let tm = ThreadModel(event: inner_event_or_self(ev: ev), damus_state: damus)
|
||||
let is_chatroom = should_show_chatroom(ev)
|
||||
let tv = ThreadView(thread: tm, damus: damus, is_chatroom: is_chatroom)
|
||||
|
||||
NavigationLink(destination: tv) {
|
||||
EventView(event: ev, highlight: .none, has_action_bar: true, damus: damus, show_friend_icon: show_friend_icon)
|
||||
if events.isEmpty {
|
||||
EmptyTimelineView()
|
||||
} else {
|
||||
ForEach(events.filter(filter), id: \.id) { (ev: NostrEvent) in
|
||||
let tm = ThreadModel(event: inner_event_or_self(ev: ev), damus_state: damus)
|
||||
let is_chatroom = should_show_chatroom(ev)
|
||||
let tv = ThreadView(thread: tm, damus: damus, is_chatroom: is_chatroom)
|
||||
|
||||
NavigationLink(destination: tv) {
|
||||
EventView(event: ev, highlight: .none, has_action_bar: true, damus: damus, show_friend_icon: show_friend_icon)
|
||||
}
|
||||
.isDetailLink(true)
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
.isDetailLink(true)
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
@@ -76,8 +80,11 @@ struct TimelineView: View {
|
||||
ScrollView {
|
||||
if loading {
|
||||
InnerTimelineRedactedView(events: Constants.EXAMPLE_EVENTS, damus: damus, show_friend_icon: true)
|
||||
ProgressView()
|
||||
.progressViewStyle(.circular)
|
||||
} else {
|
||||
InnerTimelineView(events: $events, damus: damus, show_friend_icon: show_friend_icon, filter: filter)
|
||||
}
|
||||
InnerTimelineView(events: $events, damus: damus, show_friend_icon: show_friend_icon, filter: filter)
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .scroll_to_top)) { _ in
|
||||
guard let event = events.filter(self.filter).first else {
|
||||
|
||||
Reference in New Issue
Block a user