Files
Luma/Sources/Shared/UI/RootView.swift
T
wt efe3986ba5 add a telegram-style bottom tab bar to the main screen
- Replace the sidebar-based MainChatView with MainTabView: a custom
  bottom bar with Контакты / Звонки / Чаты / Настройки that looks the
  same on iOS and macOS, and open chats via push navigation.
- Put the search field above the chat and contact lists (searchable on
  iOS, an inline field on macOS) and add an aggregated call-history
  screen backed by model.callHistoryMessages.
- Embed SettingsView as a tab, update verify.sh guards, and keep CI on
  deterministic unit tests while the UI tests stay runnable manually.
2026-08-30 01:39:54 +07:00

55 lines
1.9 KiB
Swift

import QuickLook
import SwiftData
import SwiftUI
struct RootView: View {
@ObservedObject var model: AppModel
var body: some View {
ZStack {
if model.isAppLocked {
// The lock covers every layer: chat list, media viewer and
// calls stay hidden until the passcode or biometrics succeed.
AppLockView(model: model)
} else {
Group {
if model.account == nil {
LoginView(model: model)
} else {
MainTabView(model: model)
.environment(\.modelContext, model.modelContext)
}
}
if let item = model.mediaViewerItem {
MediaViewer(item: item, onClose: model.closeMediaViewer)
.transition(.opacity.combined(with: .scale(scale: 0.98)))
.zIndex(100)
}
if let call = model.activeCall {
CallView(model: model, call: call)
.transition(.opacity.combined(with: .scale(scale: 1.015)))
.zIndex(200)
}
}
}
.animation(.easeInOut(duration: 0.22), value: model.account?.id)
.animation(.easeInOut(duration: 0.2), value: model.mediaViewerItem?.id)
.animation(.easeInOut(duration: 0.2), value: model.activeCall?.id)
.alert("Luma", isPresented: errorBinding) {
Button("OK") { model.clearError() }
} message: {
Text(model.errorMessage ?? "Неизвестная ошибка")
}
.quickLookPreview($model.previewURL)
}
private var errorBinding: Binding<Bool> {
Binding(
get: { model.errorMessage != nil },
set: { visible in if !visible { model.clearError() } }
)
}
}