1
This commit is contained in:
parent
b4c1d9074c
commit
49c3b9b3c9
@ -199,15 +199,15 @@ class FAStoreAPI: NSObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///挽留支付项
|
///挽留支付项
|
||||||
static func requestPayRetainInfo(completer: ((_ model: FAPayAlertModel?) -> Void)?) {
|
static func requestPayRetainInfo(completer: ((_ model: FAPayDateModel?) -> Void)?) {
|
||||||
|
|
||||||
FANetworkManager.manager.request(FABaseURL + "/payRetrieveSettings",
|
FANetworkManager.manager.request(FABaseURL + "/payRetrieveSettings",
|
||||||
method: .get,
|
method: .get,
|
||||||
parameters: nil,
|
parameters: nil,
|
||||||
isLoding: true,
|
isLoding: true,
|
||||||
isToast: true,
|
isToast: true,
|
||||||
) { (response: FANetworkManager.Response<FAPayAlertModel>) in
|
) { (response: FANetworkManager.Response<FAPayDateModel>) in
|
||||||
if let _ = response.data?.info {
|
if (response.data?.list_coins?.count ?? 0) > 0 {
|
||||||
completer?(response.data)
|
completer?(response.data)
|
||||||
} else {
|
} else {
|
||||||
completer?(nil)
|
completer?(nil)
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class FALabel: UILabel {
|
|||||||
|
|
||||||
override var intrinsicContentSize: CGSize {
|
override var intrinsicContentSize: CGSize {
|
||||||
let size = super.intrinsicContentSize
|
let size = super.intrinsicContentSize
|
||||||
return .init(width: size.width + borderLineWidth / 2, height: size.height)
|
return .init(width: size.width + borderLineWidth, height: size.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func drawText(in rect: CGRect) {
|
override func drawText(in rect: CGRect) {
|
||||||
@ -57,7 +57,7 @@ class FALabel: UILabel {
|
|||||||
// let y = (rect.height - textSize.height) / 2
|
// let y = (rect.height - textSize.height) / 2
|
||||||
|
|
||||||
let textSize = self.attributedText?.boundingRect(with: rect.size, options: [.usesLineFragmentOrigin, .usesFontLeading], context: nil).size ?? .zero
|
let textSize = self.attributedText?.boundingRect(with: rect.size, options: [.usesLineFragmentOrigin, .usesFontLeading], context: nil).size ?? .zero
|
||||||
let x = 0.0
|
let x = borderLineWidth / 2
|
||||||
let y = 0.0
|
let y = 0.0
|
||||||
let textRect = CGRect(x: x, y: y, width: textSize.width, height: textSize.height)
|
let textRect = CGRect(x: x, y: y, width: textSize.width, height: textSize.height)
|
||||||
|
|
||||||
|
|||||||
@ -235,23 +235,19 @@ extension FAShortDetailViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func _showPayRetainAlert(_ videoInfo: FAVideoInfoModel) {
|
private func _showPayRetainAlert(_ videoInfo: FAVideoInfoModel) {
|
||||||
|
|
||||||
|
|
||||||
|
payDataRequest = FAPayDataRequest()
|
||||||
|
|
||||||
|
payDataRequest?.requestPayRetainInfo { [weak self] model in
|
||||||
|
guard let self = self else { return }
|
||||||
|
guard let model = model else { return }
|
||||||
|
|
||||||
let view = FAPayRetainAlert()
|
let view = FAPayRetainAlert()
|
||||||
|
view.model = model
|
||||||
view.show(in: FATool.keyWindow)
|
view.show(in: FATool.keyWindow)
|
||||||
|
|
||||||
// payDataRequest = FAPayDataRequest()
|
}
|
||||||
|
|
||||||
// payDataRequest?.requestPayRetainInfo { [weak self] model in
|
|
||||||
// guard let self = self else { return }
|
|
||||||
// guard let model = model else { return }
|
|
||||||
// let view = FAVipRetainAlert()
|
|
||||||
// view.model = model
|
|
||||||
// view.videoInfo = videoInfo
|
|
||||||
// view.buyFinishHandle = { [weak self] in
|
|
||||||
// guard let self = self else { return }
|
|
||||||
// self.requestDetailData(indexPath: self.currentIndexPath, completer: nil)
|
|
||||||
// }
|
|
||||||
// view.show(in: FATool.keyWindow)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,8 @@ class FAPayDateModel: NSObject, SmartCodable {
|
|||||||
///0: 普通金币 1:金币包模式
|
///0: 普通金币 1:金币包模式
|
||||||
var show_type: Int?
|
var show_type: Int?
|
||||||
|
|
||||||
|
var retrieve_lang: FAPayRetrieveLang?
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,6 +164,19 @@ class FAPayExtInfo: NSObject, SmartCodable {
|
|||||||
var extra_day_coins: Int?
|
var extra_day_coins: Int?
|
||||||
var receive_coins_rate: String?
|
var receive_coins_rate: String?
|
||||||
var max_total_coins: Int?
|
var max_total_coins: Int?
|
||||||
|
var max_total_coins_pop: Int?
|
||||||
var sub_coins_txt_list: [String]?
|
var sub_coins_txt_list: [String]?
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class FAPayRetrieveLang: NSObject, SmartCodable {
|
||||||
|
required override init() {
|
||||||
|
super.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
var title: String?
|
||||||
|
var remaining_time: String?
|
||||||
|
var miss_out: String?
|
||||||
|
var subtitle: String?
|
||||||
|
var claim_reward: String?
|
||||||
|
}
|
||||||
|
|||||||
@ -10,6 +10,16 @@ import SnapKit
|
|||||||
|
|
||||||
class FAPayRetainAlert: FABaseAlert {
|
class FAPayRetainAlert: FABaseAlert {
|
||||||
|
|
||||||
|
var model: FAPayDateModel? {
|
||||||
|
didSet {
|
||||||
|
self.collectionView.reloadData()
|
||||||
|
self.titleLabel.text = model?.retrieve_lang?.title
|
||||||
|
self.countdownView.model = model
|
||||||
|
|
||||||
|
bonusTagView.update(text: model?.retrieve_lang?.subtitle ?? "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private var selectedIndex = FAPayRetainAlertData.defaultSelectedIndex
|
private var selectedIndex = FAPayRetainAlertData.defaultSelectedIndex
|
||||||
|
|
||||||
private lazy var bgView: UIImageView = {
|
private lazy var bgView: UIImageView = {
|
||||||
@ -21,13 +31,15 @@ class FAPayRetainAlert: FABaseAlert {
|
|||||||
|
|
||||||
private lazy var titleLabel: FALabel = {
|
private lazy var titleLabel: FALabel = {
|
||||||
let label = FALabel()
|
let label = FALabel()
|
||||||
|
label.borderLineWidth = 6
|
||||||
|
label.borderColor = ._9_ED_0_FF
|
||||||
label.text = FAPayRetainAlertData.titleText
|
label.text = FAPayRetainAlertData.titleText
|
||||||
label.font = .font(ofSize: 44, weight: .init(900)).withBoldItalic()
|
label.font = .font(ofSize: 44, weight: .init(900)).withBoldItalic()
|
||||||
label.textStartPoint = .init(x: 0, y: 0.5)
|
label.textStartPoint = .init(x: 0, y: 0.5)
|
||||||
label.textEndPoint = .init(x: 1, y: 0.5)
|
label.textEndPoint = .init(x: 1, y: 0.5)
|
||||||
label.textColors = [
|
label.textColors = [
|
||||||
UIColor.fa_hex(0x0178FF).cgColor,
|
UIColor.fa_hex(0x0178FF).cgColor,
|
||||||
UIColor.fa_hex(0x81CAFF).cgColor
|
UIColor.fa_hex(0x0D8AFF).cgColor
|
||||||
]
|
]
|
||||||
return label
|
return label
|
||||||
}()
|
}()
|
||||||
@ -42,7 +54,6 @@ class FAPayRetainAlert: FABaseAlert {
|
|||||||
|
|
||||||
private lazy var bonusTagView: PayRetainBonusTagView = {
|
private lazy var bonusTagView: PayRetainBonusTagView = {
|
||||||
let view = PayRetainBonusTagView()
|
let view = PayRetainBonusTagView()
|
||||||
view.update(text: FAPayRetainAlertData.bonusTitle)
|
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -81,13 +92,8 @@ extension FAPayRetainAlert {
|
|||||||
private func fa_setupLayout() {
|
private func fa_setupLayout() {
|
||||||
contentWidth = FAPayRetainAlertData.Layout.contentWidth
|
contentWidth = FAPayRetainAlertData.Layout.contentWidth
|
||||||
contentView.backgroundColor = .clear
|
contentView.backgroundColor = .clear
|
||||||
contentView.layer.cornerRadius = FAPayRetainAlertData.Layout.cardCornerRadius
|
contentView.layer.cornerRadius = 0
|
||||||
contentView.layer.masksToBounds = true
|
contentView.layer.masksToBounds = true
|
||||||
closeButton.layer.cornerRadius = 12
|
|
||||||
closeButton.layer.masksToBounds = true
|
|
||||||
closeButton.layer.borderWidth = 1.3
|
|
||||||
closeButton.layer.borderColor = UIColor.fa_hex(0xCACACA).cgColor
|
|
||||||
closeButton.tintColor = UIColor.fa_hex(0xCACACA)
|
|
||||||
|
|
||||||
contentView.addSubview(bgView)
|
contentView.addSubview(bgView)
|
||||||
contentView.addSubview(titleLabel)
|
contentView.addSubview(titleLabel)
|
||||||
@ -101,36 +107,30 @@ extension FAPayRetainAlert {
|
|||||||
}
|
}
|
||||||
|
|
||||||
titleLabel.snp.makeConstraints { make in
|
titleLabel.snp.makeConstraints { make in
|
||||||
make.top.equalToSuperview().offset(FAPayRetainAlertData.Layout.titleTop)
|
make.top.equalToSuperview().offset(143)
|
||||||
make.centerX.equalToSuperview()
|
make.centerX.equalToSuperview()
|
||||||
make.right.lessThanOrEqualToSuperview().offset(-1)
|
make.right.lessThanOrEqualToSuperview().offset(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
countdownView.snp.makeConstraints { make in
|
countdownView.snp.makeConstraints { make in
|
||||||
make.left.equalToSuperview().offset(FAPayRetainAlertData.Layout.countdownLeft)
|
make.left.equalToSuperview().offset(FAPayRetainAlertData.Layout.countdownLeft)
|
||||||
make.top.equalToSuperview().offset(FAPayRetainAlertData.Layout.countdownTop)
|
make.top.equalTo(titleLabel.snp.bottom).offset(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
bonusTagView.snp.makeConstraints { make in
|
bonusTagView.snp.makeConstraints { make in
|
||||||
make.left.equalToSuperview().offset(FAPayRetainAlertData.Layout.bonusTagLeft)
|
make.top.equalTo(titleLabel.snp.bottom).offset(35)
|
||||||
make.top.equalToSuperview().offset(FAPayRetainAlertData.Layout.bonusTagTop)
|
make.centerX.equalToSuperview()
|
||||||
|
make.right.lessThanOrEqualToSuperview().offset(-10)
|
||||||
make.height.equalTo(FAPayRetainAlertData.Layout.bonusTagHeight)
|
make.height.equalTo(FAPayRetainAlertData.Layout.bonusTagHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
collectionView.snp.makeConstraints { make in
|
collectionView.snp.makeConstraints { make in
|
||||||
make.left.equalToSuperview().offset(FAPayRetainAlertData.Layout.packListLeft)
|
make.left.equalToSuperview().offset(10)
|
||||||
make.top.equalToSuperview().offset(FAPayRetainAlertData.Layout.packListTop)
|
make.right.equalToSuperview().offset(-10)
|
||||||
make.width.equalTo(FAPayRetainAlertData.Layout.packItemSize.width)
|
make.top.equalTo(bonusTagView.snp.bottom).offset(15)
|
||||||
make.height.equalTo(FAPayRetainAlertData.Layout.packListHeight)
|
make.bottom.equalToSuperview().offset(-10)
|
||||||
}
|
}
|
||||||
|
|
||||||
closeButton.snp.updateConstraints { make in
|
|
||||||
make.width.height.equalTo(24)
|
|
||||||
}
|
|
||||||
|
|
||||||
contentView.snp.makeConstraints { make in
|
|
||||||
make.height.equalTo(FAPayRetainAlertData.Layout.contentHeight)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -138,12 +138,12 @@ extension FAPayRetainAlert {
|
|||||||
// MARK: - UICollectionViewDataSource & Delegate
|
// MARK: - UICollectionViewDataSource & Delegate
|
||||||
extension FAPayRetainAlert: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
|
extension FAPayRetainAlert: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
|
||||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||||
return FAPayRetainAlertData.packItems.count
|
return self.model?.list_coins?.count ?? 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FAPayRetainPackCell.reuseIdentifier, for: indexPath) as! FAPayRetainPackCell
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FAPayRetainPackCell.reuseIdentifier, for: indexPath) as! FAPayRetainPackCell
|
||||||
let item = FAPayRetainAlertData.packItems[indexPath.item]
|
let item = self.model?.list_coins?[indexPath.row]
|
||||||
cell.configure(with: item, isSelected: indexPath.item == selectedIndex)
|
cell.configure(with: item, isSelected: indexPath.item == selectedIndex)
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
@ -157,6 +157,13 @@ extension FAPayRetainAlert: UICollectionViewDataSource, UICollectionViewDelegate
|
|||||||
// MARK: - Subviews
|
// MARK: - Subviews
|
||||||
extension FAPayRetainAlert {
|
extension FAPayRetainAlert {
|
||||||
final class PayRetainCountdownView: UIView {
|
final class PayRetainCountdownView: UIView {
|
||||||
|
var model: FAPayDateModel? {
|
||||||
|
didSet {
|
||||||
|
prefixLabel.text = model?.retrieve_lang?.remaining_time
|
||||||
|
suffixLabel.text = model?.retrieve_lang?.miss_out
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private let prefixLabel = UILabel()
|
private let prefixLabel = UILabel()
|
||||||
private let suffixLabel = UILabel()
|
private let suffixLabel = UILabel()
|
||||||
private let timeStackView = UIStackView()
|
private let timeStackView = UIStackView()
|
||||||
@ -190,10 +197,10 @@ extension FAPayRetainAlert {
|
|||||||
mainStack.alignment = .center
|
mainStack.alignment = .center
|
||||||
mainStack.spacing = 5
|
mainStack.spacing = 5
|
||||||
|
|
||||||
prefixLabel.font = .font(ofSize: 12, weight: .medium).withBoldItalic()
|
prefixLabel.font = .font(ofSize: 12, weight: .medium)
|
||||||
prefixLabel.textColor = UIColor.fa_hex(0x0F0F0F)
|
prefixLabel.textColor = UIColor.fa_hex(0x0F0F0F)
|
||||||
|
|
||||||
suffixLabel.font = .font(ofSize: 12, weight: .medium).withBoldItalic()
|
suffixLabel.font = .font(ofSize: 12, weight: .medium)
|
||||||
suffixLabel.textColor = UIColor.fa_hex(0x0F0F0F)
|
suffixLabel.textColor = UIColor.fa_hex(0x0F0F0F)
|
||||||
|
|
||||||
timeStackView.axis = .horizontal
|
timeStackView.axis = .horizontal
|
||||||
@ -262,7 +269,6 @@ extension FAPayRetainAlert {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final class PayRetainBonusTagView: UIView {
|
final class PayRetainBonusTagView: UIView {
|
||||||
private let stackView = UIStackView()
|
|
||||||
private let leftStar = UIImageView(image: UIImage(named: FAPayRetainAlertData.Assets.starIcon))
|
private let leftStar = UIImageView(image: UIImage(named: FAPayRetainAlertData.Assets.starIcon))
|
||||||
private let rightStar = UIImageView(image: UIImage(named: FAPayRetainAlertData.Assets.starIcon))
|
private let rightStar = UIImageView(image: UIImage(named: FAPayRetainAlertData.Assets.starIcon))
|
||||||
private let titleLabel = UILabel()
|
private let titleLabel = UILabel()
|
||||||
@ -286,27 +292,27 @@ extension FAPayRetainAlert {
|
|||||||
layer.cornerRadius = 10
|
layer.cornerRadius = 10
|
||||||
layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMaxYCorner]
|
layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMaxYCorner]
|
||||||
|
|
||||||
stackView.axis = .horizontal
|
|
||||||
stackView.alignment = .center
|
|
||||||
stackView.spacing = 5
|
|
||||||
|
|
||||||
titleLabel.font = .font(ofSize: 20, weight: .bold).withBoldItalic()
|
titleLabel.font = .font(ofSize: 20, weight: .bold).withBoldItalic()
|
||||||
titleLabel.textColor = .FFFFFF
|
titleLabel.textColor = .FFFFFF
|
||||||
|
|
||||||
[leftStar, titleLabel, rightStar].forEach { stackView.addArrangedSubview($0) }
|
addSubview(leftStar)
|
||||||
[leftStar, rightStar].forEach { imageView in
|
addSubview(rightStar)
|
||||||
imageView.contentMode = .scaleAspectFit
|
addSubview(titleLabel)
|
||||||
imageView.snp.makeConstraints { make in
|
|
||||||
make.width.height.equalTo(9)
|
leftStar.snp.makeConstraints { make in
|
||||||
}
|
make.centerY.equalToSuperview()
|
||||||
|
make.left.equalToSuperview().offset(8)
|
||||||
}
|
}
|
||||||
|
|
||||||
addSubview(stackView)
|
titleLabel.snp.makeConstraints { make in
|
||||||
stackView.snp.makeConstraints { make in
|
make.centerY.equalToSuperview()
|
||||||
make.left.equalToSuperview().offset(8)
|
make.left.equalTo(leftStar.snp.right).offset(5)
|
||||||
|
}
|
||||||
|
|
||||||
|
rightStar.snp.makeConstraints { make in
|
||||||
|
make.centerY.equalToSuperview()
|
||||||
|
make.left.equalTo(titleLabel.snp.right).offset(5)
|
||||||
make.right.equalToSuperview().offset(-8)
|
make.right.equalToSuperview().offset(-8)
|
||||||
make.top.equalToSuperview().offset(4)
|
|
||||||
make.bottom.equalToSuperview().offset(-4)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -316,13 +322,29 @@ extension FAPayRetainAlert {
|
|||||||
final class FAPayRetainPackCell: UICollectionViewCell {
|
final class FAPayRetainPackCell: UICollectionViewCell {
|
||||||
static let reuseIdentifier = "FAPayRetainPackCell"
|
static let reuseIdentifier = "FAPayRetainPackCell"
|
||||||
|
|
||||||
private let bgView = FAGradientView()
|
private lazy var bgView: UIImageView = {
|
||||||
|
let imageView = UIImageView(image: UIImage(named: FAPayRetainAlertData.Assets.cellBackground))
|
||||||
|
return imageView
|
||||||
|
}()
|
||||||
private let selectedBorderView = UIView()
|
private let selectedBorderView = UIView()
|
||||||
private let giftImageView = UIImageView(image: UIImage(named: FAPayRetainAlertData.Assets.giftIcon))
|
|
||||||
private let coinIconView = UIImageView(image: UIImage(named: FAPayRetainAlertData.Assets.coinIcon))
|
private let coinIconView = UIImageView(image: UIImage(named: FAPayRetainAlertData.Assets.coinIcon))
|
||||||
private let coinLabel = UILabel()
|
private let coinLabel = UILabel()
|
||||||
private let bonusLabel = UILabel()
|
private let bonusLabel = UILabel()
|
||||||
private let priceView = FAGradientView()
|
private lazy var priceView: FAGradientView = {
|
||||||
|
let view = FAGradientView()
|
||||||
|
view.fa_colors = [
|
||||||
|
UIColor.fa_hex(0x3071FF).cgColor,
|
||||||
|
UIColor.fa_hex(0x6DB6FF).cgColor
|
||||||
|
]
|
||||||
|
view.fa_locations = [0, 1]
|
||||||
|
view.fa_startPoint = .init(x: 0, y: 0.5)
|
||||||
|
view.fa_endPoint = .init(x: 1, y: 0.5)
|
||||||
|
view.layer.cornerRadius = FAPayRetainAlertData.Layout.priceSize.height / 2
|
||||||
|
view.layer.masksToBounds = true
|
||||||
|
view.layer.borderWidth = 1
|
||||||
|
view.layer.borderColor = UIColor.fa_hex(0xFFFFFF).cgColor
|
||||||
|
return view
|
||||||
|
}()
|
||||||
private let priceLabel = UILabel()
|
private let priceLabel = UILabel()
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
@ -335,23 +357,19 @@ final class FAPayRetainPackCell: UICollectionViewCell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 绑定套餐数据和选中状态
|
// 绑定套餐数据和选中状态
|
||||||
func configure(with item: FAPayRetainAlertData.PackItem, isSelected: Bool) {
|
func configure(with item: FAPayItem?, isSelected: Bool) {
|
||||||
coinLabel.text = "\(item.coinCount)"
|
|
||||||
bonusLabel.text = item.bonusText
|
|
||||||
priceLabel.text = item.priceText
|
|
||||||
selectedBorderView.isHidden = !isSelected
|
selectedBorderView.isHidden = !isSelected
|
||||||
|
guard let item = item else { return }
|
||||||
|
|
||||||
|
coinLabel.text = "\(item.coins ?? 0)"
|
||||||
|
bonusLabel.text = "+\((item.ext_info?.max_total_coins_pop ?? 0) - (item.ext_info?.max_total_coins ?? 0)) " + "fableon_free_coins".localized
|
||||||
|
priceLabel.text = "\(item.currency ?? "")\(item.price ?? "")"
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setupView() {
|
private func setupView() {
|
||||||
contentView.backgroundColor = .clear
|
contentView.backgroundColor = .clear
|
||||||
|
|
||||||
bgView.fa_colors = [
|
|
||||||
UIColor.fa_hex(0xF6F9FF).cgColor,
|
|
||||||
UIColor.fa_hex(0x4583FF).cgColor
|
|
||||||
]
|
|
||||||
bgView.fa_locations = [0, 1]
|
|
||||||
bgView.fa_startPoint = .init(x: 0.5, y: 0)
|
|
||||||
bgView.fa_endPoint = .init(x: 0.5, y: 1)
|
|
||||||
bgView.layer.cornerRadius = 15
|
bgView.layer.cornerRadius = 15
|
||||||
bgView.layer.masksToBounds = true
|
bgView.layer.masksToBounds = true
|
||||||
|
|
||||||
@ -360,7 +378,6 @@ final class FAPayRetainPackCell: UICollectionViewCell {
|
|||||||
selectedBorderView.layer.borderColor = UIColor.fa_hex(0x1F8FFF).cgColor
|
selectedBorderView.layer.borderColor = UIColor.fa_hex(0x1F8FFF).cgColor
|
||||||
selectedBorderView.isHidden = true
|
selectedBorderView.isHidden = true
|
||||||
|
|
||||||
giftImageView.contentMode = .scaleAspectFit
|
|
||||||
|
|
||||||
coinIconView.contentMode = .scaleAspectFit
|
coinIconView.contentMode = .scaleAspectFit
|
||||||
|
|
||||||
@ -370,17 +387,7 @@ final class FAPayRetainPackCell: UICollectionViewCell {
|
|||||||
bonusLabel.font = .font(ofSize: 12, weight: .medium)
|
bonusLabel.font = .font(ofSize: 12, weight: .medium)
|
||||||
bonusLabel.textColor = .FFFFFF
|
bonusLabel.textColor = .FFFFFF
|
||||||
|
|
||||||
priceView.fa_colors = [
|
|
||||||
UIColor.fa_hex(0x3071FF).cgColor,
|
|
||||||
UIColor.fa_hex(0x4583FF).cgColor
|
|
||||||
]
|
|
||||||
priceView.fa_locations = [0, 1]
|
|
||||||
priceView.fa_startPoint = .init(x: 0, y: 0.5)
|
|
||||||
priceView.fa_endPoint = .init(x: 1, y: 0.5)
|
|
||||||
priceView.layer.cornerRadius = FAPayRetainAlertData.Layout.priceSize.height / 2
|
|
||||||
priceView.layer.masksToBounds = true
|
|
||||||
priceView.layer.borderWidth = 1
|
|
||||||
priceView.layer.borderColor = UIColor.fa_hex(0xFFFFFF).cgColor
|
|
||||||
|
|
||||||
priceLabel.font = .font(ofSize: 22, weight: .bold)
|
priceLabel.font = .font(ofSize: 22, weight: .bold)
|
||||||
priceLabel.textColor = .FFFFFF
|
priceLabel.textColor = .FFFFFF
|
||||||
@ -392,7 +399,7 @@ final class FAPayRetainPackCell: UICollectionViewCell {
|
|||||||
|
|
||||||
contentView.addSubview(bgView)
|
contentView.addSubview(bgView)
|
||||||
contentView.addSubview(selectedBorderView)
|
contentView.addSubview(selectedBorderView)
|
||||||
bgView.addSubview(giftImageView)
|
|
||||||
bgView.addSubview(coinStack)
|
bgView.addSubview(coinStack)
|
||||||
bgView.addSubview(bonusLabel)
|
bgView.addSubview(bonusLabel)
|
||||||
bgView.addSubview(priceView)
|
bgView.addSubview(priceView)
|
||||||
@ -406,12 +413,6 @@ final class FAPayRetainPackCell: UICollectionViewCell {
|
|||||||
make.edges.equalToSuperview()
|
make.edges.equalToSuperview()
|
||||||
}
|
}
|
||||||
|
|
||||||
giftImageView.snp.makeConstraints { make in
|
|
||||||
make.left.equalToSuperview().offset(6)
|
|
||||||
make.centerY.equalToSuperview()
|
|
||||||
make.width.height.equalTo(FAPayRetainAlertData.Layout.giftSize)
|
|
||||||
}
|
|
||||||
|
|
||||||
coinStack.snp.makeConstraints { make in
|
coinStack.snp.makeConstraints { make in
|
||||||
make.left.equalToSuperview().offset(FAPayRetainAlertData.Layout.coinStackLeft)
|
make.left.equalToSuperview().offset(FAPayRetainAlertData.Layout.coinStackLeft)
|
||||||
make.top.equalToSuperview().offset(FAPayRetainAlertData.Layout.coinStackTop)
|
make.top.equalToSuperview().offset(FAPayRetainAlertData.Layout.coinStackTop)
|
||||||
|
|||||||
@ -12,7 +12,6 @@ enum FAPayRetainAlertData {
|
|||||||
static let titleText = "Exclusive Gift"
|
static let titleText = "Exclusive Gift"
|
||||||
static let countdownPrefix = "Last"
|
static let countdownPrefix = "Last"
|
||||||
static let countdownSuffix = "Don't Miss Out!"
|
static let countdownSuffix = "Don't Miss Out!"
|
||||||
static let bonusTitle = "New User Bonus Bundle"
|
|
||||||
|
|
||||||
static let countdown = Countdown(hours: "03", minutes: "29", seconds: "55")
|
static let countdown = Countdown(hours: "03", minutes: "29", seconds: "55")
|
||||||
|
|
||||||
@ -22,7 +21,7 @@ enum FAPayRetainAlertData {
|
|||||||
PackItem(coinCount: 3500, bonusText: "+700 free coins", priceText: "$4.99")
|
PackItem(coinCount: 3500, bonusText: "+700 free coins", priceText: "$4.99")
|
||||||
]
|
]
|
||||||
|
|
||||||
static let defaultSelectedIndex = 2
|
static let defaultSelectedIndex = -1
|
||||||
static let defaultCenterIndex = 1
|
static let defaultCenterIndex = 1
|
||||||
|
|
||||||
struct Countdown {
|
struct Countdown {
|
||||||
@ -40,8 +39,8 @@ enum FAPayRetainAlertData {
|
|||||||
struct Assets {
|
struct Assets {
|
||||||
// 资源名集中管理,便于从 Assets.xcassets 替换
|
// 资源名集中管理,便于从 Assets.xcassets 替换
|
||||||
static let background = "pay_retain_bg_image"
|
static let background = "pay_retain_bg_image"
|
||||||
static let giftIcon = "pay_retain_gift"
|
static let cellBackground = "pay_retain_cell_bg_image"
|
||||||
static let coinIcon = "pay_retain_coin"
|
static let coinIcon = "coins_icon_11"
|
||||||
static let starIcon = "pay_retain_star"
|
static let starIcon = "pay_retain_star"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,12 +50,12 @@ enum FAPayRetainAlertData {
|
|||||||
static let contentHeight: CGFloat = 515
|
static let contentHeight: CGFloat = 515
|
||||||
static let cardCornerRadius: CGFloat = 22
|
static let cardCornerRadius: CGFloat = 22
|
||||||
|
|
||||||
static let titleTop: CGFloat = 30
|
static let titleTop: CGFloat = 164
|
||||||
static let countdownTop: CGFloat = 72
|
static let countdownTop: CGFloat = 72
|
||||||
static let countdownLeft: CGFloat = 10
|
static let countdownLeft: CGFloat = 10
|
||||||
static let bonusTagTop: CGFloat = 105
|
static let bonusTagTop: CGFloat = 105
|
||||||
static let bonusTagLeft: CGFloat = 22
|
static let bonusTagLeft: CGFloat = 22
|
||||||
static let bonusTagHeight: CGFloat = 24
|
static let bonusTagHeight: CGFloat = 32
|
||||||
|
|
||||||
static let packListTop: CGFloat = 152
|
static let packListTop: CGFloat = 152
|
||||||
static let packListLeft: CGFloat = 10
|
static let packListLeft: CGFloat = 10
|
||||||
|
|||||||
@ -16,6 +16,7 @@ class FAPayDataRequest: NSObject {
|
|||||||
private var payAlertModel: FAPayAlertModel?
|
private var payAlertModel: FAPayAlertModel?
|
||||||
|
|
||||||
private var completerBlock: ((_ model: FAPayDateModel?) -> Void)?
|
private var completerBlock: ((_ model: FAPayDateModel?) -> Void)?
|
||||||
|
private var payRetainBlock: ((_ model: FAPayDateModel?) -> Void)?
|
||||||
private var payAlertBlock: ((_ model: FAPayAlertModel?) -> Void)?
|
private var payAlertBlock: ((_ model: FAPayAlertModel?) -> Void)?
|
||||||
|
|
||||||
private var isLoding = false
|
private var isLoding = false
|
||||||
@ -104,21 +105,23 @@ class FAPayDataRequest: NSObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func requestPayRetainInfo(completer: ((_ model: FAPayAlertModel?) -> Void)?) {
|
func requestPayRetainInfo(completer: ((_ model: FAPayDateModel?) -> Void)?) {
|
||||||
self.completerBlock = nil
|
self.payRetainBlock = completer
|
||||||
self.payAlertBlock = completer
|
|
||||||
|
|
||||||
FAStoreAPI.requestPayRetainInfo { [weak self] model in
|
FAStoreAPI.requestPayRetainInfo { [weak self] model in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
guard let model = model else {
|
guard let model = model else {
|
||||||
self.payAlertBlock?(nil)
|
self.payRetainBlock?(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.payAlertModel = model
|
self.oldTemplateModel = model
|
||||||
|
|
||||||
let productId = FAIapManager.manager.getProductId(templateId: model.info?.ios_template_id) ?? ""
|
var productIdArr: [String] = []
|
||||||
|
model.list_coins?.forEach { item in
|
||||||
|
productIdArr.append(FAIapManager.manager.getProductId(templateId: item.ios_template_id) ?? "")
|
||||||
|
}
|
||||||
|
|
||||||
let set = Set([productId])
|
let set = Set(productIdArr)
|
||||||
let productsRequest = SKProductsRequest(productIdentifiers: set)
|
let productsRequest = SKProductsRequest(productIdentifiers: set)
|
||||||
productsRequest.delegate = self
|
productsRequest.delegate = self
|
||||||
productsRequest.start()
|
productsRequest.start()
|
||||||
@ -136,7 +139,7 @@ extension FAPayDataRequest: SKProductsRequestDelegate {
|
|||||||
}
|
}
|
||||||
let products = response.products
|
let products = response.products
|
||||||
|
|
||||||
if let block = self.completerBlock {
|
if self.completerBlock != nil || self.payRetainBlock != nil {
|
||||||
guard let templateModel = self.oldTemplateModel else { return }
|
guard let templateModel = self.oldTemplateModel else { return }
|
||||||
|
|
||||||
var newCoinList: [FAPayItem] = []
|
var newCoinList: [FAPayItem] = []
|
||||||
@ -174,11 +177,17 @@ extension FAPayDataRequest: SKProductsRequestDelegate {
|
|||||||
templateModel.list_sub_vip = newVipList
|
templateModel.list_sub_vip = newVipList
|
||||||
|
|
||||||
self.newTemplateModel = templateModel
|
self.newTemplateModel = templateModel
|
||||||
FAIapManager.manager.payDateModel = templateModel
|
|
||||||
|
|
||||||
|
if let block = self.completerBlock {
|
||||||
|
FAIapManager.manager.payDateModel = templateModel
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
block(templateModel)
|
block(templateModel)
|
||||||
}
|
}
|
||||||
|
} else if let block = self.payRetainBlock {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
block(templateModel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else if let block = self.payAlertBlock {
|
} else if let block = self.payAlertBlock {
|
||||||
guard let coinalertModel = self.payAlertModel else { return }
|
guard let coinalertModel = self.payAlertModel else { return }
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "0xFF",
|
||||||
|
"green" : "0xD0",
|
||||||
|
"red" : "0x9E"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Fableon/Source/Assets.xcassets/image/coins_icon_11.imageset/Contents.json
vendored
Normal file
22
Fableon/Source/Assets.xcassets/image/coins_icon_11.imageset/Contents.json
vendored
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Fableon/Source/Assets.xcassets/image/coins_icon_11.imageset/金币@2x.png
vendored
Normal file
BIN
Fableon/Source/Assets.xcassets/image/coins_icon_11.imageset/金币@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
BIN
Fableon/Source/Assets.xcassets/image/coins_icon_11.imageset/金币@3x.png
vendored
Normal file
BIN
Fableon/Source/Assets.xcassets/image/coins_icon_11.imageset/金币@3x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
44
Fableon/Source/Assets.xcassets/image/pay_retain_cell_bg_image.imageset/Contents.json
vendored
Normal file
44
Fableon/Source/Assets.xcassets/image/pay_retain_cell_bg_image.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "卡片bj@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"resizing" : {
|
||||||
|
"cap-insets" : {
|
||||||
|
"left" : 169,
|
||||||
|
"right" : 325
|
||||||
|
},
|
||||||
|
"center" : {
|
||||||
|
"mode" : "tile",
|
||||||
|
"width" : 1
|
||||||
|
},
|
||||||
|
"mode" : "3-part-horizontal"
|
||||||
|
},
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "卡片bj@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"resizing" : {
|
||||||
|
"cap-insets" : {
|
||||||
|
"left" : 243,
|
||||||
|
"right" : 459
|
||||||
|
},
|
||||||
|
"center" : {
|
||||||
|
"mode" : "tile",
|
||||||
|
"width" : 1
|
||||||
|
},
|
||||||
|
"mode" : "3-part-horizontal"
|
||||||
|
},
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Fableon/Source/Assets.xcassets/image/pay_retain_cell_bg_image.imageset/卡片bj@2x.png
vendored
Normal file
BIN
Fableon/Source/Assets.xcassets/image/pay_retain_cell_bg_image.imageset/卡片bj@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
BIN
Fableon/Source/Assets.xcassets/image/pay_retain_cell_bg_image.imageset/卡片bj@3x.png
vendored
Normal file
BIN
Fableon/Source/Assets.xcassets/image/pay_retain_cell_bg_image.imageset/卡片bj@3x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 152 KiB |
22
Fableon/Source/Assets.xcassets/image/pay_retain_star.imageset/Contents.json
vendored
Normal file
22
Fableon/Source/Assets.xcassets/image/pay_retain_star.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "star@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "star@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Fableon/Source/Assets.xcassets/image/pay_retain_star.imageset/star@2x.png
vendored
Normal file
BIN
Fableon/Source/Assets.xcassets/image/pay_retain_star.imageset/star@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 287 B |
BIN
Fableon/Source/Assets.xcassets/image/pay_retain_star.imageset/star@3x.png
vendored
Normal file
BIN
Fableon/Source/Assets.xcassets/image/pay_retain_star.imageset/star@3x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 402 B |
@ -98,6 +98,7 @@
|
|||||||
"fableon_kick_out_login" = "Your account is already logged in on another device~";
|
"fableon_kick_out_login" = "Your account is already logged in on another device~";
|
||||||
"fableon_rabkings" = "Rankings";
|
"fableon_rabkings" = "Rankings";
|
||||||
"fableon_recommended_for_you" = "Recommended for you";
|
"fableon_recommended_for_you" = "Recommended for you";
|
||||||
|
"fableon_free_coins" = "free coins";
|
||||||
|
|
||||||
"remove_collect_alert_title" = "Remove from Favorites?";
|
"remove_collect_alert_title" = "Remove from Favorites?";
|
||||||
"remove_collect_alert_text" = "This drama will be removed from your favorites.";
|
"remove_collect_alert_text" = "This drama will be removed from your favorites.";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user