/*
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-iphone
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
import SwiftUI
import linphonesw
import UniformTypeIdentifiers
struct SideMenu: View {
@EnvironmentObject var accountProfileViewModel: AccountProfileViewModel
let width: CGFloat
@Binding var isOpen: Bool
let menuClose: () -> Void
let safeAreaInsets: EdgeInsets
@Binding var isShowLoginFragment: Bool
@Binding var isShowAccountProfileFragment: Bool
@Binding var isShowSettingsFragment: Bool
@Binding var isShowRecordingsListFragment: Bool
@Binding var isShowHelpFragment: Bool
@State private var showHelp = false
var body: some View {
ZStack {
GeometryReader { _ in
EmptyView()
}
.background(.gray.opacity(0.3))
.opacity(self.isOpen ? 1.0 : 0.0)
.onTapGesture {
self.menuClose()
}
VStack {
VStack {
HStack {
Image("linphone")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.orangeMain500)
.frame(width: 32, height: 32)
.padding(10)
Text(Bundle.main.displayName)
.default_text_style_800(styleSize: 16)
Spacer()
Image("x")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c600)
.frame(width: 24, height: 24)
.padding(10)
}
.padding(.leading, 10)
.onTapGesture {
self.menuClose()
}
List {
ForEach(0.. 0
|| SharedMainViewModel.shared.waitingMessageCount > 0
|| !SharedMainViewModel.shared.fileUrlsToShare.isEmpty
? 0
: safeAreaInsets.top
)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
#Preview {
GeometryReader { geometry in
SideMenu(
width: geometry.size.width / 5 * 4,
isOpen: .constant(true),
menuClose: {},
safeAreaInsets: geometry.safeAreaInsets,
isShowLoginFragment: .constant(false),
isShowAccountProfileFragment: .constant(false),
isShowSettingsFragment: .constant(false),
isShowRecordingsListFragment: .constant(false),
isShowHelpFragment: .constant(false)
)
.ignoresSafeArea(.all)
.zIndex(2)
}
}