Start schedule meeting fragment and model

This commit is contained in:
QuentinArguillere 2024-03-29 14:08:52 +01:00
parent 550859d51d
commit 0432c9799d
8 changed files with 286 additions and 22 deletions

View file

@ -15,6 +15,7 @@
6613A0B62BAEBE5C008923A4 /* ScheduleMeetingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6613A0B52BAEBE5C008923A4 /* ScheduleMeetingViewModel.swift */; };
662B69D92B25DE18007118BF /* TelecomManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 662B69D82B25DE18007118BF /* TelecomManager.swift */; };
662B69DB2B25DE25007118BF /* ProviderDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 662B69DA2B25DE25007118BF /* ProviderDelegate.swift */; };
6646A7A32BB2E224006B842A /* ScheduleMeetingFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6646A7A22BB2E224006B842A /* ScheduleMeetingFragment.swift */; };
667E5D7F2B8E430C00EBCFC4 /* linphonerc-factory in Resources */ = {isa = PBXBuildFile; fileRef = D732A90B2B0376F500DB42BA /* linphonerc-factory */; };
667E5D812B8E444E00EBCFC4 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 667E5D802B8E444D00EBCFC4 /* GoogleService-Info.plist */; };
6691CA7E2B839C2D00B2A7B8 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6691CA7D2B839C2D00B2A7B8 /* NotificationService.swift */; };
@ -164,6 +165,7 @@
6613A0B52BAEBE5C008923A4 /* ScheduleMeetingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleMeetingViewModel.swift; sourceTree = "<group>"; };
662B69D82B25DE18007118BF /* TelecomManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TelecomManager.swift; sourceTree = "<group>"; };
662B69DA2B25DE25007118BF /* ProviderDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProviderDelegate.swift; sourceTree = "<group>"; };
6646A7A22BB2E224006B842A /* ScheduleMeetingFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleMeetingFragment.swift; sourceTree = "<group>"; };
667E5D802B8E444D00EBCFC4 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
6691CA7D2B839C2D00B2A7B8 /* NotificationService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
66C491F82B24D25A00CEA16D /* ConfigExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigExtension.swift; sourceTree = "<group>"; };
@ -341,6 +343,7 @@
children = (
6613A0AD2BAEB7DF008923A4 /* MeetingFragment.swift */,
6613A0AF2BAEB7F4008923A4 /* MeetingsListFragment.swift */,
6646A7A22BB2E224006B842A /* ScheduleMeetingFragment.swift */,
);
path = Fragments;
sourceTree = "<group>";
@ -957,6 +960,7 @@
D7B99E992B29B39000BE7BF2 /* CallViewModel.swift in Sources */,
D7702EF22AC7205000557C00 /* WelcomeView.swift in Sources */,
D732A9152B04C7FE00DB42BA /* HistoryListViewModel.swift in Sources */,
6646A7A32BB2E224006B842A /* ScheduleMeetingFragment.swift in Sources */,
D71FCA7F2AE1397200D2E43E /* ContactsListViewModel.swift in Sources */,
D71FCA812AE14CFC00D2E43E /* ContactsListFragment.swift in Sources */,
D734499B2BC694C900778C56 /* MeetingWaitingRoomViewModel.swift in Sources */,

View file

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "earth.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.62,87.62,0,0,1-6.4,32.94l-44.7-27.49a15.92,15.92,0,0,0-6.24-2.23l-22.82-3.08a16.11,16.11,0,0,0-16,7.86h-8.72l-3.8-7.86a15.91,15.91,0,0,0-11-8.67l-8-1.73L96.14,104h16.71a16.06,16.06,0,0,0,7.73-2l12.25-6.76a16.62,16.62,0,0,0,3-2.14l26.91-24.34A15.93,15.93,0,0,0,166,49.1l-.36-.65A88.11,88.11,0,0,1,216,128ZM143.31,41.34,152,56.9,125.09,81.24,112.85,88H96.14a16,16,0,0,0-13.88,8l-8.73,15.23L63.38,84.19,74.32,58.32a87.87,87.87,0,0,1,69-17ZM40,128a87.53,87.53,0,0,1,8.54-37.8l11.34,30.27a16,16,0,0,0,11.62,10l21.43,4.61L96.74,143a16.09,16.09,0,0,0,14.4,9h1.48l-7.23,16.23a16,16,0,0,0,2.86,17.37l.14.14L128,205.94l-1.94,10A88.11,88.11,0,0,1,40,128Zm102.58,86.78,1.13-5.81a16.09,16.09,0,0,0-4-13.9,1.85,1.85,0,0,1-.14-.14L120,174.74,133.7,144l22.82,3.08,45.72,28.12A88.18,88.18,0,0,1,142.58,214.78Z"></path></svg>

After

Width:  |  Height:  |  Size: 984 B

View file

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "note.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M88,96a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H96A8,8,0,0,1,88,96Zm8,40h64a8,8,0,0,0,0-16H96a8,8,0,0,0,0,16Zm32,16H96a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16ZM224,48V156.69A15.86,15.86,0,0,1,219.31,168L168,219.31A15.86,15.86,0,0,1,156.69,224H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H208A16,16,0,0,1,224,48ZM48,208H152V160a8,8,0,0,1,8-8h48V48H48Zm120-40v28.7L196.69,168Z"></path></svg>

After

Width:  |  Height:  |  Size: 479 B

View file

@ -0,0 +1,223 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
// swiftlint:disable line_length
import SwiftUI
struct ScheduleMeetingFragment: View {
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
@Environment(\.dismiss) var dismiss
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
@State private var orientation = UIDevice.current.orientation
@ObservedObject var scheduleMeetingViewModel: ScheduleMeetingViewModel
@State private var delayedColor = Color.white
var body: some View {
ZStack {
VStack(spacing: 16) {
if #available(iOS 16.0, *) {
Rectangle()
.foregroundColor(delayedColor)
.edgesIgnoringSafeArea(.top)
.frame(height: 0)
.task(delayColor)
} else if idiom != .pad && !(orientation == .landscapeLeft || orientation == .landscapeRight
|| UIScreen.main.bounds.size.width > UIScreen.main.bounds.size.height) {
Rectangle()
.foregroundColor(delayedColor)
.edgesIgnoringSafeArea(.top)
.frame(height: 1)
.task(delayColor)
}
HStack {
Image("caret-left")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.orangeMain500)
.frame(width: 25, height: 25, alignment: .leading)
.padding(.all, 10)
.padding(.top, 2)
.padding(.leading, -10)
.onTapGesture {
}
Text("New meeting" )
.multilineTextAlignment(.leading)
.default_text_style_orange_800(styleSize: 16)
Spacer()
}
.frame(maxWidth: .infinity)
.frame(height: 50)
.padding(.horizontal)
.padding(.bottom, 4)
.background(.white)
HStack(alignment: .center, spacing: 8) {
Image("users-three")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c600)
.frame(width: 24, height: 24)
.padding(.leading, 16)
TextField("Subject", text: $scheduleMeetingViewModel.subject)
.default_text_style_700(styleSize: 20)
.frame(height: 29, alignment: .leading)
Spacer()
}
Rectangle()
.foregroundStyle(.clear)
.frame(height: 1)
.background(Color.gray200)
HStack(alignment: .center, spacing: 8) {
Image("clock")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c800)
.frame(width: 24, height: 24)
.padding(.leading, 16)
Text(scheduleMeetingViewModel.fromDateStr)
.fontWeight(.bold)
.frame(width: 300, height: 29, alignment: .leading)
.padding(.leading, 8)
.default_text_style_500(styleSize: 16)
.background(Color.gray200)
Spacer()
}
HStack(alignment: .center, spacing: 8) {
Text(scheduleMeetingViewModel.fromTime)
.fontWeight(.bold)
.frame(height: 29, alignment: .leading)
.default_text_style_500(styleSize: 16)
.opacity(scheduleMeetingViewModel.allDayMeeting ? 0 : 1)
Text(scheduleMeetingViewModel.toTime)
.fontWeight(.bold)
.frame(height: 29, alignment: .leading)
.default_text_style_500(styleSize: 16)
.opacity(scheduleMeetingViewModel.allDayMeeting ? 0 : 1)
Toggle("", isOn: $scheduleMeetingViewModel.allDayMeeting)
.labelsHidden()
.tint(Color.orangeMain300)
Text("All day")
.fontWeight(.bold)
.default_text_style_500(styleSize: 16)
}
HStack(alignment: .center, spacing: 8) {
Image("earth")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c800)
.frame(width: 24, height: 24)
.padding(.leading, 16)
Text("TODO : timezone")
.fontWeight(.bold)
.padding(.leading, 8)
.default_text_style_500(styleSize: 16)
Spacer()
}
HStack(alignment: .center, spacing: 8) {
Image("arrow-clockwise")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c800)
.frame(width: 24, height: 24)
.padding(.leading, 16)
Text("TODO : repeat")
.fontWeight(.bold)
.padding(.leading, 8)
.default_text_style_500(styleSize: 16)
Spacer()
}
Rectangle()
.foregroundStyle(.clear)
.frame(height: 1)
.background(Color.gray200)
HStack(alignment: .center, spacing: 8) {
Image("note")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c600)
.frame(width: 24, height: 24)
.padding(.leading, 16)
TextField("Add a description", text: $scheduleMeetingViewModel.subject)
.default_text_style_700(styleSize: 16)
.frame(height: 29, alignment: .leading)
Spacer()
}
Rectangle()
.foregroundStyle(.clear)
.frame(height: 1)
.background(Color.gray200)
HStack(alignment: .center, spacing: 8) {
Image("users")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c600)
.frame(width: 24, height: 24)
.padding(.leading, 16)
Text("Add participants")
.default_text_style_700(styleSize: 16)
.frame(height: 29, alignment: .leading)
Spacer()
}
ScrollView {
}
.background(Color.gray100)
}
.background(.white)
.navigationBarHidden(true)
}
}
@Sendable private func delayColor() async {
try? await Task.sleep(nanoseconds: 250_000_000)
delayedColor = Color.orangeMain500
}
func delayColorDismiss() {
Task {
try? await Task.sleep(nanoseconds: 80_000_000)
delayedColor = .white
}
}
}
#Preview {
ScheduleMeetingFragment(scheduleMeetingViewModel: ScheduleMeetingViewModel())
}
// swiftlint:enable line_length

View file

@ -34,7 +34,7 @@ class MeetingModel: ObservableObject {
let formatter = DateFormatter()
formatter.dateFormat = Locale.current.identifier == "fr_FR" ? "HH:mm" : "h:mm a"
startTime = formatter.string(from: meetingDate)
let endDate = Calendar.current.date(byAdding: .minute, value: Int(confInfo.duration), to: meetingDate)
let endDate = Calendar.current.date(byAdding: .minute, value: Int(confInfo.duration), to: meetingDate)!
endTime = formatter.string(from: endDate)
time = "\(startTime) - \(endTime)"

View file

@ -21,24 +21,23 @@ import Foundation
import linphonesw
import Combine
class ScheduleMeetingViewModel: ObservableObject {
private let TAG = "[ScheduleMeetingViewModel]"
@Published var isBroadcastSelected: Bool
@Published var showBroadcastHelp: Bool
@Published var subject: String
@Published var description: String
@Published var allDayMeeting: Bool
@Published var fromDateStr: String
@Published var fromTime: String
@Published var toDateStr: String
@Published var toTime: String
@Published var timezone: String
@Published var sendInvitations: Bool
@Published var isBroadcastSelected: Bool = false
@Published var showBroadcastHelp: Bool = false
@Published var subject: String = ""
@Published var description: String = ""
@Published var allDayMeeting: Bool = false
@Published var fromDateStr: String = ""
@Published var fromTime: String = ""
@Published var toDateStr: String = ""
@Published var toTime: String = ""
@Published var timezone: String = ""
@Published var sendInvitations: Bool = true
// var participants = MutableLiveData<ArrayList<SelectedAddressModel>>()
@Published var operationInProgress: Bool
@Published var conferenceCreatedEvent: Bool
@Published var operationInProgress: Bool = false
@Published var conferenceCreatedEvent: Bool = false
var conferenceScheduler: ConferenceScheduler?
var conferenceInfoToEdit: ConferenceScheduler?
@ -47,11 +46,6 @@ class ScheduleMeetingViewModel: ObservableObject {
private var toDate: Date
init() {
isBroadcastSelected = false
showBroadcastHelp = false
allDayMeeting = false
sendInvitations = true
fromDate = Calendar.current.date(byAdding: .hour, value: 1, to: Date.now)!
toDate = Calendar.current.date(byAdding: .hour, value: 1, to: fromDate)!
@ -78,11 +72,10 @@ class ScheduleMeetingViewModel: ObservableObject {
let formatter = DateFormatter()
formatter.dateFormat = Locale.current.identifier == "fr_FR" ? "HH:mm" : "h:mm a"
fromTime = formatter.string(from: fromDate)
toTime = formatter.string(from:toDate)
toTime = formatter.string(from: toDate)
}
private func updateTimezone() {
// TODO
}
}