From 5fe8762e1f806597b42c94726c3adba4ea124b10 Mon Sep 17 00:00:00 2001 From: fmodf Date: Thu, 3 Oct 2024 14:54:15 +0200 Subject: [PATCH] wip --- .../Resources/Strings/Localizable.strings | 14 +- .../View/Entering/LoginScreen.swift | 2 +- .../Main/ChatList/ChatsCreateScreenMain.swift | 171 ++++-------------- 3 files changed, 40 insertions(+), 147 deletions(-) diff --git a/ConversationsClassic/Resources/Strings/Localizable.strings b/ConversationsClassic/Resources/Strings/Localizable.strings index a88a61a..5f6eab7 100644 --- a/ConversationsClassic/Resources/Strings/Localizable.strings +++ b/ConversationsClassic/Resources/Strings/Localizable.strings @@ -67,14 +67,10 @@ "Conversation.settings.title.channel" = "Channel settings"; "Conversation.settings.enableOmemo" = "Enable OMEMO"; - - - - - -//"Chats.Create.Main.createGroup" = "Create public group"; -//"Chats.Create.Main.createPrivateGroup" = "Create private group"; -//"Chats.Create.Main.findGroup" = "Find public group"; - +// MARK: Create chats +"Chats.Create.Main.createGroup" = "Create public group"; +"Chats.Create.Main.createPrivateGroup" = "Create private group"; +"Chats.Create.Main.createChannel" = "Create channel"; +"Chats.Create.Main.findChannel" = "Find channel"; diff --git a/ConversationsClassic/View/Entering/LoginScreen.swift b/ConversationsClassic/View/Entering/LoginScreen.swift index d6da9b6..c67881e 100644 --- a/ConversationsClassic/View/Entering/LoginScreen.swift +++ b/ConversationsClassic/View/Entering/LoginScreen.swift @@ -14,7 +14,7 @@ struct LoginScreen: View { @FocusState private var focus: Field? #if DEBUG - @State private var jidStr: String = "omemotest3@test.anal.company" + @State private var jidStr: String = "grouptest1@test.anal.company" @State private var pass: String = "12345" // @State private var jidStr: String = "nartest1@conversations.im" // @State private var pass: String = "nartest12345" diff --git a/ConversationsClassic/View/Main/ChatList/ChatsCreateScreenMain.swift b/ConversationsClassic/View/Main/ChatList/ChatsCreateScreenMain.swift index e82ff73..0ad89b7 100644 --- a/ConversationsClassic/View/Main/ChatList/ChatsCreateScreenMain.swift +++ b/ConversationsClassic/View/Main/ChatList/ChatsCreateScreenMain.swift @@ -24,22 +24,40 @@ struct ChatsCreateScreenMain: View { // List List { - Text("test") - // ChatsCreateRowButton( - // title: L10n.Chats.Create.Main.createGroup, - // image: "person.2.fill", - // action: {} - // ) - // ChatsCreateRowButton( - // title: L10n.Chats.Create.Main.createPrivateGroup, - // image: "person.2.fill", - // action: {} - // ) - // ChatsCreateRowButton( - // title: L10n.Chats.Create.Main.findGroup, - // image: "magnifyingglass", - // action: {} - // ) + // Groups creation buttons + SharedListRow( + iconType: .image(Image(systemName: "person.2.fill"), .Material.Elements.active), + text: L10n.Chats.Create.Main.createGroup, + controlType: .none + ) + .onTapGesture { + print("Tapped createGroup") + } + + SharedListRow( + iconType: .image(Image(systemName: "person.2.fill"), .Material.Elements.active), + text: L10n.Chats.Create.Main.createPrivateGroup, + controlType: .none + ).onTapGesture { + print("Tapped createPrivateGroup") + } + + // Channel buttons + SharedListRow( + iconType: .image(Image(systemName: "globe.americas"), .Material.Elements.active), + text: L10n.Chats.Create.Main.createChannel, + controlType: .none + ).onTapGesture { + print("Tapped createChannel") + } + + SharedListRow( + iconType: .image(Image(systemName: "magnifyingglass"), .Material.Elements.active), + text: L10n.Chats.Create.Main.findChannel, + controlType: .none + ).onTapGesture { + print("Tapped findChannel") + } // for contacts list // let rosters = store.state.rostersState.rosters.filter { !$0.locallyDeleted } @@ -55,129 +73,8 @@ struct ChatsCreateScreenMain: View { } } -// private struct ChatsCreateRowButton: View { -// var title: String -// var image: String -// var action: () -> Void -// -// var body: some View { -// VStack(alignment: .center, spacing: 0) { -// Spacer() -// HStack(alignment: .center, spacing: 16) { -// Image(systemName: image) -// .font(.head2) -// .foregroundColor(.Material.Elements.active) -// .padding(.leading, 16) -// Text(title) -// .font(.body1) -// .foregroundColor(.Material.Text.main) -// Spacer() -// } -// Spacer() -// Rectangle() -// .frame(maxWidth: .infinity) -// .frame(height: 1) -// .foregroundColor(.Material.Background.dark) -// } -// .sharedListRow() -// .frame(height: 48) -// .onTapGesture { -// action() -// } -// } -// } - private struct ChatsCreateRowSeparator: View { var body: some View { Text("aa") } } - -// import SwiftUI -// -// struct CreateConversationMainScreen: View { -// @EnvironmentObject var store: AppStore -// -// var body: some View { -// ZStack { -// // Background color -// Color.Material.Background.light -// .ignoresSafeArea() -// -// // Content -// VStack(spacing: 0) { -// // Header -// CreateConversationHeader() -// -// // Chats list -// // if !store.state.chatsState.chats.isEmpty { -// // List { -// // ForEach(store.state.chatsState.chats) { chat in -// // ChatsRow(chat: chat) -// // } -// // } -// // .listStyle(.plain) -// // .background(Color.Material.Background.light) -// // } else { -// // Spacer() -// // } -// // -// // // Tab bar -// // SharedTabBar() -// } -// } -// } -// } -// -// private struct CreateConversationHeader: View { -// @EnvironmentObject var store: AppStore -// -// var body: some View { -// ZStack { -// // bg -// Color.Material.Background.dark -// .ignoresSafeArea() -// -// HStack(spacing: 0) { -// Image(systemName: "arrow.left") -// .foregroundColor(.Material.Elements.active) -// .padding(.leading, 16) -// .tappablePadding(.symmetric(12)) { -// store.dispatch(.changeFlow(store.state.previousFlow)) -// } -// Spacer() -// } -// -// // title -// Text("New conversation") -// .font(.head2) -// .foregroundColor(Color.Material.Text.main) -// } -// } -// } -// - -// Preview -// #if DEBUG -// struct ChatsCreateMainScreen_Previews: PreviewProvider { -// static var previews: some View { -// ChatsCreateMainScreen(isPresented: .constant(true)) -// .environmentObject(pStore) -// } -// -// static var pStore: AppStore { -// let state = pState -// return AppStore(initialState: state, reducer: AppState.reducer, middlewares: []) -// } -// -// static var pState: AppState { -// var state = AppState() -// -// state.rostersState.rosters = [ -// .init(contactBareJid: "test@me.com", subscription: "both", ask: true, data: .init(groups: [], annotations: [])) -// ] -// -// return state -// } -// } -// #endif