From b84e11633659f40af09e7b452f9bd93982794e3e Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Mon, 8 Jul 2024 10:43:27 +0200 Subject: [PATCH] Change texts in call view when history list is empty --- Linphone/Localizable.xcstrings | 34 +++++++++++++++++++ Linphone/UI/Main/ContentView.swift | 3 +- .../History/Fragments/HistoryFragment.swift | 8 +++-- .../Fragments/HistoryListFragment.swift | 6 ++-- Linphone/UI/Main/History/HistoryView.swift | 7 ++-- 5 files changed, 50 insertions(+), 8 deletions(-) diff --git a/Linphone/Localizable.xcstrings b/Linphone/Localizable.xcstrings index 0e0fdb998..9aea334bb 100644 --- a/Linphone/Localizable.xcstrings +++ b/Linphone/Localizable.xcstrings @@ -1183,6 +1183,40 @@ } } }, + "history_list_empty_history" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "No call for the moment…" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Aucun appel dans votre historique…" + } + } + } + }, + "history_list_empty_with_filter_history" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "No entries match your search" + } + }, + "fr" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "Aucune entrée ne correspond à votre recherche" + } + } + } + }, "I prefere create an account" : { }, diff --git a/Linphone/UI/Main/ContentView.swift b/Linphone/UI/Main/ContentView.swift index 96d7cc2d6..599c92f1a 100644 --- a/Linphone/UI/Main/ContentView.swift +++ b/Linphone/UI/Main/ContentView.swift @@ -532,7 +532,8 @@ struct ContentView: View { editContactViewModel: editContactViewModel, index: $index, isShowStartCallFragment: $isShowStartCallFragment, - isShowEditContactFragment: $isShowEditContactFragment + isShowEditContactFragment: $isShowEditContactFragment, + text: $text ) } else if self.index == 2 { ConversationsView(conversationViewModel: conversationViewModel, conversationsListViewModel: conversationsListViewModel) diff --git a/Linphone/UI/Main/History/Fragments/HistoryFragment.swift b/Linphone/UI/Main/History/Fragments/HistoryFragment.swift index bce55db80..1a4d8c6cc 100644 --- a/Linphone/UI/Main/History/Fragments/HistoryFragment.swift +++ b/Linphone/UI/Main/History/Fragments/HistoryFragment.swift @@ -30,11 +30,12 @@ struct HistoryFragment: View { @State private var showingSheet = false @Binding var index: Int @Binding var isShowEditContactFragment: Bool + @Binding var text: String var body: some View { ZStack { if #available(iOS 16.0, *), idiom != .pad { - HistoryListFragment(historyListViewModel: historyListViewModel, historyViewModel: historyViewModel, showingSheet: $showingSheet) + HistoryListFragment(historyListViewModel: historyListViewModel, historyViewModel: historyViewModel, showingSheet: $showingSheet, text: $text) .sheet(isPresented: $showingSheet) { HistoryListBottomSheet( historyViewModel: historyViewModel, @@ -48,7 +49,7 @@ struct HistoryFragment: View { .presentationDetents([.fraction(0.2)]) } } else { - HistoryListFragment(historyListViewModel: historyListViewModel, historyViewModel: historyViewModel, showingSheet: $showingSheet) + HistoryListFragment(historyListViewModel: historyListViewModel, historyViewModel: historyViewModel, showingSheet: $showingSheet, text: $text) .halfSheet(showSheet: $showingSheet) { HistoryListBottomSheet( historyViewModel: historyViewModel, @@ -72,6 +73,7 @@ struct HistoryFragment: View { contactViewModel: ContactViewModel(), editContactViewModel: EditContactViewModel(), index: .constant(1), - isShowEditContactFragment: .constant(false) + isShowEditContactFragment: .constant(false), + text: .constant("") ) } diff --git a/Linphone/UI/Main/History/Fragments/HistoryListFragment.swift b/Linphone/UI/Main/History/Fragments/HistoryListFragment.swift index 25520b254..9df4cddf2 100644 --- a/Linphone/UI/Main/History/Fragments/HistoryListFragment.swift +++ b/Linphone/UI/Main/History/Fragments/HistoryListFragment.swift @@ -31,6 +31,7 @@ struct HistoryListFragment: View { @ObservedObject var historyViewModel: HistoryViewModel @Binding var showingSheet: Bool + @Binding var text: String var body: some View { VStack { @@ -151,8 +152,9 @@ struct HistoryListFragment: View { .scaledToFit() .clipped() .padding(.all) - Text("No call for the moment...") + Text(historyListViewModel.callLogs.isEmpty && !text.isEmpty ? "history_list_empty_with_filter_history" : "history_list_empty_history") .default_text_style_800(styleSize: 16) + .multilineTextAlignment(.center) Spacer() Spacer() } @@ -170,7 +172,7 @@ struct HistoryListFragment: View { } #Preview { - HistoryListFragment(historyListViewModel: HistoryListViewModel(), historyViewModel: HistoryViewModel(), showingSheet: .constant(false)) + HistoryListFragment(historyListViewModel: HistoryListViewModel(), historyViewModel: HistoryViewModel(), showingSheet: .constant(false), text: .constant("")) } // swiftlint:enable line_length diff --git a/Linphone/UI/Main/History/HistoryView.swift b/Linphone/UI/Main/History/HistoryView.swift index 236ff3572..ee9f01b73 100644 --- a/Linphone/UI/Main/History/HistoryView.swift +++ b/Linphone/UI/Main/History/HistoryView.swift @@ -30,6 +30,7 @@ struct HistoryView: View { @Binding var index: Int @Binding var isShowStartCallFragment: Bool @Binding var isShowEditContactFragment: Bool + @Binding var text: String var body: some View { NavigationView { @@ -40,7 +41,8 @@ struct HistoryView: View { contactViewModel: contactViewModel, editContactViewModel: editContactViewModel, index: $index, - isShowEditContactFragment: $isShowEditContactFragment + isShowEditContactFragment: $isShowEditContactFragment, + text: $text ) Button { @@ -72,6 +74,7 @@ struct HistoryView: View { contactViewModel: ContactViewModel(), editContactViewModel: EditContactViewModel(), index: .constant(1), - isShowEditContactFragment: .constant(false) + isShowEditContactFragment: .constant(false), + text: .constant("") ) }