Change texts in call view when history list is empty

This commit is contained in:
Benoit Martins 2024-07-08 10:43:27 +02:00
parent c750a8cfb2
commit b84e116336
5 changed files with 50 additions and 8 deletions

View file

@ -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" : {
},

View file

@ -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)

View file

@ -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("")
)
}

View file

@ -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

View file

@ -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("")
)
}