Skip to content

Commit

Permalink
Clean code : remove Tchap specific code or comment unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Buquet committed Oct 12, 2023
1 parent c7cf6e7 commit 52e76b0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 31 deletions.
3 changes: 0 additions & 3 deletions Riot/Modules/Application/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,6 @@ extension AppCoordinator: SplitViewCoordinatorDelegate {
// MARK: - SideMenuCoordinatorDelegate
extension AppCoordinator: SideMenuCoordinatorDelegate {
func sideMenuCoordinator(_ coordinator: SideMenuCoordinatorType, didTapMenuItem menuItem: SideMenuItem, fromSourceView sourceView: UIView) {
if menuItem == .inviteFriends {
self.splitViewCoordinator?.presentInvitePeople()
}
}
}

Expand Down
14 changes: 9 additions & 5 deletions Riot/Modules/Home/AllChats/AllChatsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ class AllChatsCoordinatorParameters {
}

class AllChatsCoordinator: NSObject, SplitViewMasterCoordinatorProtocol {
func presentInvitePeople() {
//
}


// MARK: Properties

// MARK: Private
Expand Down Expand Up @@ -641,6 +636,15 @@ class AllChatsCoordinator: NSObject, SplitViewMasterCoordinatorProtocol {
// return versionCheckCoordinator
// }

private func showInviteFriends(from sourceView: UIView?) {
// Tchap: commented because Tchap now uses Element Direct Message mechanism

// let myUserId = self.parameters.userSessionsService.mainUserSession?.userId ?? ""
//
// let inviteFriendsPresenter = InviteFriendsPresenter()
// inviteFriendsPresenter.present(for: myUserId, from: self.navigationRouter.toPresentable(), sourceView: sourceView, animated: true)
}

private func showBugReport() {
let bugReportViewController = BugReportViewController()

Expand Down
2 changes: 2 additions & 0 deletions Riot/Modules/SideMenu/SideMenuCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ final class SideMenuCoordinator: NSObject, SideMenuCoordinatorType {
}

private func showInviteFriends(from sourceView: UIView?) {
// Tchap: commented because Tchap now uses Element Direct Message mechanism

// let myUserId = self.parameters.userSessionsService.mainUserSession?.userId ?? ""
//
// let inviteFriendsPresenter = InviteFriendsPresenter()
Expand Down
4 changes: 0 additions & 4 deletions Riot/Modules/SplitView/SplitViewCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ final class SplitViewCoordinator: NSObject, SplitViewCoordinatorType {
func showAppStateIndicator(with text: String, icon: UIImage?) {
masterCoordinator?.showAppStateIndicator(with: text, icon: icon)
}

func presentInvitePeople() {
masterCoordinator?.presentInvitePeople()
}

// MARK: - Private methods

Expand Down
4 changes: 0 additions & 4 deletions Riot/Modules/SplitView/SplitViewCoordinatorType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,4 @@ protocol SplitViewCoordinatorType: Coordinator, Presentable {

/// Hide the message related to the application state currently displayed.
func hideAppStateIndicator()

// Tchap: redirect to invite people alert
/// Present invite people alert (with textField)
func presentInvitePeople()
}
4 changes: 0 additions & 4 deletions Riot/Modules/TabBar/SplitViewMasterCoordinatorProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,4 @@ protocol SplitViewMasterCoordinatorProtocol: Coordinator, SplitViewMasterPresent

/// Hide the message related to the application state currently displayed.
func hideAppStateIndicator()

// Tchap: redirect to invite people alert
/// Present invite people alert (with textField)
func presentInvitePeople()
}
18 changes: 7 additions & 11 deletions Riot/Modules/TabBar/TabBarCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,6 @@ final class TabBarCoordinator: NSObject, SplitViewMasterCoordinatorProtocol {
appSateIndicator = nil
}

func presentInvitePeople() {
promptUserToFillAnEmailToInvite { [weak self] email in

}
}

// MARK: - SplitViewMasterPresentable

var selectedNavigationRouter: NavigationRouterType? {
Expand All @@ -260,10 +254,12 @@ final class TabBarCoordinator: NSObject, SplitViewMasterCoordinatorProtocol {
}

private func showInviteFriends(from sourceView: UIView?) {
let myUserId = self.parameters.userSessionsService.mainUserSession?.userId ?? ""

let inviteFriendsPresenter = InviteFriendsPresenter()
inviteFriendsPresenter.present(for: myUserId, from: self.navigationRouter.toPresentable(), sourceView: sourceView, animated: true)
// Tchap: commented because Tchap now uses Element Direct Message mechanism

// let myUserId = self.parameters.userSessionsService.mainUserSession?.userId ?? ""
//
// let inviteFriendsPresenter = InviteFriendsPresenter()
// inviteFriendsPresenter.present(for: myUserId, from: self.navigationRouter.toPresentable(), sourceView: sourceView, animated: true)
}

private func showBugReport() {
Expand Down Expand Up @@ -795,7 +791,7 @@ final class TabBarCoordinator: NSObject, SplitViewMasterCoordinatorProtocol {
var subMenuActions: [UIAction] = []
if BuildSettings.sideMenuShowInviteFriends {
subMenuActions.append(UIAction(title: VectorL10n.inviteTo(AppInfo.current.displayName), image: UIImage(systemName: "envelope")) { [weak self] action in
self?.showInviteFriends(from: nil)
self?.showInviteFriends(from: nil)
})
}

Expand Down

0 comments on commit 52e76b0

Please sign in to comment.