From 85be73b84fb8f6bc98ce8b8e4eb27b8b9fd98d85 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Tue, 25 Jun 2024 12:31:39 +0200 Subject: [PATCH] meetings list - scroll to "Today" on appear and when pressing the top right calendar button --- Linphone/UI/Main/ContentView.swift | 15 +++- .../Meetings/Fragments/MeetingsFragment.swift | 68 +++++++++++-------- .../ViewModel/MeetingsListViewModel.swift | 1 + 3 files changed, 54 insertions(+), 30 deletions(-) diff --git a/Linphone/UI/Main/ContentView.swift b/Linphone/UI/Main/ContentView.swift index 6fd3e2e32..8fd3d50b5 100644 --- a/Linphone/UI/Main/ContentView.swift +++ b/Linphone/UI/Main/ContentView.swift @@ -299,7 +299,18 @@ struct ContentView: View { } .padding(.trailing, index == 2 ? 10 : 0) - if index != 2 { + if index == 3 { + Button { + NotificationCenter.default.post(name: MeetingsListViewModel.ScrollToTodayNotification, object: nil) + } label: { + Image("calendar") + .renderingMode(.template) + .resizable() + .foregroundStyle(.white) + .frame(width: 25, height: 25, alignment: .leading) + .padding(.all, 10) + } + } else if index != 2 { Menu { if index == 0 { Button { @@ -355,7 +366,7 @@ struct ContentView: View { } } } label: { - Image(index == 0 ? "funnel" : (index == 3 ? "calendar" : "dots-three-vertical")) + Image(index == 0 ? "funnel" : "dots-three-vertical") .renderingMode(.template) .resizable() .foregroundStyle(.white) diff --git a/Linphone/UI/Main/Meetings/Fragments/MeetingsFragment.swift b/Linphone/UI/Main/Meetings/Fragments/MeetingsFragment.swift index 3d2bc8780..a012c8bdd 100644 --- a/Linphone/UI/Main/Meetings/Fragments/MeetingsFragment.swift +++ b/Linphone/UI/Main/Meetings/Fragments/MeetingsFragment.swift @@ -28,6 +28,7 @@ struct MeetingsFragment: View { private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } @State var showingSheet: Bool = false + @State var reader : ScrollViewProxy? @ViewBuilder func createMonthLine(model: MeetingsListItemModel) -> some View { @@ -76,7 +77,6 @@ struct MeetingsFragment: View { .background(.white) .clipShape(RoundedRectangle(cornerRadius: 20)) .shadow(color: .black.opacity(0.2), radius: 4) - .padding(.bottom, 5) .onTapGesture { withAnimation { if let meetingModel = model.model { @@ -88,15 +88,15 @@ struct MeetingsFragment: View { var body: some View { VStack { - List { - VStack(alignment: .leading, spacing: 0) { - ForEach(0..()