From 82a37cc8c4d011d7cccf47ca09700c4e23143d9a Mon Sep 17 00:00:00 2001 From: Phl-Pro Date: Fri, 6 Jan 2023 16:08:59 +0100 Subject: [PATCH 1/4] Merge pull request #705 from tchapgouv/phlpro/fix-invited-users-rights Hide menu for invited users --- .../AllChatsEditActionProvider.swift | 12 ++---- .../AllChats/AllChatsViewController.swift | 37 ++++++------------- changelog.d/701.bugfix | 1 + 3 files changed, 16 insertions(+), 34 deletions(-) create mode 100644 changelog.d/701.bugfix diff --git a/Riot/Modules/ContextMenu/ActionProviders/AllChatsEditActionProvider.swift b/Riot/Modules/ContextMenu/ActionProviders/AllChatsEditActionProvider.swift index 25a27d5e6a..c63b6318fc 100644 --- a/Riot/Modules/ContextMenu/ActionProviders/AllChatsEditActionProvider.swift +++ b/Riot/Modules/ContextMenu/ActionProviders/AllChatsEditActionProvider.swift @@ -58,14 +58,10 @@ class AllChatsEditActionProvider { if rootSpaceCount > 0 { createActions.insert(self.createSpaceAction, at: 0) } - - // Tchap: Add external account management - var menuChildren: [UIMenuElement] = [self.exploreRoomsAction] - if let userID = UserSessionsService.shared.mainUserSession?.userId, - !UserService.isExternalUser(for: userID) { - menuChildren.append(UIMenu(title: "", options: .displayInline, children: createActions)) - } - return UIMenu(title: "", children: menuChildren) + return UIMenu(title: "", children: [ + self.exploreRoomsAction, + UIMenu(title: "", options: .displayInline, children: createActions) + ]) } return UIMenu(title: "", children: [ diff --git a/Riot/Modules/Home/AllChats/AllChatsViewController.swift b/Riot/Modules/Home/AllChats/AllChatsViewController.swift index 13de555cf2..689b6e4aac 100644 --- a/Riot/Modules/Home/AllChats/AllChatsViewController.swift +++ b/Riot/Modules/Home/AllChats/AllChatsViewController.swift @@ -156,8 +156,6 @@ class AllChatsViewController: HomeViewController { NotificationCenter.default.addObserver(self, selector: #selector(self.spaceListDidChange), name: MXSpaceService.didInitialise, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(self.spaceListDidChange), name: MXSpaceService.didBuildSpaceGraph, object: nil) - // Tchap: Register user sessions service notifications to manage external users restrictions. - registerUserSessionsServiceNotifications() set(tableHeadeView: self.bannerView) } @@ -202,12 +200,6 @@ class AllChatsViewController: HomeViewController { } } - override func viewDidDisappear(_ animated: Bool) { - super.viewDidDisappear(animated) - // Tchap: Unregister user sessions service notifications to manage external users restrictions. - unregisterUserSessionsServiceNotifications() - } - // MARK: - Public func switchSpace(withId spaceId: String?) { @@ -246,6 +238,9 @@ class AllChatsViewController: HomeViewController { } else { initDataSource() } + + // Tchap: Force update UI to manage external users restrictions (useful after login). + updateUI() } override func removeMatrixSession(_ mxSession: MXSession!) { @@ -533,13 +528,20 @@ class AllChatsViewController: HomeViewController { let spacesButton = UIBarButtonItem(image: Asset.Images.allChatsSpacesIcon.image, style: .done, target: self, action: #selector(self.showSpaceSelectorAction(sender: ))) spacesButton.accessibilityLabel = VectorL10n.spaceSelectorTitle - self.toolbar.items = [ + var toolbarItems = [ // Tchap: Hide space button /*spacesButton,*/ UIBarButtonItem.flexibleSpace(), // Tchap: Update icon UIBarButtonItem(image: Asset_tchap.Images.homePlus.image, menu: menu) ] + + if let userID = UserSessionsService.shared.mainUserSession?.userId, + !UserService.isExternalUser(for: userID) { + self.toolbar.items = toolbarItems + } else { + self.toolbar.items = nil + } } private func showCreateSpace(parentSpaceId: String?) { @@ -673,23 +675,6 @@ class AllChatsViewController: HomeViewController { allChatsOnboardingCoordinatorBridgePresenter.present(from: self, animated: true) self.allChatsOnboardingCoordinatorBridgePresenter = allChatsOnboardingCoordinatorBridgePresenter } - - // Tchap: Register and unregister sessions service notifications to manage external users restrictions. - private func registerUserSessionsServiceNotifications() { - NotificationCenter.default.addObserver(self, selector: #selector(didUpdateUserSession), name: UserSessionsService.didAddUserSession, object: nil) - - NotificationCenter.default.addObserver(self, selector: #selector(didUpdateUserSession), name: UserSessionsService.willRemoveUserSession, object: nil) - } - - private func unregisterUserSessionsServiceNotifications() { - NotificationCenter.default.removeObserver(self, name: UserSessionsService.didAddUserSession, object: nil) - - NotificationCenter.default.removeObserver(self, name: UserSessionsService.willRemoveUserSession, object: nil) - } - - @objc private func didUpdateUserSession() { - updateUI() - } } // MARK: - SpaceSelectorBottomSheetCoordinatorBridgePresenterDelegate diff --git a/changelog.d/701.bugfix b/changelog.d/701.bugfix new file mode 100644 index 0000000000..0dbcee58ec --- /dev/null +++ b/changelog.d/701.bugfix @@ -0,0 +1 @@ +Fix external account management From e94b357b6b1303158a543f70f6b2bfcfa7ed121d Mon Sep 17 00:00:00 2001 From: Phl-Pro Date: Mon, 16 Jan 2023 14:00:33 +0100 Subject: [PATCH 2/4] Merge pull request #708 from tchapgouv/phlpro/706-forgot-password-logout-checkbox Forgot password without signing out of all devices --- .../AuthenticationChoosePasswordViewModel.swift | 2 +- .../View/AuthenticationChoosePasswordScreen.swift | 4 ++-- .../Settings/ChangePassword/View/ChangePasswordScreen.swift | 4 ++-- Tchap/Assets/Localizations/fr.lproj/Tchap.strings | 1 + Tchap/Generated/Strings.swift | 2 ++ changelog.d/706.change | 1 + 6 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 changelog.d/706.change diff --git a/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordViewModel.swift b/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordViewModel.swift index 07df73c2b3..35584139cf 100644 --- a/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordViewModel.swift +++ b/RiotSwiftUI/Modules/Authentication/ChoosePassword/AuthenticationChoosePasswordViewModel.swift @@ -30,7 +30,7 @@ class AuthenticationChoosePasswordViewModel: AuthenticationChoosePasswordViewMod // MARK: - Setup // Tchap: Update default signoutAllDevices value - init(password: String = "", signoutAllDevices: Bool = true) { + init(password: String = "", signoutAllDevices: Bool = false) { let viewState = AuthenticationChoosePasswordViewState(bindings: AuthenticationChoosePasswordBindings(password: password, signoutAllDevices: signoutAllDevices)) super.init(initialViewState: viewState) } diff --git a/RiotSwiftUI/Modules/Authentication/ChoosePassword/View/AuthenticationChoosePasswordScreen.swift b/RiotSwiftUI/Modules/Authentication/ChoosePassword/View/AuthenticationChoosePasswordScreen.swift index 704ca6a367..3fb495d99c 100644 --- a/RiotSwiftUI/Modules/Authentication/ChoosePassword/View/AuthenticationChoosePasswordScreen.swift +++ b/RiotSwiftUI/Modules/Authentication/ChoosePassword/View/AuthenticationChoosePasswordScreen.swift @@ -73,10 +73,10 @@ struct AuthenticationChoosePasswordScreen: View { textField HStack(alignment: .center, spacing: 8) { - Toggle(VectorL10n.authenticationChoosePasswordSignoutAllDevices, isOn: $viewModel.signoutAllDevices) + Toggle(TchapL10n.authenticationChoosePasswordSignoutAllDevices, isOn: $viewModel.signoutAllDevices) .toggleStyle(AuthenticationTermsToggleStyle()) .accessibilityIdentifier("signoutAllDevicesToggle") - Text(VectorL10n.authenticationChoosePasswordSignoutAllDevices) + Text(TchapL10n.authenticationChoosePasswordSignoutAllDevices) .foregroundColor(theme.colors.secondaryContent) } .padding(.bottom, 16) diff --git a/RiotSwiftUI/Modules/Settings/ChangePassword/View/ChangePasswordScreen.swift b/RiotSwiftUI/Modules/Settings/ChangePassword/View/ChangePasswordScreen.swift index 0602c3d4d5..b93dac7311 100644 --- a/RiotSwiftUI/Modules/Settings/ChangePassword/View/ChangePasswordScreen.swift +++ b/RiotSwiftUI/Modules/Settings/ChangePassword/View/ChangePasswordScreen.swift @@ -90,10 +90,10 @@ struct ChangePasswordScreen: View { .accessibilityIdentifier("newPasswordTextField2") HStack(alignment: .center, spacing: 8) { - Toggle(VectorL10n.authenticationChoosePasswordSignoutAllDevices, isOn: $viewModel.signoutAllDevices) + Toggle(TchapL10n.authenticationChoosePasswordSignoutAllDevices, isOn: $viewModel.signoutAllDevices) .toggleStyle(AuthenticationTermsToggleStyle()) .accessibilityIdentifier("signoutAllDevicesToggle") - Text(VectorL10n.authenticationChoosePasswordSignoutAllDevices) + Text(TchapL10n.authenticationChoosePasswordSignoutAllDevices) .foregroundColor(theme.colors.secondaryContent) } .onTapGesture(perform: toggleSignoutAllDevices) diff --git a/Tchap/Assets/Localizations/fr.lproj/Tchap.strings b/Tchap/Assets/Localizations/fr.lproj/Tchap.strings index 379fd4aeb5..3819e0be41 100644 --- a/Tchap/Assets/Localizations/fr.lproj/Tchap.strings +++ b/Tchap/Assets/Localizations/fr.lproj/Tchap.strings @@ -34,6 +34,7 @@ "authentication_error_missing_password" = "Mot de passe manquant"; "authentication_error_email_in_use" = "Cette adresse email est déjà utilisée"; "authentication_error_limit_exceeded" = "Vos trois dernières tentatives de connexion ont échoué. Veuillez réessayer dans 30 minutes"; +"authentication_choose_password_signout_all_devices" = "Déconnecter mes appareils et verrouiller mes messages (en cas de piratage de votre compte ou de la perte d'un appareil)"; //////////////////////////////////////////////////////////////////////////////// // MARK: Forgot password diff --git a/Tchap/Generated/Strings.swift b/Tchap/Generated/Strings.swift index 10e6518bb6..a3c84da60c 100644 --- a/Tchap/Generated/Strings.swift +++ b/Tchap/Generated/Strings.swift @@ -35,6 +35,8 @@ internal enum TchapL10n { internal static let appVersionUpdateMandatoryUpdateMessageFallback = TchapL10n.tr("Tchap", "app_version_update_mandatory_update_message_fallback", fallback: "Une nouvelle version est disponible, veuillez mettre à jour votre application.") /// Ouvrir l'App Store internal static let appVersionUpdateOpenAppStoreAction = TchapL10n.tr("Tchap", "app_version_update_open_app_store_action", fallback: "Ouvrir l'App Store") + /// Déconnecter mes appareils et verrouiller mes messages (en cas de piratage de votre compte ou de la perte d'un appareil) + internal static let authenticationChoosePasswordSignoutAllDevices = TchapL10n.tr("Tchap", "authentication_choose_password_signout_all_devices", fallback: "Déconnecter mes appareils et verrouiller mes messages (en cas de piratage de votre compte ou de la perte d'un appareil)") /// Cette adresse email est déjà utilisée internal static let authenticationErrorEmailInUse = TchapL10n.tr("Tchap", "authentication_error_email_in_use", fallback: "Cette adresse email est déjà utilisée") /// L'adresse email ne semble pas valide diff --git a/changelog.d/706.change b/changelog.d/706.change new file mode 100644 index 0000000000..7e242df04a --- /dev/null +++ b/changelog.d/706.change @@ -0,0 +1 @@ +"Forgot password" without signing out of all devices From aa99a0e6055a80eaad00b3b60f939b61a6eef5ac Mon Sep 17 00:00:00 2001 From: Nicolas Buquet <> Date: Thu, 19 Jan 2023 14:59:35 +0100 Subject: [PATCH 3/4] Update versions --- Config/AppVersion.xcconfig | 2 +- towncrier.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Config/AppVersion.xcconfig b/Config/AppVersion.xcconfig index 0824a85dde..f4b21db733 100644 --- a/Config/AppVersion.xcconfig +++ b/Config/AppVersion.xcconfig @@ -15,5 +15,5 @@ // // Version -MARKETING_VERSION = 2.2.2 +MARKETING_VERSION = 2.2.3 CURRENT_PROJECT_VERSION = 1 diff --git a/towncrier.toml b/towncrier.toml index d7b845fed3..e4f5c6207a 100644 --- a/towncrier.toml +++ b/towncrier.toml @@ -1,6 +1,6 @@ [tool.towncrier] name = "Changes in" -version = "2.2.2" +version = "2.2.3" filename = "TCHAP_CHANGES.md" directory = "changelog.d" template = "changelog.d/_template.md.jinja" From 4d837b417d493796e2038d9f7a5f08ccf55664fe Mon Sep 17 00:00:00 2001 From: Nicolas Buquet <> Date: Thu, 19 Jan 2023 15:13:13 +0100 Subject: [PATCH 4/4] execute Towncrier --- TCHAP_CHANGES.md | 11 +++++++++++ changelog.d/701.bugfix | 1 - changelog.d/706.change | 1 - 3 files changed, 11 insertions(+), 2 deletions(-) delete mode 100644 changelog.d/701.bugfix delete mode 100644 changelog.d/706.change diff --git a/TCHAP_CHANGES.md b/TCHAP_CHANGES.md index e54d724a63..84afceed7c 100644 --- a/TCHAP_CHANGES.md +++ b/TCHAP_CHANGES.md @@ -1,3 +1,14 @@ +## Changes in 2.2.3 (2023-01-19) + +🙌 Improvements + +- "Forgot password" without signing out of all devices ([#706](https://github.com/tchapgouv/tchap-ios/issues/706)) + +🐛 Bugfixes + +- Fix external account management ([#701](https://github.com/tchapgouv/tchap-ios/issues/701)) + + ## Changes in 2.2.2 (2022-12-07) 🙌 Improvements diff --git a/changelog.d/701.bugfix b/changelog.d/701.bugfix deleted file mode 100644 index 0dbcee58ec..0000000000 --- a/changelog.d/701.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix external account management diff --git a/changelog.d/706.change b/changelog.d/706.change deleted file mode 100644 index 7e242df04a..0000000000 --- a/changelog.d/706.change +++ /dev/null @@ -1 +0,0 @@ -"Forgot password" without signing out of all devices