1.1.1提审
This commit is contained in:
parent
97924c6c9f
commit
536482bd2d
@ -1918,7 +1918,7 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Veloria/Veloria.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Veloria/Veloria.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 2;
|
||||||
DEVELOPMENT_TEAM = 394VH538M8;
|
DEVELOPMENT_TEAM = 394VH538M8;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = Veloria/Source/Info.plist;
|
INFOPLIST_FILE = Veloria/Source/Info.plist;
|
||||||
@ -1937,7 +1937,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.1.0;
|
MARKETING_VERSION = 1.1.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.qjwl168.veloria.ios;
|
PRODUCT_BUNDLE_IDENTIFIER = com.qjwl168.veloria.ios;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
@ -1961,7 +1961,7 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Veloria/Veloria.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Veloria/Veloria.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 2;
|
||||||
DEVELOPMENT_TEAM = 394VH538M8;
|
DEVELOPMENT_TEAM = 394VH538M8;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = Veloria/Source/Info.plist;
|
INFOPLIST_FILE = Veloria/Source/Info.plist;
|
||||||
@ -1980,7 +1980,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.1.0;
|
MARKETING_VERSION = 1.1.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.qjwl168.veloria.ios;
|
PRODUCT_BUNDLE_IDENTIFIER = com.qjwl168.veloria.ios;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
|
@ -227,7 +227,7 @@ class VPPlayerRechargeView: HWPanModalContentView {
|
|||||||
|
|
||||||
|
|
||||||
@objc private func handleCloseButton() {
|
@objc private func handleCloseButton() {
|
||||||
let payTemplateModel = self.discountPayTemplateModel
|
// let payTemplateModel = self.discountPayTemplateModel
|
||||||
|
|
||||||
self.dismiss(animated: true) {
|
self.dismiss(animated: true) {
|
||||||
// if let payTemplateModel = payTemplateModel, payTemplateModel.list_sub_vip?.isEmpty == false {
|
// if let payTemplateModel = payTemplateModel, payTemplateModel.list_sub_vip?.isEmpty == false {
|
||||||
@ -243,8 +243,7 @@ class VPPlayerRechargeView: HWPanModalContentView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func longFormHeight() -> PanModalHeight {
|
override func longFormHeight() -> PanModalHeight {
|
||||||
// return PanModalHeightMake(.content, UIScreen.height * (4 / 5))
|
return PanModalHeightMake(.content, UIScreen.height - UIScreen.statusBarHeight)
|
||||||
return PanModalHeightMake(.content, UIScreen.height - UIScreen.navBarHeight)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func showDragIndicator() -> Bool {
|
override func showDragIndicator() -> Bool {
|
||||||
|
@ -83,7 +83,6 @@ class VPIAPManager {
|
|||||||
|
|
||||||
self.iapManager.start(productId: productId, orderId: self.orderCode ?? "", discount: discount)
|
self.iapManager.start(productId: productId, orderId: self.orderCode ?? "", discount: discount)
|
||||||
|
|
||||||
// self.iapManager.showCodeRedemption()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import StoreKit
|
|||||||
|
|
||||||
@objc protocol JXIAPManagerDelegate {
|
@objc protocol JXIAPManagerDelegate {
|
||||||
/// 获取到可购买商品列表
|
/// 获取到可购买商品列表
|
||||||
@objc optional func jx_iapPayGotProducts(productIds: [String])
|
@objc optional func jx_iapPayGotProducts(productIds: [SKProduct])
|
||||||
/// 购买成功
|
/// 购买成功
|
||||||
@objc optional func jx_iapPaySuccess(productId: String, receipt: String, transactionIdentifier: String?)
|
@objc optional func jx_iapPaySuccess(productId: String, receipt: String, transactionIdentifier: String?)
|
||||||
/// 购买失败
|
/// 购买失败
|
||||||
@ -34,28 +34,28 @@ import StoreKit
|
|||||||
case cancelled
|
case cancelled
|
||||||
///没有商品
|
///没有商品
|
||||||
case noProduct
|
case noProduct
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class JXIAPManager: NSObject {
|
class JXIAPManager: NSObject {
|
||||||
|
|
||||||
|
enum OperationType {
|
||||||
|
case idle
|
||||||
|
case buy
|
||||||
|
case request
|
||||||
|
}
|
||||||
|
|
||||||
static let manager: JXIAPManager = JXIAPManager()
|
static let manager: JXIAPManager = JXIAPManager()
|
||||||
|
|
||||||
weak var delegate: JXIAPManagerDelegate?
|
weak var delegate: JXIAPManagerDelegate?
|
||||||
|
|
||||||
|
///当前操作状态
|
||||||
|
private var operationType = OperationType.idle
|
||||||
|
|
||||||
private var payment: SKPayment?
|
private var payment: SKPayment?
|
||||||
|
|
||||||
private var product: SKProduct?
|
private var product: SKProduct?
|
||||||
private var productId: String?
|
private var productId: String?
|
||||||
/*
|
|
||||||
let discount = SKPaymentDiscount(
|
|
||||||
identifier: offerIdentifier,//促销优惠中设置的 ID
|
|
||||||
keyIdentifier: keyIdentifier, //订阅密钥ID
|
|
||||||
nonce: UUID(), //随机数
|
|
||||||
signature: signature, //服务器生成的签名
|
|
||||||
timestamp: timestamp //服务器生成签名的时间戳
|
|
||||||
)
|
|
||||||
*/
|
|
||||||
private var discount: SKPaymentDiscount?
|
private var discount: SKPaymentDiscount?
|
||||||
private var orderId: String?
|
private var orderId: String?
|
||||||
private var applicationUsername: String? {
|
private var applicationUsername: String? {
|
||||||
@ -94,7 +94,39 @@ class JXIAPManager: NSObject {
|
|||||||
SKPaymentQueue.default().presentCodeRedemptionSheet()
|
SKPaymentQueue.default().presentCodeRedemptionSheet()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func requestProductList(productIdArr: [String]) {
|
||||||
|
guard self.operationType == .idle else { return }
|
||||||
|
self.operationType = .request
|
||||||
|
|
||||||
|
let set = Set(productIdArr)
|
||||||
|
let productsRequest = SKProductsRequest(productIdentifiers: set)
|
||||||
|
productsRequest.delegate = self
|
||||||
|
productsRequest.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ///发起购买
|
||||||
|
// func buyProduct(product: SKProduct, orderId: String, discount: SKPaymentDiscount? = nil) {
|
||||||
|
// guard self.operationType == .idle else { return }
|
||||||
|
// self.operationType = .buy
|
||||||
|
//
|
||||||
|
// self.product = product
|
||||||
|
// self.orderId = orderId
|
||||||
|
//
|
||||||
|
// // 要购买商品,开个小票
|
||||||
|
// let payment = SKMutablePayment(product: product)
|
||||||
|
// payment.applicationUsername = applicationUsername
|
||||||
|
// if let discount = discount {
|
||||||
|
// payment.paymentDiscount = discount
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 去收银台排队,准备购买
|
||||||
|
// SKPaymentQueue.default().add(payment)
|
||||||
|
// }
|
||||||
|
|
||||||
func start(productId: String, orderId: String, discount: SKPaymentDiscount? = nil) {
|
func start(productId: String, orderId: String, discount: SKPaymentDiscount? = nil) {
|
||||||
|
guard self.operationType == .idle else { return }
|
||||||
|
self.operationType = .buy
|
||||||
|
|
||||||
self.product = nil
|
self.product = nil
|
||||||
self.productId = productId
|
self.productId = productId
|
||||||
self.orderId = orderId
|
self.orderId = orderId
|
||||||
@ -129,6 +161,11 @@ class JXIAPManager: NSObject {
|
|||||||
//MARK: -------------- SKProductsRequestDelegate --------------
|
//MARK: -------------- SKProductsRequestDelegate --------------
|
||||||
extension JXIAPManager: SKProductsRequestDelegate {
|
extension JXIAPManager: SKProductsRequestDelegate {
|
||||||
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
|
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
|
||||||
|
if self.operationType == .request {
|
||||||
|
self.delegate?.jx_iapPayGotProducts?(productIds: response.products)
|
||||||
|
self.operationType = .idle
|
||||||
|
} else if self.operationType == .buy {
|
||||||
|
|
||||||
guard let product = response.products.first else {
|
guard let product = response.products.first else {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
if let productId = self.productId {
|
if let productId = self.productId {
|
||||||
@ -142,6 +179,8 @@ extension JXIAPManager: SKProductsRequestDelegate {
|
|||||||
|
|
||||||
self.buyProduct()
|
self.buyProduct()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//MARK: -------------- SKPaymentTransactionObserver --------------
|
//MARK: -------------- SKPaymentTransactionObserver --------------
|
||||||
@ -196,12 +235,14 @@ extension JXIAPManager {
|
|||||||
|
|
||||||
|
|
||||||
guard let productId = self.productId, productId == transaction.payment.productIdentifier else { return }
|
guard let productId = self.productId, productId == transaction.payment.productIdentifier else { return }
|
||||||
|
self.operationType = .idle
|
||||||
self.productId = nil
|
self.productId = nil
|
||||||
self.delegate?.jx_iapPaySuccess?(productId: productId, receipt: encodeStr, transactionIdentifier: transactionIdentifier)
|
self.delegate?.jx_iapPaySuccess?(productId: productId, receipt: encodeStr, transactionIdentifier: transactionIdentifier)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func failedTransaction(transaction: SKPaymentTransaction) {
|
private func failedTransaction(transaction: SKPaymentTransaction) {
|
||||||
|
self.operationType = .idle
|
||||||
let error = transaction.error as? SKError
|
let error = transaction.error as? SKError
|
||||||
guard let productId = self.productId else { return }
|
guard let productId = self.productId else { return }
|
||||||
self.productId = nil
|
self.productId = nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user