Compare commits

..

No commits in common. "40a5f4c628b908496207ed6bf98494127967f55c" and "3ae7576c2411ed17cbd40e060688f7a3bcd9e35c" have entirely different histories.

5 changed files with 57 additions and 139 deletions

View File

@ -3,7 +3,6 @@ import SwiftUI
struct TopBarView: View { struct TopBarView: View {
var title: String var title: String
let isMessengerModeEnabled: Bool
// Состояния для ProfileTab // Состояния для ProfileTab
@Binding var selectedAccount: String @Binding var selectedAccount: String
// @Binding var sheetType: ProfileTab.SheetType? // @Binding var sheetType: ProfileTab.SheetType?
@ -42,19 +41,17 @@ struct TopBarView: View {
var body: some View { var body: some View {
VStack(spacing: 0) { VStack(spacing: 0) {
HStack { HStack {
// Кнопка "Гамбургер" для открытия меню
if !isMessengerModeEnabled{ Button(action: {
// Кнопка "Гамбургер" для открытия меню withAnimation {
Button(action: { isSideMenuPresented.toggle()
withAnimation {
isSideMenuPresented.toggle()
}
}) {
Image(systemName: "line.horizontal.3")
.imageScale(.large)
.foregroundColor(.primary)
} }
}) {
Image(systemName: "line.horizontal.3")
.imageScale(.large)
.foregroundColor(.primary)
} }
// Spacer() // Spacer()
if let statusMessage { if let statusMessage {
@ -224,14 +221,13 @@ struct TopBarView_Previews: PreviewProvider {
var body: some View { var body: some View {
TopBarView( TopBarView(
title: "Chats", title: "Chats",
isMessengerModeEnabled: false,
selectedAccount: $selectedAccount, selectedAccount: $selectedAccount,
accounts: [selectedAccount], accounts: [selectedAccount],
viewModel: viewModel, viewModel: viewModel,
isSettingsPresented: $isSettingsPresented, isSettingsPresented: $isSettingsPresented,
isSideMenuPresented: $isSideMenuPresented, isSideMenuPresented: $isSideMenuPresented,
chatSearchRevealProgress: $revealProgress, chatSearchRevealProgress: $revealProgress,
chatSearchText: $searchText, chatSearchText: $searchText
) )
} }
} }

View File

@ -12,7 +12,6 @@ struct LoginView: View {
@EnvironmentObject private var themeManager: ThemeManager @EnvironmentObject private var themeManager: ThemeManager
@Environment(\.colorScheme) private var colorScheme @Environment(\.colorScheme) private var colorScheme
private let themeOptions = ThemeOption.ordered private let themeOptions = ThemeOption.ordered
@AppStorage("messengerModeEnabled") private var isMessengerModeEnabled: Bool = false
@State private var isShowingRegistration = false @State private var isShowingRegistration = false
@State private var showLegacySupportNotice = false @State private var showLegacySupportNotice = false
@ -35,8 +34,7 @@ struct LoginView: View {
} }
private var isLoginButtonEnabled: Bool { private var isLoginButtonEnabled: Bool {
// !viewModel.isLoading && isUsernameValid && isPasswordValid && viewModel.hasAcceptedTerms !viewModel.isLoading && isUsernameValid && isPasswordValid && viewModel.hasAcceptedTerms
!viewModel.isLoading && isUsernameValid && isPasswordValid
} }
var body: some View { var body: some View {
@ -115,17 +113,14 @@ struct LoginView: View {
.font(.caption) .font(.caption)
} }
// TermsAgreementCard( TermsAgreementCard(
// isAccepted: $viewModel.hasAcceptedTerms, isAccepted: $viewModel.hasAcceptedTerms,
// openTerms: { openTerms: {
// viewModel.loadTermsIfNeeded() viewModel.loadTermsIfNeeded()
// isShowingTerms = true isShowingTerms = true
// } }
// ) )
// .padding(.vertical, 12) .padding(.vertical, 12)
Toggle(NSLocalizedString("Режим мессенжера", comment: ""), isOn: $isMessengerModeEnabled)
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
Button(action: { Button(action: {
viewModel.login() viewModel.login()

View File

@ -1,24 +0,0 @@
//
// ContactsTab.swift
// yobble
//
// Created by cheykrym on 23.10.2025.
//
import SwiftUI
struct ContactsTab: View {
var body: some View {
VStack {
VStack {
Text("Здесь не будут чаты")
.font(.title)
.foregroundColor(.gray)
Spacer()
}
}
// .background(Color(.secondarySystemBackground)) // Фон для всей вкладки
}
}

View File

@ -2,44 +2,33 @@ import SwiftUI
struct CustomTabBar: View { struct CustomTabBar: View {
@Binding var selectedTab: Int @Binding var selectedTab: Int
let isMessengerModeEnabled: Bool
var onCreate: () -> Void var onCreate: () -> Void
var body: some View { var body: some View {
HStack { HStack {
if isMessengerModeEnabled { // Tab 1: Feed
TabBarButton(systemName: "list.bullet.rectangle", text: NSLocalizedString("Лента", comment: ""), isSelected: selectedTab == 0) {
selectedTab = 0
}
TabBarButton(systemName: "person.2.fill", text: NSLocalizedString("Контакты", comment: ""), isSelected: selectedTab == 4) { // Tab 2: Search
selectedTab = 4 TabBarButton(systemName: "gamecontroller.fill", text: NSLocalizedString("Концепт", comment: "Tab bar: concept clicker"), isSelected: selectedTab == 1) {
} selectedTab = 1
}
TabBarButton(systemName: "bubble.left.and.bubble.right.fill", text: NSLocalizedString("Чаты", comment: ""), isSelected: selectedTab == 2) { // Create Button
selectedTab = 2 CreateButton {
} onCreate()
}
TabBarButton(systemName: "gearshape.fill", text: NSLocalizedString("Настройки", comment: ""), isSelected: selectedTab == 5) { // Tab 3: Chats
selectedTab = 5 TabBarButton(systemName: "bubble.left.and.bubble.right.fill", text: NSLocalizedString("Чаты", comment: ""), isSelected: selectedTab == 2) {
} selectedTab = 2
} else { }
TabBarButton(systemName: "list.bullet.rectangle", text: NSLocalizedString("Лента", comment: ""), isSelected: selectedTab == 0) {
selectedTab = 0
}
TabBarButton(systemName: "gamecontroller.fill", text: NSLocalizedString("Концепт", comment: "Tab bar: concept clicker"), isSelected: selectedTab == 1) { // Tab 4: Profile
selectedTab = 1 TabBarButton(systemName: "person.crop.square", text: NSLocalizedString("Лицо", comment: ""), isSelected: selectedTab == 3) {
} selectedTab = 3
CreateButton {
onCreate()
}
TabBarButton(systemName: "bubble.left.and.bubble.right.fill", text: NSLocalizedString("Чаты", comment: ""), isSelected: selectedTab == 2) {
selectedTab = 2
}
TabBarButton(systemName: "person.crop.square", text: NSLocalizedString("Лицо", comment: ""), isSelected: selectedTab == 3) {
selectedTab = 3
}
} }
} }
.padding(.horizontal) .padding(.horizontal)

View File

@ -4,7 +4,6 @@ struct MainView: View {
@ObservedObject var viewModel: LoginViewModel @ObservedObject var viewModel: LoginViewModel
@EnvironmentObject private var messageCenter: IncomingMessageCenter @EnvironmentObject private var messageCenter: IncomingMessageCenter
@State private var selectedTab: Int = 0 @State private var selectedTab: Int = 0
@AppStorage("messengerModeEnabled") private var isMessengerModeEnabled: Bool = false
// @StateObject private var newHomeTabViewModel = NewHomeTabViewModel() // @StateObject private var newHomeTabViewModel = NewHomeTabViewModel()
// Состояния для TopBarView // Состояния для TopBarView
@ -27,8 +26,6 @@ struct MainView: View {
case 1: return "Concept" case 1: return "Concept"
case 2: return "Chats" case 2: return "Chats"
case 3: return "Profile" case 3: return "Profile"
case 4: return "Contacts"
case 5: return "Settings"
default: return "Home" default: return "Home"
} }
} }
@ -45,7 +42,6 @@ struct MainView: View {
VStack(spacing: 0) { VStack(spacing: 0) {
TopBarView( TopBarView(
title: tabTitle, title: tabTitle,
isMessengerModeEnabled: isMessengerModeEnabled,
selectedAccount: $selectedAccount, selectedAccount: $selectedAccount,
accounts: accounts, accounts: accounts,
viewModel: viewModel, viewModel: viewModel,
@ -56,42 +52,26 @@ struct MainView: View {
) )
ZStack { ZStack {
if isMessengerModeEnabled { NewHomeTab()
ChatsTab( .opacity(selectedTab == 0 ? 1 : 0)
loginViewModel: viewModel,
searchRevealProgress: $chatSearchRevealProgress, ConceptTab()
searchText: $chatSearchText .opacity(selectedTab == 1 ? 1 : 0)
)
ChatsTab(
loginViewModel: viewModel,
searchRevealProgress: $chatSearchRevealProgress,
searchText: $chatSearchText
)
.opacity(selectedTab == 2 ? 1 : 0) .opacity(selectedTab == 2 ? 1 : 0)
.allowsHitTesting(selectedTab == 2) .allowsHitTesting(selectedTab == 2)
ContactsTab() ProfileTab()
.opacity(selectedTab == 4 ? 1 : 0) .opacity(selectedTab == 3 ? 1 : 0)
SettingsView(viewModel: viewModel)
.opacity(selectedTab == 5 ? 1 : 0)
} else {
NewHomeTab()
.opacity(selectedTab == 0 ? 1 : 0)
ConceptTab()
.opacity(selectedTab == 1 ? 1 : 0)
ChatsTab(
loginViewModel: viewModel,
searchRevealProgress: $chatSearchRevealProgress,
searchText: $chatSearchText
)
.opacity(selectedTab == 2 ? 1 : 0)
.allowsHitTesting(selectedTab == 2)
ProfileTab()
.opacity(selectedTab == 3 ? 1 : 0)
}
} }
.frame(maxWidth: .infinity, maxHeight: .infinity) .frame(maxWidth: .infinity, maxHeight: .infinity)
CustomTabBar(selectedTab: $selectedTab, isMessengerModeEnabled: isMessengerModeEnabled) { CustomTabBar(selectedTab: $selectedTab) {
print("Create button tapped") print("Create button tapped")
} }
} }
@ -114,12 +94,10 @@ struct MainView: View {
.allowsHitTesting(menuOffset > 0) .allowsHitTesting(menuOffset > 0)
// Боковое меню // Боковое меню
if !isMessengerModeEnabled { SideMenuView(viewModel: viewModel, isPresented: $isSideMenuPresented)
SideMenuView(viewModel: viewModel, isPresented: $isSideMenuPresented) .frame(width: menuWidth)
.frame(width: menuWidth) .offset(x: -menuWidth + menuOffset) // Новая логика смещения
.offset(x: -menuWidth + menuOffset) // Новая логика смещения .ignoresSafeArea(edges: .vertical)
.ignoresSafeArea(edges: .vertical)
}
} }
deepLinkNavigationLink deepLinkNavigationLink
@ -164,12 +142,6 @@ struct MainView: View {
menuOffset = presented ? menuWidth : 0 menuOffset = presented ? menuWidth : 0
} }
} }
.onAppear {
enforceTabSelectionForMessengerMode()
}
.onChange(of: isMessengerModeEnabled) { _ in
enforceTabSelectionForMessengerMode()
}
.onChange(of: messageCenter.pendingNavigation?.id) { _ in .onChange(of: messageCenter.pendingNavigation?.id) { _ in
guard !AppConfig.PRESENT_CHAT_AS_SHEET, guard !AppConfig.PRESENT_CHAT_AS_SHEET,
let target = messageCenter.pendingNavigation else { return } let target = messageCenter.pendingNavigation else { return }
@ -201,16 +173,6 @@ struct MainView: View {
} }
private extension MainView { private extension MainView {
func enforceTabSelectionForMessengerMode() {
if isMessengerModeEnabled {
if selectedTab < 2 {
selectedTab = 2
}
} else if selectedTab > 3 {
selectedTab = 0
}
}
var deepLinkNavigationLink: some View { var deepLinkNavigationLink: some View {
NavigationLink( NavigationLink(
destination: deepLinkChatDestination, destination: deepLinkChatDestination,