Skip to content

Commit

Permalink
Merge branch 'hotfix/tchap_v2.2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Buquet committed Jan 19, 2023
2 parents ede68bd + 4d837b4 commit f19bb4b
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Config/AppVersion.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
//

// Version
MARKETING_VERSION = 2.2.2
MARKETING_VERSION = 2.2.3
CURRENT_PROJECT_VERSION = 1
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
37 changes: 11 additions & 26 deletions Riot/Modules/Home/AllChats/AllChatsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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?) {
Expand Down Expand Up @@ -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!) {
Expand Down Expand Up @@ -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?) {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions TCHAP_CHANGES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions Tchap/Assets/Localizations/fr.lproj/Tchap.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Tchap/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion towncrier.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit f19bb4b

Please sign in to comment.