修复bug

This commit is contained in:
zjx 2025-06-23 15:04:37 +08:00
parent e8def60d17
commit 3e994dacee
17 changed files with 154 additions and 85 deletions

View File

@ -1,6 +1,6 @@
# Uncomment the next line to define a global platform for your project # Uncomment the next line to define a global platform for your project
#source 'https://github.com/CocoaPods/Specs.git' #source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '15.6' platform :ios, '15.0'
post_install do |installer| post_install do |installer|
installer.pods_project.targets.each do |target| installer.pods_project.targets.each do |target|

View File

@ -1798,7 +1798,7 @@
CODE_SIGN_ENTITLEMENTS = Veloria/Veloria.entitlements; CODE_SIGN_ENTITLEMENTS = Veloria/Veloria.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = 394VH538M8; DEVELOPMENT_TEAM = 394VH538M8;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Veloria/Source/Info.plist; INFOPLIST_FILE = Veloria/Source/Info.plist;
@ -1810,7 +1810,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = ""; INFOPLIST_KEY_UIMainStoryboardFile = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 15.6; IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
@ -1839,7 +1839,7 @@
CODE_SIGN_ENTITLEMENTS = Veloria/Veloria.entitlements; CODE_SIGN_ENTITLEMENTS = Veloria/Veloria.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = 394VH538M8; DEVELOPMENT_TEAM = 394VH538M8;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Veloria/Source/Info.plist; INFOPLIST_FILE = Veloria/Source/Info.plist;
@ -1851,7 +1851,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = ""; INFOPLIST_KEY_UIMainStoryboardFile = "";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 15.6; IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",

View File

@ -55,7 +55,9 @@ class VPTabBarController: UITabBarController {
vp_setup() vp_setup()
self.tabBar.isTranslucent = true self.tabBar.isTranslucent = true
checkUpdates() DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] in
self?.checkUpdates()
}
} }
@ -197,7 +199,7 @@ extension VPTabBarController {
let alert = VPVersionUpdateAlertView(model: model).show() let alert = VPVersionUpdateAlertView(model: model).show()
alert.clickHighlightButton = { [weak self] in alert.clickHighlightButton = { [weak self] in
guard let self = self else { return } guard let _ = self else { return }
guard let url = URL(string: "https://apps.apple.com/app/id6746436168") else { return } guard let url = URL(string: "https://apps.apple.com/app/id6746436168") else { return }
if UIApplication.shared.canOpenURL(url) { if UIApplication.shared.canOpenURL(url) {

View File

@ -15,9 +15,10 @@ class VPWalletAPI {
} }
/// ///
static func requestPayTemplate(completer: ((_ model: VPPayTemplateModel?) -> Void)?) { static func requestPayTemplate(isLoding: Bool = false, completer: ((_ model: VPPayTemplateModel?) -> Void)?) {
var param = VPNetworkParameters(path: "/paySettingsV3") var param = VPNetworkParameters(path: "/paySettingsV3")
param.method = .get param.method = .get
param.isLoding = isLoding
VPNetwork.request(parameters: param) { (response: VPNetworkResponse<VPPayTemplateModel>) in VPNetwork.request(parameters: param) { (response: VPNetworkResponse<VPPayTemplateModel>) in
completer?(response.data) completer?(response.data)

View File

@ -43,10 +43,12 @@ class VPWebViewController: VPViewController {
_setupUI() _setupUI()
showEmptyView()
if let url = urlStr { if let url = urlStr, VPNetworkReachabilityManager.manager.isReachable == true {
self.load(urlString: url) self.load(urlString: url)
} }
} }
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
@ -83,6 +85,20 @@ extension VPWebViewController {
} }
} }
private func showEmptyView() {
if VPNetworkReachabilityManager.manager.isReachable != true {
if emptyView.superview == nil {
view.addSubview(emptyView)
emptyView.snp.makeConstraints { make in
make.left.equalToSuperview()
make.centerX.equalToSuperview()
make.centerY.equalToSuperview().offset(-100)
}
self.webView.isHidden = true
}
}
}
} }
//MARK: -------------- VPWebViewDelegate -------------- //MARK: -------------- VPWebViewDelegate --------------
@ -114,17 +130,7 @@ extension VPWebViewController: VPWebViewDelegate {
VPHUD.dismiss() VPHUD.dismiss()
vpLog(message: error) vpLog(message: error)
if VPNetworkReachabilityManager.manager.isReachable != true { showEmptyView()
if emptyView.superview == nil {
view.addSubview(emptyView)
emptyView.snp.makeConstraints { make in
make.left.equalToSuperview()
make.centerX.equalToSuperview()
make.centerY.equalToSuperview().offset(-100)
}
self.webView.isHidden = true
}
}
} }
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {

View File

@ -223,16 +223,18 @@ extension VPDetailPlayerViewController {
/// ///
private func onRecharge() { private func onRecharge() {
guard let videoInfo = self.viewModel.currentPlayer?.videoInfo else { return } // guard let videoInfo = self.viewModel.currentPlayer?.videoInfo else { return }
let view = VPPlayerRechargeView() self.viewModel.showRechargeView()
view.shortPlayId = videoInfo.short_play_id
view.videoId = videoInfo.short_play_video_id // let view = VPPlayerRechargeView()
view.buyFinishBlock = { [weak self] in // view.shortPlayId = videoInfo.short_play_id
guard let self = self else { return } // view.videoId = videoInfo.short_play_video_id
self.requestDetailData(indexPath: self.viewModel.currentIndexPath) // view.buyFinishBlock = { [weak self] in
} // guard let self = self else { return }
view.present(in: nil) // self.requestDetailData(indexPath: self.viewModel.currentIndexPath)
// }
// view.present(in: nil)
} }
/// ///

View File

@ -383,7 +383,7 @@ extension VPVideoPlayerViewController {
} }
} }
//MARK: -------------- APP -------------- //MARK: -------------- --------------
extension VPVideoPlayerViewController { extension VPVideoPlayerViewController {
@objc func didBecomeActiveNotification() { @objc func didBecomeActiveNotification() {

View File

@ -127,7 +127,8 @@ class VPDetailPlayerControlView: VPVideoPlayerControlView {
button.layer.masksToBounds = true button.layer.masksToBounds = true
button.configurationUpdateHandler = { [weak self] button in button.configurationUpdateHandler = { [weak self] button in
guard let self = self else { return } guard let self = self else { return }
button.configuration?.attributedTitle = AttributedString.createAttributedString(string: self.viewModel?.revolution.toString ?? "", color: .colorFFFFFF(), font: .fontRegular(ofSize: 13)) let revolution = VPVideoRevolutionManager.manager.revolution
button.configuration?.attributedTitle = AttributedString.createAttributedString(string: revolution.toString ?? "", color: .colorFFFFFF(), font: .fontRegular(ofSize: 13))
} }
button.addTarget(self, action: #selector(handleRevolutionButton), for: .touchUpInside) button.addTarget(self, action: #selector(handleRevolutionButton), for: .touchUpInside)
return button return button
@ -217,7 +218,7 @@ extension VPDetailPlayerControlView {
@objc private func handleRevolutionButton() { @objc private func handleRevolutionButton() {
addSubview(revolutionSelectedView) addSubview(revolutionSelectedView)
revolutionSelectedView.currentRevolution = self.viewModel?.revolution revolutionSelectedView.currentRevolution = VPVideoRevolutionManager.manager.revolution
revolutionSelectedView.snp.makeConstraints { make in revolutionSelectedView.snp.makeConstraints { make in
make.edges.equalToSuperview() make.edges.equalToSuperview()

View File

@ -22,6 +22,43 @@ class VPPlayerRechargeView: HWPanModalContentView {
} }
} }
var model: VPPayTemplateModel? {
didSet {
stackView.removeAllArrangedSubview()
if let model = self.model {
if let list = model.list_sub_vip, list.count > 0 {
self.stackView.addArrangedSubview(self.vipView)
self.vipView.dataArr = list
}
if let list = model.list_coins, list.count > 0 {
self.stackView.addArrangedSubview(self.coinsView)
self.coinsView.dataArr = list
}
if self.stackView.arrangedSubviews.count == 1,
let view = self.stackView.arrangedSubviews.first,
view == self.coinsView {
scrollView.snp.updateConstraints { make in
make.top.equalToSuperview().offset(56)
}
} else {
scrollView.snp.updateConstraints { make in
make.top.equalToSuperview().offset(41)
}
}
self.stackView.addArrangedSubview(tipView)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { [weak self] in
self?.panModalSetNeedsLayoutUpdate()
}
}
}
var buyFinishBlock: (() -> Void)? var buyFinishBlock: (() -> Void)?
var vipBuyFinishBlock: (() -> Void)? var vipBuyFinishBlock: (() -> Void)?
@ -144,7 +181,7 @@ class VPPlayerRechargeView: HWPanModalContentView {
updateCoin() updateCoin()
requestRechargeData() // requestRechargeData()
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
@ -275,38 +312,10 @@ extension VPPlayerRechargeView {
VPWalletAPI.requestPayTemplate { [weak self] model in VPWalletAPI.requestPayTemplate { [weak self] model in
guard let self = self else { return } guard let self = self else { return }
stackView.removeAllArrangedSubview() guard let model = model else { return }
self.model = model
if let model = model {
if let list = model.list_sub_vip, list.count > 0 {
self.stackView.addArrangedSubview(self.vipView)
self.vipView.dataArr = list
}
if let list = model.list_coins, list.count > 0 {
self.stackView.addArrangedSubview(self.coinsView)
self.coinsView.dataArr = list
}
if self.stackView.arrangedSubviews.count == 1,
let view = self.stackView.arrangedSubviews.first,
view == self.coinsView {
scrollView.snp.updateConstraints { make in
make.top.equalToSuperview().offset(56)
}
} else {
scrollView.snp.updateConstraints { make in
make.top.equalToSuperview().offset(41)
}
}
self.stackView.addArrangedSubview(tipView)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { [weak self] in
self?.panModalSetNeedsLayoutUpdate()
}
} }
} }

View File

@ -162,6 +162,7 @@ class VPVideoPlayerControlView: UIView {
playIconImageView.image = UIImage(named: "play_icon_01") playIconImageView.image = UIImage(named: "play_icon_01")
hiddenPlayButtonTimer?.invalidate() hiddenPlayButtonTimer?.invalidate()
hiddenPlayButtonTimer = nil hiddenPlayButtonTimer = nil
playButton.isHidden = false
} }
} else { } else {
playButton.isHidden = true playButton.isHidden = true

View File

@ -30,9 +30,6 @@ class VPVideoPlayViewModel: NSObject {
} }
} }
///
lazy var revolution: VPShortModel.VideoRevolution = VPVideoRevolutionManager.manager.revolution
/// ///
func seekToTime(toTime: Int) { func seekToTime(toTime: Int) {
self.currentPlayer?.seekToTime(toTime: toTime) self.currentPlayer?.seekToTime(toTime: toTime)
@ -56,39 +53,58 @@ class VPVideoPlayViewModel: NSObject {
extension VPVideoPlayViewModel { extension VPVideoPlayViewModel {
/// ///
func selectedRevolution(revolution: VPShortModel.VideoRevolution) { func selectedRevolution(revolution: VPShortModel.VideoRevolution) {
guard self.revolution != revolution else { return } guard VPVideoRevolutionManager.manager.revolution != revolution else { return }
let userInfo = VPLoginManager.manager.userInfo let userInfo = VPLoginManager.manager.userInfo
if revolution.needLogin, userInfo?.is_tourist != false, userInfo?.is_vip != true { if revolution.needLogin, userInfo?.is_tourist != false, userInfo?.is_vip != true {
VPLoginManager.manager.openLogin { [weak self] in VPLoginManager.manager.openLogin { [weak self] in
guard let self = self else { return } guard let _ = self else { return }
VPVideoRevolutionManager.manager.setVideoRevolution(revolution: revolution) VPVideoRevolutionManager.manager.setVideoRevolution(revolution: revolution)
self.revolution = VPVideoRevolutionManager.manager.revolution
} }
} else if revolution.needVip, userInfo?.is_vip != true { } else if revolution.needVip, userInfo?.is_vip != true {
guard let videoInfo = self.currentPlayer?.videoInfo else { return } let alert = VPAlertView(title: "veloria_vip_activate_title".localized, subtitle: "veloria_vip_activate_content".localized, icon: UIImage(named: "alert_icon_06"), normalButtonText: "veloria_later".localized, highlightButtonText: "veloria_go".localized).show()
alert.clickHighlightButton = { [weak self] in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {
self?.showRechargeView(revolution: revolution)
}
}
} else {
VPVideoRevolutionManager.manager.setVideoRevolution(revolution: revolution)
}
}
///
func showRechargeView(revolution: VPShortModel.VideoRevolution? = nil) {
guard let videoInfo = self.currentPlayer?.videoInfo else { return }
VPWalletAPI.requestPayTemplate(isLoding: true) { [weak self] model in
guard let self = self else { return }
guard let model = model else { return }
let view = VPPlayerRechargeView() let view = VPPlayerRechargeView()
view.model = model
view.shortPlayId = videoInfo.short_play_id view.shortPlayId = videoInfo.short_play_id
view.videoId = videoInfo.short_play_video_id view.videoId = videoInfo.short_play_video_id
view.buyFinishBlock = { [weak self] in view.buyFinishBlock = { [weak self] in
guard let self = self else { return } guard let self = self else { return }
self.updateDetailDataBlock?(self.currentIndexPath) self.updateDetailDataBlock?(self.currentIndexPath)
} }
view.vipBuyFinishBlock = { [weak self] in if let revolution = revolution {
guard let self = self else { return } view.vipBuyFinishBlock = { [weak self] in
VPVideoRevolutionManager.manager.setVideoRevolution(revolution: revolution) guard let _ = self else { return }
self.revolution = VPVideoRevolutionManager.manager.revolution VPVideoRevolutionManager.manager.setVideoRevolution(revolution: revolution)
}
} }
view.present(in: nil) view.present(in: VPAppTool.keyWindow)
} else {
VPVideoRevolutionManager.manager.setVideoRevolution(revolution: revolution)
self.revolution = VPVideoRevolutionManager.manager.revolution
} }
} }
} }

View File

@ -58,6 +58,8 @@ class VPPlayer: NSObject {
weak var delegate: VPPlayerDelegate? weak var delegate: VPPlayerDelegate?
private(set) lazy var isPlaying = false private(set) lazy var isPlaying = false
///
private(set) lazy var systemPause = false
private(set) lazy var playState: PlayState = .unknown private(set) lazy var playState: PlayState = .unknown
private(set) lazy var loadState: LoadState = .unknown private(set) lazy var loadState: LoadState = .unknown
@ -168,6 +170,7 @@ class VPPlayer: NSObject {
} }
func start() { func start() {
self.systemPause = false
self.isPlaying = true self.isPlaying = true
// if self.interruptionType != .began { // if self.interruptionType != .began {
// } // }
@ -224,7 +227,7 @@ extension VPPlayer {
guard let self = self else { return } guard let self = self else { return }
if playState == .playStatePlaying && !isPlaying { if playState == .playStatePlaying && !isPlaying {
self.pause() self.pause()
} else if playState == .playStatePaused, isPlaying { } else if playState == .playStatePaused, isPlaying, !self.systemPause {
self.start() self.start()
} }
switch playState { switch playState {
@ -255,7 +258,7 @@ extension VPPlayer {
guard let self = self else { return } guard let self = self else { return }
if loadState == .playable && !isPlaying { if loadState == .playable && !isPlaying {
self.pause() self.pause()
} else if loadState == .playable, isPlaying, self.player.playState != .playStatePlaying { } else if loadState == .playable, isPlaying, self.player.playState != .playStatePlaying, !self.systemPause {
self.start() self.start()
} }
@ -281,7 +284,7 @@ extension VPPlayer {
} }
// //
player.playerPlayFailed = { [weak self] (asset, error) in player.playerPlayFailed = { (asset, error) in
vpLog(message: "错误信息====\(error)") vpLog(message: "错误信息====\(error)")
} }
@ -319,15 +322,16 @@ extension VPPlayer {
guard let interruptionType = userInfo[AVAudioSessionInterruptionTypeKey] as? UInt else { return } guard let interruptionType = userInfo[AVAudioSessionInterruptionTypeKey] as? UInt else { return }
self.interruptionType = AVAudioSession.InterruptionType(rawValue: interruptionType) self.interruptionType = AVAudioSession.InterruptionType(rawValue: interruptionType)
if self.interruptionType == .began { if self.interruptionType == .began, self.isPlaying {
self.systemPause = true
self.player.pause() self.player.pause()
} else { } else if self.interruptionType == .ended {
self.systemPause = false
if self.isPlaying { if self.isPlaying {
self.player.play() self.player.play()
} }
} }
vpLog(message: "======音频发生变化\(interruptionType)") vpLog(message: "======音频发生变化\(interruptionType)")
} }
@objc private func routeChangeNotification(sender: Notification) { @objc private func routeChangeNotification(sender: Notification) {

View File

@ -60,6 +60,7 @@ class VPIAPManager {
VPHUD.dismiss() VPHUD.dismiss()
self.waitRestoreModel = nil self.waitRestoreModel = nil
self.completionHandler?(false) self.completionHandler?(false)
VPToast.show(text: "veloria_network".localized)
return return
} }
self.orderCode = orderModel.order_code self.orderCode = orderModel.order_code

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "通知图标-切图图层@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "通知图标-切图图层@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

View File

@ -97,6 +97,10 @@
"veloria_coin_buy_title" = "Top Up | Indefinitely use"; "veloria_coin_buy_title" = "Top Up | Indefinitely use";
"veloria_update_title" = "Discover a new version"; "veloria_update_title" = "Discover a new version";
"veloria_update_now" = "Update Now"; "veloria_update_now" = "Update Now";
"veloria_vip_activate_title" = "Unlock HD VIP Access!";
"veloria_vip_activate_content" = "Activate vip and enjoy HD video privileges.";
"veloria_later" = "Later";
"veloria_go" = "Go";
"veloria_bonus_count_text" = "+## Bonus"; "veloria_bonus_count_text" = "+## Bonus";