Change text in views when lists are empty

This commit is contained in:
Benoit Martins 2024-07-09 17:38:26 +02:00
parent a96ae05dd6
commit afa7496e82
12 changed files with 107 additions and 36 deletions

View file

@ -846,6 +846,23 @@
},
"Contacts" : {
},
"contacts_list_empty" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "No contact for the moment…"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Aucun contact pour le moment…"
}
}
}
},
"Content" : {
@ -868,6 +885,23 @@
},
"Conversations" : {
},
"conversations_list_empty" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "No conversation for the moment…"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Aucune conversation pour le moment…"
}
}
}
},
"Copy address" : {
@ -1269,12 +1303,31 @@
},
"Joining..." : {
},
"Key" : {
"extractionState" : "manual"
},
"Last name" : {
},
"Linphone" : {
},
"list_filter_no_result_found" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "No result found…"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Aucun résultat…"
}
}
}
},
"Log out" : {
@ -1296,6 +1349,22 @@
},
"Meetings" : {
},
"meetings_list_empty" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "No meeting for the moment…"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Aucune réunion pour le moment…"
}
}
}
},
"Message" : {
@ -1320,18 +1389,6 @@
},
"Next" : {
},
"No call for the moment..." : {
},
"No contacts for the moment..." : {
},
"No conversation for the moment..." : {
},
"No meeting for the moment..." : {
},
"No meeting today" : {

View file

@ -365,7 +365,7 @@ struct CallsListFragment: View {
.scaledToFit()
.clipped()
.padding(.all)
Text("No call for the moment...")
Text("history_list_empty_history")
.default_text_style_800(styleSize: 16)
Spacer()
Spacer()

View file

@ -27,11 +27,12 @@ struct ContactsView: View {
@Binding var isShowEditContactFragment: Bool
@Binding var isShowDeletePopup: Bool
@Binding var text: String
var body: some View {
NavigationView {
ZStack(alignment: .bottomTrailing) {
ContactsFragment(contactViewModel: contactViewModel, isShowDeletePopup: $isShowDeletePopup)
ContactsFragment(contactViewModel: contactViewModel, isShowDeletePopup: $isShowDeletePopup, text: $text)
Button {
withAnimation {
@ -66,6 +67,7 @@ struct ContactsView: View {
historyViewModel: HistoryViewModel(),
editContactViewModel: EditContactViewModel(),
isShowEditContactFragment: .constant(false),
isShowDeletePopup: .constant(false)
isShowDeletePopup: .constant(false),
text: .constant("")
)
}

View file

@ -29,11 +29,12 @@ struct ContactsFragment: View {
@State private var showingSheet = false
@State private var showShareSheet = false
@Binding var text: String
var body: some View {
ZStack {
if #available(iOS 16.0, *), idiom != .pad {
ContactsInnerFragment(contactViewModel: contactViewModel, showingSheet: $showingSheet)
ContactsInnerFragment(contactViewModel: contactViewModel, showingSheet: $showingSheet, text: $text)
.sheet(isPresented: $showingSheet) {
ContactsListBottomSheet(
contactViewModel: contactViewModel,
@ -49,7 +50,7 @@ struct ContactsFragment: View {
.edgesIgnoringSafeArea(.bottom)
}
} else {
ContactsInnerFragment(contactViewModel: contactViewModel, showingSheet: $showingSheet)
ContactsInnerFragment(contactViewModel: contactViewModel, showingSheet: $showingSheet, text: $text)
.halfSheet(showSheet: $showingSheet) {
ContactsListBottomSheet(
contactViewModel: contactViewModel,
@ -68,5 +69,5 @@ struct ContactsFragment: View {
}
#Preview {
ContactsFragment(contactViewModel: ContactViewModel(), isShowDeletePopup: .constant(false))
ContactsFragment(contactViewModel: ContactViewModel(), isShowDeletePopup: .constant(false), text: .constant(""))
}

View file

@ -29,6 +29,7 @@ struct ContactsInnerFragment: View {
@State private var isFavoriteOpen = true
@Binding var showingSheet: Bool
@Binding var text: String
var body: some View {
VStack(alignment: .leading) {
@ -87,7 +88,7 @@ struct ContactsInnerFragment: View {
.scaledToFit()
.clipped()
.padding(.all)
Text("No contacts for the moment...")
Text(!text.isEmpty ? "list_filter_no_result_found" : "contacts_list_empty")
.default_text_style_800(styleSize: 16)
Spacer()
Spacer()
@ -102,5 +103,5 @@ struct ContactsInnerFragment: View {
}
#Preview {
ContactsInnerFragment(contactViewModel: ContactViewModel(), showingSheet: .constant(false))
ContactsInnerFragment(contactViewModel: ContactViewModel(), showingSheet: .constant(false), text: .constant(""))
}

View file

@ -522,7 +522,8 @@ struct ContentView: View {
historyViewModel: historyViewModel,
editContactViewModel: editContactViewModel,
isShowEditContactFragment: $isShowEditContactFragment,
isShowDeletePopup: $isShowDeleteContactPopup
isShowDeletePopup: $isShowDeleteContactPopup,
text: $text
)
} else if self.index == 1 {
HistoryView(
@ -536,13 +537,14 @@ struct ContentView: View {
text: $text
)
} else if self.index == 2 {
ConversationsView(conversationViewModel: conversationViewModel, conversationsListViewModel: conversationsListViewModel)
ConversationsView(conversationViewModel: conversationViewModel, conversationsListViewModel: conversationsListViewModel, text: $text)
} else if self.index == 3 {
MeetingsView(
meetingsListViewModel: meetingsListViewModel,
meetingViewModel: meetingViewModel,
isShowScheduleMeetingFragment: $isShowScheduleMeetingFragment,
isShowSendCancelMeetingNotificationPopup: $isShowSendCancelMeetingNotificationPopup
isShowSendCancelMeetingNotificationPopup: $isShowSendCancelMeetingNotificationPopup,
text: $text
)
}
}

View file

@ -23,11 +23,12 @@ struct ConversationsView: View {
@ObservedObject var conversationViewModel: ConversationViewModel
@ObservedObject var conversationsListViewModel: ConversationsListViewModel
@Binding var text: String
var body: some View {
NavigationView {
ZStack(alignment: .bottomTrailing) {
ConversationsFragment(conversationViewModel: conversationViewModel, conversationsListViewModel: conversationsListViewModel)
ConversationsFragment(conversationViewModel: conversationViewModel, conversationsListViewModel: conversationsListViewModel, text: $text)
Button {
} label: {
@ -51,6 +52,7 @@ struct ConversationsView: View {
ConversationsListFragment(
conversationViewModel: ConversationViewModel(),
conversationsListViewModel: ConversationsListViewModel(),
showingSheet: .constant(false)
showingSheet: .constant(false),
text: .constant("")
)
}

View file

@ -27,11 +27,12 @@ struct ConversationsFragment: View {
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
@State var showingSheet: Bool = false
@Binding var text: String
var body: some View {
ZStack {
if #available(iOS 16.0, *), idiom != .pad {
ConversationsListFragment(conversationViewModel: conversationViewModel, conversationsListViewModel: conversationsListViewModel, showingSheet: $showingSheet)
ConversationsListFragment(conversationViewModel: conversationViewModel, conversationsListViewModel: conversationsListViewModel, showingSheet: $showingSheet, text: $text)
.sheet(isPresented: $showingSheet) {
ConversationsListBottomSheet(
conversationsListViewModel: conversationsListViewModel,
@ -40,7 +41,7 @@ struct ConversationsFragment: View {
.presentationDetents([.fraction(0.4)])
}
} else {
ConversationsListFragment(conversationViewModel: conversationViewModel, conversationsListViewModel: conversationsListViewModel, showingSheet: $showingSheet)
ConversationsListFragment(conversationViewModel: conversationViewModel, conversationsListViewModel: conversationsListViewModel, showingSheet: $showingSheet, text: $text)
.halfSheet(showSheet: $showingSheet) {
ConversationsListBottomSheet(
conversationsListViewModel: conversationsListViewModel,
@ -53,5 +54,5 @@ struct ConversationsFragment: View {
}
#Preview {
ConversationsFragment(conversationViewModel: ConversationViewModel(), conversationsListViewModel: ConversationsListViewModel())
ConversationsFragment(conversationViewModel: ConversationViewModel(), conversationsListViewModel: ConversationsListViewModel(), text: .constant(""))
}

View file

@ -26,6 +26,7 @@ struct ConversationsListFragment: View {
@ObservedObject var conversationsListViewModel: ConversationsListViewModel
@Binding var showingSheet: Bool
@Binding var text: String
var body: some View {
VStack {
@ -162,7 +163,7 @@ struct ConversationsListFragment: View {
.scaledToFit()
.clipped()
.padding(.all)
Text("No conversation for the moment...")
Text(!text.isEmpty ? "list_filter_no_result_found" : "conversations_list_empty")
.default_text_style_800(styleSize: 16)
Spacer()
Spacer()
@ -180,6 +181,7 @@ struct ConversationsListFragment: View {
ConversationsListFragment(
conversationViewModel: ConversationViewModel(),
conversationsListViewModel: ConversationsListViewModel(),
showingSheet: .constant(false)
showingSheet: .constant(false),
text: .constant("")
)
}

View file

@ -152,7 +152,7 @@ struct HistoryListFragment: View {
.scaledToFit()
.clipped()
.padding(.all)
Text(historyListViewModel.callLogs.isEmpty && !text.isEmpty ? "history_list_empty_with_filter_history" : "history_list_empty_history")
Text(!text.isEmpty ? "list_filter_no_result_found" : "history_list_empty_history")
.default_text_style_800(styleSize: 16)
.multilineTextAlignment(.center)
Spacer()

View file

@ -28,6 +28,7 @@ struct MeetingsFragment: View {
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
@Binding var showingSheet: Bool
@Binding var text: String
@ViewBuilder
func createMonthLine(model: MeetingsListItemModel) -> some View {
@ -162,7 +163,7 @@ struct MeetingsFragment: View {
.scaledToFit()
.clipped()
.padding(.all)
Text("No meeting for the moment...")
Text(!text.isEmpty ? "list_filter_no_result_found" : "meetings_list_empty")
.default_text_style_800(styleSize: 16)
Spacer()
Spacer()
@ -180,5 +181,5 @@ struct MeetingsFragment: View {
#Preview {
MeetingsFragment(meetingsListViewModel: MeetingsListViewModel(),
meetingViewModel: MeetingViewModel(),
showingSheet: .constant(false))
showingSheet: .constant(false), text: .constant(""))
}

View file

@ -29,13 +29,14 @@ struct MeetingsView: View {
@Binding var isShowSendCancelMeetingNotificationPopup: Bool
@State private var showingSheet = false
@Binding var text: String
var body: some View {
NavigationView {
ZStack(alignment: .bottomTrailing) {
if #available(iOS 16.0, *), idiom != .pad {
MeetingsFragment(meetingsListViewModel: meetingsListViewModel, meetingViewModel: meetingViewModel, showingSheet: $showingSheet)
MeetingsFragment(meetingsListViewModel: meetingsListViewModel, meetingViewModel: meetingViewModel, showingSheet: $showingSheet, text: $text)
.sheet(isPresented: $showingSheet) {
MeetingsListBottomSheet(
meetingsListViewModel: meetingsListViewModel,
@ -45,7 +46,7 @@ struct MeetingsView: View {
.presentationDetents([.fraction(0.1)])
}
} else {
MeetingsFragment(meetingsListViewModel: meetingsListViewModel, meetingViewModel: meetingViewModel, showingSheet: $showingSheet)
MeetingsFragment(meetingsListViewModel: meetingsListViewModel, meetingViewModel: meetingViewModel, showingSheet: $showingSheet, text: $text)
.halfSheet(showSheet: $showingSheet) {
MeetingsListBottomSheet(
meetingsListViewModel: meetingsListViewModel,
@ -82,6 +83,7 @@ struct MeetingsView: View {
meetingsListViewModel: MeetingsListViewModel(),
meetingViewModel: MeetingViewModel(),
isShowScheduleMeetingFragment: .constant(false),
isShowSendCancelMeetingNotificationPopup: .constant(false)
isShowSendCancelMeetingNotificationPopup: .constant(false),
text: .constant("")
)
}