Skip to content

Commit

Permalink
Merge branch 'release/tchap_v2.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Loriaux committed Dec 7, 2022
2 parents 71cb2c5 + ee33fef commit ede68bd
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 28 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.1
MARKETING_VERSION = 2.2.2
CURRENT_PROJECT_VERSION = 1
2 changes: 1 addition & 1 deletion DesignKit/Variants/Colors/Dark/DarkColors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
69 changes: 54 additions & 15 deletions Riot/Modules/Home/AllChats/AllChatsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -355,23 +357,27 @@ 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
self?.showBugReport()
})

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)

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
}
})
}
Expand Down Expand Up @@ -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)
}
}
30 changes: 28 additions & 2 deletions Riot/Modules/Home/AllChats/AllChatsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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?) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
]
}

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/Room/Members/RoomParticipantsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
15 changes: 15 additions & 0 deletions TCHAP_CHANGES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions Tchap/Assets/Images.xcassets/Home/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
12 changes: 12 additions & 0 deletions Tchap/Assets/Images.xcassets/Home/home_plus.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "home_plus.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Tchap/Generated/Images.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
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.1"
version = "2.2.2"
filename = "TCHAP_CHANGES.md"
directory = "changelog.d"
template = "changelog.d/_template.md.jinja"
Expand Down

0 comments on commit ede68bd

Please sign in to comment.