minor UI improvements (#267)
This commit is contained in:
parent
7d06d0660d
commit
214ecf605b
@ -55,18 +55,15 @@ final class ChatModel: ObservableObject {
|
||||
func addChatItem(_ cInfo: ChatInfo, _ cItem: ChatItem) {
|
||||
if let ix = chats.firstIndex(where: { $0.id == cInfo.id }) {
|
||||
chats[ix].chatItems = [cItem]
|
||||
if chatId != cInfo.id {
|
||||
withAnimation {
|
||||
let chat = chats.remove(at: ix)
|
||||
chats.insert(chat, at: 0)
|
||||
}
|
||||
if chatId != nil {
|
||||
// meesage arrived to some other chat
|
||||
}
|
||||
withAnimation {
|
||||
let chat = chats.remove(at: ix)
|
||||
chats.insert(chat, at: 0)
|
||||
}
|
||||
}
|
||||
if chatId == cInfo.id {
|
||||
withAnimation { chatItems.append(cItem) }
|
||||
} else if chatId != nil {
|
||||
// meesage arrived to some other chat, show notification
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ struct ChatView: View {
|
||||
VStack {
|
||||
ScrollViewReader { proxy in
|
||||
ScrollView {
|
||||
VStack {
|
||||
VStack(spacing: 5) {
|
||||
ForEach(chatModel.chatItems, id: \.id) {
|
||||
ChatItemView(chatItem: $0)
|
||||
}
|
||||
@ -35,12 +35,14 @@ struct ChatView: View {
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
Button { chatModel.chatId = nil } label: {
|
||||
Image(systemName: "chevron.backward")
|
||||
HStack(spacing: 4) {
|
||||
Image(systemName: "chevron.backward")
|
||||
Text("Chats")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationBarBackButtonHidden(true)
|
||||
|
||||
}
|
||||
|
||||
func scrollToBottom(_ proxy: ScrollViewProxy) {
|
||||
|
@ -26,12 +26,6 @@ struct ChatListView: View {
|
||||
|
||||
NavigationView {
|
||||
List {
|
||||
NavigationLink {
|
||||
TerminalView()
|
||||
} label: {
|
||||
Text("Terminal")
|
||||
}
|
||||
|
||||
ForEach(chatModel.chats) { chat in
|
||||
ChatListNavLink(chat: chat)
|
||||
}
|
||||
|
@ -14,26 +14,39 @@ struct TerminalView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
ScrollView {
|
||||
LazyVStack {
|
||||
ForEach(chatModel.terminalItems) { item in
|
||||
NavigationLink {
|
||||
ScrollView {
|
||||
Text(item.details)
|
||||
.textSelection(.enabled)
|
||||
ScrollViewReader { proxy in
|
||||
ScrollView {
|
||||
LazyVStack {
|
||||
ForEach(chatModel.terminalItems) { item in
|
||||
NavigationLink {
|
||||
ScrollView {
|
||||
Text(item.details)
|
||||
.textSelection(.enabled)
|
||||
}
|
||||
} label: {
|
||||
Text(item.label)
|
||||
.frame(width: 360, height: 30, alignment: .leading)
|
||||
}
|
||||
} label: {
|
||||
Text(item.label)
|
||||
.frame(width: 360, height: 30, alignment: .leading)
|
||||
}
|
||||
.onAppear { scrollToBottom(proxy) }
|
||||
.onChange(of: chatModel.terminalItems.count) { _ in scrollToBottom(proxy) }
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
SendMessageView(sendMessage: sendMessage, inProgress: inProgress)
|
||||
}
|
||||
.navigationViewStyle(.stack)
|
||||
}
|
||||
.navigationViewStyle(.stack)
|
||||
.navigationTitle("Chat console")
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
SendMessageView(sendMessage: sendMessage, inProgress: inProgress)
|
||||
func scrollToBottom(_ proxy: ScrollViewProxy) {
|
||||
if let id = chatModel.terminalItems.last?.id {
|
||||
withAnimation {
|
||||
proxy.scrollTo(id, anchor: .bottom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,11 +44,19 @@ struct SettingsView: View {
|
||||
}
|
||||
}
|
||||
|
||||
Section("Develop") {
|
||||
NavigationLink {
|
||||
TerminalView()
|
||||
} label: {
|
||||
Text("Chat console")
|
||||
}
|
||||
}
|
||||
|
||||
// Section("Your SimpleX servers") {
|
||||
//
|
||||
// }
|
||||
}
|
||||
.navigationTitle("Settings")
|
||||
.navigationTitle("Your settings")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
5C116CF027ABC81C00E66D01 /* libgmp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C116CEB27ABC81C00E66D01 /* libgmp.a */; };
|
||||
5C116CF127ABC81C00E66D01 /* libgmpxx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C116CEC27ABC81C00E66D01 /* libgmpxx.a */; };
|
||||
5C116CF227ABC81C00E66D01 /* libffi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C116CED27ABC81C00E66D01 /* libffi.a */; };
|
||||
5C116CF327ABC81C00E66D01 /* libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w-ghc8.10.7.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C116CEE27ABC81C00E66D01 /* libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w-ghc8.10.7.a */; };
|
||||
5C116CF427ABC81C00E66D01 /* libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C116CEF27ABC81C00E66D01 /* libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w.a */; };
|
||||
5C1A4C1E27A715B700EAD5AD /* ChatItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C1A4C1D27A715B700EAD5AD /* ChatItemView.swift */; };
|
||||
5C1A4C1F27A715B700EAD5AD /* ChatItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C1A4C1D27A715B700EAD5AD /* ChatItemView.swift */; };
|
||||
5C2E260727A2941F00F70299 /* SimpleXAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C2E260627A2941F00F70299 /* SimpleXAPI.swift */; };
|
||||
@ -73,6 +71,8 @@
|
||||
5CCD403827A5F9A200368C90 /* ConnectContactView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD403627A5F9A200368C90 /* ConnectContactView.swift */; };
|
||||
5CCD403A27A5F9BE00368C90 /* CreateGroupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD403927A5F9BE00368C90 /* CreateGroupView.swift */; };
|
||||
5CCD403B27A5F9BE00368C90 /* CreateGroupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD403927A5F9BE00368C90 /* CreateGroupView.swift */; };
|
||||
5CE4406F27AD2648007B033A /* libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE4406D27AD2648007B033A /* libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi.a */; };
|
||||
5CE4407027AD2648007B033A /* libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi-ghc8.10.7.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE4406E27AD2648007B033A /* libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi-ghc8.10.7.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -98,8 +98,6 @@
|
||||
5C116CEB27ABC81C00E66D01 /* libgmp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmp.a; sourceTree = "<group>"; };
|
||||
5C116CEC27ABC81C00E66D01 /* libgmpxx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmpxx.a; sourceTree = "<group>"; };
|
||||
5C116CED27ABC81C00E66D01 /* libffi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libffi.a; sourceTree = "<group>"; };
|
||||
5C116CEE27ABC81C00E66D01 /* libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w-ghc8.10.7.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w-ghc8.10.7.a"; sourceTree = "<group>"; };
|
||||
5C116CEF27ABC81C00E66D01 /* libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w.a"; sourceTree = "<group>"; };
|
||||
5C1A4C1D27A715B700EAD5AD /* ChatItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatItemView.swift; sourceTree = "<group>"; };
|
||||
5C2E260627A2941F00F70299 /* SimpleXAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleXAPI.swift; sourceTree = "<group>"; };
|
||||
5C2E260927A2C63500F70299 /* MyPlayground.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = MyPlayground.playground; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
@ -138,6 +136,8 @@
|
||||
5CCD403327A5F6DF00368C90 /* AddContactView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddContactView.swift; sourceTree = "<group>"; };
|
||||
5CCD403627A5F9A200368C90 /* ConnectContactView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectContactView.swift; sourceTree = "<group>"; };
|
||||
5CCD403927A5F9BE00368C90 /* CreateGroupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateGroupView.swift; sourceTree = "<group>"; };
|
||||
5CE4406D27AD2648007B033A /* libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi.a"; sourceTree = "<group>"; };
|
||||
5CE4406E27AD2648007B033A /* libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi-ghc8.10.7.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi-ghc8.10.7.a"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -145,11 +145,11 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5CE4406F27AD2648007B033A /* libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi.a in Frameworks */,
|
||||
5CE4407027AD2648007B033A /* libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi-ghc8.10.7.a in Frameworks */,
|
||||
5C8F01CD27A6F0D8007D2C8D /* CodeScanner in Frameworks */,
|
||||
5C116CF227ABC81C00E66D01 /* libffi.a in Frameworks */,
|
||||
5C116CF427ABC81C00E66D01 /* libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w.a in Frameworks */,
|
||||
5C116CF127ABC81C00E66D01 /* libgmpxx.a in Frameworks */,
|
||||
5C116CF327ABC81C00E66D01 /* libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w-ghc8.10.7.a in Frameworks */,
|
||||
5C764E83279C748B000C6508 /* libz.tbd in Frameworks */,
|
||||
5C116CF027ABC81C00E66D01 /* libgmp.a in Frameworks */,
|
||||
5C764E82279C748B000C6508 /* libiconv.tbd in Frameworks */,
|
||||
@ -211,8 +211,8 @@
|
||||
5C116CED27ABC81C00E66D01 /* libffi.a */,
|
||||
5C116CEB27ABC81C00E66D01 /* libgmp.a */,
|
||||
5C116CEC27ABC81C00E66D01 /* libgmpxx.a */,
|
||||
5C116CEE27ABC81C00E66D01 /* libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w-ghc8.10.7.a */,
|
||||
5C116CEF27ABC81C00E66D01 /* libHSsimplex-chat-1.0.2-5okwuQXOXC78H7u8DMgS6w.a */,
|
||||
5CE4406E27AD2648007B033A /* libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi-ghc8.10.7.a */,
|
||||
5CE4406D27AD2648007B033A /* libHSsimplex-chat-1.1.0-1RUev578BUjGkBObUSYLQi.a */,
|
||||
);
|
||||
path = Libraries;
|
||||
sourceTree = "<group>";
|
||||
@ -734,7 +734,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = "";
|
||||
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Libraries";
|
||||
"LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = "$(PROJECT_DIR)/Libraries/ios";
|
||||
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = "$(PROJECT_DIR)/Libraries/sim";
|
||||
MARKETING_VERSION = 1.0.1;
|
||||
@ -774,7 +774,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = "";
|
||||
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Libraries";
|
||||
"LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = "$(PROJECT_DIR)/Libraries/ios";
|
||||
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = "$(PROJECT_DIR)/Libraries/sim";
|
||||
MARKETING_VERSION = 1.0.1;
|
||||
|
Loading…
Reference in New Issue
Block a user