Compare commits

...

9 Commits

Author SHA1 Message Date
liyuhua
c5a6e45c7c 商店包版本修改 此commit置顶 10.13.3 2023-09-19 18:57:42 +08:00
liyuhua
a98ece29f6 v2支付优化 2023-09-19 16:00:06 +08:00
liyuhua
57b112bb09 支付优化 2023-09-19 11:38:21 +08:00
liyuhua
2bf7626def v2内购 2023-09-18 16:24:28 +08:00
liyuhua
d66dd68242 修改接口 2023-09-15 16:29:37 +08:00
liyuhua
34f328115a 修改接口 2023-09-15 16:20:37 +08:00
liyuhua
7cf333572e v2支付 2023-09-15 14:38:43 +08:00
liyuhua
e4de2f78a1 修复福袋有时礼物值无法更新问题 2023-09-04 10:50:03 +08:00
liyuhua
f4f413c374 商店包版本修改 此commit置顶 10.13.1 2023-09-04 10:31:13 +08:00
31 changed files with 804 additions and 178 deletions

View File

@@ -130,6 +130,7 @@
18F404BB2760982000A6C548 /* ChatLimitModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404BA2760982000A6C548 /* ChatLimitModel.m */; };
18F404C3276098F100A6C548 /* Api+Message.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C2276098F100A6C548 /* Api+Message.m */; };
18F404C927609A4300A6C548 /* MessagePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 18F404C827609A4300A6C548 /* MessagePresenter.m */; };
232C44492AB31CD700D4B2ED /* PIIAPPayment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232C44482AB31CD700D4B2ED /* PIIAPPayment.swift */; };
2331C0DC2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 2331C0DB2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.m */; };
2331C1632A5EB71000E1D940 /* XPNobleCenterPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 2331C1322A5EB71000E1D940 /* XPNobleCenterPresenter.m */; };
2331C1642A5EB71000E1D940 /* NobleInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 2331C1362A5EB71000E1D940 /* NobleInfo.m */; };
@@ -1589,6 +1590,7 @@
18F404C6276099DF00A6C548 /* MessageProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageProtocol.h; sourceTree = "<group>"; };
18F404C727609A4300A6C548 /* MessagePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessagePresenter.h; sourceTree = "<group>"; };
18F404C827609A4300A6C548 /* MessagePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessagePresenter.m; sourceTree = "<group>"; };
232C44482AB31CD700D4B2ED /* PIIAPPayment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PIIAPPayment.swift; sourceTree = "<group>"; };
2331C0DA2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIFullScreenBannerAnimation.h; sourceTree = "<group>"; };
2331C0DB2A5E9E9000E1D940 /* PIFullScreenBannerAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIFullScreenBannerAnimation.m; sourceTree = "<group>"; };
2331C1312A5EB71000E1D940 /* XPNobleCenterPresenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPNobleCenterPresenter.h; sourceTree = "<group>"; };
@@ -4442,6 +4444,7 @@
189DD5A726DFA09700AB55B1 /* Tools */ = {
isa = PBXGroup;
children = (
232C44452AB31C7C00D4B2ED /* PIIAPTool */,
23E9EA9B2A84C42B00B792F2 /* SGYProgressView */,
23E9E9AB2A81E8E900B792F2 /* Event */,
E83645A42A40AEF600E0DBE4 /* Bundle */,
@@ -4677,6 +4680,14 @@
path = Protocol;
sourceTree = "<group>";
};
232C44452AB31C7C00D4B2ED /* PIIAPTool */ = {
isa = PBXGroup;
children = (
232C44482AB31CD700D4B2ED /* PIIAPPayment.swift */,
);
path = PIIAPTool;
sourceTree = "<group>";
};
2331C12F2A5EB71000E1D940 /* Noble */ = {
isa = PBXGroup;
children = (
@@ -4813,14 +4824,14 @@
2331C1882A60F32D00E1D940 /* Model */ = {
isa = PBXGroup;
children = (
2331C1892A60F32D00E1D940 /* CandyTreeResultModel.m */,
2331C18A2A60F32D00E1D940 /* CandyTreeRecordModel.m */,
2331C18B2A60F32D00E1D940 /* XPCandyTreeAnimationModel.h */,
2331C18C2A60F32D00E1D940 /* CandyTreeInfoModel.h */,
2331C18D2A60F32D00E1D940 /* XPCandyTreeAnimationModel.m */,
2331C18E2A60F32D00E1D940 /* CandyTreeRecordModel.h */,
2331C18F2A60F32D00E1D940 /* CandyTreeResultModel.h */,
2331C1902A60F32D00E1D940 /* CandyTreeInfoModel.m */,
2331C18E2A60F32D00E1D940 /* CandyTreeRecordModel.h */,
2331C18A2A60F32D00E1D940 /* CandyTreeRecordModel.m */,
2331C18F2A60F32D00E1D940 /* CandyTreeResultModel.h */,
2331C1892A60F32D00E1D940 /* CandyTreeResultModel.m */,
2331C18B2A60F32D00E1D940 /* XPCandyTreeAnimationModel.h */,
2331C18D2A60F32D00E1D940 /* XPCandyTreeAnimationModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -10337,6 +10348,7 @@
E81366E326F0A1FC0076364C /* LoginBindPhoneViewController.m in Sources */,
1464C5F329A4C18000AF7C94 /* XPIAPRechargeViewController.m in Sources */,
E85E7B662A4EC35A00B6D00A /* XPIncomeRecordGoldDetailsModel.m in Sources */,
232C44492AB31CD700D4B2ED /* PIIAPPayment.swift in Sources */,
9B2EA7CC2804245500ED17BF /* XPAnchorPKPanelUserView.m in Sources */,
2331C1B42A60F32D00E1D940 /* XPCandyTreeRankTableViewCell.m in Sources */,
9B85B6DA279FDC5200A0A1AC /* XPUserCardSkillCollectionViewCell.m in Sources */,
@@ -11190,10 +11202,11 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 10.13;
MARKETING_VERSION = 10.13.3;
PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
@@ -11223,10 +11236,11 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 10.13;
MARKETING_VERSION = 10.13.3;
PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;

View File

@@ -5,7 +5,7 @@
"scale" : "1x"
},
{
"filename" : "room_background .png",
"filename" : "room_background.png",
"idiom" : "universal",
"scale" : "2x"
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

View File

@@ -164,7 +164,7 @@ NS_ASSUME_NONNULL_BEGIN
/// @param uid 用户uid
/// @param ticket ticket
+ (void)checkReceipt:(HttpRequestHelperCompletion)complection
receipt:(NSString *)receipt
chooseEnv:(NSString *)chooseEnv
chargeRecordId:(NSString *)chargeRecordId
transcationId:(NSString *)transcationId

View File

@@ -178,22 +178,21 @@
/// @param deviceInfo uuid
/// @param clientIp ip
+ (void)requestIAPRecharge:(HttpRequestHelperCompletion)completion chargeProdId:(NSString *)chargeProdId uid:(NSString *)uid ticket:(NSString *)ticket deviceInfo:(NSString *)deviceInfo clientIp:(NSString *)clientIp {
NSString * fang = [NSString stringFromBase64String:@"b3JkZXIvcGxhY2VWMg=="];///order/placeV2
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,chargeProdId, uid, ticket, deviceInfo, clientIp, nil];
[self makeRequest:@"storeKitV2/placeOrder" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,chargeProdId, uid, ticket, deviceInfo, clientIp, nil];
}
///
/// @param completion
/// @param receipt base 64 recepit
/// @param chooseEnv @"true"
/// @param chargeRecordId
/// @param transcationId
/// @param uid uid
/// @param ticket ticket
+ (void)checkReceipt:(HttpRequestHelperCompletion)completion receipt:(NSString *)receipt chooseEnv:(NSString *)chooseEnv chargeRecordId:(NSString *)chargeRecordId transcationId:(NSString *)transcationId uid:(NSString *)uid ticket:(NSString *)ticket {
NSString * fang = [NSString stringFromBase64String:@"dmVyaWZ5L3NldGlhcA=="];///verify/setiap
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,receipt, chooseEnv, chargeRecordId, transcationId, uid, ticket, nil];
+ (void)checkReceipt:(HttpRequestHelperCompletion)completion chooseEnv:(NSString *)chooseEnv chargeRecordId:(NSString *)chargeRecordId transcationId:(NSString *)transcationId uid:(NSString *)uid ticket:(NSString *)ticket {
[self makeRequest:@"storeKitV2/verifyOrder" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, chooseEnv, chargeRecordId, transcationId, uid, ticket, nil];
}

View File

@@ -32,7 +32,8 @@ typedef NS_ENUM(NSInteger, XPMineItemType) {
XPMineItemType_FansTeam = 72,///粉丝团
XPMineItemType_DressUp_Market = 73, ///装扮商场
XPMineItemType_My_Dressup = 74,///我的装扮
XPMineItemType_My_Set = 75///设置
XPMineItemType_My_Set = 75,///设置
XPMineItemType_My_Refund = 76///设置
};

View File

@@ -22,10 +22,9 @@ NS_ASSUME_NONNULL_BEGIN
- (void)requestIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId;
/// 充值成功二次验证
/// @param receipt 凭据
/// @param orderId 订单编号
/// @param transcationId 商品id
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId;
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast;
/// 批量验证内购掉单
/// @param transcations 凭据的数组

View File

@@ -50,7 +50,8 @@
NSString * clientIp= [YYUtility ipAddress];
[Api requestIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSString *orderId = (NSString *)data.data[@"recordId"];
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId];
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] requestIAPRechargeOrderFail];
}] chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
@@ -58,17 +59,16 @@
///
/// @param receipt
/// @param orderId
/// @param transcationId id
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId {
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast{
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api checkReceipt:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] checkReceiptSuccess:transcationId];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView]hideHUD];
} showLoading:YES] receipt:receipt chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
[[self getView]checkReceiptFailWithCode:code transcationId:transcationId];
} showLoading:NO errorToast:errorToast] chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
}

View File

@@ -15,11 +15,13 @@ NS_ASSUME_NONNULL_BEGIN
///请求充值列表成功
- (void)requestRechargeListSucccess:(NSArray *)list;
///请求充值id的状态成功
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId;
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid;
///请求充值账单失败
- (void)requestIAPRechargeOrderFail;
///二次校验成功
- (void)checkReceiptSuccess:(NSString *)transcationId;
///二次校验失败
- (void)checkReceiptFailWithCode:(NSInteger)code transcationId:(NSString *)transcationId;
///批量验证凭据成功
- (void)checkTranscationIdsSuccess;
@end

View File

@@ -38,7 +38,7 @@
if (!roomUid) {
roomUid = NULL;
}
[self makeRequest:@"order/placeV2" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,chargeProdId, uid, roomUid, ticket, deviceInfo, clientIp, nil];
[self makeRequest:@"storeKitV2/placeOrder" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__,chargeProdId, uid, roomUid, ticket, deviceInfo, clientIp, nil];
}
///

View File

@@ -25,10 +25,9 @@ NS_ASSUME_NONNULL_BEGIN
- (void)requestNobleIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId roomUid:(NSString *)roomUid ;
/// 充值成功二次验证
/// @param receipt 凭据
/// @param orderId 订单编号
/// @param transcationId 商品id
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId;
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast;
/// 批量验证内购掉单
/// @param transcations 凭据的数组

View File

@@ -58,22 +58,25 @@
NSString * clientIp= [YYUtility ipAddress];
[Api requestNobleIAPRecharge:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSString *orderId = (NSString *)data.data[@"recordId"];
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId];
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
[[self getView] requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] requestIAPRechargeOrderFail:msg code:code];
} errorToast:YES] chargeProdId:chargeProdId uid:uid roomUid:roomUid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
}
///
/// @param receipt
/// @param orderId
/// @param transcationId id
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId {
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast{
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api checkReceipt:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] checkReceiptSuccess:transcationId];
} showLoading:YES] receipt:receipt chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView]hideHUD];
} showLoading:YES errorToast:errorToast] chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
}
///

View File

@@ -20,13 +20,14 @@
- (void)onGetNobleRechargeDataSuccess:(NobleRechargeModel *)rechargeInfo;
///请求充值id的状态成功
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId;
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid;
///请求充值账单失败
- (void)requestIAPRechargeOrderFail:(NSString *)message code:(NSInteger)code;
///二次校验成功
- (void)checkReceiptSuccess:(NSString *)transcationId;
///二次校验失败
- (void)checkReceiptFailWithCode:(NSInteger)code transcationId:(NSString *)transcationId;
///批量验证凭据成功
- (void)checkTranscationIdsSuccess;

View File

@@ -18,7 +18,7 @@
#import "ThemeColor+NobleCenter.h"
#import "Api+NobleCenter.h"
#import "XPIAPHelper.h"
#import "RechargeStorage.h"
#import "AccountInfoStorage.h"
#import "UIImage+Utils.h"
@@ -43,7 +43,8 @@
#import "XPNobleCenterPayView.h"
#import "XPNobleCenterProtocol.h"
#import "XPIAPRechargeViewController.h"
@interface XPNobleCenterViewController ()<XPNobleCenterProtocol,XPNobleCenterPayViewDelegate,JXCategoryViewDelegate, JXCategoryListContainerViewDelegate,XPNobleCenterNavViewDelegate, XPIAPHelperDelegate, NIMSystemNotificationManagerDelegate>
#import "YuMi-swift.h"
@interface XPNobleCenterViewController ()<XPNobleCenterProtocol,XPNobleCenterPayViewDelegate,JXCategoryViewDelegate, JXCategoryListContainerViewDelegate,XPNobleCenterNavViewDelegate, NIMSystemNotificationManagerDelegate>
///
@property (nonatomic, strong) NSArray<NSString *> *titles;
///
@@ -92,19 +93,18 @@
}
- (void)dealloc {
[XPIAPHelper shareHelper].delegate = nil;
}
- (void)viewDidLoad {
[super viewDidLoad];
[XPIAPHelper shareHelper].delegate = self;
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
[self requestHttp];
[self initSubViews];
[self initSubViewConstraints];
}
- (BOOL)isHiddenNavBar {
return YES;
}
@@ -116,8 +116,8 @@
[self.presenter getUserInfo];
}
if([XPSkillCardPlayerManager shareInstance].isInRoom == YES && [XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge == NO){
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = YES;
}
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = YES;
}
}
- (XPNobleCenterPresenter *)createPresenter {
@@ -144,7 +144,7 @@
make.leading.top.trailing.mas_equalTo(self.view);
make.height.mas_equalTo(height);
}];
[self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.top.mas_equalTo(self.view);
make.height.mas_equalTo(kNavigationHeight);
@@ -154,7 +154,7 @@
make.height.mas_equalTo(40);
make.top.mas_equalTo(self.navView.mas_bottom);
}];
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.bottom.mas_equalTo(self.view);
make.top.mas_equalTo(self.titleView.mas_bottom);
@@ -178,7 +178,7 @@
make.width.height.mas_equalTo(20);
make.centerY.equalTo(self.openNobleView);
make.trailing.equalTo(self.openNobleButton.mas_leading).mas_offset(-2);
}];
[self.rankBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(57);
@@ -186,7 +186,7 @@
make.trailing.mas_equalTo(-24);
make.top.mas_equalTo(139);
}];
}
#pragma mark - XPNobleCenterPayViewDelegate
- (void)payWithType:(NobleCenterPayType)type{
@@ -196,11 +196,11 @@
config.message = YMLocalizedString(@"XPNobleCenterViewController3");
config.actionStyle = TTAlertActionBothStyle;
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{
XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init];
[self.navigationController pushViewController:webVC animated:YES];
} cancelHandler:^{
}];
return;
}
@@ -238,8 +238,11 @@
- (void)checkTranscationIds {
NSString * uid = [AccountInfoStorage instance].getUid;
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
if (array.count > 0) {
[self.presenter checkTranscationIds:array];
for (NSDictionary *transcation in array) {
NSString *orderId = transcation[@"orderId"];
NSString *transcationId = transcation[@"transcationId"];
///
[self.presenter checkReceiptWithOrderId:orderId transcationId:transcationId errorToast:NO];
}
}
@@ -285,10 +288,45 @@
}
///id
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId {
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid{
if (orderId.length > 0) {
self.orderId = orderId;
[[XPIAPHelper shareHelper] buyAppProductWithAppProductId:chargeProdId];
if (@available(iOS 15.0, *)) {
PIIAPPayment *iap = [PIIAPPayment shared];
[iap requestBuyProductWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
}];
@kWeakify(self);
iap.stateBlock = ^(enum StoreState state, NSDictionary<NSString *,id> * _Nullable result) {
@kStrongify(self);
[self rechargeNewProcessStatus:state];
switch (state) {
case StoreStateVerifiedServer:
{
NSString *transactionId = result[@"transactionId"];
[self rechargeSuccess:transactionId];
}
break;
default:
{
}
break;
}
};
} else {
[self hideHUD];
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController8")];
}
} else {
[self hideHUD];
}
@@ -301,6 +339,13 @@
///
- (void)checkReceiptSuccess:(NSString *)transcationId {
[self hideHUD];
if (@available(iOS 15.0, *)) {
PIIAPPayment *iap = [PIIAPPayment shared];
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
self.orderId = nil;
//5
@@ -311,7 +356,18 @@
}
});
}
- (void)checkReceiptFailWithCode:(NSInteger)code transcationId:(NSString *)transcationId{
[self hideHUD];
if(code == 1444){
if (@available(iOS 15.0, *)) {
PIIAPPayment *iap = [PIIAPPayment shared];
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
}
}
///
- (void)deleteRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
NSString * uid = [AccountInfoStorage instance].getUid;
@@ -332,16 +388,15 @@
}
#pragma mark - XPIAPHelperDelegate
///
- (void)rechargeProcessStatus:(PaymentStatus)status {
- (void)rechargeNewProcessStatus:(StoreState)status {
[self hideHUD];
if (status == PaymentStatus_Purchased) {
if (status == StoreStatePay || status == StoreStateStart || status == StoreStateVerifiedServer) {
[self showLoading];
} else if (status == PaymentStatus_Purchasing) {
[self showLoading];
} else if (status == PaymentStatus_Failed) {
[self showErrorToast:YMLocalizedString(@"XPNobleCenterViewController1")];
} else if (status == PaymentStatus_Deferred) {
[self showErrorToast:YMLocalizedString(@"XPNobleCenterViewController2")];
}else if (status == StoreStateUnowned) {
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
}else{
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController0")];
}
}
@@ -349,10 +404,9 @@
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
///
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
NSData *receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
NSString * receipt = [MF_Base64Codec base64StringFromData:receiptData];
[self showLoading];
///
[self.presenter checkReceiptWithData:receipt orderId:self.orderId transcationId:transactionIdentifier];
[self.presenter checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier errorToast:YES];
}
///
@@ -442,7 +496,7 @@
payView.delegate = self;
[self.view addSubview:payView];
}
#pragma mark - Getters And Setters
@@ -519,7 +573,7 @@
_openNobleButton.textColor = [DJDKMIMOMColor mainTextColor];
_openNobleButton.numberOfLines = 0;
_openNobleButton.textAlignment = NSTextAlignmentCenter;
}
return _openNobleButton;
}

View File

@@ -30,10 +30,10 @@
#import "XPMineRechargeProtocol.h"
///VC
#import "XPWebViewController.h"
#import "YuMi-swift.h"
#define kHeaderViewHeight 220.0/375.0*KScreenWidth
@interface XPIAPRechargeViewController ()<UICollectionViewDelegate, UICollectionViewDataSource, XPMineRechargeProtocol, XPIAPHelperDelegate, XPMineRechargeNavViewDelegate>
@interface XPIAPRechargeViewController ()<UICollectionViewDelegate, UICollectionViewDataSource, XPMineRechargeProtocol, XPMineRechargeNavViewDelegate>
@property (nonatomic, strong) UICollectionView *collectionView;
///
@@ -86,7 +86,6 @@
[self createUI];
[self initHttpData];
[XPIAPHelper shareHelper].delegate = self;
}
- (void)createUI {
@@ -202,9 +201,32 @@
- (void)checkTranscationIds {
NSString * uid = [AccountInfoStorage instance].getUid;
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
if (array.count > 0) {
[self.presenter checkTranscationIds:array];
// [self.presenter checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier];
// NSMutableArray *list = [NSMutableArray array];
// for (NSDictionary *transcationDic in array) {
// NSString *transcationId = transcationDic[@"transcationId"];
// if(transcationId){
// [list addObject:transcationId];
// }
// }
// if(list.count > 0){
// if (@available(iOS 15.0, *)) {
// PIIAPPayment *iap = [PIIAPPayment shared];
// [iap allTransactionWithList:list completionHandler:^{
//
// }];
//
// }
// }
for (NSDictionary *transcation in array) {
NSString *orderId = transcation[@"orderId"];
NSString *transcationId = transcation[@"transcationId"];
///
[self.presenter checkReceiptWithOrderId:orderId transcationId:transcationId errorToast:NO];
}
}
///
@@ -239,16 +261,15 @@
#pragma mark - XPIAPHelperDelegate
///
- (void)rechargeProcessStatus:(PaymentStatus)status {
- (void)rechargeNewProcessStatus:(StoreState)status {
[self hideHUD];
if (status == PaymentStatus_Purchased) {
if (status == StoreStatePay || status == StoreStateStart || status == StoreStateVerifiedServer) {
[self showLoading];
} else if (status == PaymentStatus_Purchasing) {
[self showLoading];
} else if (status == PaymentStatus_Failed) {
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController0")];
} else if (status == PaymentStatus_Deferred) {
}else if (status == StoreStateUnowned) {
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
}else{
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController0")];
}
}
@@ -256,10 +277,10 @@
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
///
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
NSData *receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
NSString * receipt = [MF_Base64Codec base64StringFromData:receiptData];
[self showLoading];
///
[self.presenter checkReceiptWithData:receipt orderId:self.orderId transcationId:transactionIdentifier];
[self.presenter checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier errorToast:YES];
}
#pragma mark - XPMineRechargeProtocol
@@ -268,10 +289,51 @@
[self.collectionView reloadData];
}
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId {
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(nonnull NSString *)uuid{
if (orderId.length > 0) {
self.orderId = orderId;
[[XPIAPHelper shareHelper] buyAppProductWithAppProductId:chargeProdId];
if (@available(iOS 15.0, *)) {
PIIAPPayment *iap = [PIIAPPayment shared];
[iap requestBuyProductWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
}];
@kWeakify(self);
iap.stateBlock = ^(enum StoreState state, NSDictionary<NSString *,id> * _Nullable result) {
@kStrongify(self);
[self rechargeNewProcessStatus:state];
switch (state) {
case StoreStateVerifiedServer:
{
NSString *transactionId = result[@"transactionId"];
[self rechargeSuccess:transactionId];
}
break;
default:
{
}
break;
}
};
} else {
[self hideHUD];
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController8")];
}
}else{
[self hideHUD];
}
}
@@ -282,7 +344,15 @@
///
- (void)checkReceiptSuccess:(NSString *)transcationId {
[self hideHUD];
if (@available(iOS 15.0, *)) {
PIIAPPayment *iap = [PIIAPPayment shared];
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
///💎
[self getUserWalletBalanceInfo];
self.orderId = nil;
@@ -291,7 +361,18 @@
[self.delegate paySuccess];
}
}
-(void)checkReceiptFailWithCode:(NSInteger)code transcationId:(NSString *)transcationId{
[self hideHUD];
if(code == 1444){
if (@available(iOS 15.0, *)) {
PIIAPPayment *iap = [PIIAPPayment shared];
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
}
}
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
self.headerView.walletInfo = balanceInfo;
}

View File

@@ -208,7 +208,7 @@
NSData *receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
NSString * receipt = [MF_Base64Codec base64StringFromData:receiptData];
///
[self.presenter checkReceiptWithData:receipt orderId:self.orderId transcationId:transactionIdentifier];
// [self.presenter checkReceiptWithData:receipt orderId:self.orderId transcationId:transactionIdentifier];
}
#pragma mark - XPMineRechargeProtocol

View File

@@ -58,6 +58,7 @@
#import "XPIAPRechargeViewController.h"
#import "XPIncomeRecordVC.h"
#import "XPNobleCenterViewController.h"
#import "YuMi-swift.h"
UIKIT_EXTERN NSString *kRequestRicket;
@interface XPMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineProtocol, XPMineHeadItemTableViewCellDelegate, XPMineHeadViewDelegate, XPHomeBannerTableViewCellDelegate>
@@ -294,11 +295,96 @@ UIKIT_EXTERN NSString *kRequestRicket;
}
break;
case XPMineItemType_My_Refund:{
#ifdef DEBUG
UIView *bgView = [[UIView alloc]init];
[kWindow addSubview:bgView];
[bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.bottom.right.mas_equalTo(0);
}];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hiddenTextVeiw:)];
[bgView addGestureRecognizer:tap];
bgView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
UIView *bgView1 = [UIView new];
bgView1.layer.cornerRadius = 10;
bgView1.layer.masksToBounds = YES;
[bgView addSubview:bgView1];
bgView1.backgroundColor = [UIColor whiteColor];
CGFloat width = KScreenWidth - kGetScaleWidth(60);
[bgView1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(bgView);
make.width.mas_equalTo(width);
make.height.mas_equalTo(kGetScaleWidth(200));
}];
UITextField *textf = [[UITextField alloc]init];
textf.backgroundColor = UIColorRGBAlpha(0xBBBCCF, 0.1);
textf.layer.cornerRadius = kGetScaleWidth(40)/2;
textf.layer.masksToBounds = YES;
textf.attributedPlaceholder = [[NSMutableAttributedString alloc]initWithString:@" 请输入订单号" attributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x2B2D33),NSFontAttributeName:kFontRegular(14)}];
textf.textColor = UIColorFromRGB(0x222222);
textf.font = kFontRegular(14);
[bgView1 addSubview:textf];
[textf mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(bgView1);
make.top.mas_equalTo(kGetScaleWidth(25));
make.left.right.equalTo(bgView1).inset(kGetScaleWidth(30));
make.height.mas_equalTo(kGetScaleWidth(40));
}];
textf.tag = 1001;
UIButton *bnt = [UIButton new];
[bnt setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor], [DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(kGetScaleWidth(200), kGetScaleWidth(50))] forState:UIControlStateNormal];
[bnt setTitle:@"确定" forState:UIControlStateNormal];
[bnt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[bnt addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventTouchUpInside];
[bgView1 addSubview:bnt];
[bnt mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(bgView1);
make.top.equalTo(textf.mas_bottom).mas_offset(kGetScaleWidth(40));
make.width.mas_equalTo(kGetScaleWidth(250));
make.height.mas_equalTo(kGetScaleWidth(50));
}];
bnt.layer.cornerRadius = kGetScaleWidth(50)/2;
bnt.layer.masksToBounds = YES;
#else
#endif
}
default:
break;
}
}
-(void)hiddenTextVeiw:(UITapGestureRecognizer *)sender{
[sender.view removeFromSuperview];
}
- (void)textFieldDidChange:(UIButton *)sender {
UITextField *textField = [sender.superview viewWithTag:1001];
[textField.superview.superview removeFromSuperview];
if (textField.text.length == 0) {
[self showErrorToast:@"请输入订单号"];
return;
}
if (@available(iOS 15.0, *)) {
PIIAPPayment *iap = [PIIAPPayment shared];
NSUInteger text = [textField.text integerValue];
[iap refunRequestWithView:self.view transactionId:text completionHandler:^{
}];
}
}
- (void)pushWebViewWIthUrl:(NSString *)url {
XPWebViewController * webVC = [[XPWebViewController alloc] init];

View File

@@ -136,8 +136,8 @@
/// @param roomUid uid
/// @param ticket ticket
+ (void)requestReportUserInterRoom:(HttpRequestHelperCompletion)completion uid:(NSString *)uid roomUid:(NSString *)roomUid ticket:(NSString *)ticket {
NSString * fang = [NSString stringFromBase64String:@""];///userroom/inV2
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, roomUid, ticket, nil];
[self makeRequest:@"userroom/inV2" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, roomUid, ticket, nil];
}
/// 退
@@ -197,8 +197,8 @@
/// PK
/// @param completion
+ (void)requestAnchorPkRule:(HttpRequestHelperCompletion)completion {
NSString * fang = [NSString stringFromBase64String:@""];///
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, nil];
[self makeRequest:@"crossroompkround/getSingleRoomPkRule" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, nil];
}
#pragma mark -

View File

@@ -188,7 +188,7 @@
return;
}
[Api requestReportUserInterRoom:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
NSLog(@"%ld",code);
} uid:[[AccountInfoStorage instance] getUid] roomUid:roomUid ticket:[[AccountInfoStorage instance] getTicket]];
}

View File

@@ -12,6 +12,8 @@
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomAnimationView : XPRoomAnimationHitView <RoomGuestDelegate>
-(void)resumeTimer;
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
@end

View File

@@ -153,6 +153,9 @@
- (void)dealloc {
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
}
-(void)resumeTimer{
if(self.giftEffectTimer != nil){
dispatch_resume(self.giftEffectTimer);
self.giftEffectTimer = nil;
@@ -163,7 +166,6 @@
self.giftTimer = nil;
}
}
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
self = [super init];
if (self) {

View File

@@ -17,7 +17,7 @@
#import "AccountInfoStorage.h"
#import "YYUtility.h"
#import "Api+Mine.h"
#import "XPIAPHelper.h"
#import "RechargeStorage.h"
///Model
#import "FirstRechargeModel.h"
@@ -34,7 +34,8 @@
#import "Api+FirstRecharge.h"
#import "FirstRechargeModel.h"
#import "XPSkillCardPlayerManager.h"
@interface XPFirstRechargeView ()<UICollectionViewDelegate, UICollectionViewDataSource,UICollectionViewDelegateFlowLayout, XPIAPHelperDelegate>
#import "YuMi-swift.h"
@interface XPFirstRechargeView ()<UICollectionViewDelegate, UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
///
@property (nonatomic,strong) UIButton *backBtn;
///
@@ -71,7 +72,7 @@
@implementation XPFirstRechargeView
- (void)dealloc {
[XPIAPHelper shareHelper].delegate = nil;
}
@@ -81,8 +82,8 @@
[self initSubViews];
[self initSubViewConstraints];
[self getFirstRechargeRewardList];
[XPIAPHelper shareHelper].delegate = self;
}
return self;
}
@@ -98,6 +99,7 @@
}
[XNDJTDDLoadingTool showErrorWithMessage:msg];
} channelType:@"3"];
[self checkTranscationIds];
}
#pragma mark - Private Method
- (void)initSubViews {
@@ -199,7 +201,7 @@
if (array.count <= 0) return;
self.typeArrowView.hidden = NO;
self.originArray = array;
self.currentInfo = [array safeObjectAtIndex1:0];
self.currentInfo = [array safeObjectAtIndex1:0];
if (self.segmentView.arrangedSubviews.count > 0) {
[[self.segmentView arrangedSubviews] enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
[obj removeFromSuperview];
@@ -207,7 +209,7 @@
}
for (int i = 0 ; i < array.count; i++) {
FirstRechargeModel * modelInfo = [array safeObjectAtIndex1:i];
NSString * title = [NSString stringWithFormat:@"$%.2f", modelInfo.chargeMoney];
NSString * title = [NSString stringWithFormat:@"$%.2f", modelInfo.chargeMoney];
UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
@@ -263,94 +265,183 @@
///
/// @param chargeProdId id
- (void)requestIAPRechargeOrderWithChargeProdId:(NSString *)chargeProdId {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
NSString * deviceInfo = [YYUtility deviceID];
NSString * clientIp= [YYUtility ipAddress];
[Api requestIAPRecharge:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSString *orderId = (NSString *)data.data[@"recordId"];
[self requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId];
} else {
[XNDJTDDLoadingTool hideHUD];
[XNDJTDDLoadingTool showErrorWithMessage:msg];
}
} chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
NSString * deviceInfo = [YYUtility deviceID];
NSString * clientIp= [YYUtility ipAddress];
[Api requestIAPRecharge:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSString *orderId = (NSString *)data.data[@"recordId"];
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
[self requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
} else {
[XNDJTDDLoadingTool hideHUD];
[XNDJTDDLoadingTool showErrorWithMessage:msg];
}
} chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
}
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId {
if (orderId.length > 0) {
self.orderId = orderId;
[[XPIAPHelper shareHelper] buyAppProductWithAppProductId:chargeProdId];
}
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid{
if (orderId.length > 0) {
self.orderId = orderId;
if (@available(iOS 15.0, *)) {
PIIAPPayment *iap = [PIIAPPayment shared];
[iap requestBuyProductWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
}];
@kWeakify(self);
iap.stateBlock = ^(enum StoreState state, NSDictionary<NSString *,id> * _Nullable result) {
@kStrongify(self);
[self rechargeNewProcessStatus:state];
switch (state) {
case StoreStateVerifiedServer:
{
NSString *transactionId = result[@"transactionId"];
[self rechargeSuccess:transactionId];
}
break;
default:
{
}
break;
}
};
} else {
[XNDJTDDLoadingTool hideHUD];
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController8")];
}
}else{
[XNDJTDDLoadingTool hideHUD];
}
}
#pragma mark - XPIAPHelperDelegate
///
- (void)rechargeProcessStatus:(PaymentStatus)status {
[XNDJTDDLoadingTool hideHUD];
if (status == PaymentStatus_Purchased) {
[XNDJTDDLoadingTool showLoading];
} else if (status == PaymentStatus_Purchasing) {
[XNDJTDDLoadingTool showLoading];
} else if (status == PaymentStatus_Failed) {
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController0")];
} else if (status == PaymentStatus_Deferred) {
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController1")];
}
- (void)rechargeNewProcessStatus:(StoreState)status {
[XNDJTDDLoadingTool hideHUD];
if (status == StoreStatePay || status == StoreStateStart || status == StoreStateVerifiedServer) {
[XNDJTDDLoadingTool showLoading];
}else if (status == StoreStateUnowned) {
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController1")];
}else{
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController0")];
}
}
///id
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
///
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
NSData *receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
NSString * receipt = [MF_Base64Codec base64StringFromData:receiptData];
///
[self checkReceiptWithData:receipt orderId:self.orderId transcationId:transactionIdentifier];
///
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
///
[self checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier errorToast:YES];
}
///
- (void)saveRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
NSData *receipt = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
NSString *encodeStr = [receipt base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[dictionary setObject:transactionIdentifier forKey:@"transcationId"];
[dictionary setObject:encodeStr forKey:@"recipt"];
[dictionary setObject:self.orderId forKey:@"orderId"];
NSString *reciptJson = [dictionary toJSONString];
NSString * uid = [AccountInfoStorage instance].getUid;
BOOL saveSuccess = [RechargeStorage saveTranscationId:transactionIdentifier recipt:reciptJson uid:uid];
if (!saveSuccess) {
NSData *receipt = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]];
NSString *encodeStr = [receipt base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[dictionary setObject:transactionIdentifier forKey:@"transcationId"];
[dictionary setObject:encodeStr forKey:@"recipt"];
[dictionary setObject:self.orderId forKey:@"orderId"];
NSString *reciptJson = [dictionary toJSONString];
NSString * uid = [AccountInfoStorage instance].getUid;
BOOL saveSuccess = [RechargeStorage saveTranscationId:transactionIdentifier recipt:reciptJson uid:uid];
if (!saveSuccess) {
#warning to do
}
}
}
///
- (void)deleteRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
NSString * uid = [AccountInfoStorage instance].getUid;
BOOL deleteSuccess = [RechargeStorage delegateTranscationId:transactionIdentifier uid:uid];
if (deleteSuccess) {
NSString * uid = [AccountInfoStorage instance].getUid;
BOOL deleteSuccess = [RechargeStorage delegateTranscationId:transactionIdentifier uid:uid];
if (deleteSuccess) {
#warning to do
}
}
}
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
[self checkReceiptSuccess:transcationId];
} else {
[XNDJTDDLoadingTool showErrorWithMessage:msg];
}
///
- (void)checkTranscationIds {
NSString * uid = [AccountInfoStorage instance].getUid;
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
// [self.presenter checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier];
// NSMutableArray *list = [NSMutableArray array];
// for (NSDictionary *transcationDic in array) {
// NSString *transcationId = transcationDic[@"transcationId"];
// if(transcationId){
// [list addObject:transcationId];
// }
// }
// if(list.count > 0){
// if (@available(iOS 15.0, *)) {
// PIIAPPayment *iap = [PIIAPPayment shared];
// [iap allTransactionWithList:list completionHandler:^{
//
// }];
//
// }
// }
for (NSDictionary *transcation in array) {
NSString *orderId = transcation[@"orderId"];
NSString *transcationId = transcation[@"transcationId"];
///
[self checkReceiptWithOrderId:orderId transcationId:transcationId errorToast:NO] ;
}
}
- (void)checkReceiptWithOrderId:(NSString *)orderId transcationId:(NSString *)transcationId errorToast:(BOOL)errorToast{
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
[self checkReceiptSuccess:transcationId];
} else {
if(code == 1444){
if (@available(iOS 15.0, *)) {
PIIAPPayment *iap = [PIIAPPayment shared];
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
}
if(errorToast == YES){
[XNDJTDDLoadingTool showErrorWithMessage:msg];
}
}
[XNDJTDDLoadingTool hideHUD];
} receipt:receipt chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
} chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
}
///
- (void)checkReceiptSuccess:(NSString *)transcationId {
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
self.orderId = nil;
if (@available(iOS 15.0, *)) {
PIIAPPayment *iap = [PIIAPPayment shared];
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
self.orderId = nil;
}
#pragma mark - Event Response
@@ -362,14 +453,14 @@
}
- (void)rechargeButtonAction {
if (self.currentInfo == nil|| self.currentInfo.chargeProdId == nil) {
return;
}
FirstRechargeModel *model = self.currentInfo;
if (model.chargeProdId) {
[XNDJTDDLoadingTool showLoading];
[self requestIAPRechargeOrderWithChargeProdId:model.chargeProdId];
}
if (self.currentInfo == nil|| self.currentInfo.chargeProdId == nil) {
return;
}
FirstRechargeModel *model = self.currentInfo;
if (model.chargeProdId) {
[XNDJTDDLoadingTool showLoading];
[self requestIAPRechargeOrderWithChargeProdId:model.chargeProdId];
}
}
-(void)backAction{
[self removeFromSuperview];
@@ -377,7 +468,7 @@
- (void)buttonAction:(UIButton *)sender {
if (sender.tag <= self.originArray.count) {
FirstRechargeModel * model = [self.originArray safeObjectAtIndex1:sender.tag];
self.currentInfo = model;
self.currentInfo = model;
[self createExtraRewardAttrebute:model];
self.rewardArray = model.firstChargeRewardList;
self.collectionView.hidden = self.rewardArray.count < 2;
@@ -541,7 +632,7 @@
if (!_backBtn){
_backBtn = [UIButton new];
[_backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
}
return _backBtn;
}

View File

@@ -647,7 +647,11 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
} else {
[self.presenter getUserWallInfo];
}
[self sendCustomMessage:receiveInfo oringinDic:originDic];
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC));
dispatch_after(delayTime, dispatch_get_main_queue(), ^{
[self sendCustomMessage:receiveInfo oringinDic:originDic];
});
///
[self sendGraffitiGiftMessage];
if (self.segmentType == GiftSegmentType_Graffiti) {

View File

@@ -1433,6 +1433,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
- (void)exitRoom {
[self.menuContainerView menuResignFirstResponder];
[self.animationView resumeTimer];
if (self.roomInfo.roomModeType == RoomModeType_Open_Micro_Mode || self.roomInfo.roomModeType == RoomModeType_Open_Blind) {
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
NSString * uid = [AccountInfoStorage instance].getUid;

View File

@@ -10,6 +10,7 @@
#import "RechargeStorage.h"
#import "AccountModel.h"
#import "Api+Main.h"
#import "Api+Mine.h"
#import "MainProtocol.h"
#import "NSObject+MJExtension.h"
#import <NIMSDK/NIMSDK.h>
@@ -66,15 +67,24 @@ static NSString * kUpdateVersionNum = @"kUpdateVersionNum";
- (void)checkTranscation {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
if (array == nil || array.count <= 0) {
return;
}
NSString * transcationIdStr = [array toJSONString];
[Api requestCheckTranscationIds:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSString * uid = [AccountInfoStorage instance].getUid;
[RechargeStorage delegateAllTranscationIdsWithUid:uid];
}] transcationIdStr:transcationIdStr];
for (NSDictionary *transcation in array) {
NSString *orderId = transcation[@"orderId"];
NSString *transcationId = transcation[@"transcationId"];
///
[Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSString * uid = [AccountInfoStorage instance].getUid;
[RechargeStorage delegateTranscationId:transcationId uid:uid];
}
} chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
}
}

View File

@@ -12,6 +12,14 @@
#define AppName ([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"])
#define isEnterprise \
({BOOL isEnterprise = NO;\
if (@available(iOS 11.0, *)) {\
NSString *bundleID = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];\
isEnterprise = [bundleID isEqualToString:@"com.hflighting.yumi"];\
}\
(isEnterprise);})
#ifdef DEBUG
#define NSLog(fmt,...) NSLog((@"%s [Line %d]" fmt),__PRETTY_FUNCTION__,__LINE__,##__VA_ARGS__)
#else

View File

@@ -0,0 +1,263 @@
//
// PIIAPPayment.swift
// YuMi
//
// Created by duoban on 2023/9/14.
//
import UIKit
import StoreKit
@available(iOS 15.0, *)
typealias Transaction = StoreKit.Transaction
@available(iOS 15.0, *)
typealias RenewalInfo = StoreKit.Product.SubscriptionInfo.RenewalInfo
@available(iOS 15.0, *)
typealias RenewalState = StoreKit.Product.SubscriptionInfo.RenewalState
enum PIStoreError: Error {
//
case failedVerification
case noProduct
}
@objc public enum StoreState: Int64 { //
case start //
case pay //
case verifiedServer //
case userCancelled //
case pending //
case unowned
case noProduct //
case failedVerification //
}
@available(iOS 15.0, *)
public class PIIAPPayment: NSObject {
public typealias KStateBlock = (_ state :StoreState,_ param:Dictionary<String,Any>?) ->()
@objc public var stateBlock: KStateBlock! //
var updateListenerTask: Task<Void, Error>? = nil //
var transactionMap :[String:Transaction] // Idmap
var name: String = "iosStore" //
@objc public static let shared = {
let instance = PIIAPPayment()
return instance
}()
private override init() { // private
transactionMap = [:] //
super.init()
Task {
updateListenerTask = listenForTransactions()
}
}
// 退
@objc public func refunRequest(view: UIView,transactionId:UInt64) async{
do {
if let scene = await view.window?.windowScene{
try await Transaction.beginRefundRequest(for:transactionId , in: scene)
}
}catch{
print("iap error")
}
}
//
@objc public func requestBuyProduct(productId:String, uuid: String) async throws {
if(stateBlock != nil ){
stateBlock(StoreState.start,nil)
}
do {
let list:[String] = [productId]
let storeProducts = try await Product.products(for: Set.init(list))
if storeProducts.count > 0 {
try await purchase(storeProducts[0],uuid)
}else {
print("iap: no found product")
if(stateBlock != nil ){
stateBlock(StoreState.noProduct,nil)
}
throw PIStoreError.noProduct //
}
} catch {
print("Failed product request from the App Store server: \(error)")
if(stateBlock != nil ){
stateBlock(StoreState.noProduct,nil)
}
throw PIStoreError.noProduct //
}
}
//
private func purchase(_ product: Product, _ uuid: String) async throws -> Transaction? {
if(stateBlock != nil ){
stateBlock(StoreState.pay,nil)
}
guard let curUUID = UUID.init(uuidString: uuid) else{
if(stateBlock != nil ){
stateBlock(StoreState.failedVerification,nil)
}
return nil
}
let getUUID = Product.PurchaseOption.appAccountToken(curUUID)
let result = try await product.purchase(options: [getUUID])
switch result {
case .success(let verification): //
let transaction = try await verifiedAndFinish(verification)
return transaction
case .userCancelled: //
if(stateBlock != nil ){
stateBlock(StoreState.userCancelled,nil)
}
return nil
case .pending: //
if(stateBlock != nil ){
stateBlock(StoreState.pending,nil)
}
return nil
default:
if(stateBlock != nil ){
stateBlock(StoreState.unowned,nil)
}
return nil
}
}
//
func checkVerified<T>(_ result: VerificationResult<T>) throws -> T {
//Check whether the JWS passes StoreKit verification.
switch result {
case .unverified:
//StoreKit parses the JWS, but it fails verification.
if(stateBlock != nil ){
stateBlock(StoreState.failedVerification,nil)
}
throw PIStoreError.failedVerification
case .verified(let safe):
//The result is verified. Return the unwrapped value.
print("iap: verified success")
return safe
}
}
// &
func verifiedAndFinish(_ verification:VerificationResult<Transaction>) async throws -> Transaction?{
//Check whether the transaction is verified. If it isn't,
//this function rethrows the verification error.
let transaction = try checkVerified(verification)
// ~~~
let transactionId = try verification.payloadValue.id
// map
let key = String(transactionId)
transactionMap[key] = transaction
await uploadServer(for: transactionId)
//
await transaction.finish()
print("iap: finish")
return transaction
}
/*All transactions
Latest transactions
Current entitlements
*/
func allTransaction(transactionId:String) async {
let transactionIntId = UInt64(transactionId)
for await result in Transaction.all {
do {
let tran = try checkVerified(result)
let resultId = try result.payloadValue.id
if transactionIntId == resultId {
await tran.finish()
break
}
} catch let error {
print("error:----\(error)")
}
}
//Transaction.latest(for: "pid")
}
//
@objc public func transactionFinish(transaction:String) async{
if(transactionMap[transaction] != nil){
await transactionMap[transaction]!.finish()
transactionMap.removeValue(forKey: transaction)
print("transactionFinish end")
}else {
await allTransaction(transactionId: transaction)
}
}
@MainActor
func uploadServer(for transactionId:UInt64) async {
let dic :Dictionary<String,Any> = ["transactionId":transactionId]
if(stateBlock != nil ){
stateBlock(StoreState.verifiedServer,dic)
}
}
//
func listenForTransactions() -> Task<Void, Error> {
return Task.detached {
//Iterate through any transactions that don't come from a direct call to `purchase()`.
// update unfinished?
for await result in Transaction.updates { //
do {
print("iap: updates")
print("result:\(result)")
try await self.verifiedAndFinish(result)
} catch {
//StoreKit has a transaction that fails verification. Don't deliver content to the user.
print("Transaction failed verification")
}
}
}
}
//广
func Promotion() async -> [SKProduct]?{
let promotion = SKProductStorePromotionController()
let prodicts = try? await promotion.promotionOrder()
return prodicts
}
//
deinit {
updateListenerTask?.cancel()
}
}

View File

@@ -118,7 +118,11 @@ static NSString *_from = nil;
&& ![from isEqualToString:@""]) {
_from = from;
} else {
_from = @"appstore"; // App Store
if (isEnterprise == NO) {
_from = @"piko_Enterprise"; //
}else {
_from = @"appstore"; // App Store
}
}
}

View File

@@ -513,6 +513,7 @@
"XPIAPRechargeViewController5" = "如有任何问题请咨询客服Piko号";
"XPIAPRechargeViewController6" = "我的账户";
"XPIAPRechargeViewController7" = "未成年禁止充值消费!请勿轻易相信各类刷单、 退款等信息,以免上当受骗";
"XPIAPRechargeViewController8" = "储值失败。当前仅支持运行iOS15及以上系统的手机进行储值请升级系统版本后重试。";
"XPMineRechargeViewController0" = "购买失败";
"XPMineRechargeViewController1" = "出现未知错误,请重新尝试";

View File

@@ -521,6 +521,7 @@
"XPIAPRechargeViewController5" = "如有任何問題請咨詢客服Piko號";
"XPIAPRechargeViewController6" = "我的賬戶";
"XPIAPRechargeViewController7" = "未成年禁止充值消費!請勿輕易相信各類刷單、 退款等信息,以免上當受騙";
"XPIAPRechargeViewController8" = "儲值失敗。當前僅支持運行iOS15及以上系統的手機進行儲值請升級系統版本後重試。";
"XPMineRechargeViewController0" = "購買失敗";
"XPMineRechargeViewController1" = "出現未知錯誤,請重新嘗試";