diff --git a/Veloria.xcodeproj/project.pbxproj b/Veloria.xcodeproj/project.pbxproj index 284e864..30f41d3 100644 --- a/Veloria.xcodeproj/project.pbxproj +++ b/Veloria.xcodeproj/project.pbxproj @@ -1794,7 +1794,7 @@ CODE_SIGN_ENTITLEMENTS = Veloria/Veloria.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = 394VH538M8; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Veloria/Source/Info.plist; @@ -1813,7 +1813,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.4; + MARKETING_VERSION = 1.0.5; PRODUCT_BUNDLE_IDENTIFIER = com.qjwl168.veloria.ios; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1837,7 +1837,7 @@ CODE_SIGN_ENTITLEMENTS = Veloria/Veloria.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_TEAM = 394VH538M8; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Veloria/Source/Info.plist; @@ -1856,7 +1856,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.4; + MARKETING_VERSION = 1.0.5; PRODUCT_BUNDLE_IDENTIFIER = com.qjwl168.veloria.ios; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Veloria/AppDelegate/AppDelegate+Open.swift b/Veloria/AppDelegate/AppDelegate+Open.swift index 45c7661..a8fa83e 100644 --- a/Veloria/AppDelegate/AppDelegate+Open.swift +++ b/Veloria/AppDelegate/AppDelegate+Open.swift @@ -46,7 +46,7 @@ extension SceneDelegate { func vp_handleOpenAppMessage(webpageURL: URL?) { guard VPNetworkReachabilityManager.manager.isReachable == true, //有网 - AppDelegate.haveBeenShownAPNS, //推送弹窗 +// AppDelegate.haveBeenShownAPNS, //推送弹窗 self.isOpenApp, //APP被开启 VPAppTool.idfaAuthorizationFinish //idfa授权完成 else { diff --git a/Veloria/Class/Home/Controller/VPMoreVideoViewController.swift b/Veloria/Class/Home/Controller/VPMoreVideoViewController.swift index b2b8c57..0c3d0e5 100644 --- a/Veloria/Class/Home/Controller/VPMoreVideoViewController.swift +++ b/Veloria/Class/Home/Controller/VPMoreVideoViewController.swift @@ -15,6 +15,11 @@ class VPMoreVideoViewController: VPViewController { } } + private lazy var bgView: UIImageView = { + let imageView = UIImageView(image: UIImage(named: "more_bg_image")) + return imageView + }() + private lazy var titleLeftImageView: UIImageView = { let imageView = UIImageView(image: UIImage(named: "title_icon_01")) return imageView @@ -67,11 +72,16 @@ class VPMoreVideoViewController: VPViewController { extension VPMoreVideoViewController { private func vp_setupUI() { + view.addSubview(bgView) view.addSubview(titleLeftImageView) view.addSubview(titleRightImageView) view.addSubview(titleLabel) view.addSubview(collectionView) + bgView.snp.makeConstraints { make in + make.left.right.top.equalToSuperview() + } + titleLeftImageView.snp.makeConstraints { make in make.left.equalToSuperview().offset(15) make.top.equalToSuperview().offset(UIScreen.navBarHeight + 10) diff --git a/Veloria/Class/Player/View/VPDetailRecommandBannerCell.swift b/Veloria/Class/Player/View/VPDetailRecommandBannerCell.swift index 9d88fe8..6184636 100644 --- a/Veloria/Class/Player/View/VPDetailRecommandBannerCell.swift +++ b/Veloria/Class/Player/View/VPDetailRecommandBannerCell.swift @@ -26,6 +26,7 @@ class VPDetailRecommandBannerCell: FSPagerViewCell { } } + private(set) lazy var player: VPPlayer = { let player = VPPlayer() player.playerView = playerView @@ -33,33 +34,52 @@ class VPDetailRecommandBannerCell: FSPagerViewCell { return player }() - + private(set) lazy var bgView: UIView = { + let view = VPGradientView() + view.isHidden = true + view.layer.cornerRadius = 14 + view.layer.masksToBounds = true + view.colors = [UIColor.color05CEA0(alpha: 0.5).cgColor, UIColor.color7C174F(alpha: 0.5).cgColor] + view.locations = [0, 1] + view.startPoint = .init(x: 0, y: 0.3) + view.endPoint = .init(x: 1, y: 0.8) + return view + }() private lazy var coverImageView: VPImageView = { let imageView = VPImageView() + imageView.layer.cornerRadius = bgView.layer.cornerRadius + imageView.layer.masksToBounds = true return imageView }() private lazy var playerView: UIView = { let view = UIView() + view.layer.cornerRadius = bgView.layer.cornerRadius + view.layer.masksToBounds = true return view }() override init(frame: CGRect) { super.init(frame: frame) - contentView.layer.cornerRadius = 14 - contentView.layer.masksToBounds = true + contentView.addSubview(bgView) contentView.addSubview(playerView) contentView.addSubview(coverImageView) - coverImageView.snp.makeConstraints { make in + + bgView.snp.makeConstraints { make in make.edges.equalToSuperview() } + coverImageView.snp.makeConstraints { make in + make.left.equalToSuperview().offset(2.5) + make.top.equalToSuperview().offset(2.5) + make.center.equalToSuperview() + } playerView.snp.makeConstraints { make in - make.edges.equalToSuperview() + make.edges.equalTo(coverImageView) } } diff --git a/Veloria/Class/Player/View/VPDetailRecommandView.swift b/Veloria/Class/Player/View/VPDetailRecommandView.swift index 789f865..78179f9 100644 --- a/Veloria/Class/Player/View/VPDetailRecommandView.swift +++ b/Veloria/Class/Player/View/VPDetailRecommandView.swift @@ -34,8 +34,10 @@ class VPDetailRecommandView: HWPanModalContentView { oldValue?.isCurrentPlayer = false oldValue?.player.pause() + oldValue?.bgView.isHidden = true currentCell?.isCurrentPlayer = true + currentCell?.bgView.isHidden = false } } @@ -297,6 +299,9 @@ extension VPDetailRecommandView: FSPagerViewDelegate, FSPagerViewDataSource { func pagerView(_ pagerView: FSPagerView, cellForItemAt index: Int) -> FSPagerViewCell { let cell = pagerView.dequeueReusableCell(withReuseIdentifier: "cell", at: index) as! VPDetailRecommandBannerCell cell.model = self.dataArr[index] + if currentCell == nil, index == 0 { + cell.bgView.isHidden = false + } return cell } @@ -312,5 +317,6 @@ extension VPDetailRecommandView: FSPagerViewDelegate, FSPagerViewDataSource { } + } diff --git a/Veloria/Class/Player/View/VPPlayerRechargeView.swift b/Veloria/Class/Player/View/VPPlayerRechargeView.swift index ad22abb..c5bf0d0 100644 --- a/Veloria/Class/Player/View/VPPlayerRechargeView.swift +++ b/Veloria/Class/Player/View/VPPlayerRechargeView.swift @@ -25,21 +25,24 @@ class VPPlayerRechargeView: HWPanModalContentView { var model: VPPayTemplateModel? { didSet { stackView.removeAllArrangedSubview() + guard let model = self.model else { return } - 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 sort = model.sort, sort.count > 0 { + sort.forEach { + if $0 == .vip { + addVipView() + } else if $0 == .coin { + addCoinView() + } } - - if let list = model.list_coins, list.count > 0 { - self.stackView.addArrangedSubview(self.coinsView) - self.coinsView.dataArr = list - } - - self.stackView.addArrangedSubview(tipView) + } else { + addVipView() + addCoinView() } + + + self.stackView.addArrangedSubview(tipView) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] in self?.panModalSetNeedsLayoutUpdate() @@ -50,7 +53,13 @@ class VPPlayerRechargeView: HWPanModalContentView { var unlockCoin: Int? { didSet { - let coinCountStr = " \(unlockCoin ?? 0)" + guard let coin = unlockCoin, coin > 0 else { + self.unlockCoinBgView.isHidden = true + return + } + self.unlockCoinBgView.isHidden = false + + let coinCountStr = " \(coin)" let text = "veloria_unlock".localized + coinCountStr let coinRange = text.ocString().range(of: coinCountStr) @@ -262,6 +271,20 @@ class VPPlayerRechargeView: HWPanModalContentView { extension VPPlayerRechargeView { + private func addVipView() { + if let list = model?.list_sub_vip, list.count > 0 { + self.stackView.addArrangedSubview(self.vipView) + self.vipView.dataArr = list + } + } + + private func addCoinView() { + if let list = model?.list_coins, list.count > 0 { + self.stackView.addArrangedSubview(self.coinsView) + self.coinsView.dataArr = list + } + } + @objc private func updateCoin() { let coinCountStr = " \(VPLoginManager.manager.userInfo?.totalCoin ?? 0)" let text = "veloria_your_coins".localized + coinCountStr diff --git a/Veloria/Class/Player/ViewModel/VPVideoPlayViewModel.swift b/Veloria/Class/Player/ViewModel/VPVideoPlayViewModel.swift index 17d0d7b..8fb04a5 100644 --- a/Veloria/Class/Player/ViewModel/VPVideoPlayViewModel.swift +++ b/Veloria/Class/Player/ViewModel/VPVideoPlayViewModel.swift @@ -88,7 +88,11 @@ extension VPVideoPlayViewModel { let view = VPPlayerRechargeView() view.model = model - view.unlockCoin = videoInfo.coins + if videoInfo.is_lock != true { + view.unlockCoin = nil + } else { + view.unlockCoin = videoInfo.coins + } view.shortPlayId = videoInfo.short_play_id view.videoId = videoInfo.short_play_video_id view.buyFinishBlock = { [weak self] in diff --git a/Veloria/Class/Wallet/Controller/VPStoreViewController.swift b/Veloria/Class/Wallet/Controller/VPStoreViewController.swift index adac84b..4f7ca22 100644 --- a/Veloria/Class/Wallet/Controller/VPStoreViewController.swift +++ b/Veloria/Class/Wallet/Controller/VPStoreViewController.swift @@ -11,6 +11,8 @@ class VPStoreViewController: VPViewController { ///vip购买成功回调 var vipBuyFinishBlock: (() -> Void)? + + private var templateModel: VPPayTemplateModel? private lazy var scrollView: VPScrollView = { let scrollView = VPScrollView() @@ -88,6 +90,42 @@ class VPStoreViewController: VPViewController { } } +extension VPStoreViewController { + + private func updateLayout() { + guard let model = self.templateModel else { return } + + if let sort = model.sort, sort.count > 0 { + sort.forEach { + if $0 == .vip { + addVipView() + } else if $0 == .coin { + addCoinView() + } + } + } else { + addVipView() + addCoinView() + } + + } + + private func addVipView() { + if let list = templateModel?.list_sub_vip, list.count > 0 { + self.stackView.addArrangedSubview(self.vipView) + self.vipView.dataArr = list + } + } + + private func addCoinView() { + if let list = templateModel?.list_coins, list.count > 0 { + self.stackView.addArrangedSubview(self.coinsView) + self.coinsView.dataArr = list + } + } + +} + extension VPStoreViewController { private func vp_setupUI() { @@ -115,18 +153,11 @@ extension VPStoreViewController { VPWalletAPI.requestPayTemplate { [weak self] model in guard let self = self else { return } + self.stackView.removeAllArrangedSubview() + if let model = model { - self.stackView.removeAllArrangedSubview() - - 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 - } + self.templateModel = model + self.updateLayout() self.stackView.addArrangedSubview(self.tipView) } diff --git a/Veloria/Class/Wallet/Model/VPPayTemplateModel.swift b/Veloria/Class/Wallet/Model/VPPayTemplateModel.swift index 4e6b80b..e2a71fa 100644 --- a/Veloria/Class/Wallet/Model/VPPayTemplateModel.swift +++ b/Veloria/Class/Wallet/Model/VPPayTemplateModel.swift @@ -10,6 +10,12 @@ import SmartCodable class VPPayTemplateModel: VPModel, SmartCodable { + enum SortName: String, SmartCaseDefaultable { + case coin = "list_coins" + case vip = "list_sub_vip" + } + var list_coins: [VPPayTemplateItem]? var list_sub_vip: [VPPayTemplateItem]? + var sort: [SortName]? } diff --git a/Veloria/Class/Wallet/View/VPStoreVipBuyView.swift b/Veloria/Class/Wallet/View/VPStoreVipBuyView.swift index f7c84cd..3659a96 100644 --- a/Veloria/Class/Wallet/View/VPStoreVipBuyView.swift +++ b/Veloria/Class/Wallet/View/VPStoreVipBuyView.swift @@ -9,15 +9,15 @@ import UIKit class VPStoreVipBuyView: UIView { - override var intrinsicContentSize: CGSize { - var height: CGFloat = 1 - - if dataArr.count > 0, collectionView.contentSize.height > 0 { - height = collectionView.contentSize.height + 1 - } - - return .init(width: UIScreen.width, height: height) - } +// override var intrinsicContentSize: CGSize { +// var height: CGFloat = 1 +// +// if dataArr.count > 0, collectionView.contentSize.height > 0 { +// height = collectionView.contentSize.height + 1 +// } +// +// return .init(width: UIScreen.width, height: height) +// } var buyFinishBlock: (() -> Void)? @@ -31,7 +31,11 @@ class VPStoreVipBuyView: UIView { self?.collectionView.reloadData() } self.collectionView.performBatchUpdates(nil) { [weak self] _ in - self?.invalidateIntrinsicContentSize() + guard let self = self else { return } + let height = self.collectionView.contentSize.height + 1 + self.collectionView.snp.updateConstraints { make in + make.height.equalTo(height) + } } } @@ -90,6 +94,7 @@ extension VPStoreVipBuyView { collectionView.snp.makeConstraints { make in make.left.right.bottom.equalToSuperview() make.top.equalTo(titleLabel.snp.bottom) + make.height.equalTo(1) } } diff --git a/Veloria/Class/Wallet/View/VPWalletHeaderItemView.swift b/Veloria/Class/Wallet/View/VPWalletHeaderItemView.swift index c9590bf..9e3031e 100644 --- a/Veloria/Class/Wallet/View/VPWalletHeaderItemView.swift +++ b/Veloria/Class/Wallet/View/VPWalletHeaderItemView.swift @@ -21,6 +21,7 @@ class VPWalletHeaderItemView: UIView { } } + private var textAlignment: NSTextAlignment = .left private lazy var coinCountLabel: UILabel = { let label = UILabel() @@ -36,8 +37,9 @@ class VPWalletHeaderItemView: UIView { return label }() - override init(frame: CGRect) { - super.init(frame: frame) + init(textAlignment: NSTextAlignment) { + super.init(frame: .zero) + self.textAlignment = textAlignment vp_setupUI() } @@ -56,13 +58,16 @@ extension VPWalletHeaderItemView { titleLabel.snp.makeConstraints { make in -// make.left.equalTo(coinCountLabel) - make.centerX.equalToSuperview() + if self.textAlignment == .left { + make.left.equalToSuperview().offset(20) + } else if self.textAlignment == .center { + make.centerX.equalToSuperview().offset(-20) + } make.top.equalToSuperview() } coinCountLabel.snp.makeConstraints { make in - make.centerX.equalToSuperview() + make.left.equalTo(titleLabel) make.bottom.equalToSuperview() make.top.equalTo(titleLabel.snp.bottom).offset(5) } diff --git a/Veloria/Class/Wallet/View/VPWalletHeaderView.swift b/Veloria/Class/Wallet/View/VPWalletHeaderView.swift index 7c0c844..20170dd 100644 --- a/Veloria/Class/Wallet/View/VPWalletHeaderView.swift +++ b/Veloria/Class/Wallet/View/VPWalletHeaderView.swift @@ -57,13 +57,13 @@ class VPWalletHeaderView: UIView { }() private lazy var rechargeCoinView: VPWalletHeaderItemView = { - let view = VPWalletHeaderItemView() + let view = VPWalletHeaderItemView(textAlignment: .left) view.title = "veloria_recharge".localized return view }() private lazy var sendCoinView: VPWalletHeaderItemView = { - let view = VPWalletHeaderItemView() + let view = VPWalletHeaderItemView(textAlignment: .center) view.title = "veloria_bonus".localized return view }() diff --git a/Veloria/Source/Assets.xcassets/image/more_bg_image.imageset/Contents.json b/Veloria/Source/Assets.xcassets/image/more_bg_image.imageset/Contents.json new file mode 100644 index 0000000..b3858aa --- /dev/null +++ b/Veloria/Source/Assets.xcassets/image/more_bg_image.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "顶部bg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "顶部bg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Veloria/Source/Assets.xcassets/image/more_bg_image.imageset/顶部bg@2x.png b/Veloria/Source/Assets.xcassets/image/more_bg_image.imageset/顶部bg@2x.png new file mode 100644 index 0000000..dacf99a Binary files /dev/null and b/Veloria/Source/Assets.xcassets/image/more_bg_image.imageset/顶部bg@2x.png differ diff --git a/Veloria/Source/Assets.xcassets/image/more_bg_image.imageset/顶部bg@3x.png b/Veloria/Source/Assets.xcassets/image/more_bg_image.imageset/顶部bg@3x.png new file mode 100644 index 0000000..ac0c7d9 Binary files /dev/null and b/Veloria/Source/Assets.xcassets/image/more_bg_image.imageset/顶部bg@3x.png differ