Commit f7fe092a authored by pete谢兆麟's avatar pete谢兆麟

parent 88721a74
......@@ -181,154 +181,157 @@ extension YHHomeBannerView: FSPagerViewDataSource, FSPagerViewDelegate {
return
}
YHAnalytics.track("APP_Home_Banners")
switch model.skip_type {
case 1: // 跳转H5
if model.skip_url.isEmpty == false {
} else {
YHHUD.flash(message: "error:skip_url不能为空")
return
}
// 1.增加app token
var url = ""
if YHLoginManager.shared.isLogin() {
let token = YHLoginManager.shared.h5Token
url = model.skip_url + "?param=" + token
let urlHasParam = String.hasQueryParameters(urlString: model.skip_url)
if urlHasParam {
url = model.skip_url + "&param=" + token
}
} else {
url = model.skip_url
}
// 2.增加导航栏高度
var tUrl = url
if !url.contains("navigationH=") {
tUrl = url + "?navigationH=\(k_Height_NavigationtBarAndStatuBar)"
if url.contains("?") {
tUrl = url + "&navigationH=\(k_Height_NavigationtBarAndStatuBar)"
}
}
let vc = YHH5WebViewVC()
vc.url = tUrl
if model.is_double_11_flag {
vc.isHideNavigationBar = false
}
if let tag = model.is_full_screen {
vc.isFullScreenFlag = tag
}
if model.is_share_h5_flag {
if let tModel = model.addtition_param {
if !tModel.ShareH5Url.isEmpty {
vc.isShowRightShareItemFlag = true
vc.shareH5Title = tModel.ShareH5Title
vc.shareH5Describe = tModel.ShareH5Describe
vc.shareUrlFromOutside = tModel.ShareH5Url
}
}
}
self.parentViewController?.navigationController?.pushViewController(vc)
case 2: // 跳转APP内Tab
if model.skip_url.isEmpty == false {
} else {
YHHUD.flash(message: "error:skip_url不能为空")
return
}
goAppTab(tabBarName: model.skip_url)
case 3:// 3-跳转资讯页
if model.skip_url.isEmpty == false {
} else {
YHHUD.flash(message: "error:skip_url不能为空")
return
}
let vc = YHHomeWebViewController()
vc.url = model.skip_url
self.parentViewController?.navigationController?.pushViewController(vc)
case 100:// 直播
// 文哥
// media_type 投放类型:1 图片,2 直播
// live_id 直播ID
// live_status 直播状态 1:直播中 2:未直播 0:未知状态 3:结束直播
// live_type 播放类型:1 展示最新直播,2指定直播,3 指定录播
// live_pull_url 直播拉流链接
// video_url 视频链接
// recorded_video_id 录播id token: String? = nil, channelId
if !checkLogin() {
return
}
let cell: YHHomeBannerCollectionViewCell? = pagerView.cellForItem(at: index) as? YHHomeBannerCollectionViewCell
// if let player = YHPlayerManager.shared.getPlayer(.secondary) {
// YHPlayerManager.shared.leaveChannel(for: player)
// player.clearPlayerView()
let vc = YHVoiceDemo()
UIViewController.current?.navigationController?.pushViewController(vc)
// switch model.skip_type {
// case 1: // 跳转H5
// if model.skip_url.isEmpty == false {
// } else {
// YHHUD.flash(message: "error:skip_url不能为空")
// return
// }
//
// // 1.增加app token
// var url = ""
// if YHLoginManager.shared.isLogin() {
// let token = YHLoginManager.shared.h5Token
// url = model.skip_url + "?param=" + token
// let urlHasParam = String.hasQueryParameters(urlString: model.skip_url)
// if urlHasParam {
// url = model.skip_url + "&param=" + token
// }
// } else {
// url = model.skip_url
// }
//
// // 2.增加导航栏高度
// var tUrl = url
// if !url.contains("navigationH=") {
// tUrl = url + "?navigationH=\(k_Height_NavigationtBarAndStatuBar)"
// if url.contains("?") {
// tUrl = url + "&navigationH=\(k_Height_NavigationtBarAndStatuBar)"
// }
// }
//
// let vc = YHH5WebViewVC()
// vc.url = tUrl
// if model.is_double_11_flag {
// vc.isHideNavigationBar = false
// }
//
// if let tag = model.is_full_screen {
// vc.isFullScreenFlag = tag
// }
//
// if model.is_share_h5_flag {
// if let tModel = model.addtition_param {
// if !tModel.ShareH5Url.isEmpty {
// vc.isShowRightShareItemFlag = true
// vc.shareH5Title = tModel.ShareH5Title
// vc.shareH5Describe = tModel.ShareH5Describe
// vc.shareUrlFromOutside = tModel.ShareH5Url
// }
// }
// }
// self.parentViewController?.navigationController?.pushViewController(vc)
//
// case 2: // 跳转APP内Tab
// if model.skip_url.isEmpty == false {
// } else {
// YHHUD.flash(message: "error:skip_url不能为空")
// return
// }
// goAppTab(tabBarName: model.skip_url)
// case 3:// 3-跳转资讯页
// if model.skip_url.isEmpty == false {
// } else {
// YHHUD.flash(message: "error:skip_url不能为空")
// return
// }
// let vc = YHHomeWebViewController()
// vc.url = model.skip_url
// self.parentViewController?.navigationController?.pushViewController(vc)
// case 100:// 直播
// // 文哥
// // media_type 投放类型:1 图片,2 直播
// // live_id 直播ID
// // live_status 直播状态 1:直播中 2:未直播 0:未知状态 3:结束直播
// // live_type 播放类型:1 展示最新直播,2指定直播,3 指定录播
// // live_pull_url 直播拉流链接
// // video_url 视频链接
// // recorded_video_id 录播id token: String? = nil, channelId
// if !checkLogin() {
// return
// }
// let cell: YHHomeBannerCollectionViewCell? = pagerView.cellForItem(at: index) as? YHHomeBannerCollectionViewCell
//// if let player = YHPlayerManager.shared.getPlayer(.secondary) {
//// YHPlayerManager.shared.leaveChannel(for: player)
//// player.clearPlayerView()
//// }
// YHHUD.show(.progress(message: "加载中..."))
// viewModel.getLiveStatus(liveId: model.live_id) { liveInfo, _ in
// YHHUD.hide()
// guard let liveInfo = liveInfo else {
// let ctl = YHLiveAppointmentViewController(liveId: model.live_id)
// UIViewController.current?.navigationController?.pushViewController(ctl)
// return
// }
// if liveInfo.status == 2 {
// let ctl = YHLiveAppointmentViewController(liveId: model.live_id)
// UIViewController.current?.navigationController?.pushViewController(ctl)
// } else {
// let playbackInfo = YHPlayerManager.PlaybackInfo(id: model.live_id, url: nil, title: nil, roomId: nil, token: nil, channelId: nil, uid: nil, isLive: true, scene: .fullscreen)
// YHPlayerManager.shared.enterLive(from: cell?.bannerImagV, playbackInfo: playbackInfo)
// }
// }
//
// printLog("跳转直播")
// case 101:// 录播
// printLog("跳转录播")
// if !checkLogin() {
// return
// }
YHHUD.show(.progress(message: "加载中..."))
viewModel.getLiveStatus(liveId: model.live_id) { liveInfo, _ in
YHHUD.hide()
guard let liveInfo = liveInfo else {
let ctl = YHLiveAppointmentViewController(liveId: model.live_id)
UIViewController.current?.navigationController?.pushViewController(ctl)
return
}
if liveInfo.status == 2 {
let ctl = YHLiveAppointmentViewController(liveId: model.live_id)
UIViewController.current?.navigationController?.pushViewController(ctl)
} else {
let playbackInfo = YHPlayerManager.PlaybackInfo(id: model.live_id, url: nil, title: nil, roomId: nil, token: nil, channelId: nil, uid: nil, isLive: true, scene: .fullscreen)
YHPlayerManager.shared.enterLive(from: cell?.bannerImagV, playbackInfo: playbackInfo)
}
}
printLog("跳转直播")
case 101:// 录播
printLog("跳转录播")
if !checkLogin() {
return
}
if let player = YHPlayerManager.shared.getPlayer(.secondary) {
player.stop()
player.clearPlayerView()
}
let cell: YHHomeBannerCollectionViewCell? = pagerView.cellForItem(at: index) as? YHHomeBannerCollectionViewCell
let playbackInfo = YHPlayerManager.PlaybackInfo(id: model.recorded_video_id, url: nil, title: nil, roomId: nil, uid: nil, isLive: false, scene: .fullscreen)
YHPlayerManager.shared.enterVOD(from: cell?.bannerImagV, playbackInfo: playbackInfo)
case 102:// 图片直播
printLog("跳转录播")
if !checkLogin() {
return
}
// if let player = YHPlayerManager.shared.getPlayer(.secondary) {
// YHPlayerManager.shared.leaveChannel(for: player)
// player.stop()
// player.clearPlayerView()
// }
let cell: YHHomeBannerCollectionViewCell? = pagerView.cellForItem(at: index) as? YHHomeBannerCollectionViewCell
YHHUD.show(.progress(message: "加载中..."))
viewModel.getLiveStatus(liveId: model.live_id) { liveInfo, _ in
YHHUD.hide()
guard let liveInfo = liveInfo else {
let ctl = YHLiveAppointmentViewController(liveId: model.live_id)
UIViewController.current?.navigationController?.pushViewController(ctl)
return
}
if liveInfo.status == 2 {
let ctl = YHLiveAppointmentViewController(liveId: model.live_id)
UIViewController.current?.navigationController?.pushViewController(ctl)
} else {
let playbackInfo = YHPlayerManager.PlaybackInfo(id: model.live_id, url: nil, title: nil, roomId: nil, token: nil, channelId: nil, uid: nil, isLive: true, scene: .fullscreen)
YHPlayerManager.shared.enterLive(from: cell?.bannerImagV, playbackInfo: playbackInfo)
}
}
case 0:// 0 不需要跳转
printLog("0 不需要跳转")
default:
YHHUD.flash(message: "不需要处理的类型")
}
YHAnalytics.track("homeBannerClick", properties: ["url": model.img_url, "index": index])
// let cell: YHHomeBannerCollectionViewCell? = pagerView.cellForItem(at: index) as? YHHomeBannerCollectionViewCell
// let playbackInfo = YHPlayerManager.PlaybackInfo(id: model.recorded_video_id, url: nil, title: nil, roomId: nil, uid: nil, isLive: false, scene: .fullscreen)
// YHPlayerManager.shared.enterVOD(from: cell?.bannerImagV, playbackInfo: playbackInfo)
// case 102:// 图片直播
// printLog("跳转录播")
// if !checkLogin() {
// return
// }
//// if let player = YHPlayerManager.shared.getPlayer(.secondary) {
//// YHPlayerManager.shared.leaveChannel(for: player)
//// player.clearPlayerView()
//// }
// let cell: YHHomeBannerCollectionViewCell? = pagerView.cellForItem(at: index) as? YHHomeBannerCollectionViewCell
// YHHUD.show(.progress(message: "加载中..."))
// viewModel.getLiveStatus(liveId: model.live_id) { liveInfo, _ in
// YHHUD.hide()
// guard let liveInfo = liveInfo else {
// let ctl = YHLiveAppointmentViewController(liveId: model.live_id)
// UIViewController.current?.navigationController?.pushViewController(ctl)
// return
// }
// if liveInfo.status == 2 {
// let ctl = YHLiveAppointmentViewController(liveId: model.live_id)
// UIViewController.current?.navigationController?.pushViewController(ctl)
// } else {
// let playbackInfo = YHPlayerManager.PlaybackInfo(id: model.live_id, url: nil, title: nil, roomId: nil, token: nil, channelId: nil, uid: nil, isLive: true, scene: .fullscreen)
// YHPlayerManager.shared.enterLive(from: cell?.bannerImagV, playbackInfo: playbackInfo)
// }
// }
//
// case 0:// 0 不需要跳转
// printLog("0 不需要跳转")
// default:
// YHHUD.flash(message: "不需要处理的类型")
// }
// YHAnalytics.track("homeBannerClick", properties: ["url": model.img_url, "index": index])
}
func pagerViewWillEndDragging(_ pagerView: FSPagerView, targetIndex: Int) {
......
//
// YHVoiceDemo.swift
// galaxy
//
// Created by EDY on 2025/6/4.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHVoiceDemo: YHBaseViewController {
var start: UIButton!
var end: UIButton!
var result: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
}
extension YHVoiceDemo {
func setupUI() {
// let recognizer = NuanceManager()
start = {
let view = UIButton()
view.setTitle("start", for: .normal)
view.setTitleColor(.black, for: .normal)
view.addTarget(self, action: #selector(startClick), for: .touchUpInside)
return view
}()
view.addSubview(start)
start.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.left.equalToSuperview()
make.height.equalTo(44)
make.width.equalTo(KScreenWidth/2)
}
end = {
let view = UIButton()
view.setTitle("end", for: .normal)
view.setTitleColor(.black, for: .normal)
view.addTarget(self, action: #selector(endClick), for: .touchUpInside)
return view
}()
view.addSubview(end)
end.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.right.equalToSuperview()
make.height.equalTo(44)
make.width.equalTo(KScreenWidth/2)
}
result = {
let view = UILabel()
view.text = "demo"
return view
}()
view.addSubview(result)
result.snp.makeConstraints { make in
make.top.equalTo(k_Height_NavigationtBarAndStatuBar + 44)
make.right.left.bottom.equalToSuperview()
}
}
@objc func startClick() {
}
@objc func endClick() {
}
}
......@@ -15,6 +15,7 @@
#import "WXApi.h"
#import "JPUSHService.h"
#import <nuisdk/NeoNui.h>
// iOS10注册APNs所需头文件
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
#import <UserNotifications/UserNotifications.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment