|
|
@@ -18,6 +18,9 @@ extension UIView {
|
|
|
navigationController.popToViewController(liveVC, animated: true)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ let index = navigationController.viewControllers.firstIndex(where: { $0 is LNRoomViewController })
|
|
|
+
|
|
|
showLoading()
|
|
|
LNRoomManager.shared.leaveRoom { success in
|
|
|
guard success else {
|
|
|
@@ -27,7 +30,7 @@ extension UIView {
|
|
|
LNRoomManager.shared.joinRoom(roomId: id) { roomId in
|
|
|
dismissLoading()
|
|
|
guard let roomId else { return }
|
|
|
- if let index = navigationController.viewControllers.firstIndex(where: { $0 is LNRoomViewController }) {
|
|
|
+ if let index {
|
|
|
var viewControllers = Array(navigationController.viewControllers[0..<index])
|
|
|
viewControllers.append(LNRoomViewController(roomId))
|
|
|
navigationController.setViewControllers(viewControllers, animated: true)
|
|
|
@@ -70,6 +73,8 @@ extension LNRoomViewController: LNRoomViewModelNotify {
|
|
|
func onRoomClosed() {
|
|
|
if view.window != nil {
|
|
|
navigationController?.popViewController(animated: true)
|
|
|
+ } else if let index = navigationController?.viewControllers.firstIndex(of: self) {
|
|
|
+ navigationController?.viewControllers.remove(at: index)
|
|
|
}
|
|
|
}
|
|
|
}
|