From dac985f177f1344d3b544e15520aba81cd3683f0 Mon Sep 17 00:00:00 2001 From: zeng Date: Wed, 30 Jul 2025 11:29:42 +0800 Subject: [PATCH] 1 --- BeeReel.xcodeproj/project.pbxproj | 10 ++ BeeReel/Base/Network/API/BRStoreAPI.swift | 27 ++++ BeeReel/BeeReel.entitlements | 6 +- .../BRCoinOrderRecordViewController.swift | 1 + .../BRConsumptionRecordViewController.swift | 39 ++++- .../BRRewardCoinsRecordViewController.swift | 38 ++++- .../BRVipOrderRecordViewController.swift | 38 ++++- .../Model/BRConsumptionRecordsModel.swift | 22 +++ .../Class/Store/Model/BRPayDataRequest.swift | 143 ++++++++---------- .../Store/Model/BRRewardCoinRecordModel.swift | 21 +++ .../Store/View/BRCoinOrderRecordCell.swift | 6 +- .../Store/View/BRConsumptionRecordCell.swift | 13 +- .../Store/View/BRRewardCoinsRecordCell.swift | 23 ++- .../Store/View/BRVipOrderRecordCell.swift | 9 ++ BeeReel/Delegate/AppDelegate+APNS.swift | 34 ++--- BeeReel/Delegate/AppDelegate+Thirdparty.swift | 4 +- BeeReel/Delegate/SceneDelegate+Open.swift | 4 +- BeeReel/Lib/IAP/BRIAP.swift | 2 +- BeeReel/Sources/Localizable.xcstrings | 33 ++++ 19 files changed, 354 insertions(+), 119 deletions(-) create mode 100644 BeeReel/Class/Store/Model/BRConsumptionRecordsModel.swift create mode 100644 BeeReel/Class/Store/Model/BRRewardCoinRecordModel.swift diff --git a/BeeReel.xcodeproj/project.pbxproj b/BeeReel.xcodeproj/project.pbxproj index bacc938..b934be5 100644 --- a/BeeReel.xcodeproj/project.pbxproj +++ b/BeeReel.xcodeproj/project.pbxproj @@ -215,6 +215,8 @@ F39855A32E38D25900E2D28D /* BRWaitRestoreModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39855A22E38D25900E2D28D /* BRWaitRestoreModel.swift */; }; F39855A52E38D2A800E2D28D /* BRIAP.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39855A42E38D2A800E2D28D /* BRIAP.swift */; }; F39855A72E38EE9800E2D28D /* BRRechargeRecordModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39855A62E38EE9800E2D28D /* BRRechargeRecordModel.swift */; }; + F39855A92E39AD7300E2D28D /* BRConsumptionRecordsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39855A82E39AD7300E2D28D /* BRConsumptionRecordsModel.swift */; }; + F39855AB2E39ADEF00E2D28D /* BRRewardCoinRecordModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39855AA2E39ADEF00E2D28D /* BRRewardCoinRecordModel.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -441,6 +443,8 @@ F39855A22E38D25900E2D28D /* BRWaitRestoreModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRWaitRestoreModel.swift; sourceTree = ""; }; F39855A42E38D2A800E2D28D /* BRIAP.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRIAP.swift; sourceTree = ""; }; F39855A62E38EE9800E2D28D /* BRRechargeRecordModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRRechargeRecordModel.swift; sourceTree = ""; }; + F39855A82E39AD7300E2D28D /* BRConsumptionRecordsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRConsumptionRecordsModel.swift; sourceTree = ""; }; + F39855AA2E39ADEF00E2D28D /* BRRewardCoinRecordModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRRewardCoinRecordModel.swift; sourceTree = ""; }; F70FA1F4169364C4C53534CE /* Pods-BeeReel.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BeeReel.release.xcconfig"; path = "Target Support Files/Pods-BeeReel/Pods-BeeReel.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1200,6 +1204,8 @@ F398553D2E336D3000E2D28D /* BRPayDateModel.swift */, F39855532E34A49500E2D28D /* BRPayDataRequest.swift */, F39855A62E38EE9800E2D28D /* BRRechargeRecordModel.swift */, + F39855A82E39AD7300E2D28D /* BRConsumptionRecordsModel.swift */, + F39855AA2E39ADEF00E2D28D /* BRRewardCoinRecordModel.swift */, ); path = Model; sourceTree = ""; @@ -1428,6 +1434,7 @@ F398554A2E33929C00E2D28D /* BRStoreCoinCell.swift in Sources */, F39855842E37705700E2D28D /* AppDelegate+Thirdparty.swift in Sources */, BF3A568C2E30EBA2009E5CF9 /* BRHomePlayRecordButton.swift in Sources */, + F39855A92E39AD7300E2D28D /* BRConsumptionRecordsModel.swift in Sources */, BF692B162E0A7CD600A5C2DA /* BRHUD.swift in Sources */, BF3338F72E16176900B10F76 /* BRDetailPlayerCell.swift in Sources */, BF3338EA2E152B8100B10F76 /* BRPlayerCache.swift in Sources */, @@ -1447,6 +1454,7 @@ BF692AEC2E0A475D00A5C2DA /* SceneDelegate.swift in Sources */, BF692B492E0A9D0E00A5C2DA /* UIView+BRAdd.swift in Sources */, BF02B7F82E2F211A00172177 /* BRHomeCategoriesMainCell.swift in Sources */, + F39855AB2E39ADEF00E2D28D /* BRRewardCoinRecordModel.swift in Sources */, F398559C2E38CF9700E2D28D /* JXIAPManager.swift in Sources */, BF02B8192E2F8B1100172177 /* BRMineCell.swift in Sources */, BFC676812E122733006659E5 /* BRPlayerProtocol.swift in Sources */, @@ -1595,6 +1603,7 @@ INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = ""; + INFOPLIST_KEY_UIRequiredDeviceCapabilities = arm64; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 15.0; @@ -1635,6 +1644,7 @@ INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = ""; + INFOPLIST_KEY_UIRequiredDeviceCapabilities = arm64; INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; IPHONEOS_DEPLOYMENT_TARGET = 15.0; diff --git a/BeeReel/Base/Network/API/BRStoreAPI.swift b/BeeReel/Base/Network/API/BRStoreAPI.swift index 6284106..e4100da 100644 --- a/BeeReel/Base/Network/API/BRStoreAPI.swift +++ b/BeeReel/Base/Network/API/BRStoreAPI.swift @@ -90,4 +90,31 @@ class BRStoreAPI { completer?(response.data) } } + + ///消费记录 + static func requestConsumptionRecords(page: Int, completer: ((_ listModel: BRListModel?) -> Void)?) { + var param = BRNetworkParameters(path: "/getCustomerBuyRecords") + param.method = .get + param.parameters = [ + "page_size" : 20, + "current_page" : page, + ] + + BRNetwork.request(parameters: param) { (response: BRNetworkResponse>) in + completer?(response.data) + } + } + + ///赠币记录 + static func reuqestGiveCoinRecords(page: Int, completer: ((_ listModel: BRListModel?) -> Void)?) { + + var param = BRNetworkParameters(path: "/sendCoinList") + param.parameters = [ + "page_size" : 20, + "current_page" : page + ] + BRNetwork.request(parameters: param) { (response: BRNetworkResponse>) in + completer?(response.data) + } + } } diff --git a/BeeReel/BeeReel.entitlements b/BeeReel/BeeReel.entitlements index f67c43c..fedd412 100644 --- a/BeeReel/BeeReel.entitlements +++ b/BeeReel/BeeReel.entitlements @@ -5,7 +5,11 @@ aps-environment development com.apple.developer.associated-domains - + + applinks:beereel.go.link + applinks:www.breeltv.com + applinks:jyev.adj.st + keychain-access-groups diff --git a/BeeReel/Class/Store/Controller/BRCoinOrderRecordViewController.swift b/BeeReel/Class/Store/Controller/BRCoinOrderRecordViewController.swift index 8a9770c..52eb62c 100644 --- a/BeeReel/Class/Store/Controller/BRCoinOrderRecordViewController.swift +++ b/BeeReel/Class/Store/Controller/BRCoinOrderRecordViewController.swift @@ -26,6 +26,7 @@ class BRCoinOrderRecordViewController: BRViewController, WMZPageProtocol { collectionView.contentInset = .init(top: 0, left: 0, bottom: UIScreen.tabbarSafeBottomMargin + 10, right: 0) collectionView.delegate = self collectionView.dataSource = self + collectionView.ly_emptyView = BREmpty.br_normalEmptyView() collectionView.br_addRefreshBackFooter(insetBottom: collectionView.contentInset.bottom) { [weak self] in self?.handleFooterRefresh(nil) } diff --git a/BeeReel/Class/Store/Controller/BRConsumptionRecordViewController.swift b/BeeReel/Class/Store/Controller/BRConsumptionRecordViewController.swift index 6e7f991..d2fef40 100644 --- a/BeeReel/Class/Store/Controller/BRConsumptionRecordViewController.swift +++ b/BeeReel/Class/Store/Controller/BRConsumptionRecordViewController.swift @@ -9,6 +9,11 @@ import UIKit class BRConsumptionRecordViewController: BRViewController, WMZPageProtocol { + + private lazy var listArr: [BRConsumptionRecordsModel] = [] + private lazy var page = 1 + + private lazy var collectionViewLayout: UICollectionViewFlowLayout = { let layout = UICollectionViewFlowLayout() layout.itemSize = .init(width: UIScreen.width - 30, height: 80) @@ -22,6 +27,7 @@ class BRConsumptionRecordViewController: BRViewController, WMZPageProtocol { collectionView.contentInset = .init(top: 0, left: 0, bottom: UIScreen.tabbarSafeBottomMargin + 10, right: 0) collectionView.delegate = self collectionView.dataSource = self + collectionView.ly_emptyView = BREmpty.br_normalEmptyView() collectionView.br_addRefreshBackFooter(insetBottom: collectionView.contentInset.bottom) { [weak self] in self?.handleFooterRefresh(nil) } @@ -34,6 +40,8 @@ class BRConsumptionRecordViewController: BRViewController, WMZPageProtocol { self.view.backgroundColor = .colorFFFFFF() br_setupUI() + + requestDataList(page: 1, completer: nil) } func getMyScrollView() -> UIScrollView { @@ -41,11 +49,15 @@ class BRConsumptionRecordViewController: BRViewController, WMZPageProtocol { } override func handleHeaderRefresh(_ completer: (() -> Void)?) { - completer?() + self.requestDataList(page: 1) { + completer?() + } } override func handleFooterRefresh(_ completer: (() -> Void)?) { - self.collectionView.br_endFooterRefreshing() + self.requestDataList(page: self.page + 1) { [weak self] in + self?.collectionView.br_endFooterRefreshing() + } } } @@ -65,10 +77,31 @@ extension BRConsumptionRecordViewController { extension BRConsumptionRecordViewController: UICollectionViewDelegate, UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! BRConsumptionRecordCell + cell.model = self.listArr[indexPath.row] return cell } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return 10 + return self.listArr.count } } + +extension BRConsumptionRecordViewController { + + private func requestDataList(page: Int, completer: (() -> Void)?) { + BRStoreAPI.requestConsumptionRecords(page: page) { [weak self] listModel in + guard let self = self else { return } + + if let list = listModel?.list { + if page == 1 { + self.listArr.removeAll() + } + self.listArr += list + self.page = page + self.collectionView.reloadData() + } + completer?() + } + } + +} diff --git a/BeeReel/Class/Store/Controller/BRRewardCoinsRecordViewController.swift b/BeeReel/Class/Store/Controller/BRRewardCoinsRecordViewController.swift index 2d99046..48fbe84 100644 --- a/BeeReel/Class/Store/Controller/BRRewardCoinsRecordViewController.swift +++ b/BeeReel/Class/Store/Controller/BRRewardCoinsRecordViewController.swift @@ -9,6 +9,9 @@ import UIKit class BRRewardCoinsRecordViewController: BRViewController, WMZPageProtocol { + private lazy var listArr: [BRRewardCoinRecordModel] = [] + private lazy var page = 1 + private lazy var collectionViewLayout: UICollectionViewFlowLayout = { let layout = UICollectionViewFlowLayout() layout.itemSize = .init(width: UIScreen.width - 30, height: 80) @@ -22,6 +25,7 @@ class BRRewardCoinsRecordViewController: BRViewController, WMZPageProtocol { collectionView.contentInset = .init(top: 0, left: 0, bottom: UIScreen.tabbarSafeBottomMargin + 10, right: 0) collectionView.delegate = self collectionView.dataSource = self + collectionView.ly_emptyView = BREmpty.br_normalEmptyView() collectionView.br_addRefreshBackFooter(insetBottom: collectionView.contentInset.bottom) { [weak self] in self?.handleFooterRefresh(nil) } @@ -34,6 +38,8 @@ class BRRewardCoinsRecordViewController: BRViewController, WMZPageProtocol { self.view.backgroundColor = .colorFFFFFF() br_setupUI() + + requestDataList(page: 1, completer: nil) } func getMyScrollView() -> UIScrollView { @@ -41,13 +47,16 @@ class BRRewardCoinsRecordViewController: BRViewController, WMZPageProtocol { } override func handleHeaderRefresh(_ completer: (() -> Void)?) { - completer?() + self.requestDataList(page: 1) { + completer?() + } } override func handleFooterRefresh(_ completer: (() -> Void)?) { - self.collectionView.br_endFooterRefreshing() + self.requestDataList(page: self.page + 1) { [weak self] in + self?.collectionView.br_endFooterRefreshing() + } } - } extension BRRewardCoinsRecordViewController { @@ -66,10 +75,31 @@ extension BRRewardCoinsRecordViewController { extension BRRewardCoinsRecordViewController: UICollectionViewDelegate, UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! BRRewardCoinsRecordCell + cell.model = listArr[indexPath.row] return cell } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return 10 + return self.listArr.count } } + +extension BRRewardCoinsRecordViewController { + + private func requestDataList(page: Int, completer: (() -> Void)?) { + BRStoreAPI.reuqestGiveCoinRecords(page: page) { [weak self] listModel in + guard let self = self else { return } + + if let list = listModel?.list { + if page == 1 { + self.listArr.removeAll() + } + self.listArr += list + self.page = page + self.collectionView.reloadData() + } + completer?() + } + } + +} diff --git a/BeeReel/Class/Store/Controller/BRVipOrderRecordViewController.swift b/BeeReel/Class/Store/Controller/BRVipOrderRecordViewController.swift index da35c43..83b79c1 100644 --- a/BeeReel/Class/Store/Controller/BRVipOrderRecordViewController.swift +++ b/BeeReel/Class/Store/Controller/BRVipOrderRecordViewController.swift @@ -9,7 +9,8 @@ import UIKit class BRVipOrderRecordViewController: BRViewController, WMZPageProtocol { - + private lazy var listArr: [BRRechargeRecordModel] = [] + private lazy var page = 1 private lazy var collectionViewLayout: UICollectionViewFlowLayout = { let layout = UICollectionViewFlowLayout() @@ -24,6 +25,7 @@ class BRVipOrderRecordViewController: BRViewController, WMZPageProtocol { collectionView.contentInset = .init(top: 0, left: 0, bottom: UIScreen.tabbarSafeBottomMargin + 10, right: 0) collectionView.delegate = self collectionView.dataSource = self + collectionView.ly_emptyView = BREmpty.br_normalEmptyView() collectionView.br_addRefreshBackFooter(insetBottom: collectionView.contentInset.bottom) { [weak self] in self?.handleFooterRefresh(nil) } @@ -36,6 +38,8 @@ class BRVipOrderRecordViewController: BRViewController, WMZPageProtocol { self.view.backgroundColor = .colorFFFFFF() br_setupUI() + + requestDataList(page: 1, completer: nil) } func getMyScrollView() -> UIScrollView { @@ -43,11 +47,15 @@ class BRVipOrderRecordViewController: BRViewController, WMZPageProtocol { } override func handleHeaderRefresh(_ completer: (() -> Void)?) { - completer?() + self.requestDataList(page: 1) { + completer?() + } } override func handleFooterRefresh(_ completer: (() -> Void)?) { - self.collectionView.br_endFooterRefreshing() + self.requestDataList(page: self.page + 1) { [weak self] in + self?.collectionView.br_endFooterRefreshing() + } } } @@ -69,12 +77,34 @@ extension BRVipOrderRecordViewController: UICollectionViewDelegate, UICollection func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! BRVipOrderRecordCell + cell.model = self.listArr[indexPath.row] return cell } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return 10 + return self.listArr.count } } +extension BRVipOrderRecordViewController { + + private func requestDataList(page: Int, completer: (() -> Void)?) { + BRStoreAPI.requestRechargeRecord(buyType: .subVip, page: page) { [weak self] listModel in + guard let self = self else { return } + + if let list = listModel?.list { + if page == 1 { + self.listArr.removeAll() + } + self.listArr += list + self.page = page + self.collectionView.reloadData() + } + completer?() + } + } + +} + + diff --git a/BeeReel/Class/Store/Model/BRConsumptionRecordsModel.swift b/BeeReel/Class/Store/Model/BRConsumptionRecordsModel.swift new file mode 100644 index 0000000..5bd9ad0 --- /dev/null +++ b/BeeReel/Class/Store/Model/BRConsumptionRecordsModel.swift @@ -0,0 +1,22 @@ +// +// BRConsumptionRecordsModel.swift +// BeeReel +// +// Created by 长沙鸿瑶 on 2025/7/30. +// + +import UIKit +import SmartCodable + +class BRConsumptionRecordsModel: BRModel, SmartCodable { + + var created_at: String? + var short_play_id: String? + var coins: Int? + var image_url: String? + var name: String? + var coin_type: Int? + var short_play_video_id: String? + var episode: String? + +} diff --git a/BeeReel/Class/Store/Model/BRPayDataRequest.swift b/BeeReel/Class/Store/Model/BRPayDataRequest.swift index 700922d..fd03d95 100644 --- a/BeeReel/Class/Store/Model/BRPayDataRequest.swift +++ b/BeeReel/Class/Store/Model/BRPayDataRequest.swift @@ -27,88 +27,79 @@ class BRPayDataRequest: NSObject { BRHUD.show() } - BRStoreAPI.requestPayTemplate { [weak self] model in + BRStoreAPI.requestPayTemplate(isToast: isToast) { [weak self] model in guard let self = self else { return } - if isLoding { - BRHUD.dismiss() + guard let model = model else { + if isLoding { + BRHUD.dismiss() + } + self.completerBlock?(nil) + return } - completer?(model) + self.oldTemplateModel = model + + var productIdArr: [String] = [] + model.list_sub_vip?.forEach { item in + productIdArr.append(BRIAP.manager.getProductId(templateId: item.ios_template_id) ?? "") + } + model.list_coins?.forEach { item in + productIdArr.append(BRIAP.manager.getProductId(templateId: item.ios_template_id) ?? "") + } + + let set = Set(productIdArr) + let productsRequest = SKProductsRequest(productIdentifiers: set) + productsRequest.delegate = self + productsRequest.start() } - -// BRStoreAPI.requestPayTemplate(isToast: isToast) { [weak self] model in -// guard let self = self else { return } -// guard let model = model else { -// if isLoding { -// VPHUD.dismiss() -// } -// self.completerBlock?(nil) -// return -// } -// self.oldTemplateModel = model -// -// var productIdArr: [String] = [] -// model.list_sub_vip?.forEach { item in -// productIdArr.append(VPIAPManager.manager.getProductId(templateId: item.ios_template_id) ?? "") -// } -// model.list_coins?.forEach { item in -// productIdArr.append(VPIAPManager.manager.getProductId(templateId: item.ios_template_id) ?? "") -// } -// -// let set = Set(productIdArr) -// let productsRequest = SKProductsRequest(productIdentifiers: set) -// productsRequest.delegate = self -// productsRequest.start() -// -// } } } -/* - //MARK: -------------- SKProductsRequestDelegate -------------- - extension BRPayDataRequest: SKProductsRequestDelegate { - - func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) { - if isLoding { - VPHUD.dismiss() - } - - guard let templateModel = self.oldTemplateModel else { return } - let products = response.products - - var newCoinList: [VPPayTemplateItem] = [] - var newVipList: [VPPayTemplateItem] = [] - - templateModel.list_coins?.forEach { item in - let productId = VPIAPManager.manager.getProductId(templateId: item.ios_template_id) ?? "" - for product in products { - if productId == product.productIdentifier { - item.price = product.price.stringValue - item.currency = product.priceLocale.currencySymbol - newCoinList.append(item) - break - } - } - } - templateModel.list_sub_vip?.forEach { item in - let productId = VPIAPManager.manager.getProductId(templateId: item.ios_template_id) ?? "" - for product in products { - if productId == product.productIdentifier { - item.price = product.price.stringValue - item.currency = product.priceLocale.currencySymbol - newVipList.append(item) - break - } - } - } - templateModel.list_coins = newCoinList - templateModel.list_sub_vip = newVipList - - DispatchQueue.main.async { - self.completerBlock?(templateModel) - } - } - } - */ +//MARK: -------------- SKProductsRequestDelegate -------------- +extension BRPayDataRequest: SKProductsRequestDelegate { + + func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) { + if isLoding { + BRHUD.dismiss() + } + + guard let templateModel = self.oldTemplateModel else { return } + let products = response.products + + var newCoinList: [BRPayItem] = [] + var newVipList: [BRPayItem] = [] + + templateModel.list_coins?.forEach { item in + let productId = BRIAP.manager.getProductId(templateId: item.ios_template_id) ?? "" + for product in products { + if productId == product.productIdentifier { + item.price = product.price.stringValue + item.currency = product.priceLocale.currencySymbol + newCoinList.append(item) + break + } + } + } + templateModel.list_sub_vip?.forEach { item in + let productId = BRIAP.manager.getProductId(templateId: item.ios_template_id) ?? "" + for product in products { + if productId == product.productIdentifier { + item.price = product.price.stringValue + item.currency = product.priceLocale.currencySymbol + newVipList.append(item) + break + } + } + } + templateModel.list_coins = newCoinList + templateModel.list_sub_vip = newVipList + + DispatchQueue.main.async { + self.completerBlock?(templateModel) + } + } +} + + diff --git a/BeeReel/Class/Store/Model/BRRewardCoinRecordModel.swift b/BeeReel/Class/Store/Model/BRRewardCoinRecordModel.swift new file mode 100644 index 0000000..ba3f5ae --- /dev/null +++ b/BeeReel/Class/Store/Model/BRRewardCoinRecordModel.swift @@ -0,0 +1,21 @@ +// +// BRRewardCoinRecordModel.swift +// BeeReel +// +// Created by 长沙鸿瑶 on 2025/7/30. +// + +import UIKit +import SmartCodable + +class BRRewardCoinRecordModel: BRModel, SmartCodable { + + var id: String? + var type: String? + var coins: Int? + var left_coins: String? + var created_at: String? + var diff_datetime: String? + var expired_time: TimeInterval? + +} diff --git a/BeeReel/Class/Store/View/BRCoinOrderRecordCell.swift b/BeeReel/Class/Store/View/BRCoinOrderRecordCell.swift index 1bacb82..435d538 100644 --- a/BeeReel/Class/Store/View/BRCoinOrderRecordCell.swift +++ b/BeeReel/Class/Store/View/BRCoinOrderRecordCell.swift @@ -11,7 +11,9 @@ class BRCoinOrderRecordCell: BRCollectionViewCell { var model: BRRechargeRecordModel? { didSet { - + titleLabel.text = model?.type + timeLabel.text = model?.created_at + coinView.setNeedsUpdateConfiguration() } } @@ -35,7 +37,7 @@ class BRCoinOrderRecordCell: BRCollectionViewCell { button.configurationUpdateHandler = { [weak self] button in guard let self = self else { return } - button.configuration?.attributedTitle = AttributedString.br_createAttributedString(string: "+60", color: .color7ECD5E(), font: .fontMedium(ofSize: 15)) + button.configuration?.attributedTitle = AttributedString.br_createAttributedString(string: "+\(model?.value ?? "0")", color: .color7ECD5E(), font: .fontMedium(ofSize: 15)) } return button }() diff --git a/BeeReel/Class/Store/View/BRConsumptionRecordCell.swift b/BeeReel/Class/Store/View/BRConsumptionRecordCell.swift index 5ea4279..826bfe2 100644 --- a/BeeReel/Class/Store/View/BRConsumptionRecordCell.swift +++ b/BeeReel/Class/Store/View/BRConsumptionRecordCell.swift @@ -9,12 +9,21 @@ import UIKit class BRConsumptionRecordCell: BRCollectionViewCell { + var model: BRConsumptionRecordsModel? { + didSet { + timeLabel.text = model?.created_at + let episode = "EP.##".localizedReplace(text: "\(model?.episode ?? "0")") + "\(model?.name ?? "")" + contentLabel.text = episode + + coinView.setNeedsUpdateConfiguration() + } + } private lazy var titleLabel: UILabel = { let label = UILabel() label.font = .fontRegular(ofSize: 14) label.textColor = .color1C1C1C() - label.text = "Purchase Single Episode" + label.text = "Purchase Single Episode".localized return label }() @@ -48,7 +57,7 @@ class BRConsumptionRecordCell: BRCollectionViewCell { button.configurationUpdateHandler = { [weak self] button in guard let self = self else { return } - button.configuration?.attributedTitle = AttributedString.br_createAttributedString(string: "-60", color: .color7ECD5E(), font: .fontMedium(ofSize: 15)) + button.configuration?.attributedTitle = AttributedString.br_createAttributedString(string: "-\(model?.coins ?? 0)", color: .color7ECD5E(), font: .fontMedium(ofSize: 15)) } return button }() diff --git a/BeeReel/Class/Store/View/BRRewardCoinsRecordCell.swift b/BeeReel/Class/Store/View/BRRewardCoinsRecordCell.swift index 2fc9e12..256d368 100644 --- a/BeeReel/Class/Store/View/BRRewardCoinsRecordCell.swift +++ b/BeeReel/Class/Store/View/BRRewardCoinsRecordCell.swift @@ -9,11 +9,28 @@ import UIKit class BRRewardCoinsRecordCell: BRCollectionViewCell { + var model: BRRewardCoinRecordModel? { + didSet { + titleLabel.text = model?.type + timeLabel.text = model?.created_at + coinView.setNeedsUpdateConfiguration() + + let expireDate = Date(timeIntervalSince1970: model?.expired_time ?? 0) + let nowDate = Date() + let days = nowDate.differenceDay(date: expireDate) + + if days > 0 { + contentLabel.text = "Expires in ## days".localizedReplace(text: "\(days)") + } else { + contentLabel.text = "Expired".localized + } + } + } + private lazy var titleLabel: UILabel = { let label = UILabel() label.font = .fontRegular(ofSize: 14) label.textColor = .color1C1C1C() - label.text = "Check in" return label }() @@ -21,7 +38,6 @@ class BRRewardCoinsRecordCell: BRCollectionViewCell { let label = UILabel() label.font = .fontRegular(ofSize: 12) label.textColor = .colorC2C2C2() - label.text = "Expires in 30 days" return label }() @@ -29,7 +45,6 @@ class BRRewardCoinsRecordCell: BRCollectionViewCell { let label = UILabel() label.font = .fontRegular(ofSize: 11) label.textColor = .colorC2C2C2() - label.text = "2025-04-17 06:19:13" label.setContentHuggingPriority(.required, for: .horizontal) label.setContentCompressionResistancePriority(.required, for: .horizontal) return label @@ -47,7 +62,7 @@ class BRRewardCoinsRecordCell: BRCollectionViewCell { button.configurationUpdateHandler = { [weak self] button in guard let self = self else { return } - button.configuration?.attributedTitle = AttributedString.br_createAttributedString(string: "+60", color: .color7ECD5E(), font: .fontMedium(ofSize: 15)) + button.configuration?.attributedTitle = AttributedString.br_createAttributedString(string: "+\(self.model?.coins ?? 0)", color: .color7ECD5E(), font: .fontMedium(ofSize: 15)) } return button }() diff --git a/BeeReel/Class/Store/View/BRVipOrderRecordCell.swift b/BeeReel/Class/Store/View/BRVipOrderRecordCell.swift index 660f268..836ae46 100644 --- a/BeeReel/Class/Store/View/BRVipOrderRecordCell.swift +++ b/BeeReel/Class/Store/View/BRVipOrderRecordCell.swift @@ -8,6 +8,15 @@ import UIKit class BRVipOrderRecordCell: BRCollectionViewCell { + + var model: BRRechargeRecordModel? { + didSet { + durationLabel.text = model?.value + timeLabel.text = model?.created_at + titleLabel.text = model?.type + } + } + private lazy var titleLabel: UILabel = { let label = UILabel() label.font = .fontRegular(ofSize: 14) diff --git a/BeeReel/Delegate/AppDelegate+APNS.swift b/BeeReel/Delegate/AppDelegate+APNS.swift index 51daa40..ce5b555 100644 --- a/BeeReel/Delegate/AppDelegate+APNS.swift +++ b/BeeReel/Delegate/AppDelegate+APNS.swift @@ -5,6 +5,8 @@ // Created by 长沙鸿瑶 on 2025/7/28. // +import FirebaseMessaging + extension AppDelegate { ///是否展示过通知提示 static var haveBeenShownAPNS = false @@ -56,7 +58,7 @@ extension AppDelegate { //MARK: -------------- UNUserNotificationCenterDelegate -------------- extension AppDelegate: UNUserNotificationCenterDelegate { func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { -// Messaging.messaging().apnsToken = deviceToken + Messaging.messaging().apnsToken = deviceToken } func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: any Error) { @@ -85,23 +87,19 @@ extension AppDelegate: UNUserNotificationCenterDelegate { completionHandler() return } -// VPStatAPI.requestStatApns(messageId: model.message_id ?? "", title: response.notification.request.content.title) -// -// -// if model.path == .videoDetail, let shortPlayId = model.short_play_id { -// let vc = VPDetailPlayerViewController() -// vc.shortPlayId = shortPlayId -// VPAppTool.topViewController?.navigationController?.pushViewController(vc, animated: true) -// -// } else if model.path == .promotion { -// let vc = VPRewardsViewController() -// VPAppTool.topViewController?.navigationController?.pushViewController(vc, animated: true) -// -// } else if model.path == .feedback { -// let vc = VPCampaignWebViewController() -// vc.urlStr = kVPFeedBackListWebUrl -// VPAppTool.topViewController?.navigationController?.pushViewController(vc, animated: true) -// } + BRStatAPI.requestStatApns(messageId: model.message_id ?? "", title: response.notification.request.content.title) + + + if model.path == .videoDetail, let shortPlayId = model.short_play_id { + let vc = BRVideoDetailViewController() + vc.shortPlayId = shortPlayId + BRAppTool.topViewController?.navigationController?.pushViewController(vc, animated: true) + + } else if model.path == .feedback { + let vc = BRAppWebViewController() + vc.webUrl = kBRFeedBackListWebUrl + BRAppTool.topViewController?.navigationController?.pushViewController(vc, animated: true) + } completionHandler() } diff --git a/BeeReel/Delegate/AppDelegate+Thirdparty.swift b/BeeReel/Delegate/AppDelegate+Thirdparty.swift index ecf3d24..f719d72 100644 --- a/BeeReel/Delegate/AppDelegate+Thirdparty.swift +++ b/BeeReel/Delegate/AppDelegate+Thirdparty.swift @@ -25,8 +25,8 @@ extension AppDelegate { Adjust.initSdk(config) -// FirebaseApp.configure() -// Messaging.messaging().delegate = self + FirebaseApp.configure() + Messaging.messaging().delegate = self } } diff --git a/BeeReel/Delegate/SceneDelegate+Open.swift b/BeeReel/Delegate/SceneDelegate+Open.swift index 03a292b..1bec292 100644 --- a/BeeReel/Delegate/SceneDelegate+Open.swift +++ b/BeeReel/Delegate/SceneDelegate+Open.swift @@ -48,7 +48,7 @@ extension SceneDelegate { Self.isNeedRetry = false SceneDelegate.webpageURL = nil - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { self._handleOpenAppMessage(webpageURL: webpageURL) } @@ -63,7 +63,7 @@ extension SceneDelegate { var data: [String : Any]? = webpageURL?.query?.br_urlQuryToDictionary() - if statUrlStr == nil, let pasteStr = UIPasteboard.general.string, pasteStr.contains("veloriaapp") { + if statUrlStr == nil, let pasteStr = UIPasteboard.general.string, pasteStr.contains("beereel") { let tempArr = pasteStr.components(separatedBy: "?") let query = tempArr.last diff --git a/BeeReel/Lib/IAP/BRIAP.swift b/BeeReel/Lib/IAP/BRIAP.swift index 1d7fa12..fa442ad 100644 --- a/BeeReel/Lib/IAP/BRIAP.swift +++ b/BeeReel/Lib/IAP/BRIAP.swift @@ -10,7 +10,7 @@ import UIKit class BRIAP { typealias CompletionHandler = ((_ finish: Bool) -> Void) ///内购模版前缀 - static let IAPPrefix = "veloria." + static let IAPPrefix = "beereel." static let manager = BRIAP() diff --git a/BeeReel/Sources/Localizable.xcstrings b/BeeReel/Sources/Localizable.xcstrings index 82d29f0..94045de 100644 --- a/BeeReel/Sources/Localizable.xcstrings +++ b/BeeReel/Sources/Localizable.xcstrings @@ -293,6 +293,28 @@ } } }, + "Expired" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Expired" + } + } + } + }, + "Expires in ## days" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Expires in ## days" + } + } + } + }, "Explicit List of Personal Information Collection" : { "extractionState" : "manual", "localizations" : { @@ -667,6 +689,17 @@ } } }, + "Purchase Single Episode" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Purchase Single Episode" + } + } + } + }, "quarter" : { "extractionState" : "manual", "localizations" : {