damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 2c44366ca5b4c297b5a22478781005230c0be1df
parent 300cae68002843c3f5c38dd88d266f32e207512e
Author: Jacob Davis <ismyhc@gmail.com>
Date:   Sat, 17 Dec 2022 16:11:19 -0500

Fix padding and other minor UI improvements

Diffstat:
Mdamus.xcodeproj/project.pbxproj | 4++--
Mdamus/ContentView.swift | 16+++++++++++++---
Mdamus/Views/ChatroomView.swift | 2++
Mdamus/Views/DMChatView.swift | 48+++++++++++++++++++++++++-----------------------
Mdamus/Views/DirectMessagesView.swift | 2++
Mdamus/Views/EventDetailView.swift | 20++++++++++++--------
Mdamus/Views/SearchHomeView.swift | 22++++++++++++++++------
Mdamus/Views/ThreadView.swift | 1-
Mdamus/Views/TimelineView.swift | 1+
9 files changed, 73 insertions(+), 43 deletions(-)

diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj @@ -1000,7 +1000,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\""; - DEVELOPMENT_TEAM = XK7H4JAB3D; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = damus/Info.plist; @@ -1039,7 +1039,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\""; - DEVELOPMENT_TEAM = XK7H4JAB3D; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = damus/Info.plist; diff --git a/damus/ContentView.swift b/damus/ContentView.swift @@ -73,11 +73,11 @@ struct ContentView: View { let timer = Timer.publish(every: 4, on: .main, in: .common).autoconnect() let sub_id = UUID().description + + @Environment(\.colorScheme) var colorScheme var PostingTimelineView: some View { VStack{ - FiltersView - .padding([.bottom], 8) ZStack { if let damus = self.damus_state { TimelineView(events: $home.events, loading: $home.loading, damus: damus, show_friend_icon: false, filter: filter_event) @@ -89,6 +89,16 @@ struct ContentView: View { } } } + .safeAreaInset(edge: .top) { + VStack(spacing: 0) { + FiltersView + //.frame(maxWidth: 275) + .padding() + Divider() + .frame(height: 1) + } + .background(colorScheme == .dark ? Color.black : Color.white) + } } var FiltersView: some View { @@ -139,7 +149,7 @@ struct ContentView: View { EmptyView() } } - .navigationBarTitle("Damus", displayMode: .inline) + .navigationBarTitle(selected_timeline == .home ? "Home" : "Global", displayMode: .inline) } var MaybeSearchView: some View { diff --git a/damus/Views/ChatroomView.swift b/damus/Views/ChatroomView.swift @@ -37,6 +37,8 @@ struct ChatroomView: View { } } + .padding(.horizontal) + .padding(.top) EndBlock() } diff --git a/damus/Views/DMChatView.swift b/damus/Views/DMChatView.swift @@ -12,12 +12,6 @@ struct DMChatView: View { let pubkey: String @EnvironmentObject var dms: DirectMessageModel @State var message: String = "" - - init(damus_state: DamusState, pubkey: String) { - self.damus_state = damus_state - self.pubkey = pubkey - UITextView.appearance().backgroundColor = .clear - } var Messages: some View { ScrollViewReader { scroller in @@ -29,6 +23,7 @@ struct DMChatView: View { } EndBlock(height: 80) } + .padding(.horizontal) } .onAppear { scroller.scrollTo("endblock") @@ -53,9 +48,16 @@ struct DMChatView: View { var InputField: some View { TextEditor(text: $message) - .cornerRadius(20) - .padding(8) - .background(InputBackground().cornerRadius(20)) + .textEditorBackground { + InputBackground() + } + .cornerRadius(8) + .background( + RoundedRectangle(cornerRadius: 8) + .stroke(style: .init(lineWidth: 2)) + .foregroundColor(.secondary.opacity(0.2)) + ) + .padding(16) .foregroundColor(Color.primary) } @@ -63,9 +65,9 @@ struct DMChatView: View { func InputBackground() -> Color { if colorScheme == .light { - return Color.init(.sRGB, red: 0.8, green: 0.8, blue: 0.8, opacity: 1.0) + return Color.init(.sRGB, red: 0.9, green: 0.9, blue: 0.9, opacity: 1.0) } else { - return Color.init(.sRGB, red: 0.2, green: 0.2, blue: 0.2, opacity: 1.0) + return Color.init(.sRGB, red: 0.1, green: 0.1, blue: 0.1, opacity: 1.0) } } @@ -78,21 +80,21 @@ struct DMChatView: View { } var Footer: some View { - //ZStack { - //BackgroundColor() - - HStack(spacing: 0) { - InputField - - if !message.isEmpty { - Button(role: .none, action: send_message) { - Label("", systemImage: "arrow.right.circle") - .font(.title) + ZStack { + BackgroundColor() + + HStack(spacing: 0) { + InputField + + if !message.isEmpty { + Button(role: .none, action: send_message) { + Label("", systemImage: "arrow.right.circle") + .font(.title) + } } } } .frame(height: 50 + 20 * CGFloat(text_lines)) - //} } var text_lines: Int { @@ -123,12 +125,12 @@ struct DMChatView: View { message = "" damus_state.pool.send(.event(dm)) + end_editing() } var body: some View { ZStack { Messages - .padding([.top, .leading, .trailing], 10) .dismissKeyboardOnTap() VStack { diff --git a/damus/Views/DirectMessagesView.swift b/damus/Views/DirectMessagesView.swift @@ -18,6 +18,8 @@ struct DirectMessagesView: View { MaybeEvent(tup) } } + .padding(.horizontal) + .padding(.top) } } diff --git a/damus/Views/EventDetailView.swift b/damus/Views/EventDetailView.swift @@ -91,15 +91,19 @@ struct EventDetailView: View { } ScrollView(.vertical) { - let collapsed_events = calculated_collapsed_events( - privkey: damus.keypair.privkey, - collapsed: self.collapsed, - active: thread.event, - events: thread.events - ) - ForEach(collapsed_events, id: \.id) { cev in - CollapsedEventView(cev, scroller: proxy) + LazyVStack { + let collapsed_events = calculated_collapsed_events( + privkey: damus.keypair.privkey, + collapsed: self.collapsed, + active: thread.event, + events: thread.events + ) + ForEach(collapsed_events, id: \.id) { cev in + CollapsedEventView(cev, scroller: proxy) + } } + .padding(.horizontal) + .padding(.top) EndBlock() } diff --git a/damus/Views/SearchHomeView.swift b/damus/Views/SearchHomeView.swift @@ -17,7 +17,7 @@ struct SearchHomeView: View { ZStack(alignment: .leading) { HStack{ TextField("", text: $search) - .padding(5) + .padding(8) .padding(.leading, 35) .textInputAutocapitalization(.never) Label("", systemImage: "xmark.square") @@ -32,10 +32,10 @@ struct SearchHomeView: View { .padding(.leading, 10) } .background { - RoundedRectangle(cornerRadius: 20) - .foregroundColor(.gray.opacity(0.2)) + RoundedRectangle(cornerRadius: 8) + .foregroundColor(.secondary.opacity(0.2)) } - .padding() + //.padding() } var GlobalContent: some View { @@ -56,12 +56,22 @@ struct SearchHomeView: View { } } + @Environment(\.colorScheme) var colorScheme + var body: some View { VStack { - SearchInput - MainContent } + .safeAreaInset(edge: .top) { + VStack(spacing: 0) { + SearchInput + //.frame(maxWidth: 275) + .padding() + Divider() + .frame(height: 1) + } + .background(colorScheme == .dark ? Color.black : Color.white) + } .onChange(of: search) { s in print("search change 1") } diff --git a/damus/Views/ThreadView.swift b/damus/Views/ThreadView.swift @@ -35,7 +35,6 @@ struct ThreadView: View { } */ } - .padding([.leading, .trailing], 6) .onReceive(handle_notify(.switched_timeline)) { n in dismiss() } diff --git a/damus/Views/TimelineView.swift b/damus/Views/TimelineView.swift @@ -32,6 +32,7 @@ struct InnerTimelineView: View { .buttonStyle(PlainButtonStyle()) } } + .padding(.horizontal) } }