diff --git a/Config/AppVersion.xcconfig b/Config/AppVersion.xcconfig index 6cfeff85a1..0824a85dde 100644 --- a/Config/AppVersion.xcconfig +++ b/Config/AppVersion.xcconfig @@ -15,5 +15,5 @@ // // Version -MARKETING_VERSION = 2.2.1 +MARKETING_VERSION = 2.2.2 CURRENT_PROJECT_VERSION = 1 diff --git a/DesignKit/Variants/Colors/Dark/DarkColors.swift b/DesignKit/Variants/Colors/Dark/DarkColors.swift index 8d0b0a0e97..a8a444e215 100644 --- a/DesignKit/Variants/Colors/Dark/DarkColors.swift +++ b/DesignKit/Variants/Colors/Dark/DarkColors.swift @@ -21,7 +21,7 @@ import SwiftUI /// Dark theme colors. public class DarkColors { private static let values = ColorValues( - accent: UIColor(rgb:0xFFFFFF), + accent: UIColor(rgb:0x2F80ED), alert: UIColor(rgb:0xFF4B55), primaryContent: UIColor(rgb:0xFFFFFF), secondaryContent: UIColor(rgb:0xA9B2BC), diff --git a/Riot/Modules/ContextMenu/ActionProviders/AllChatsEditActionProvider.swift b/Riot/Modules/ContextMenu/ActionProviders/AllChatsEditActionProvider.swift index c63b6318fc..25a27d5e6a 100644 --- a/Riot/Modules/ContextMenu/ActionProviders/AllChatsEditActionProvider.swift +++ b/Riot/Modules/ContextMenu/ActionProviders/AllChatsEditActionProvider.swift @@ -58,10 +58,14 @@ class AllChatsEditActionProvider { if rootSpaceCount > 0 { createActions.insert(self.createSpaceAction, at: 0) } - return UIMenu(title: "", children: [ - self.exploreRoomsAction, - UIMenu(title: "", options: .displayInline, children: createActions) - ]) + + // 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: [ diff --git a/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift b/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift index 771d680413..ee58546bd1 100644 --- a/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift +++ b/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift @@ -285,6 +285,8 @@ class AllChatsCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { } self.addMatrixSessionToAllChatsController(userSession.matrixSession) + // Tchap: Add external account management + self.createLeftButtonItem(for: allChatsViewController) } @objc private func userSessionsServiceWillRemoveUserSession(_ notification: Notification) { @@ -355,11 +357,14 @@ class AllChatsCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { var subMenuActions: [UIAction] = [] if BuildSettings.sideMenuShowInviteFriends { - // Tchap: Fix title for invite button. - subMenuActions.append(UIAction(title: TchapL10n.sideMenuActionInviteFriends, image: UIImage(systemName: "square.and.arrow.up.fill")) { [weak self] action in - guard let self = self else { return } - self.showInviteFriends(from: self.avatarMenuButton) - }) + // Tchap: Fix title for invite button, and manage invite users + if let userID = UserSessionsService.shared.mainUserSession?.userId, + !UserService.isExternalUser(for: userID) { + subMenuActions.append(UIAction(title: TchapL10n.sideMenuActionInviteFriends, image: UIImage(systemName: "square.and.arrow.up.fill")) { [weak self] action in + guard let self = self else { return } + self.showInviteFriends(from: self.avatarMenuButton) + }) + } } subMenuActions.append(UIAction(title: VectorL10n.sideMenuActionFeedback, image: UIImage(systemName: "questionmark.circle")) { [weak self] action in @@ -367,11 +372,12 @@ class AllChatsCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { }) actions.append(UIMenu(title: "", options: .displayInline, children: subMenuActions)) - actions.append(UIMenu(title: "", options: .displayInline, children: [ - UIAction(title: VectorL10n.settingsSignOut, image: UIImage(systemName: "rectangle.portrait.and.arrow.right.fill"), attributes: .destructive) { [weak self] action in - self?.signOut() - } - ])) + // Tchap: Hide Disconnect button +// actions.append(UIMenu(title: "", options: .displayInline, children: [ +// UIAction(title: VectorL10n.settingsSignOut, image: UIImage(systemName: "rectangle.portrait.and.arrow.right.fill"), attributes: .destructive) { [weak self] action in +// self?.signOut() +// } +// ])) let menu = UIMenu(options: .displayInline, children: actions) @@ -494,6 +500,27 @@ class AllChatsCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { completion: completion) } + // Tchap: Update room preview for Tchap. + private func showRoomPreview(with publicRoom: MXPublicRoom) { + guard let session = self.currentMatrixSession else { return } + + let roomPreviewCoordinator = RoomPreviewCoordinator(session: session, publicRoom: publicRoom) + self.showRoomPreview(with: roomPreviewCoordinator) + } + + // Tchap: Update room preview for Tchap. + private func showRoomPreview(with coordinator: RoomPreviewCoordinator) { + let roomPreviewCoordinator = coordinator + roomPreviewCoordinator.start() + roomPreviewCoordinator.delegate = self + + self.add(childCoordinator: roomPreviewCoordinator) + + self.showSplitViewDetails(with: roomPreviewCoordinator, stackedOnSplitViewDetail: false) { [weak self] in + self?.remove(childCoordinator: roomPreviewCoordinator) + } + } + private func showRoom(with parameters: RoomCoordinatorParameters, stackOnSplitViewDetail: Bool = false, completion: (() -> Void)? = nil) { @@ -887,12 +914,9 @@ extension AllChatsCoordinator: PublicRoomsViewControllerDelegate { if let room: MXRoom = self.currentMatrixSession?.room(withRoomId: roomID), room.summary.membership == .join { self.showRoom(withId: roomID) - } else if let previewData = RoomPreviewData(publicRoom: publicRoom, andSession: self.currentMatrixSession) { - // Try to preview the unknown room. - self.showRoomPreview(with: previewData) } else { - // This case should never happen. - MXLog.failure("[AllChatsCoordinator] publicRoomsViewController didSelect publicRoom failure !") + // Try to preview the unknown room. + self.showRoomPreview(with: publicRoom) } }) } @@ -1040,3 +1064,18 @@ extension AllChatsCoordinator { return ErrorPresentableImpl(title: errorTitle, message: errorMessage) } } + +// Tchap: Add delegate for Room Preview +// MARK: - RoomPreviewCoordinatorDelegate +extension AllChatsCoordinator: RoomPreviewCoordinatorDelegate { + func roomPreviewCoordinatorDidCancel(_ coordinator: RoomPreviewCoordinatorType) { + self.navigationRouter.popModule(animated: true) + } + + func roomPreviewCoordinator(_ coordinator: RoomPreviewCoordinatorType, + didJoinRoomWithId roomID: String, + onEventId eventId: String?) { + self.navigationRouter.popModule(animated: true) + self.showRoom(withId: roomID, eventId: eventId) + } +} diff --git a/Riot/Modules/Home/AllChats/AllChatsViewController.swift b/Riot/Modules/Home/AllChats/AllChatsViewController.swift index 6ba94e6ae1..13de555cf2 100644 --- a/Riot/Modules/Home/AllChats/AllChatsViewController.swift +++ b/Riot/Modules/Home/AllChats/AllChatsViewController.swift @@ -156,6 +156,8 @@ 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) } @@ -200,6 +202,12 @@ 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?) { @@ -501,7 +509,7 @@ class AllChatsViewController: HomeViewController { private func updateUI() { let currentSpace = self.dataSource?.currentSpace - self.title = currentSpace?.summary?.displayname ?? VectorL10n.allChatsTitle + self.title = currentSpace?.summary?.displayname ?? VectorL10n.titleHome setupEditOptions() updateToolbar(with: editActionProvider.updateMenu(with: mainSession, parentSpace: currentSpace, completion: { [weak self] menu in @@ -529,7 +537,8 @@ class AllChatsViewController: HomeViewController { // Tchap: Hide space button /*spacesButton,*/ UIBarButtonItem.flexibleSpace(), - UIBarButtonItem(image: Asset.Images.allChatsEditIcon.image, menu: menu) + // Tchap: Update icon + UIBarButtonItem(image: Asset_tchap.Images.homePlus.image, menu: menu) ] } @@ -664,6 +673,23 @@ 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/Riot/Modules/Room/Members/RoomParticipantsViewController.m b/Riot/Modules/Room/Members/RoomParticipantsViewController.m index be8e7ce9fe..dc448bbc09 100644 --- a/Riot/Modules/Room/Members/RoomParticipantsViewController.m +++ b/Riot/Modules/Room/Members/RoomParticipantsViewController.m @@ -85,7 +85,7 @@ - (void)finalizeInit // Setup `MXKViewControllerHandling` properties self.enableBarTintColorStatusChange = NO; self.rageShakeManager = [RageShakeManager sharedManager]; - self.showParticipantCustomAccessoryView = YES; + self.showParticipantCustomAccessoryView = NO; self.showInviteUserFab = YES; } diff --git a/TCHAP_CHANGES.md b/TCHAP_CHANGES.md index a8b3a30d31..e54d724a63 100644 --- a/TCHAP_CHANGES.md +++ b/TCHAP_CHANGES.md @@ -1,3 +1,18 @@ +## Changes in 2.2.2 (2022-12-07) + +🙌 Improvements + +- [Home] Replace "Tous mes chats" screen title by "Accueil" ([#696](https://github.com/tchapgouv/tchap-ios/issues/696)) +- [Home] Tchap customizations ([#699](https://github.com/tchapgouv/tchap-ios/issues/699)) + +🐛 Bugfixes + +- Fix room preview for new AppLayout ([#689](https://github.com/tchapgouv/tchap-ios/pull/689)) +- Fix truncated User Power Level in RoomParticipantsViewController ([#690](https://github.com/tchapgouv/tchap-ios/pull/690)) +- Fix wrong accent color in Dark Mode ([#693](https://github.com/tchapgouv/tchap-ios/issues/693)) +- [AppLayout] Manage Invited users restrictions ([#701](https://github.com/tchapgouv/tchap-ios/issues/701)) + + ## Changes in 2.2.1 (2022-11-21) ✨ Features diff --git a/Tchap/Assets/Images.xcassets/Home/Contents.json b/Tchap/Assets/Images.xcassets/Home/Contents.json index da4a164c91..73c00596a7 100644 --- a/Tchap/Assets/Images.xcassets/Home/Contents.json +++ b/Tchap/Assets/Images.xcassets/Home/Contents.json @@ -1,6 +1,6 @@ { "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Tchap/Assets/Images.xcassets/Home/home_plus.imageset/Contents.json b/Tchap/Assets/Images.xcassets/Home/home_plus.imageset/Contents.json new file mode 100644 index 0000000000..6d1115bb3a --- /dev/null +++ b/Tchap/Assets/Images.xcassets/Home/home_plus.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "home_plus.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Tchap/Assets/Images.xcassets/Home/home_plus.imageset/home_plus.svg b/Tchap/Assets/Images.xcassets/Home/home_plus.imageset/home_plus.svg new file mode 100644 index 0000000000..dca3c9202d --- /dev/null +++ b/Tchap/Assets/Images.xcassets/Home/home_plus.imageset/home_plus.svg @@ -0,0 +1,3 @@ + + + diff --git a/Tchap/Generated/Images.swift b/Tchap/Generated/Images.swift index 36becd2382..64838c426f 100644 --- a/Tchap/Generated/Images.swift +++ b/Tchap/Generated/Images.swift @@ -23,6 +23,7 @@ internal class Asset_tchap: NSObject { internal static let notificationsOff = ImageAsset(name: "notificationsOff") internal static let pin = ImageAsset(name: "pin") internal static let unpin = ImageAsset(name: "unpin") + internal static let homePlus = ImageAsset(name: "home_plus") internal static let iconPageFavoris = ImageAsset(name: "icon_page_favoris") internal static let closeBanner = ImageAsset(name: "close_banner") internal static let importFilesButton = ImageAsset(name: "import_files_button") diff --git a/towncrier.toml b/towncrier.toml index f0fbb3df92..d7b845fed3 100644 --- a/towncrier.toml +++ b/towncrier.toml @@ -1,6 +1,6 @@ [tool.towncrier] name = "Changes in" -version = "2.2.1" +version = "2.2.2" filename = "TCHAP_CHANGES.md" directory = "changelog.d" template = "changelog.d/_template.md.jinja"