版本更新,分辨率开发(部分)

This commit is contained in:
zeng 2025-06-24 10:19:26 +08:00
parent 32a50bfa85
commit 1588233050
13 changed files with 226 additions and 21 deletions

View File

@ -264,6 +264,7 @@
1BB91E0F2E04FD6A00A2C715 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1BB91CDA2E04FD6A00A2C715 /* Localizable.strings */; }; 1BB91E0F2E04FD6A00A2C715 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1BB91CDA2E04FD6A00A2C715 /* Localizable.strings */; };
1BC1F0D32E09389000B579A4 /* SPVerisionUpdateAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BC1F0D22E09389000B579A4 /* SPVerisionUpdateAlertView.swift */; }; 1BC1F0D32E09389000B579A4 /* SPVerisionUpdateAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BC1F0D22E09389000B579A4 /* SPVerisionUpdateAlertView.swift */; };
1BC1F0D52E093E9900B579A4 /* SPVersionUpdateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BC1F0D42E093E9900B579A4 /* SPVersionUpdateModel.swift */; }; 1BC1F0D52E093E9900B579A4 /* SPVersionUpdateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BC1F0D42E093E9900B579A4 /* SPVersionUpdateModel.swift */; };
1BC1F0D72E0A35EF00B579A4 /* SPVideoRevolutionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BC1F0D62E0A35EF00B579A4 /* SPVideoRevolutionManager.swift */; };
1BE7892B2DCB0E530001A8F1 /* FacebookCore in Frameworks */ = {isa = PBXBuildFile; productRef = 1BE7892A2DCB0E530001A8F1 /* FacebookCore */; }; 1BE7892B2DCB0E530001A8F1 /* FacebookCore in Frameworks */ = {isa = PBXBuildFile; productRef = 1BE7892A2DCB0E530001A8F1 /* FacebookCore */; };
1BE7892D2DCB0E530001A8F1 /* FacebookLogin in Frameworks */ = {isa = PBXBuildFile; productRef = 1BE7892C2DCB0E530001A8F1 /* FacebookLogin */; }; 1BE7892D2DCB0E530001A8F1 /* FacebookLogin in Frameworks */ = {isa = PBXBuildFile; productRef = 1BE7892C2DCB0E530001A8F1 /* FacebookLogin */; };
1BF22FD12DC2169B0082429A /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 1BF22FD02DC2169B0082429A /* FirebaseAnalytics */; }; 1BF22FD12DC2169B0082429A /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 1BF22FD02DC2169B0082429A /* FirebaseAnalytics */; };
@ -557,6 +558,7 @@
1BB91D0E2E04FD6A00A2C715 /* ThimraTV.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ThimraTV.entitlements; sourceTree = "<group>"; }; 1BB91D0E2E04FD6A00A2C715 /* ThimraTV.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ThimraTV.entitlements; sourceTree = "<group>"; };
1BC1F0D22E09389000B579A4 /* SPVerisionUpdateAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPVerisionUpdateAlertView.swift; sourceTree = "<group>"; }; 1BC1F0D22E09389000B579A4 /* SPVerisionUpdateAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPVerisionUpdateAlertView.swift; sourceTree = "<group>"; };
1BC1F0D42E093E9900B579A4 /* SPVersionUpdateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPVersionUpdateModel.swift; sourceTree = "<group>"; }; 1BC1F0D42E093E9900B579A4 /* SPVersionUpdateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPVersionUpdateModel.swift; sourceTree = "<group>"; };
1BC1F0D62E0A35EF00B579A4 /* SPVideoRevolutionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPVideoRevolutionManager.swift; sourceTree = "<group>"; };
1DBC40592DA4EDFC0093FCB0 /* ThimraTV.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ThimraTV.app; sourceTree = BUILT_PRODUCTS_DIR; }; 1DBC40592DA4EDFC0093FCB0 /* ThimraTV.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ThimraTV.app; sourceTree = BUILT_PRODUCTS_DIR; };
1F666DE0B12C863F26BE5027 /* Pods-MoviaBox.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoviaBox.debug.xcconfig"; path = "Target Support Files/Pods-MoviaBox/Pods-MoviaBox.debug.xcconfig"; sourceTree = "<group>"; }; 1F666DE0B12C863F26BE5027 /* Pods-MoviaBox.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoviaBox.debug.xcconfig"; path = "Target Support Files/Pods-MoviaBox/Pods-MoviaBox.debug.xcconfig"; sourceTree = "<group>"; };
A1174E10BCF2C606F7818792 /* Pods-ThimraTV.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ThimraTV.release.xcconfig"; path = "Target Support Files/Pods-ThimraTV/Pods-ThimraTV.release.xcconfig"; sourceTree = "<group>"; }; A1174E10BCF2C606F7818792 /* Pods-ThimraTV.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ThimraTV.release.xcconfig"; path = "Target Support Files/Pods-ThimraTV/Pods-ThimraTV.release.xcconfig"; sourceTree = "<group>"; };
@ -1032,6 +1034,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
1BB91C8A2E04FD6A00A2C715 /* SPPlayerListViewModel.swift */, 1BB91C8A2E04FD6A00A2C715 /* SPPlayerListViewModel.swift */,
1BC1F0D62E0A35EF00B579A4 /* SPVideoRevolutionManager.swift */,
); );
path = ViewModel; path = ViewModel;
sourceTree = "<group>"; sourceTree = "<group>";
@ -1612,6 +1615,7 @@
1BB91D312E04FD6A00A2C715 /* SPApnsAPI.swift in Sources */, 1BB91D312E04FD6A00A2C715 /* SPApnsAPI.swift in Sources */,
1BB91D322E04FD6A00A2C715 /* SPHomeAPI.swift in Sources */, 1BB91D322E04FD6A00A2C715 /* SPHomeAPI.swift in Sources */,
1BB91D332E04FD6A00A2C715 /* SPRewardsAPI.swift in Sources */, 1BB91D332E04FD6A00A2C715 /* SPRewardsAPI.swift in Sources */,
1BC1F0D72E0A35EF00B579A4 /* SPVideoRevolutionManager.swift in Sources */,
1BB91D342E04FD6A00A2C715 /* SPSettingAPI.swift in Sources */, 1BB91D342E04FD6A00A2C715 /* SPSettingAPI.swift in Sources */,
1BB91D352E04FD6A00A2C715 /* SPStatAPI.swift in Sources */, 1BB91D352E04FD6A00A2C715 /* SPStatAPI.swift in Sources */,
1BB91D362E04FD6A00A2C715 /* SPUserAPI.swift in Sources */, 1BB91D362E04FD6A00A2C715 /* SPUserAPI.swift in Sources */,

View File

@ -29,3 +29,6 @@ let kSPVipAlertDateDefaultsKey = "kSPVipAlertDateDefaultsKey"
/// ///
let kSPVersionUpdateAlertDefaultsKey = "kSPVersionUpdateAlertDefaultsKey" let kSPVersionUpdateAlertDefaultsKey = "kSPVersionUpdateAlertDefaultsKey"
///
let kSPVideoRevolutionDefaultsKey = "kSPVideoRevolutionDefaultsKey"

View File

@ -556,5 +556,9 @@ extension UIColor {
static func color94550E(alpha: CGFloat = 1) -> UIColor { static func color94550E(alpha: CGFloat = 1) -> UIColor {
return color(hex: 0x94550E, alpha: alpha) return color(hex: 0x94550E, alpha: alpha)
} }
static func colorE0E0E0(alpha: CGFloat = 1) -> UIColor {
return color(hex: 0xE0E0E0, alpha: alpha)
}
} }

View File

@ -57,6 +57,13 @@ class SPPlayerDetailViewController: SPPlayerListViewController {
return label return label
}() }()
private lazy var revolutionButton: UIButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "revolution_icon_01"), for: .normal)
button.addTarget(self, action: #selector(handleRevolutionButton), for: .touchUpInside)
return button
}()
private lazy var bottomView: UIView = { private lazy var bottomView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .color1C1C1E() view.backgroundColor = .color1C1C1E()
@ -71,6 +78,7 @@ class SPPlayerDetailViewController: SPPlayerListViewController {
super.viewDidLoad() super.viewDidLoad()
NotificationCenter.default.addObserver(self, selector: #selector(buyVipFinishNotification), name: SPIAPManager.buyVipFinishNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(buyVipFinishNotification), name: SPIAPManager.buyVipFinishNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(reachabilityDidChangeNotification), name: SPNetworkReachabilityManager.reachabilityDidChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(reachabilityDidChangeNotification), name: SPNetworkReachabilityManager.reachabilityDidChangeNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(didChangeRevolutionNotification), name: SPVideoRevolutionManager.didChangeRevolutionNotification, object: nil)
self.autoNextEpisode = true self.autoNextEpisode = true
self.dataSource = self self.dataSource = self
@ -180,6 +188,7 @@ extension SPPlayerDetailViewController {
view.addSubview(backButton) view.addSubview(backButton)
view.addSubview(titleLabel) view.addSubview(titleLabel)
view.addSubview(episodeLabel) view.addSubview(episodeLabel)
// view.addSubview(revolutionButton)
view.addSubview(bottomView) view.addSubview(bottomView)
backButton.snp.makeConstraints { make in backButton.snp.makeConstraints { make in
@ -200,6 +209,11 @@ extension SPPlayerDetailViewController {
make.left.equalTo(titleLabel.snp.right).offset(16) make.left.equalTo(titleLabel.snp.right).offset(16)
} }
// revolutionButton.snp.makeConstraints { make in
// make.right.equalToSuperview().offset(-22)
// make.centerY.equalTo(titleLabel)
// }
bottomView.snp.makeConstraints { make in bottomView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview() make.left.right.bottom.equalToSuperview()
make.top.equalTo(self.collectionView.snp.bottom) make.top.equalTo(self.collectionView.snp.bottom)
@ -211,6 +225,10 @@ extension SPPlayerDetailViewController {
self?.onEpisode() self?.onEpisode()
} }
self.viewModel.updateDetailDataBlock = { [weak self] indexPath in
self?.requestDetailData(indexPath: indexPath)
}
} }
} }
@ -220,7 +238,7 @@ extension SPPlayerDetailViewController {
let view = SPEpisodeView() let view = SPEpisodeView()
view.dataArr = detailModel?.episodeList ?? [] view.dataArr = detailModel?.episodeList ?? []
view.shortModel = detailModel?.shortPlayInfo view.shortModel = detailModel?.shortPlayInfo
view.currentIndex = self.currentIndexPath.row view.currentIndex = self.viewModel.currentIndexPath.row
view.didSelectedIndex = { [weak self] (index) in view.didSelectedIndex = { [weak self] (index) in
self?.scrollToItem(indexPath: IndexPath(row: index, section: 0), animated: false) self?.scrollToItem(indexPath: IndexPath(row: index, section: 0), animated: false)
} }
@ -230,16 +248,7 @@ extension SPPlayerDetailViewController {
/// ///
private func onPlayBuy() { private func onPlayBuy() {
guard let videoInfo = self.viewModel.currentPlayer?.videoInfo else { return } self.viewModel.onPlayBuy()
let view = SPPlayBuyView()
view.shortPlayId = videoInfo.short_play_id
view.videoId = videoInfo.short_play_video_id
view.buyFinishBlock = { [weak self] in
guard let self = self else { return }
self.requestDetailData(indexPath: self.currentIndexPath)
}
view.present(in: nil)
} }
/// ///
@ -320,6 +329,16 @@ extension SPPlayerDetailViewController {
self.isShowRecommand = true self.isShowRecommand = true
} }
///
@objc private func didChangeRevolutionNotification() {
self.requestDetailData(indexPath: self.viewModel.currentIndexPath)
}
@objc private func handleRevolutionButton() {
spLog(message: "点击分辨率")
}
} }
//MARK: -------------- SPPlayerListViewControllerDataSource -------------- //MARK: -------------- SPPlayerListViewControllerDataSource --------------

View File

@ -64,7 +64,6 @@ class SPPlayerListViewController: SPViewController {
private(set) var viewModel = SPPlayerListViewModel() private(set) var viewModel = SPPlayerListViewModel()
private(set) var currentIndexPath = IndexPath(row: 0, section: 0)
private lazy var collectionViewLayout: UICollectionViewLayout = { private lazy var collectionViewLayout: UICollectionViewLayout = {
let layout = UICollectionViewFlowLayout() let layout = UICollectionViewFlowLayout()
@ -158,7 +157,7 @@ class SPPlayerListViewController: SPViewController {
func clearDataArr() { func clearDataArr() {
self.dataArr.removeAll() self.dataArr.removeAll()
self.viewModel.currentPlayer = nil self.viewModel.currentPlayer = nil
self.currentIndexPath = .init(row: 0, section: 0) self.viewModel.currentIndexPath = .init(row: 0, section: 0)
self.collectionView.contentOffset = .init(x: 0, y: 0) self.collectionView.contentOffset = .init(x: 0, y: 0)
self.collectionView.reloadData() self.collectionView.reloadData()
} }
@ -171,7 +170,7 @@ class SPPlayerListViewController: SPViewController {
self.viewModel.isPlaying = true self.viewModel.isPlaying = true
if getDataCount() - currentIndexPath.row <= 2 { if getDataCount() - self.viewModel.currentIndexPath.row <= 2 {
self.loadMoreData() self.loadMoreData()
} }
@ -195,7 +194,7 @@ class SPPlayerListViewController: SPViewController {
func reloadData(completion: (() -> Void)? = nil) { func reloadData(completion: (() -> Void)? = nil) {
CATransaction.setCompletionBlock { [weak self] in CATransaction.setCompletionBlock { [weak self] in
guard let self = self else { return } guard let self = self else { return }
let cell = self.collectionView.cellForItem(at: self.currentIndexPath) as? SPPlayerListCell let cell = self.collectionView.cellForItem(at: self.viewModel.currentIndexPath) as? SPPlayerListCell
self.viewModel.currentPlayer = cell self.viewModel.currentPlayer = cell
completion?() completion?()
@ -213,7 +212,7 @@ class SPPlayerListViewController: SPViewController {
CATransaction.setCompletionBlock { [weak self] in CATransaction.setCompletionBlock { [weak self] in
guard let self = self else { return } guard let self = self else { return }
if !animated { if !animated {
if self.currentIndexPath != indexPath { if self.viewModel.currentIndexPath != indexPath {
self.skip(indexPath: indexPath) self.skip(indexPath: indexPath)
} else { } else {
self.play() self.play()
@ -331,8 +330,8 @@ extension SPPlayerListViewController: UICollectionViewDelegate, UICollectionView
} }
if self.viewModel.currentPlayer == nil, indexPath == currentIndexPath, let playerProtocol = cell as? SPPlayerProtocol { if self.viewModel.currentPlayer == nil, indexPath == self.viewModel.currentIndexPath, let playerProtocol = cell as? SPPlayerProtocol {
self.currentIndexPath = indexPath self.viewModel.currentIndexPath = indexPath
self.viewModel.currentPlayer = playerProtocol self.viewModel.currentPlayer = playerProtocol
didChangeIndexPathForVisible() didChangeIndexPathForVisible()
} }
@ -367,7 +366,7 @@ extension SPPlayerListViewController: UICollectionViewDelegate, UICollectionView
for indexPath in indexPaths { for indexPath in indexPaths {
guard let cell = self.collectionView.cellForItem(at: indexPath) else { continue } guard let cell = self.collectionView.cellForItem(at: indexPath) else { continue }
if floor(offsetY) == floor(cell.frame.origin.y) { if floor(offsetY) == floor(cell.frame.origin.y) {
if self.currentIndexPath != indexPath { if self.viewModel.currentIndexPath != indexPath {
self.skip(indexPath: indexPath) self.skip(indexPath: indexPath)
} }
} }
@ -375,7 +374,7 @@ extension SPPlayerListViewController: UICollectionViewDelegate, UICollectionView
} }
private func skip(indexPath: IndexPath) { private func skip(indexPath: IndexPath) {
currentIndexPath = indexPath self.viewModel.currentIndexPath = indexPath
guard let currentPlayer = self.collectionView.cellForItem(at: indexPath) as? SPPlayerProtocol else { return } guard let currentPlayer = self.collectionView.cellForItem(at: indexPath) as? SPPlayerProtocol else { return }
self.viewModel.currentPlayer = currentPlayer self.viewModel.currentPlayer = currentPlayer
// currentCell = self.collectionView.cellForItem(at: indexPath) as? BCListPlayerCell // currentCell = self.collectionView.cellForItem(at: indexPath) as? BCListPlayerCell
@ -419,6 +418,6 @@ extension SPPlayerListViewController {
} }
private func didChangeIndexPathForVisible() { private func didChangeIndexPathForVisible() {
self.delegate?.sp_playerListViewController?(self, didChangeIndexPathForVisible: self.currentIndexPath) self.delegate?.sp_playerListViewController?(self, didChangeIndexPathForVisible: self.viewModel.currentIndexPath)
} }
} }

View File

@ -10,6 +10,32 @@ import SmartCodable
class SPShortModel: SPModel, SmartCodable { class SPShortModel: SPModel, SmartCodable {
enum VideoRevolution: String, SmartCaseDefaultable {
case r_540 = "540"
case r_720 = "720"
case r_1080 = "1080"
var needLogin: Bool {
if self == .r_720 {
return true
} else {
return false
}
}
var needVip: Bool {
if self == .r_1080 {
return true
} else {
return false
}
}
var toString: String {
return "\(self.rawValue)P"
}
}
enum TagType: String, SmartCaseDefaultable { enum TagType: String, SmartCaseDefaultable {
case hot = "hot" case hot = "hot"
case new = "new" case new = "new"
@ -38,6 +64,9 @@ class SPShortModel: SPModel, SmartCodable {
var current_episode: String? var current_episode: String?
var video_url: String? var video_url: String?
///
var revolution: VideoRevolution?
@IgnoredKey @IgnoredKey
var titleAttributedString: NSAttributedString? var titleAttributedString: NSAttributedString?
@IgnoredKey @IgnoredKey

View File

@ -216,6 +216,7 @@ extension SPPlayerListCell: SPPlayerDelegate {
func sp_playerReadyToPlay(_ player: SPPlayer) { func sp_playerReadyToPlay(_ player: SPPlayer) {
self.seekToTime(toTime: (videoInfo?.play_seconds ?? 0) / 1000) self.seekToTime(toTime: (videoInfo?.play_seconds ?? 0) / 1000)
player.rate = self.viewModel?.speedModel.getRate() ?? 1
// spLog(message: "play_seconds ====== \(videoInfo?.play_seconds ?? 0)") // spLog(message: "play_seconds ====== \(videoInfo?.play_seconds ?? 0)")
} }

View File

@ -11,6 +11,8 @@ class SPPlayerListViewModel: NSObject {
@objc dynamic var isPlaying: Bool = true @objc dynamic var isPlaying: Bool = true
var currentIndexPath = IndexPath(row: 0, section: 0)
private var _currentPlayer: SPPlayerProtocol? private var _currentPlayer: SPPlayerProtocol?
var currentPlayer: SPPlayerProtocol? { var currentPlayer: SPPlayerProtocol? {
set { set {
@ -50,5 +52,53 @@ class SPPlayerListViewModel: NSObject {
var handlePlayTimeDidChange: ((_ time: Int) -> Void)? var handlePlayTimeDidChange: ((_ time: Int) -> Void)?
/// ///
var handleEpisode: (() -> Void)? var handleEpisode: (() -> Void)?
///
var updateDetailDataBlock: ((_ toIndexPath: IndexPath?) -> Void)?
} }
extension SPPlayerListViewModel {
///
func selectedRevolution(revolution: SPShortModel.VideoRevolution) {
guard SPVideoRevolutionManager.manager.revolution != revolution else { return }
let userInfo = SPLoginManager.manager.userInfo
if revolution.needLogin, userInfo?.is_tourist != false, userInfo?.is_vip != true {
// SPLoginManager.manager.openLogin { [weak self] in
// guard let _ = self else { return }
// VPVideoRevolutionManager.manager.setVideoRevolution(revolution: revolution)
// }
} else if revolution.needVip, userInfo?.is_vip != true {
// 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 {
SPVideoRevolutionManager.manager.setVideoRevolution(revolution: revolution)
}
}
///
func onPlayBuy() {
guard let videoInfo = self.currentPlayer?.videoInfo else { return }
let view = SPPlayBuyView()
view.shortPlayId = videoInfo.short_play_id
view.videoId = videoInfo.short_play_video_id
view.buyFinishBlock = { [weak self] in
guard let self = self else { return }
// self.requestDetailData(indexPath: self.currentIndexPath)
self.updateDetailDataBlock?(self.currentIndexPath)
}
view.present(in: nil)
}
}

View File

@ -0,0 +1,68 @@
//
// SPVideoRevolutionManager.swift
// ThimraTV
//
// Created by on 2025/6/24.
//
import UIKit
class SPVideoRevolutionManager: NSObject {
static let manager = SPVideoRevolutionManager()
///
lazy var revolution: SPShortModel.VideoRevolution = {
let userInfo = SPLoginManager.manager.userInfo
if let revolution = UserDefaults.standard.object(forKey: kSPVideoRevolutionDefaultsKey) as? String {
var revolution = verify(revolution: SPShortModel.VideoRevolution.init(rawValue: revolution) ?? .r_540)
return revolution
}
return .r_540
}()
override init() {
super.init()
NotificationCenter.default.addObserver(self, selector: #selector(userInfoUpdateNotification), name: SPLoginManager.userInfoUpdateNotification, object: nil)
}
@objc private func userInfoUpdateNotification() {
self.setVideoRevolution(revolution: self.revolution)
}
func setVideoRevolution(revolution: SPShortModel.VideoRevolution) {
let newRevolution = verify(revolution: revolution)
if newRevolution != self.revolution {
self.revolution = newRevolution
NotificationCenter.default.post(name: SPVideoRevolutionManager.didChangeRevolutionNotification, object: nil)
UserDefaults.standard.set(newRevolution.rawValue, forKey: kSPVideoRevolutionDefaultsKey)
}
}
}
extension SPVideoRevolutionManager {
///
func verify(revolution: SPShortModel.VideoRevolution) -> SPShortModel.VideoRevolution {
let userInfo = SPLoginManager.manager.userInfo
var newRevolution = revolution
if userInfo?.is_vip != true {
if newRevolution == .r_1080 {
newRevolution = .r_720
}
if userInfo?.is_tourist != false, revolution != .r_540 {
newRevolution = .r_540
}
}
return newRevolution
}
}
extension SPVideoRevolutionManager {
///
@objc static let didChangeRevolutionNotification = NSNotification.Name(rawValue: "SPVideoRevolutionManager.didChangeRevolutionNotification")
}

View File

@ -87,6 +87,7 @@ class SPLoginManager: NSObject {
SPStatAPI.requestEnterApp() SPStatAPI.requestEnterApp()
SPStatAPI.requestStatOnLine() SPStatAPI.requestStatOnLine()
completer?(true) completer?(true)
NotificationCenter.default.post(name: SPLoginManager.userInfoUpdateNotification, object: nil)
NotificationCenter.default.post(name: SPLoginManager.loginStateDidChangeNotification, object: nil) NotificationCenter.default.post(name: SPLoginManager.loginStateDidChangeNotification, object: nil)
} else { } else {
completer?(false) completer?(false)
@ -107,6 +108,7 @@ class SPLoginManager: NSObject {
SPStatAPI.requestEnterApp() SPStatAPI.requestEnterApp()
SPStatAPI.requestStatOnLine() SPStatAPI.requestStatOnLine()
completer?(true) completer?(true)
NotificationCenter.default.post(name: SPLoginManager.userInfoUpdateNotification, object: nil)
NotificationCenter.default.post(name: SPLoginManager.loginStateDidChangeNotification, object: nil) NotificationCenter.default.post(name: SPLoginManager.loginStateDidChangeNotification, object: nil)
} else { } else {
completer?(false) completer?(false)
@ -122,6 +124,7 @@ class SPLoginManager: NSObject {
if let userInfo = userInfo { if let userInfo = userInfo {
self.userInfo = userInfo self.userInfo = userInfo
UserDefaults.jx_setObject(userInfo, forKey: kSPLoginUserInfoDefaultsKey) UserDefaults.jx_setObject(userInfo, forKey: kSPLoginUserInfoDefaultsKey)
NotificationCenter.default.post(name: SPLoginManager.userInfoUpdateNotification, object: nil)
} }
completer?() completer?()
} }
@ -166,6 +169,7 @@ extension SPLoginManager {
SPStatAPI.requestEnterApp() SPStatAPI.requestEnterApp()
SPStatAPI.requestStatOnLine() SPStatAPI.requestStatOnLine()
completer?(true) completer?(true)
NotificationCenter.default.post(name: SPLoginManager.userInfoUpdateNotification, object: nil)
NotificationCenter.default.post(name: SPLoginManager.loginStateDidChangeNotification, object: nil) NotificationCenter.default.post(name: SPLoginManager.loginStateDidChangeNotification, object: nil)
} }
@ -177,5 +181,7 @@ extension SPLoginManager {
/// ///
@objc static let loginStateDidChangeNotification = NSNotification.Name(rawValue: "SPLoginManager.loginStateDidChangeNotification") @objc static let loginStateDidChangeNotification = NSNotification.Name(rawValue: "SPLoginManager.loginStateDidChangeNotification")
///
@objc static let userInfoUpdateNotification = NSNotification.Name(rawValue: "SPLoginManager.userInfoUpdateNotification")
} }

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Frame@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B