diff --git a/Fableon.xcodeproj/project.pbxproj b/Fableon.xcodeproj/project.pbxproj index 02cc1c1..ed72432 100644 --- a/Fableon.xcodeproj/project.pbxproj +++ b/Fableon.xcodeproj/project.pbxproj @@ -40,6 +40,7 @@ 031FDEEA2EB35D2600F4CAC7 /* FACoinPackCanReceiveModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031FDEE92EB35D2600F4CAC7 /* FACoinPackCanReceiveModel.swift */; }; 031FDEEC2EB35DF600F4CAC7 /* FACoinsPackAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031FDEEB2EB35DF600F4CAC7 /* FACoinsPackAlert.swift */; }; 031FDEEE2EB3682000F4CAC7 /* FAVipRetainAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031FDEED2EB3682000F4CAC7 /* FAVipRetainAlert.swift */; }; + 035589332F161E6E00FAEF4A /* FAPayRetainAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035589322F161E6E00FAEF4A /* FAPayRetainAlert.swift */; }; 039CE6042EAA2621007B5EED /* AppDelegate+FAAdjust.swift in Sources */ = {isa = PBXBuildFile; fileRef = 039CE6032EAA2612007B5EED /* AppDelegate+FAAdjust.swift */; }; 039CE6092EAA2F71007B5EED /* FAAdjustStateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 039CE6082EAA2F62007B5EED /* FAAdjustStateManager.swift */; }; 039CE60B2EAA31CB007B5EED /* FAStatAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 039CE60A2EAA31CB007B5EED /* FAStatAPI.swift */; }; @@ -413,6 +414,7 @@ 031FDEE92EB35D2600F4CAC7 /* FACoinPackCanReceiveModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FACoinPackCanReceiveModel.swift; sourceTree = ""; }; 031FDEEB2EB35DF600F4CAC7 /* FACoinsPackAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FACoinsPackAlert.swift; sourceTree = ""; }; 031FDEED2EB3682000F4CAC7 /* FAVipRetainAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FAVipRetainAlert.swift; sourceTree = ""; }; + 035589322F161E6E00FAEF4A /* FAPayRetainAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FAPayRetainAlert.swift; sourceTree = ""; }; 039CE6032EAA2612007B5EED /* AppDelegate+FAAdjust.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppDelegate+FAAdjust.swift"; sourceTree = ""; }; 039CE6082EAA2F62007B5EED /* FAAdjustStateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FAAdjustStateManager.swift; sourceTree = ""; }; 039CE60A2EAA31CB007B5EED /* FAStatAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FAStatAPI.swift; sourceTree = ""; }; @@ -767,6 +769,7 @@ 03E9A73D2EB460F2000D1067 /* FAApnsAlert.swift */, 03E9A73F2EB49BE6000D1067 /* FAUpdatesAlert.swift */, 03E9A7472EB5D2CB000D1067 /* FALogoutAlert.swift */, + 035589322F161E6E00FAEF4A /* FAPayRetainAlert.swift */, ); path = Alert; sourceTree = ""; @@ -2370,6 +2373,7 @@ 031FDEDC2EB3141E00F4CAC7 /* FASettingFooterView.swift in Sources */, 031FDEBE2EB0C99900F4CAC7 /* FANewVideoRechargeView.swift in Sources */, 03E239932EAA1A29004A8CEC /* Date+FAAdd.swift in Sources */, + 035589332F161E6E00FAEF4A /* FAPayRetainAlert.swift in Sources */, 031FDEDA2EB30D6E00F4CAC7 /* FASettingCell.swift in Sources */, 03E239942EAA1A29004A8CEC /* UserDefaults+FAAdd.swift in Sources */, 039CE6322EAB796F007B5EED /* FALabel.swift in Sources */, diff --git a/Fableon.xcodeproj/xcshareddata/xcschemes/FAWidgetExtension.xcscheme b/Fableon.xcodeproj/xcshareddata/xcschemes/FAWidgetExtension.xcscheme new file mode 100644 index 0000000..126b2a0 --- /dev/null +++ b/Fableon.xcodeproj/xcshareddata/xcschemes/FAWidgetExtension.xcscheme @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Fableon.xcodeproj/xcshareddata/xcschemes/Fableon.xcscheme b/Fableon.xcodeproj/xcshareddata/xcschemes/Fableon.xcscheme new file mode 100644 index 0000000..4191285 --- /dev/null +++ b/Fableon.xcodeproj/xcshareddata/xcschemes/Fableon.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Fableon.xcodeproj/xcshareddata/xcschemes/NotificationService.xcscheme b/Fableon.xcodeproj/xcshareddata/xcschemes/NotificationService.xcscheme new file mode 100644 index 0000000..0dba553 --- /dev/null +++ b/Fableon.xcodeproj/xcshareddata/xcschemes/NotificationService.xcscheme @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Fableon/Object/Base/Request/FAAPI/FAStoreAPI.swift b/Fableon/Object/Base/Request/FAAPI/FAStoreAPI.swift index 5a9083f..9e44e69 100644 --- a/Fableon/Object/Base/Request/FAAPI/FAStoreAPI.swift +++ b/Fableon/Object/Base/Request/FAAPI/FAStoreAPI.swift @@ -197,4 +197,21 @@ class FAStoreAPI: NSObject { } } } + + ///挽留支付项 + static func requestPayRetainInfo(completer: ((_ model: FAPayAlertModel?) -> Void)?) { + + FANetworkManager.manager.request(FABaseURL + "/payRetrieveSettings", + method: .get, + parameters: nil, + isLoding: true, + isToast: true, + ) { (response: FANetworkManager.Response) in + if let _ = response.data?.info { + completer?(response.data) + } else { + completer?(nil) + } + } + } } diff --git a/Fableon/Object/Class/Player/VM/FAShortDetailViewModel.swift b/Fableon/Object/Class/Player/VM/FAShortDetailViewModel.swift index 74fd689..f431193 100644 --- a/Fableon/Object/Class/Player/VM/FAShortDetailViewModel.swift +++ b/Fableon/Object/Class/Player/VM/FAShortDetailViewModel.swift @@ -201,7 +201,7 @@ extension FAShortDetailViewModel { } view.didDismissHandle = { [weak self] in guard let self = self else { return } - self._showVipRetainAlert(videoInfo) + self._showPayRetainAlert(videoInfo) } view.present(in: nil) self.popView = view @@ -233,6 +233,26 @@ extension FAShortDetailViewModel { view.show(in: FATool.keyWindow) } } + + private func _showPayRetainAlert(_ videoInfo: FAVideoInfoModel) { + let view = FAPayRetainAlert() + 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) +// } + } } extension FAShortDetailViewModel { diff --git a/Fableon/Object/Libs/Alert/FAPayRetainAlert.swift b/Fableon/Object/Libs/Alert/FAPayRetainAlert.swift new file mode 100644 index 0000000..7eda7ae --- /dev/null +++ b/Fableon/Object/Libs/Alert/FAPayRetainAlert.swift @@ -0,0 +1,56 @@ +// +// FAPayRetainAlert.swift +// Fableon +// +// Created by 湖北秦九 on 2026/1/13. +// + +import UIKit + +class FAPayRetainAlert: FABaseAlert { + + private lazy var bgView: UIImageView = { + let imageView = UIImageView(image: UIImage(named: "pay_retain_bg_image")) + return imageView + }() + + private lazy var titleLabel: UILabel = { + let label = UILabel() + + return label + }() + + override init(frame: CGRect) { + super.init(frame: frame) + + + fa_setupLayout() + } + + @MainActor required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +extension FAPayRetainAlert { + + private func fa_setupLayout() { + contentView.backgroundColor = .clear + contentView.layer.cornerRadius = 0 + + contentView.addSubview(bgView) + contentView.addSubview(titleLabel) + + + bgView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + titleLabel.snp.makeConstraints { make in + make.top.equalToSuperview().offset(160) + make.centerX.equalToSuperview() + make.right.lessThanOrEqualToSuperview().offset(-1) + } + } + +} diff --git a/Fableon/Object/Libs/FAIap/FAPayDataRequest.swift b/Fableon/Object/Libs/FAIap/FAPayDataRequest.swift index c8d5397..6ab2954 100644 --- a/Fableon/Object/Libs/FAIap/FAPayDataRequest.swift +++ b/Fableon/Object/Libs/FAIap/FAPayDataRequest.swift @@ -104,6 +104,27 @@ class FAPayDataRequest: NSObject { } } + func requestPayRetainInfo(completer: ((_ model: FAPayAlertModel?) -> Void)?) { + self.completerBlock = nil + self.payAlertBlock = completer + + FAStoreAPI.requestPayRetainInfo { [weak self] model in + guard let self = self else { return } + guard let model = model else { + self.payAlertBlock?(nil) + return + } + self.payAlertModel = model + + let productId = FAIapManager.manager.getProductId(templateId: model.info?.ios_template_id) ?? "" + + let set = Set([productId]) + let productsRequest = SKProductsRequest(productIdentifiers: set) + productsRequest.delegate = self + productsRequest.start() + } + } + } //MARK: SKProductsRequestDelegate diff --git a/Fableon/Source/Assets.xcassets/image/pay_retain_bg_image.imageset/Contents.json b/Fableon/Source/Assets.xcassets/image/pay_retain_bg_image.imageset/Contents.json new file mode 100644 index 0000000..a7c83b6 --- /dev/null +++ b/Fableon/Source/Assets.xcassets/image/pay_retain_bg_image.imageset/Contents.json @@ -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 + } +} diff --git a/Fableon/Source/Assets.xcassets/image/pay_retain_bg_image.imageset/弹窗背景@2x.png b/Fableon/Source/Assets.xcassets/image/pay_retain_bg_image.imageset/弹窗背景@2x.png new file mode 100644 index 0000000..4b392e2 Binary files /dev/null and b/Fableon/Source/Assets.xcassets/image/pay_retain_bg_image.imageset/弹窗背景@2x.png differ diff --git a/Fableon/Source/Assets.xcassets/image/pay_retain_bg_image.imageset/弹窗背景@3x.png b/Fableon/Source/Assets.xcassets/image/pay_retain_bg_image.imageset/弹窗背景@3x.png new file mode 100644 index 0000000..c6e8c48 Binary files /dev/null and b/Fableon/Source/Assets.xcassets/image/pay_retain_bg_image.imageset/弹窗背景@3x.png differ