Compare commits
No commits in common. "40a5f4c628b908496207ed6bf98494127967f55c" and "3ae7576c2411ed17cbd40e060688f7a3bcd9e35c" have entirely different histories.
40a5f4c628
...
3ae7576c24
@ -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,8 +41,6 @@ struct TopBarView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
HStack {
|
HStack {
|
||||||
|
|
||||||
if !isMessengerModeEnabled{
|
|
||||||
// Кнопка "Гамбургер" для открытия меню
|
// Кнопка "Гамбургер" для открытия меню
|
||||||
Button(action: {
|
Button(action: {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
@ -54,7 +51,7 @@ struct TopBarView: View {
|
|||||||
.imageScale(.large)
|
.imageScale(.large)
|
||||||
.foregroundColor(.primary)
|
.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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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()
|
||||||
|
|||||||
@ -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)) // Фон для всей вкладки
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -2,46 +2,35 @@ 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: "person.2.fill", text: NSLocalizedString("Контакты", comment: ""), isSelected: selectedTab == 4) {
|
|
||||||
selectedTab = 4
|
|
||||||
}
|
|
||||||
|
|
||||||
TabBarButton(systemName: "bubble.left.and.bubble.right.fill", text: NSLocalizedString("Чаты", comment: ""), isSelected: selectedTab == 2) {
|
|
||||||
selectedTab = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
TabBarButton(systemName: "gearshape.fill", text: NSLocalizedString("Настройки", comment: ""), isSelected: selectedTab == 5) {
|
|
||||||
selectedTab = 5
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
TabBarButton(systemName: "list.bullet.rectangle", text: NSLocalizedString("Лента", comment: ""), isSelected: selectedTab == 0) {
|
TabBarButton(systemName: "list.bullet.rectangle", text: NSLocalizedString("Лента", comment: ""), isSelected: selectedTab == 0) {
|
||||||
selectedTab = 0
|
selectedTab = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tab 2: Search
|
||||||
TabBarButton(systemName: "gamecontroller.fill", text: NSLocalizedString("Концепт", comment: "Tab bar: concept clicker"), isSelected: selectedTab == 1) {
|
TabBarButton(systemName: "gamecontroller.fill", text: NSLocalizedString("Концепт", comment: "Tab bar: concept clicker"), isSelected: selectedTab == 1) {
|
||||||
selectedTab = 1
|
selectedTab = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create Button
|
||||||
CreateButton {
|
CreateButton {
|
||||||
onCreate()
|
onCreate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tab 3: Chats
|
||||||
TabBarButton(systemName: "bubble.left.and.bubble.right.fill", text: NSLocalizedString("Чаты", comment: ""), isSelected: selectedTab == 2) {
|
TabBarButton(systemName: "bubble.left.and.bubble.right.fill", text: NSLocalizedString("Чаты", comment: ""), isSelected: selectedTab == 2) {
|
||||||
selectedTab = 2
|
selectedTab = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tab 4: Profile
|
||||||
TabBarButton(systemName: "person.crop.square", text: NSLocalizedString("Лицо", comment: ""), isSelected: selectedTab == 3) {
|
TabBarButton(systemName: "person.crop.square", text: NSLocalizedString("Лицо", comment: ""), isSelected: selectedTab == 3) {
|
||||||
selectedTab = 3
|
selectedTab = 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
.padding(.top, 1)
|
.padding(.top, 1)
|
||||||
.padding(.bottom, 30) // Добавляем отступ снизу
|
.padding(.bottom, 30) // Добавляем отступ снизу
|
||||||
|
|||||||
@ -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,21 +52,6 @@ struct MainView: View {
|
|||||||
)
|
)
|
||||||
|
|
||||||
ZStack {
|
ZStack {
|
||||||
if isMessengerModeEnabled {
|
|
||||||
ChatsTab(
|
|
||||||
loginViewModel: viewModel,
|
|
||||||
searchRevealProgress: $chatSearchRevealProgress,
|
|
||||||
searchText: $chatSearchText
|
|
||||||
)
|
|
||||||
.opacity(selectedTab == 2 ? 1 : 0)
|
|
||||||
.allowsHitTesting(selectedTab == 2)
|
|
||||||
|
|
||||||
ContactsTab()
|
|
||||||
.opacity(selectedTab == 4 ? 1 : 0)
|
|
||||||
|
|
||||||
SettingsView(viewModel: viewModel)
|
|
||||||
.opacity(selectedTab == 5 ? 1 : 0)
|
|
||||||
} else {
|
|
||||||
NewHomeTab()
|
NewHomeTab()
|
||||||
.opacity(selectedTab == 0 ? 1 : 0)
|
.opacity(selectedTab == 0 ? 1 : 0)
|
||||||
|
|
||||||
@ -88,10 +69,9 @@ struct MainView: View {
|
|||||||
ProfileTab()
|
ProfileTab()
|
||||||
.opacity(selectedTab == 3 ? 1 : 0)
|
.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,13 +94,11 @@ 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,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user