diff --git a/MoviaBox/Class/Mine/Controller/SPDeleteAccountViewController.swift b/MoviaBox/Class/Mine/Controller/SPDeleteAccountViewController.swift index 414dcb6..fcf7102 100644 --- a/MoviaBox/Class/Mine/Controller/SPDeleteAccountViewController.swift +++ b/MoviaBox/Class/Mine/Controller/SPDeleteAccountViewController.swift @@ -84,6 +84,8 @@ class SPDeleteAccountViewController: SPViewController { button.setImage(UIImage(named: "check_icon_01_selected"), for: .selected) button.setImage(UIImage(named: "check_icon_01_selected"), for: [.selected, .highlighted]) button.addTarget(self, action: #selector(handleCheckButton), for: .touchUpInside) + button.setContentHuggingPriority(.required, for: .horizontal) + button.setContentCompressionResistancePriority(.required, for: .horizontal) return button }() @@ -177,7 +179,7 @@ extension SPDeleteAccountViewController { make.top.equalToSuperview().offset(10) } - iconTextLabel.snp_makeConstraints { make in + iconTextLabel.snp.makeConstraints { make in make.centerX.equalToSuperview() make.top.equalTo(iconImageView.snp.bottom).offset(12) } diff --git a/MoviaBox/Class/Mine/Controller/SPSettingsViewController.swift b/MoviaBox/Class/Mine/Controller/SPSettingsViewController.swift index e40c289..ff3bf2c 100644 --- a/MoviaBox/Class/Mine/Controller/SPSettingsViewController.swift +++ b/MoviaBox/Class/Mine/Controller/SPSettingsViewController.swift @@ -148,9 +148,9 @@ extension SPSettingsViewController { ] if SPLoginManager.manager.isLogin { + arr.append(SPMineItem(type: .deleteAccount, title: "DeleteAccount".localized)) + arr.append(SPMineItem(type: .logout, title: "movia_signout".localized)) } - arr.append(SPMineItem(type: .deleteAccount, title: "DeleteAccount".localized)) - arr.append(SPMineItem(type: .logout, title: "movia_signout".localized)) return arr diff --git a/MoviaBox/Class/Mine/View/SPAboutUsCell.swift b/MoviaBox/Class/Mine/View/SPAboutUsCell.swift index ae4df6d..d9410f9 100644 --- a/MoviaBox/Class/Mine/View/SPAboutUsCell.swift +++ b/MoviaBox/Class/Mine/View/SPAboutUsCell.swift @@ -44,6 +44,7 @@ extension SPAboutUsCell { titleLabel.snp.makeConstraints { make in make.centerY.equalToSuperview() make.left.equalToSuperview().offset(16) + make.right.lessThanOrEqualToSuperview().offset(-80) } } diff --git a/MoviaBox/Class/Mine/View/SPMineHeaderView.swift b/MoviaBox/Class/Mine/View/SPMineHeaderView.swift index ba9801a..378d414 100644 --- a/MoviaBox/Class/Mine/View/SPMineHeaderView.swift +++ b/MoviaBox/Class/Mine/View/SPMineHeaderView.swift @@ -40,7 +40,7 @@ class SPMineHeaderView: UIView { if let name = userInfo?.family_name, name.count > 0 { nicknameLabel.text = name } else { - nicknameLabel.text = "Vistor" + nicknameLabel.text = "movia_Visitor".localized } idLabel.text = "ID \(userInfo?.customer_id ?? "")" diff --git a/MoviaBox/Class/Player/Controller/SPPlayerDetailViewController.swift b/MoviaBox/Class/Player/Controller/SPPlayerDetailViewController.swift index 3cebd73..d16d8f2 100644 --- a/MoviaBox/Class/Player/Controller/SPPlayerDetailViewController.swift +++ b/MoviaBox/Class/Player/Controller/SPPlayerDetailViewController.swift @@ -94,7 +94,7 @@ class SPPlayerDetailViewController: SPPlayerListViewController { override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) - self.uploadPlayTime() +// self.uploadPlayTime() } override func play() { @@ -119,11 +119,15 @@ class SPPlayerDetailViewController: SPPlayerListViewController { } override func currentPlayFinish() { - if let videoInfo = self.viewModel.currentPlayer?.videoInfo, let activityId = self.activityId, let shortPlayId = videoInfo.short_play_id, let videoId = videoInfo.short_play_video_id { - //播放完成统计 - SPVideoAPI.requestViewingFinish(shortPlayId: shortPlayId, videoId: videoId, activityId: activityId) + if let videoInfo = self.viewModel.currentPlayer?.videoInfo, let shortPlayId = videoInfo.short_play_id, let videoId = videoInfo.short_play_video_id { + if let activityId = self.activityId { + //播放完成统计 + SPVideoAPI.requestViewingFinish(shortPlayId: shortPlayId, videoId: videoId, activityId: activityId) + } + //播放完成上报进度为0 SPVideoAPI.requestUploadPlayTime(shortPlayId: shortPlayId, videoId: videoId, seconds: 0) + self.viewModel.currentPlayer?.videoInfo?.play_seconds = 0 } super.currentPlayFinish() } @@ -133,14 +137,14 @@ class SPPlayerDetailViewController: SPPlayerListViewController { //每播放5秒上报一次 播放时长小于上次上报时间也需要上报 -// if (time >= lastUploadTime + 5 || time < lastUploadTime) && time >= 5 { -// lastUploadTime = time -// -// uploadPlayTime() -// } + if (time >= lastUploadTime + 5 || time < lastUploadTime) && time >= 5 { + lastUploadTime = time + uploadPlayTime() + } } override func handleBack() { + guard isShowRecommand else { super.handleBack() return @@ -282,6 +286,7 @@ extension SPPlayerDetailViewController { if currentTime >= duration { time = 0 } + self.viewModel.currentPlayer?.videoInfo?.play_seconds = time * 1000 guard let shortPlayId = videoInfo?.short_play_id, let videoId = videoInfo?.short_play_video_id else { return } //上报播放时长 @@ -388,7 +393,7 @@ extension SPPlayerDetailViewController { self.scrollToItem(indexPath: IndexPath(row: row, section: 0), animated: false) { [weak self] in guard let self = self else { return } //跳转到指定进度 - self.viewModel.currentPlayer?.seekToTime(toTime: (videoInfo.play_seconds ?? 0) / 1000) +// self.viewModel.currentPlayer?.seekToTime(toTime: (videoInfo.play_seconds ?? 0) / 1000) } } else { self.scrollToItem(indexPath: .init(row: 0, section: 0), animated: false) diff --git a/MoviaBox/Class/Player/Controller/SPPlayerListViewController.swift b/MoviaBox/Class/Player/Controller/SPPlayerListViewController.swift index 4e100ff..c7d77a7 100644 --- a/MoviaBox/Class/Player/Controller/SPPlayerListViewController.swift +++ b/MoviaBox/Class/Player/Controller/SPPlayerListViewController.swift @@ -21,6 +21,8 @@ import UIKit ///当前展示的发生变化 @objc optional func sp_playerListViewController(_ viewController: SPPlayerListViewController, didChangeIndexPathForVisible indexPath: IndexPath) + +// @objc optional func sp_playerListViewController(_ viewController: SPPlayerListViewController, didScrollFromIndex fromIndex: Int, toIndex: Int) ///新页面展示完成 // @objc optional func yd_playerViewController(playerListViewController: BCListPlayerViewController, didShowPlayerPage playerViewController: YDBasePlayerViewController) } diff --git a/MoviaBox/Class/Player/View/SPPlayerListCell.swift b/MoviaBox/Class/Player/View/SPPlayerListCell.swift index 88ed9d1..1d02fda 100644 --- a/MoviaBox/Class/Player/View/SPPlayerListCell.swift +++ b/MoviaBox/Class/Player/View/SPPlayerListCell.swift @@ -90,6 +90,10 @@ class SPPlayerListCell: SPCollectionViewCell, SPPlayerProtocol { self.controlView.videoInfo = videoInfo player.setPlayUrl(url: videoInfo?.video_url ?? "") + +// self.seekToTime(toTime: (videoInfo?.play_seconds ?? 0) / 1000) + + } } @@ -98,7 +102,7 @@ class SPPlayerListCell: SPCollectionViewCell, SPPlayerProtocol { controlView.isCurrent = isCurrent if !isCurrent { // self.player.replay() - self.player.seekToTime(toTime: 0) +// self.player.seekToTime(toTime: 0) self.coverImageView.isHidden = false } } @@ -210,4 +214,9 @@ extension SPPlayerListCell: SPPlayerDelegate { } } + func sp_playerReadyToPlay(_ player: SPPlayer) { + self.seekToTime(toTime: (videoInfo?.play_seconds ?? 0) / 1000) +// spLog(message: "play_seconds ====== \(videoInfo?.play_seconds ?? 0)") + } + } diff --git a/MoviaBox/Class/Wallet/Model/SPPayTemplateItem.swift b/MoviaBox/Class/Wallet/Model/SPPayTemplateItem.swift index 4576f89..8f08d73 100644 --- a/MoviaBox/Class/Wallet/Model/SPPayTemplateItem.swift +++ b/MoviaBox/Class/Wallet/Model/SPPayTemplateItem.swift @@ -20,6 +20,24 @@ class SPPayTemplateItem: SPModel, SmartCodable { case month = "month" case quarter = "quarter" case year = "year" + + func getText() -> String { + switch self { + case .week: + return "w_complex".localized + + case .month: + return "m_complex".localized + + case .quarter: + return "q_complex".localized + + case .year: + return "Y_complex".localized + } + + + } } diff --git a/MoviaBox/Class/Wallet/View/SPMemberRechargeCell.swift b/MoviaBox/Class/Wallet/View/SPMemberRechargeCell.swift index e58a6f7..a8f526e 100644 --- a/MoviaBox/Class/Wallet/View/SPMemberRechargeCell.swift +++ b/MoviaBox/Class/Wallet/View/SPMemberRechargeCell.swift @@ -13,7 +13,7 @@ class SPMemberRechargeCell: SPCollectionViewCell { var model: SPPayTemplateItem? { didSet { desLabel.text = model?.sp_description - typeLabel.text = model?.vip_type_key?.rawValue.capitalizingFirstLetter() + typeLabel.text = model?.vip_type_key?.getText() currencyLabel.text = model?.currency moneyLabel.text = model?.price if let sendCoins = model?.send_coins, sendCoins > 0 { diff --git a/MoviaBox/Libs/Alert/SPAlertView.swift b/MoviaBox/Libs/Alert/SPAlertView.swift index 5c991d7..75f32d8 100644 --- a/MoviaBox/Libs/Alert/SPAlertView.swift +++ b/MoviaBox/Libs/Alert/SPAlertView.swift @@ -43,23 +43,23 @@ class SPAlertView: UIView { private lazy var cancelButton: UIButton = { let button = UIButton(type: .custom) + button.setBackgroundImage(UIImage(color: .colorFF1F1F()), for: .normal) button.setTitleColor(.colorFFFFFF(), for: .normal) button.titleLabel?.font = .fontMedium(ofSize: 14) button.layer.cornerRadius = 18 button.layer.masksToBounds = true - button.layer.borderWidth = 1 - button.layer.borderColor = UIColor.colorFFFFFF().cgColor button.addTarget(self, action: #selector(handleCancelButton), for: .touchUpInside) return button }() private lazy var sureButton: UIButton = { let button = UIButton(type: .custom) - button.setBackgroundImage(UIImage(color: .colorFF1F1F()), for: .normal) button.setTitleColor(.colorFFFFFF(), for: .normal) button.titleLabel?.font = .fontMedium(ofSize: 14) button.layer.cornerRadius = 18 button.layer.masksToBounds = true + button.layer.borderWidth = 1 + button.layer.borderColor = UIColor.colorFFFFFF().cgColor button.addTarget(self, action: #selector(handleSureButton), for: .touchUpInside) return button }() @@ -99,8 +99,8 @@ class SPAlertView: UIView { contentView.addSubview(cancelButton) contentView.addSubview(sureButton) - cancelButton.frame = CGRect(x: 30, y: alertHeight + 38, width: buttonWidth, height: buttonHeight) - sureButton.frame = CGRect(x: cancelButton.frame.maxX + 10.0, y: cancelButton.frame.minY, width: buttonWidth, height: buttonHeight) + sureButton.frame = CGRect(x: 30, y: alertHeight + 38, width: buttonWidth, height: buttonHeight) + cancelButton.frame = CGRect(x: sureButton.frame.maxX + 10.0, y: sureButton.frame.minY, width: buttonWidth, height: buttonHeight) alertHeight = sureButton.frame.maxY + 34 diff --git a/MoviaBox/Libs/Player/SPPlayer.swift b/MoviaBox/Libs/Player/SPPlayer.swift index 2353e7f..f8e420e 100644 --- a/MoviaBox/Libs/Player/SPPlayer.swift +++ b/MoviaBox/Libs/Player/SPPlayer.swift @@ -27,6 +27,9 @@ import ZFPlayer ///显示首帧 @objc optional func sp_firstRenderedStart(_ player: SPPlayer) + ///准备完成 + @objc optional func sp_playerReadyToPlay(_ player: SPPlayer) + ///播放完成 @objc optional func sp_playCompletion(_ player: SPPlayer) @@ -278,14 +281,15 @@ extension SPPlayer { } } - player.playerReadyToPlay = { (asset, assetURL) in + player.playerReadyToPlay = { [weak self] (asset, assetURL) in + guard let self = self else { return } do { try AVAudioSession.sharedInstance().setCategory(.playback) try AVAudioSession.sharedInstance().setActive(true) } catch { } - + self.delegate?.sp_playerReadyToPlay?(self) } } diff --git a/MoviaBox/Source/en.lproj/Localizable.strings b/MoviaBox/Source/en.lproj/Localizable.strings index f1a9f08..58443cc 100644 --- a/MoviaBox/Source/en.lproj/Localizable.strings +++ b/MoviaBox/Source/en.lproj/Localizable.strings @@ -107,6 +107,11 @@ "movia_logoutinfo" = "Are you sure you want to log out?"; "movia_delete" = "Delete"; "movia_deleteAccountInfo" = "Are you sure you want to deactivate your account?"; +"movia_Visitor" = "Visitor"; +"w_complex" = "week"; +"m_complex" = "months"; +"q_complex" = "quarter"; +"Y_complex" = "years"; "movia_iap_error_toast_01" = "Invalid in-app purchase"; ///没有可恢复购买