Commit 651641088e1d735c613e891a08568220fb1353d5

Authored by “张旭”
1 parent ff7c974c

多次点击跳转多个点播详情页 导航遍历移除,

metaCode/Classes/Main/HuBiLieHomePage/Util/CNLiveDownSlideTool.swift
@@ -381,6 +381,17 @@ CNLiveDownSlideTool.getVodAlbumMsgApi(contentId: albumId){ result, status in @@ -381,6 +381,17 @@ CNLiveDownSlideTool.getVodAlbumMsgApi(contentId: albumId){ result, status in
381 CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: vodModel.contentId) {result,status in //vodModel.contentId result, status in 381 CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: vodModel.contentId) {result,status in //vodModel.contentId result, status in
382 hiddenLoading() 382 hiddenLoading()
383 if status == .success{ 383 if status == .success{
  384 + //在当前堆栈里遍历删除 播放控制器CNLiveTVPlayerViewController
  385 + let tempArray = NSMutableArray.init()
  386 + navigationVC?.viewControllers.forEach({ item in
  387 + if (item.isKind(of: CNLiveTVPlayerViewController.self)) {
  388 + tempArray.remove(item)
  389 + }else{
  390 + tempArray.add(item)
  391 + }
  392 + })
  393 + navigationVC?.viewControllers = tempArray as! [UIViewController]
  394 +
384 let vc = CNLiveTVPlayerViewController() 395 let vc = CNLiveTVPlayerViewController()
385 let url = result as! String 396 let url = result as! String
386 vc.url = URL(string: url) 397 vc.url = URL(string: url)
@@ -444,6 +455,16 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in @@ -444,6 +455,16 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in
444 vc.contentId = contentId 455 vc.contentId = contentId
445 vc.vodAlbumListBaseModel = albumListBaseModel 456 vc.vodAlbumListBaseModel = albumListBaseModel
446 let naviVC = CNLiveBaseNavigationController(rootViewController: vc) 457 let naviVC = CNLiveBaseNavigationController(rootViewController: vc)
  458 + //在当前堆栈里遍历删除 播放控制器CNLiveTVPlayerViewController
  459 + let tempArray = NSMutableArray.init()
  460 + navigationVC?.viewControllers.forEach({ item in
  461 + if (item.isKind(of: CNLiveTVPlayerViewController.self)) {
  462 + tempArray.remove(item)
  463 + }else{
  464 + tempArray.add(item)
  465 + }
  466 + })
  467 + navigationVC?.viewControllers = tempArray as! [UIViewController]
447 navigationVC?.pushViewController(vc, animated: pushAnimated) 468 navigationVC?.pushViewController(vc, animated: pushAnimated)
448 }else{ 469 }else{
449 470
@@ -468,6 +489,18 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in @@ -468,6 +489,18 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in
468 CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: tempVodModel.contentId) { result, status in 489 CNLiveHomePageViewModel.shared.getVodVideoURL(contentId: tempVodModel.contentId) { result, status in
469 hiddenLoading() 490 hiddenLoading()
470 if status == .success{ 491 if status == .success{
  492 + //在当前堆栈里遍历删除 播放控制器CNLiveTVPlayerViewController
  493 + let tempArray = NSMutableArray.init()
  494 + navigationVC?.viewControllers.forEach({ item in
  495 + if (item.isKind(of: CNLiveTVPlayerViewController.self)) {
  496 + tempArray.remove(item)
  497 + }else{
  498 + tempArray.add(item)
  499 + }
  500 + })
  501 + navigationVC?.viewControllers = tempArray as! [UIViewController]
  502 +
  503 +
471 let vc = CNLiveTVPlayerViewController() 504 let vc = CNLiveTVPlayerViewController()
472 let url = result as! String 505 let url = result as! String
473 vc.url = URL(string: url) 506 vc.url = URL(string: url)
@@ -484,6 +517,19 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in @@ -484,6 +517,19 @@ CNLiveDownSlideTool.getVodPlayApi(contentId: contentId){ result, status in
484 517
485 } 518 }
486 } 519 }
  520 +
  521 + func removeTVPlayerViewController(navigationVC:UINavigationController?){
  522 + //在当前堆栈里遍历删除 播放控制器CNLiveTVPlayerViewController
  523 + let tempArray = NSMutableArray.init()
  524 + navigationVC?.viewControllers.forEach({ item in
  525 + if (item.isKind(of: CNLiveTVPlayerViewController.self)) {
  526 + tempArray.remove(item)
  527 + }else{
  528 + tempArray.add(item)
  529 + }
  530 + })
  531 + navigationVC?.viewControllers = tempArray as! [UIViewController]
  532 + }
487 } 533 }
488 534
489 535