挽留弹窗开发 1.0.5开发
This commit is contained in:
parent
d8fd08c58c
commit
9bf3fa9b0f
@ -2755,7 +2755,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.4;
|
MARKETING_VERSION = 1.0.5;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.hn.qinjiu.fableon;
|
PRODUCT_BUNDLE_IDENTIFIER = com.hn.qinjiu.fableon;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
@ -2797,7 +2797,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.4;
|
MARKETING_VERSION = 1.0.5;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.hn.qinjiu.fableon;
|
PRODUCT_BUNDLE_IDENTIFIER = com.hn.qinjiu.fableon;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
|
|||||||
@ -245,6 +245,11 @@ extension FAShortDetailViewModel {
|
|||||||
|
|
||||||
let view = FAPayRetainAlert()
|
let view = FAPayRetainAlert()
|
||||||
view.model = model
|
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)
|
view.show(in: FATool.keyWindow)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,8 @@ import SnapKit
|
|||||||
import YYText
|
import YYText
|
||||||
|
|
||||||
class FAPayRetainAlert: FABaseAlert {
|
class FAPayRetainAlert: FABaseAlert {
|
||||||
|
|
||||||
|
var buyFinishHandle: (() -> Void)?
|
||||||
|
|
||||||
var model: FAPayDateModel? {
|
var model: FAPayDateModel? {
|
||||||
didSet {
|
didSet {
|
||||||
@ -20,6 +22,12 @@ class FAPayRetainAlert: FABaseAlert {
|
|||||||
bonusTagView.update(text: model?.retrieve_lang?.subtitle ?? "")
|
bonusTagView.update(text: model?.retrieve_lang?.subtitle ?? "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var videoInfo: FAVideoInfoModel? {
|
||||||
|
didSet {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private var selectedIndex = FAPayRetainAlertData.defaultSelectedIndex
|
private var selectedIndex = FAPayRetainAlertData.defaultSelectedIndex
|
||||||
|
|
||||||
@ -152,6 +160,17 @@ extension FAPayRetainAlert: UICollectionViewDataSource, UICollectionViewDelegate
|
|||||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||||
selectedIndex = indexPath.item
|
selectedIndex = indexPath.item
|
||||||
collectionView.reloadData()
|
collectionView.reloadData()
|
||||||
|
|
||||||
|
guard let item = self.model?.list_coins?[indexPath.row] else { return }
|
||||||
|
|
||||||
|
FAIapManager.manager.start(model: item, shortPlayId: self.videoInfo?.short_play_id, videoId: self.videoInfo?.short_play_video_id) { [weak self] finish in
|
||||||
|
guard let self = self else { return }
|
||||||
|
if finish {
|
||||||
|
FALogin.manager.requestUserInfo(completer: nil)
|
||||||
|
self.dismiss()
|
||||||
|
self.buyFinishHandle?()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +188,18 @@ extension FAPayRetainAlert {
|
|||||||
private static let countdownEndTimeKey = "FAPayRetainCountdownEndTime"
|
private static let countdownEndTimeKey = "FAPayRetainCountdownEndTime"
|
||||||
private var countdownTimer: Timer?
|
private var countdownTimer: Timer?
|
||||||
private var remainingSeconds: Int = 0
|
private var remainingSeconds: Int = 0
|
||||||
|
|
||||||
|
private lazy var resolveEndTime: TimeInterval = {
|
||||||
|
let defaults = UserDefaults.standard
|
||||||
|
let now = Date().timeIntervalSince1970
|
||||||
|
let storedEndTime = defaults.double(forKey: Self.countdownEndTimeKey)
|
||||||
|
if storedEndTime > now {
|
||||||
|
return storedEndTime
|
||||||
|
}
|
||||||
|
let newEndTime = now + TimeInterval(Self.defaultCountdownSeconds)
|
||||||
|
defaults.set(newEndTime, forKey: Self.countdownEndTimeKey)
|
||||||
|
return newEndTime
|
||||||
|
}()
|
||||||
|
|
||||||
private let prefixLabel = UILabel()
|
private let prefixLabel = UILabel()
|
||||||
private let suffixLabel = UILabel()
|
private let suffixLabel = UILabel()
|
||||||
@ -253,7 +284,7 @@ extension FAPayRetainAlert {
|
|||||||
// 每次展示时从 4 小时开始倒计时
|
// 每次展示时从 4 小时开始倒计时
|
||||||
private func startCountdown() {
|
private func startCountdown() {
|
||||||
stopCountdown()
|
stopCountdown()
|
||||||
let endTime = resolveEndTime()
|
let endTime = self.resolveEndTime
|
||||||
remainingSeconds = max(0, Int(endTime - Date().timeIntervalSince1970))
|
remainingSeconds = max(0, Int(endTime - Date().timeIntervalSince1970))
|
||||||
updateTimeLabels()
|
updateTimeLabels()
|
||||||
guard remainingSeconds > 0 else {
|
guard remainingSeconds > 0 else {
|
||||||
@ -281,19 +312,14 @@ extension FAPayRetainAlert {
|
|||||||
updateTimeLabels()
|
updateTimeLabels()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func resolveEndTime() -> TimeInterval {
|
|
||||||
let defaults = UserDefaults.standard
|
|
||||||
let now = Date().timeIntervalSince1970
|
|
||||||
let storedEndTime = defaults.double(forKey: Self.countdownEndTimeKey)
|
|
||||||
if storedEndTime > now {
|
|
||||||
return storedEndTime
|
|
||||||
}
|
|
||||||
let newEndTime = now + TimeInterval(Self.defaultCountdownSeconds)
|
|
||||||
defaults.set(newEndTime, forKey: Self.countdownEndTimeKey)
|
|
||||||
return newEndTime
|
|
||||||
}
|
|
||||||
|
|
||||||
private func updateTimeLabels() {
|
private func updateTimeLabels() {
|
||||||
|
if remainingSeconds <= 0 {
|
||||||
|
self.isHidden = true
|
||||||
|
self.stopCountdown()
|
||||||
|
return
|
||||||
|
}
|
||||||
let hours = remainingSeconds / 3600
|
let hours = remainingSeconds / 3600
|
||||||
let minutes = (remainingSeconds % 3600) / 60
|
let minutes = (remainingSeconds % 3600) / 60
|
||||||
let seconds = remainingSeconds % 60
|
let seconds = remainingSeconds % 60
|
||||||
|
|||||||
@ -107,10 +107,14 @@ class FAPayDataRequest: NSObject {
|
|||||||
|
|
||||||
func requestPayRetainInfo(completer: ((_ model: FAPayDateModel?) -> Void)?) {
|
func requestPayRetainInfo(completer: ((_ model: FAPayDateModel?) -> Void)?) {
|
||||||
self.payRetainBlock = completer
|
self.payRetainBlock = completer
|
||||||
|
self.isLoding = true
|
||||||
|
self.isToast = true
|
||||||
|
FAHUD.show()
|
||||||
|
|
||||||
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 {
|
||||||
|
FAHUD.dismiss()
|
||||||
self.payRetainBlock?(nil)
|
self.payRetainBlock?(nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user