Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

[BUG] Quick reply adds new chat view #2128

Merged
merged 2 commits into from Aug 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions Rocket.Chat/Managers/AppManager.swift
Expand Up @@ -222,7 +222,7 @@ extension AppManager {
extension AppManager {

@discardableResult
static func open(room: Subscription) -> ChatViewController? {
static func open(room: Subscription, animated: Bool = true) -> ChatViewController? {
guard
let appDelegate = UIApplication.shared.delegate as? AppDelegate,
let mainViewController = appDelegate.window?.rootViewController as? MainSplitViewController
Expand All @@ -235,8 +235,8 @@ extension AppManager {
controller.subscription = room

// Close all presenting controllers, modals & pushed
mainViewController.presentedViewController?.dismiss(animated: true, completion: nil)
mainViewController.detailViewController?.presentedViewController?.dismiss(animated: true, completion: nil)
mainViewController.presentedViewController?.dismiss(animated: animated, completion: nil)
mainViewController.detailViewController?.presentedViewController?.dismiss(animated: animated, completion: nil)

let nav = BaseNavigationController(rootViewController: controller)
mainViewController.showDetailViewController(nav, sender: self)
Expand All @@ -247,11 +247,11 @@ extension AppManager {

if let nav = mainViewController.viewControllers.first as? UINavigationController {
// Close all presenting controllers, modals & pushed
nav.presentedViewController?.dismiss(animated: true, completion: nil)
nav.popToRootViewController(animated: true)
nav.presentedViewController?.dismiss(animated: animated, completion: nil)
nav.popToRootViewController(animated: animated)

// Push the new controller to the stack
nav.pushViewController(controller, animated: true)
nav.pushViewController(controller, animated: animated)

return controller
}
Expand Down
5 changes: 3 additions & 2 deletions Rocket.Chat/Managers/PushManager.swift
Expand Up @@ -153,8 +153,9 @@ extension PushManager {
AppManager.changeSelectedServer(index: index)
} else {
if let auth = AuthManager.isAuthenticated() {
if let subscription = Subscription.notificationSubscription(auth: auth) {
AppManager.open(room: subscription)
let openSubscription = MainSplitViewController.chatViewController?.subscription
if let subscription = Subscription.notificationSubscription(auth: auth), subscription != openSubscription {
AppManager.open(room: subscription, animated: false)
}
}
}
Expand Down