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/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/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_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/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/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"