diff --git a/apps/ios/Shared/Views/ChatList/ChatsView.swift b/apps/ios/Shared/Views/ChatList/ChatsView.swift index 5b6ffc8b26..2314f1c1fd 100644 --- a/apps/ios/Shared/Views/ChatList/ChatsView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatsView.swift @@ -18,7 +18,6 @@ struct ChatsView: View { @State private var searchShowingSimplexLink = false @State private var searchChatFilteredBySimplexLink: String? = nil - @State private var newChatMenuOption: NewChatMenuOption? = nil // TODO remove? @AppStorage(DEFAULT_SHOW_UNREAD_AND_FAVORITES) private var showUnreadAndFavorites = false @AppStorage(DEFAULT_ONE_HAND_UI) private var oneHandUI = true diff --git a/apps/ios/Shared/Views/Home/HomeView.swift b/apps/ios/Shared/Views/Home/HomeView.swift index 4c263ee4dd..5e8558de34 100644 --- a/apps/ios/Shared/Views/Home/HomeView.swift +++ b/apps/ios/Shared/Views/Home/HomeView.swift @@ -48,6 +48,7 @@ struct HomeView: View { destination: chatView ) { // ZStack { + VStack { switch homeTab { case .contacts: contactsView() @@ -109,20 +110,20 @@ struct HomeView: View { } } - private func bottomToolbar() -> some View { - HStack { - settingsButton() - Spacer() - contactsButton() - Spacer() - chatsButton() - Spacer() - newChatButton() - } - .padding(.horizontal, 12) - .padding(.horizontal) - .frame(maxWidth: .infinity) - } +// private func bottomToolbar() -> some View { +// HStack { +// settingsButton() +// Spacer() +// contactsButton() +// Spacer() +// chatsButton() +// Spacer() +// newChatButton() +// } +// .padding(.horizontal, 12) +// .padding(.horizontal) +// .frame(maxWidth: .infinity) +// } @ViewBuilder private func settingsButton() -> some View { let user = chatModel.currentUser ?? User.sampleData @@ -183,16 +184,21 @@ struct HomeView: View { private func newChatButton() -> some View { Menu { - Button { - newChatMenuOption = .newContact - } label: { - Text("Add contact") - } Button { newChatMenuOption = .newGroup } label: { Text("Create group") } + Button { + newChatMenuOption = .scanPaste + } label: { + Text("Scan / Paste link") + } + Button { + newChatMenuOption = .newContact + } label: { + Text("Add contact") + } } label: { iconLabel("square.and.pencil", "New chat") } @@ -200,10 +206,10 @@ struct HomeView: View { .sheet(item: $newChatMenuOption) { opt in switch opt { case .newContact: NewChatView(selection: .invite) + case .scanPaste: NewChatView(selection: .connect, showQRCodeScanner: true) case .newGroup: AddGroupView() } } -// NewChatView(selection: .connect, showQRCodeScanner: true) } private func iconLabel(_ image: String, _ title: LocalizedStringKey) -> some View { @@ -217,10 +223,6 @@ struct HomeView: View { } } - private func settingsView() -> some View { - SettingsView(showSettings: $showSettings) - } - private func contactsView() -> some View { // TODO VStack { @@ -229,8 +231,7 @@ struct HomeView: View { } @ViewBuilder private func chatsView() -> some View { - // TODO onboarding buttons (remove?) - // TODO for reversed chat list start at bottom + // TODO reverse scale effect for swipe actions if oneHandUI { ChatsView() .padding(.vertical, 5) @@ -240,22 +241,6 @@ struct HomeView: View { } } - @ViewBuilder private func newChatView() -> some View { - // TODO doesn't fit - // TODO alerts don't work - // TODO dismiss on connect - // TODO dismiss when creating group - // TODO chat stopped (see chatsStoppedIcon in ChatsView) - switch newChatMenuOption { - case .newContact: - NewChatView(selection: .invite) - case .newGroup: - AddGroupView() - case nil: - EmptyView() - } - } - @ViewBuilder private func chatView() -> some View { if let chatId = chatModel.chatId, let chat = chatModel.getChat(chatId) { ChatView(chat: chat).onAppear { diff --git a/apps/ios/Shared/Views/NewChat/NewChatMenuButton.swift b/apps/ios/Shared/Views/NewChat/NewChatMenuButton.swift index c3452ce18d..3be1095bfd 100644 --- a/apps/ios/Shared/Views/NewChat/NewChatMenuButton.swift +++ b/apps/ios/Shared/Views/NewChat/NewChatMenuButton.swift @@ -10,6 +10,7 @@ import SwiftUI enum NewChatMenuOption: Identifiable { case newContact + case scanPaste case newGroup var id: Self { self } @@ -25,6 +26,11 @@ struct NewChatMenuButton: View { } label: { Text("Add contact") } + Button { + newChatMenuOption = .scanPaste + } label: { + Text("Scan / Paste link") + } Button { newChatMenuOption = .newGroup } label: { @@ -39,6 +45,7 @@ struct NewChatMenuButton: View { .sheet(item: $newChatMenuOption) { opt in switch opt { case .newContact: NewChatView(selection: .invite) + case .scanPaste: NewChatView(selection: .connect, showQRCodeScanner: true) case .newGroup: AddGroupView() } }