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

Merge branch 'yinhe-live-1212' of...

Merge branch 'yinhe-live-1212' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into yinhe-live-1212
parents 6cc70508 ffcf182f
...@@ -182,6 +182,7 @@ ...@@ -182,6 +182,7 @@
0431F8822C942D88003B84F4 /* YHResignMaterialNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0431F8812C942D88003B84F4 /* YHResignMaterialNameCell.swift */; }; 0431F8822C942D88003B84F4 /* YHResignMaterialNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0431F8812C942D88003B84F4 /* YHResignMaterialNameCell.swift */; };
0431F8842C9579F7003B84F4 /* YHResignTemplateSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0431F8832C9579F7003B84F4 /* YHResignTemplateSheetView.swift */; }; 0431F8842C9579F7003B84F4 /* YHResignTemplateSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0431F8832C9579F7003B84F4 /* YHResignTemplateSheetView.swift */; };
04336E252D0817ED0070A71B /* YHLivePeopleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04336E242D0817ED0070A71B /* YHLivePeopleModel.swift */; }; 04336E252D0817ED0070A71B /* YHLivePeopleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04336E242D0817ED0070A71B /* YHLivePeopleModel.swift */; };
04336E272D0838100070A71B /* YHBlurredAvatarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04336E262D0838100070A71B /* YHBlurredAvatarView.swift */; };
04358E042C77322700811928 /* YHHaveGrabbedNumberListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04358E032C77322700811928 /* YHHaveGrabbedNumberListCell.swift */; }; 04358E042C77322700811928 /* YHHaveGrabbedNumberListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04358E032C77322700811928 /* YHHaveGrabbedNumberListCell.swift */; };
04358E062C77334B00811928 /* YHHaveGrabbedNumberInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04358E052C77334B00811928 /* YHHaveGrabbedNumberInfoView.swift */; }; 04358E062C77334B00811928 /* YHHaveGrabbedNumberInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04358E052C77334B00811928 /* YHHaveGrabbedNumberInfoView.swift */; };
04358E082C77657000811928 /* YHReAppointViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04358E072C77657000811928 /* YHReAppointViewController.swift */; }; 04358E082C77657000811928 /* YHReAppointViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04358E072C77657000811928 /* YHReAppointViewController.swift */; };
...@@ -1297,6 +1298,7 @@ ...@@ -1297,6 +1298,7 @@
0431F8812C942D88003B84F4 /* YHResignMaterialNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignMaterialNameCell.swift; sourceTree = "<group>"; }; 0431F8812C942D88003B84F4 /* YHResignMaterialNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignMaterialNameCell.swift; sourceTree = "<group>"; };
0431F8832C9579F7003B84F4 /* YHResignTemplateSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignTemplateSheetView.swift; sourceTree = "<group>"; }; 0431F8832C9579F7003B84F4 /* YHResignTemplateSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHResignTemplateSheetView.swift; sourceTree = "<group>"; };
04336E242D0817ED0070A71B /* YHLivePeopleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLivePeopleModel.swift; sourceTree = "<group>"; }; 04336E242D0817ED0070A71B /* YHLivePeopleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHLivePeopleModel.swift; sourceTree = "<group>"; };
04336E262D0838100070A71B /* YHBlurredAvatarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBlurredAvatarView.swift; sourceTree = "<group>"; };
04358E032C77322700811928 /* YHHaveGrabbedNumberListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHaveGrabbedNumberListCell.swift; sourceTree = "<group>"; }; 04358E032C77322700811928 /* YHHaveGrabbedNumberListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHaveGrabbedNumberListCell.swift; sourceTree = "<group>"; };
04358E052C77334B00811928 /* YHHaveGrabbedNumberInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHaveGrabbedNumberInfoView.swift; sourceTree = "<group>"; }; 04358E052C77334B00811928 /* YHHaveGrabbedNumberInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHaveGrabbedNumberInfoView.swift; sourceTree = "<group>"; };
04358E072C77657000811928 /* YHReAppointViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHReAppointViewController.swift; sourceTree = "<group>"; }; 04358E072C77657000811928 /* YHReAppointViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHReAppointViewController.swift; sourceTree = "<group>"; };
...@@ -3081,6 +3083,7 @@ ...@@ -3081,6 +3083,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04564D462CF3851D004456E4 /* YHPlayerControlView.swift */, 04564D462CF3851D004456E4 /* YHPlayerControlView.swift */,
04336E262D0838100070A71B /* YHBlurredAvatarView.swift */,
04564D4C2CF38D16004456E4 /* YHLiveMessageCell.swift */, 04564D4C2CF38D16004456E4 /* YHLiveMessageCell.swift */,
04564D4E2CF38E20004456E4 /* YHLiveMessageListView.swift */, 04564D4E2CF38E20004456E4 /* YHLiveMessageListView.swift */,
04564D622CF60222004456E4 /* YHGradientView.swift */, 04564D622CF60222004456E4 /* YHGradientView.swift */,
...@@ -6806,6 +6809,7 @@ ...@@ -6806,6 +6809,7 @@
044F39362CB6574D007CA277 /* YHVisaRenewalGuideHeaderCell.swift in Sources */, 044F39362CB6574D007CA277 /* YHVisaRenewalGuideHeaderCell.swift in Sources */,
04C85DE92C36BF49008B20D6 /* YHMyFileListFooterView.swift in Sources */, 04C85DE92C36BF49008B20D6 /* YHMyFileListFooterView.swift in Sources */,
045EEEA62B9F171A0022A143 /* YHCompanySelectViewController.swift in Sources */, 045EEEA62B9F171A0022A143 /* YHCompanySelectViewController.swift in Sources */,
04336E272D0838100070A71B /* YHBlurredAvatarView.swift in Sources */,
0425E6462BA9678E00A5E763 /* YHSchemeHeadTotalScoreView.swift in Sources */, 0425E6462BA9678E00A5E763 /* YHSchemeHeadTotalScoreView.swift in Sources */,
044D0C0F2C2287C500C5CF5E /* YHEditViewModel.swift in Sources */, 044D0C0F2C2287C500C5CF5E /* YHEditViewModel.swift in Sources */,
045EEEA92B9F171A0022A143 /* YHWorkExperienceListViewController.swift in Sources */, 045EEEA92B9F171A0022A143 /* YHWorkExperienceListViewController.swift in Sources */,
...@@ -7204,7 +7208,7 @@ ...@@ -7204,7 +7208,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyTestEnv.entitlements; CODE_SIGN_ENTITLEMENTS = galaxy/galaxyTestEnv.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14; CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
...@@ -7346,7 +7350,7 @@ ...@@ -7346,7 +7350,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements; CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14; CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
...@@ -7551,7 +7555,7 @@ ...@@ -7551,7 +7555,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyDebug.entitlements; CODE_SIGN_ENTITLEMENTS = galaxy/galaxyDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14; CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
...@@ -7598,7 +7602,7 @@ ...@@ -7598,7 +7602,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements; CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14; CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
......
...@@ -121,8 +121,8 @@ class YHAIMainChatViewController: YHBaseViewController { ...@@ -121,8 +121,8 @@ class YHAIMainChatViewController: YHBaseViewController {
DispatchQueue.main.asyncAfter(deadline: .now()+0.5) { DispatchQueue.main.asyncAfter(deadline: .now()+0.5) {
if isNeedAccurate { if isNeedAccurate {
self.tableView.setContentOffset(.zero, animated: true) // self.tableView.setContentOffset(.zero, animated: true)
self.tableView.setContentOffset(CGPointMake(0, 90000), animated: true) // self.tableView.setContentOffset(CGPointMake(0, 90000), animated: true)
} }
...@@ -151,12 +151,18 @@ class YHAIMainChatViewController: YHBaseViewController { ...@@ -151,12 +151,18 @@ class YHAIMainChatViewController: YHBaseViewController {
self.manager.requestAI(botId: self.robotId, conversationId: self.conversationId, question:text) { self.manager.requestAI(botId: self.robotId, conversationId: self.conversationId, question:text) {
[weak self] res, done in [weak self] res, done in
guard let self = self else { return } guard let self = self else { return }
self.chatConfig.handleReceiveMessage(res, done, &messages)
if done { DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
print("RESPONSE-DONE") [weak self] in
self.bottomInputView.status = self.bottomInputView.textView.text.isEmpty ? .disableSend : .enableSend guard let self = self else { return }
self.chatConfig.handleReceiveMessage(res, done, &messages)
if done {
print("RESPONSE-DONE")
self.bottomInputView.status = self.bottomInputView.textView.text.isEmpty ? .disableSend : .enableSend
}
self.reloadAndScrollToBottom(forceScrollToBottom)
} }
self.reloadAndScrollToBottom(forceScrollToBottom)
} }
} }
} }
......
...@@ -92,6 +92,7 @@ class YHAIRequestManager: NSObject { ...@@ -92,6 +92,7 @@ class YHAIRequestManager: NSObject {
switch result { switch result {
case let .success(string): case let .success(string):
print(string) print(string)
self.handle(dataString: string) { self.handle(dataString: string) {
response, done in response, done in
callback?(response, done) callback?(response, done)
...@@ -228,36 +229,36 @@ class YHAIRequestManager: NSObject { ...@@ -228,36 +229,36 @@ class YHAIRequestManager: NSObject {
self.uuid = UUID().uuidString + NSDate().timeIntervalSince1970.description self.uuid = UUID().uuidString + NSDate().timeIntervalSince1970.description
} }
if receiveMessage.isUserfulMessage() {
completion?(receiveMessage, sessionDone)
}
// if receiveMessage.isUserfulMessage() { // if receiveMessage.isUserfulMessage() {
// if receiveMessage.isNeedSpiceMessage() { // completion?(receiveMessage, sessionDone)
// let text = receiveMessage.body.contentText
// if text.count > 1 {
// let textArray = Array(text)
// for (index, character) in textArray.enumerated() {
// let msg = receiveMessage.copy() as! YHAIChatMessage
// msg.body.contentText = String(character)
// msg.body.status = ""
// if index == textArray.count-1 {
// msg.body.status = receiveMessage.body.status
// }
// msg.updateBodyToData()
// printLog("AAAAA- \(msg)")
// sessionDone = receiveMessage.body.isDone()
// completion?(msg, sessionDone)
// }
//
// } else {
// completion?(receiveMessage, sessionDone)
// }
//
// } else {
// completion?(receiveMessage, sessionDone)
// }
// } // }
if receiveMessage.isUserfulMessage() {
if receiveMessage.isNeedSpiceMessage() {
let text = receiveMessage.body.contentText
if text.count > 1 {
let textArray = Array(text)
for (index, character) in textArray.enumerated() {
let msg = receiveMessage.copy() as! YHAIChatMessage
msg.body.contentText = String(character)
msg.body.status = ""
if index == textArray.count-1 {
msg.body.status = receiveMessage.body.status
}
msg.updateBodyToData()
printLog("AAAAA- \(msg)")
sessionDone = receiveMessage.body.isDone()
completion?(msg, sessionDone)
}
} else {
completion?(receiveMessage, sessionDone)
}
} else {
completion?(receiveMessage, sessionDone)
}
}
} }
} // arr 结束 } // arr 结束
} }
......
...@@ -196,11 +196,10 @@ class YHAIRobotChatViewController: YHBaseViewController { ...@@ -196,11 +196,10 @@ class YHAIRobotChatViewController: YHBaseViewController {
DispatchQueue.main.asyncAfter(deadline: .now()+0.5) { DispatchQueue.main.asyncAfter(deadline: .now()+0.5) {
if isNeedAccurate { if isNeedAccurate {
self.tableView.setContentOffset(.zero, animated: true) // self.tableView.setContentOffset(.zero, animated: true)
self.tableView.setContentOffset(CGPointMake(0, 90000), animated: true) // self.tableView.setContentOffset(CGPointMake(0, 90000), animated: true)
} }
// 使用 performBatchUpdates 来确保所有布局更新完成后再滚动 // 使用 performBatchUpdates 来确保所有布局更新完成后再滚动
self.tableView.performBatchUpdates(nil) { _ in self.tableView.performBatchUpdates(nil) { _ in
// 在布局更新完成后执行滚动 // 在布局更新完成后执行滚动
...@@ -224,12 +223,18 @@ class YHAIRobotChatViewController: YHBaseViewController { ...@@ -224,12 +223,18 @@ class YHAIRobotChatViewController: YHBaseViewController {
self.manager.requestAI(botId: self.robotId, conversationId: self.conversationId, question:text) { self.manager.requestAI(botId: self.robotId, conversationId: self.conversationId, question:text) {
[weak self] res, done in [weak self] res, done in
guard let self = self else { return } guard let self = self else { return }
self.chatConfig.handleReceiveMessage(res, done, &messages)
if done { DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
print("RESPONSE-DONE") [weak self] in
self.bottomInputView.status = self.bottomInputView.textView.text.isEmpty ? .disableSend : .enableSend guard let self = self else { return }
self.chatConfig.handleReceiveMessage(res, done, &messages)
if done {
print("RESPONSE-DONE")
self.bottomInputView.status = self.bottomInputView.textView.text.isEmpty ? .disableSend : .enableSend
}
self.reloadAndScrollToBottom(forceScrollToBottom)
} }
self.reloadAndScrollToBottom(forceScrollToBottom)
} }
} }
......
...@@ -80,6 +80,17 @@ class YHLivePlayerViewController: YHBasePlayerViewController { ...@@ -80,6 +80,17 @@ class YHLivePlayerViewController: YHBasePlayerViewController {
label.alpha = 0.7 label.alpha = 0.7
return label return label
}() }()
private lazy var bottomImageView: UIImageView = {
let imageView = UIImageView(image: UIImage(named: "live_player_bg"))
return imageView
}()
// private lazy var blurredView: YHBlurredAvatarView = {
// let view = YHBlurredAvatarView()
// view.isHidden = true
// return view
// }()
// MARK: - Initialization // MARK: - Initialization
...@@ -147,9 +158,13 @@ class YHLivePlayerViewController: YHBasePlayerViewController { ...@@ -147,9 +158,13 @@ class YHLivePlayerViewController: YHBasePlayerViewController {
// MARK: - Setup // MARK: - Setup
private func setupLiveUI() { private func setupLiveUI() {
playerView.addSubview(bottomImageView)
//playerView.addSubview(blurredView)
containerView.addSubview(bottomInputBar) containerView.addSubview(bottomInputBar)
containerView.addSubview(messageListView) containerView.addSubview(messageListView)
bottomImageView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
bottomInputBar.snp.makeConstraints { make in bottomInputBar.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview() make.left.right.bottom.equalToSuperview()
make.top.equalTo(view.safeAreaLayoutGuide.snp.bottom) make.top.equalTo(view.safeAreaLayoutGuide.snp.bottom)
...@@ -234,16 +249,20 @@ class YHLivePlayerViewController: YHBasePlayerViewController { ...@@ -234,16 +249,20 @@ class YHLivePlayerViewController: YHBasePlayerViewController {
nickname: liveDetail.account, nickname: liveDetail.account,
count: liveDetail.access_num count: liveDetail.access_num
) )
// blurredView.setImageUrl(liveDetail.avatar) { [weak self] flag in
// self?.bottomImageView.isHidden = flag
// self?.blurredView.isHidden = !flag
// }
playbackInfo?.channelId = liveDetail.rtmp_channel playbackInfo?.channelId = liveDetail.rtmp_channel
playbackInfo?.token = liveDetail.token playbackInfo?.token = liveDetail.token
playbackInfo?.title = liveDetail.live_title playbackInfo?.title = liveDetail.live_title
playbackInfo?.uid = UInt(liveDetail.user_id) playbackInfo?.uid = UInt(liveDetail.user_id)
messageListView.anchorName = liveDetail.hxNickname messageListView.anchorName = liveDetail.hxNickname
if needJoinLiveChannel { if needJoinLiveChannel {
if !liveDetail.rtmp_channel.isEmpty, !liveDetail.token.isEmpty, let uid = playbackInfo?.uid, let player = player { if !liveDetail.rtmp_channel.isEmpty, !liveDetail.token.isEmpty, let uid = playbackInfo?.uid, let player = player, !player.isJoined {
YHPlayerManager.shared.joinChannel(for: player, token: liveDetail.token, channelId: liveDetail.rtmp_channel, uid: uid, view: playerView, defaultMuted: false) YHPlayerManager.shared.joinChannel(for: player, token: liveDetail.token, channelId: liveDetail.rtmp_channel, uid: uid, view: playerView, defaultMuted: false)
} else if currentPlayingURL == nil, !liveDetail.pullUrl.isEmpty {
play(url: liveDetail.pullUrl) // 如果没有预设URL,使用接口返回的URL播放
} }
} }
// 如果没有预设roomId,使用接口返回的roomId // 如果没有预设roomId,使用接口返回的roomId
......
...@@ -348,12 +348,12 @@ class YHPlayerManager: NSObject { ...@@ -348,12 +348,12 @@ class YHPlayerManager: NSObject {
if let url = playbackInfo.url { if let url = playbackInfo.url {
player.play(url: url, title: playbackInfo.title, view: playerVC.playerView) player.play(url: url, title: playbackInfo.title, view: playerVC.playerView)
} }
if let lastNav = lastNav, let lastVodVC = lastVodVC { if let lastNav = lastNav, lastVodVC != nil {
lastNav.viewControllers.removeAll() lastNav.viewControllers.removeAll()
var viewControllers = lastNav.viewControllers var viewControllers = lastNav.viewControllers
viewControllers.append(playerVC) viewControllers.append(playerVC)
lastNav.setViewControllers(viewControllers, animated: true) lastNav.setViewControllers(viewControllers, animated: true)
} else if let lastNav = lastNav, let lastLiveVC = lastLiveVC { } else if let lastNav = lastNav, lastLiveVC != nil {
lastNav.pushViewController(playerVC, animated: true) lastNav.pushViewController(playerVC, animated: true)
} else { } else {
present(navVC, from: sourceView) present(navVC, from: sourceView)
...@@ -429,16 +429,14 @@ class YHPlayerManager: NSObject { ...@@ -429,16 +429,14 @@ class YHPlayerManager: NSObject {
} else { } else {
joinChannel(for: player, token: token, channelId: channelId, uid: uid, view: playerVC.playerView) joinChannel(for: player, token: token, channelId: channelId, uid: uid, view: playerVC.playerView)
} }
} else if let url = playbackInfo.url, url.count > 0 {
player.play(url: url, title: playbackInfo.title, view: playerVC.playerView)
} }
if let lastNav = lastNav, let lastLiveVC = lastLiveVC { if let lastNav = lastNav, lastLiveVC != nil {
lastNav.viewControllers.removeAll() lastNav.viewControllers.removeAll()
var viewControllers = lastNav.viewControllers var viewControllers = lastNav.viewControllers
viewControllers.append(playerVC) viewControllers.append(playerVC)
lastNav.setViewControllers(viewControllers, animated: true) lastNav.setViewControllers(viewControllers, animated: true)
} else if let lastNav = lastNav, let lastVodVC = lastVodVC { } else if let lastNav = lastNav, lastVodVC != nil {
lastNav.pushViewController(playerVC, animated: true) lastNav.pushViewController(playerVC, animated: true)
} else { } else {
present(navVC, from: sourceView) present(navVC, from: sourceView)
......
//
// YHBlurredAvatarView.swift
// galaxy
//
// Created by alexzzw on 2024/12/10.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import VisualEffectView
import UIKit
class YHBlurredAvatarView: UIView {
private let imageView: UIImageView = {
let iv = UIImageView()
iv.contentMode = .scaleAspectFill
iv.clipsToBounds = true
return iv
}()
private lazy var effectView: VisualEffectView = {
let visualEffectView = VisualEffectView()
visualEffectView.colorTint = UIColor(hex: 0xAFAFAF).withAlphaComponent(0.15)
visualEffectView.blurRadius = 16
visualEffectView.scale = 1
return visualEffectView
}()
override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
setupUI()
}
private func setupUI() {
// 添加图片视图
addSubview(imageView)
imageView.frame = bounds
// 添加模糊视图
addSubview(effectView)
effectView.frame = bounds
imageView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
effectView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
}
func setImage(_ image: UIImage?) {
imageView.image = image
}
func setImageUrl(_ url: String, completion: @escaping (Bool) -> Void) {
imageView.kf.setImage(with: URL(string: url)) { [weak self] result in
guard let self = self else {
completion(false)
return
}
switch result {
case .success(let value):
self.imageView.image = value.image
completion(true)
case .failure(_):
completion(false)
}
}
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "live_player_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "live_player_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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