From f20226209a00a0b48d8d87b8c321e23335fe1b2e Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Mon, 23 Oct 2023 17:18:04 +0200 Subject: [PATCH 1/3] Make searchField active when entering this view --- .../ContactsPicker/ContactsPickerViewModel.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift b/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift index cd06bd51e..aa9026590 100644 --- a/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift +++ b/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift @@ -128,7 +128,9 @@ class ContactsPickerViewModel: NSObject, ContactsPickerViewModelProtocol { contactsViewController.showSearch(true) // Tchap: Replace string by removing user ID contactsViewController.searchBar.placeholder = VectorL10n.roomParticipantsInviteAnotherUserWithoutId - contactsViewController.searchBar.resignFirstResponder() + // Tchap: don't make searchbar rersign as first responder. + // Let it becomes first responder to activate the input field and deploy the keyboard when the controller comes to screen. +// contactsViewController.searchBar.resignFirstResponder() // Apply the search pattern if any if currentSearchText != nil { From e4d24c0c00bd30fea7866337b6a472437fea9e4b Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Mon, 23 Oct 2023 17:19:04 +0200 Subject: [PATCH 2/3] Display a more friendly error when a user can't be invited to a room (previously, a generic back-end error message in english was displayed) --- .../ContactsPicker/ContactsPickerViewModel.swift | 10 +++++++++- Tchap/Assets/Localizations/fr.lproj/Tchap.strings | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift b/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift index aa9026590..7934cae39 100644 --- a/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift +++ b/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift @@ -248,7 +248,15 @@ extension ContactsPickerViewModel: ContactsTableViewControllerDelegate { self.coordinatorDelegate?.contactsPickerViewModelDidEndInvite(self) case .failure: MXLog.error("[ContactsPickerViewModel] Failed to invite participant", context: response.error) - self.coordinatorDelegate?.contactsPickerViewModel(self, inviteFailedWithError: response.error) + // Tchap: make error message clearer and in french when a member can't be invited to a room + if let mxError = MXError(nsError: response.error), + mxError.errcode == kMXErrCodeStringForbidden, + let tchapErrorCannotInvite = MXError(errorCode: mxError.errcode, error: TchapL10n.roomInviteErrorActionForbidden, userInfo: mxError.userInfo) { + self.coordinatorDelegate?.contactsPickerViewModel(self, inviteFailedWithError: tchapErrorCannotInvite.createNSError()) + } + else { + self.coordinatorDelegate?.contactsPickerViewModel(self, inviteFailedWithError: response.error) + } } } } else { diff --git a/Tchap/Assets/Localizations/fr.lproj/Tchap.strings b/Tchap/Assets/Localizations/fr.lproj/Tchap.strings index cf00b3668..9fee78b70 100644 --- a/Tchap/Assets/Localizations/fr.lproj/Tchap.strings +++ b/Tchap/Assets/Localizations/fr.lproj/Tchap.strings @@ -309,3 +309,7 @@ //////////////////////////////////////////////////////////////////////////////// // MARK: Room Decryption error "room_decryption_error_faq_link_message" = "Sinon, consulter cet article de FAQ."; + +//////////////////////////////////////////////////////////////////////////////// +// MARK: Room Invite +"room_invite_error_action_forbidden" = "Cet utilisateur n'est pas autorisé à rejoindre ce salon."; From a8fbacb909489c5e59b7c5702c034474fb5063c6 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Mon, 23 Oct 2023 18:07:21 +0200 Subject: [PATCH 3/3] typo --- .../ContactsPicker/ContactsPickerViewModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift b/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift index 7934cae39..aa1eb92ad 100644 --- a/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift +++ b/Riot/Modules/Room/ParticipantsInviteModal/ContactsPicker/ContactsPickerViewModel.swift @@ -128,7 +128,7 @@ class ContactsPickerViewModel: NSObject, ContactsPickerViewModelProtocol { contactsViewController.showSearch(true) // Tchap: Replace string by removing user ID contactsViewController.searchBar.placeholder = VectorL10n.roomParticipantsInviteAnotherUserWithoutId - // Tchap: don't make searchbar rersign as first responder. + // Tchap: don't make searchbar resign as first responder. // Let it becomes first responder to activate the input field and deploy the keyboard when the controller comes to screen. // contactsViewController.searchBar.resignFirstResponder()