Compare commits
12 Commits
feature/1.
...
appstore_1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c5a6e45c7c | ||
![]() |
a98ece29f6 | ||
![]() |
57b112bb09 | ||
![]() |
2bf7626def | ||
![]() |
d66dd68242 | ||
![]() |
34f328115a | ||
![]() |
7cf333572e | ||
![]() |
e4de2f78a1 | ||
![]() |
f4f413c374 | ||
![]() |
367851d971 | ||
![]() |
7ebc65dfa0 | ||
![]() |
9182cdedcf |
@@ -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;
|
||||
|
@@ -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 |
BIN
YuMi/Assets.xcassets/yna/room_background.imageset/room_background.png
vendored
Normal file
BIN
YuMi/Assets.xcassets/yna/room_background.imageset/room_background.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
@@ -5,6 +5,8 @@
|
||||
// Created by YUMI on 2021/9/10.
|
||||
//
|
||||
///一些宏
|
||||
#import "NSBundle+Localizable.h"
|
||||
|
||||
#ifndef YUMIMacroUitls_h
|
||||
#define YUMIMacroUitls_h
|
||||
|
||||
@@ -49,7 +51,7 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#define API_HOST_URL [NSString stringWithFormat:@"%@%@",@"https://beta.api",@".pekolive.com"]
|
||||
#define API_HOST_URL [NSString stringWithFormat:@"%@%@",@"http://beta.api",@".pekolive.com"]
|
||||
|
||||
#else
|
||||
|
||||
@@ -58,7 +60,7 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns
|
||||
#endif
|
||||
|
||||
#define API_Image_URL @"https://image.hfighting.com"
|
||||
#import "NSBundle+Localizable.h"
|
||||
|
||||
#define YMLocalizedString(key) \
|
||||
[NSBundle ymLocalizedStringForKey:(key)]
|
||||
#endif /* YUMIMacroUitls_h */
|
||||
|
@@ -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
|
||||
|
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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///设置
|
||||
|
||||
};
|
||||
|
||||
|
@@ -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 凭据的数组
|
||||
|
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -137,16 +137,16 @@
|
||||
default:
|
||||
{
|
||||
|
||||
NSString * myUid = [AccountInfoStorage instance].getUid;
|
||||
if(![self.clanInfo.clan.elderUid isEqualToString:myUid]){
|
||||
// NSString * myUid = [AccountInfoStorage instance].getUid;
|
||||
// if(![self.clanInfo.clan.elderUid isEqualToString:myUid]){
|
||||
XPWebViewController * webVC =[[XPWebViewController alloc] init];
|
||||
webVC.url = URLWithType(kGoldEarningsRecord);
|
||||
[self.navigationController pushViewController:webVC animated:YES];
|
||||
return;
|
||||
|
||||
}
|
||||
XPIncomeRecordGoldDetailsVC *goldDetailVC = [XPIncomeRecordGoldDetailsVC new];
|
||||
[self.navigationController pushViewController:goldDetailVC animated:YES];
|
||||
// return;
|
||||
//
|
||||
// }
|
||||
// XPIncomeRecordGoldDetailsVC *goldDetailVC = [XPIncomeRecordGoldDetailsVC new];
|
||||
// [self.navigationController pushViewController:goldDetailVC animated:YES];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -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];
|
||||
}
|
||||
|
||||
/// 一键还原装扮
|
||||
|
@@ -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 凭据的数组
|
||||
|
@@ -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];
|
||||
}
|
||||
|
||||
/// 批量验证内购掉单
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -141,7 +141,7 @@
|
||||
self.descLabel.text = [NSString stringWithFormat:YMLocalizedString(@"XPNobleCenterEntranceView0"), value];
|
||||
self.descLabel.textColor = UIColorFromRGB(0x5E4D98);
|
||||
self.nextLevelLabel.text = nextLevelName;
|
||||
|
||||
self.descLabel.hidden = nobleInfo.currLevel >= 9;
|
||||
CGFloat margin = self.backProgressView.frame.size.width * (nobleInfo.currScore * 1.0 / (nextScore > 0 ? nextScore : 1));
|
||||
[self.currentProgressView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.trailing.mas_equalTo(self.backProgressView.mas_leading).mas_offset(margin);
|
||||
|
@@ -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,13 +93,12 @@
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[XPIAPHelper shareHelper].delegate = nil;
|
||||
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
[XPIAPHelper shareHelper].delegate = self;
|
||||
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
|
||||
[self requestHttp];
|
||||
[self initSubViews];
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
///充值成功之后保存订单到钥匙串
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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];
|
||||
|
@@ -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 - 超管
|
||||
|
@@ -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]];
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,8 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomAnimationView : XPRoomAnimationHitView <RoomGuestDelegate>
|
||||
|
||||
-(void)resumeTimer;
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
@end
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -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,7 +82,7 @@
|
||||
[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 {
|
||||
@@ -270,7 +272,8 @@
|
||||
[Api requestIAPRecharge:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSString *orderId = (NSString *)data.data[@"recordId"];
|
||||
[self requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId];
|
||||
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
|
||||
[self requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
|
||||
} else {
|
||||
[XNDJTDDLoadingTool hideHUD];
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:msg];
|
||||
@@ -278,35 +281,72 @@
|
||||
} chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
|
||||
}
|
||||
|
||||
- (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 {
|
||||
[XNDJTDDLoadingTool hideHUD];
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController8")];
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
[XNDJTDDLoadingTool hideHUD];
|
||||
}
|
||||
}
|
||||
#pragma mark - XPIAPHelperDelegate
|
||||
|
||||
///当前充值的状态
|
||||
- (void)rechargeProcessStatus:(PaymentStatus)status {
|
||||
- (void)rechargeNewProcessStatus:(StoreState)status {
|
||||
[XNDJTDDLoadingTool hideHUD];
|
||||
if (status == PaymentStatus_Purchased) {
|
||||
|
||||
if (status == StoreStatePay || status == StoreStateStart || status == StoreStateVerifiedServer) {
|
||||
[XNDJTDDLoadingTool showLoading];
|
||||
} else if (status == PaymentStatus_Purchasing) {
|
||||
[XNDJTDDLoadingTool showLoading];
|
||||
} else if (status == PaymentStatus_Failed) {
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController0")];
|
||||
} else if (status == PaymentStatus_Deferred) {
|
||||
}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 checkReceiptWithOrderId:self.orderId transcationId:transactionIdentifier errorToast:YES];
|
||||
}
|
||||
|
||||
///充值成功之后保存订单到钥匙串
|
||||
@@ -333,22 +373,73 @@
|
||||
#warning to do 保存失败 需要埋点
|
||||
}
|
||||
}
|
||||
///批量验证
|
||||
- (void)checkTranscationIds {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
|
||||
|
||||
- (void)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId {
|
||||
// [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 {
|
||||
if (@available(iOS 15.0, *)) {
|
||||
PIIAPPayment *iap = [PIIAPPayment shared];
|
||||
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
|
||||
self.orderId = nil;
|
||||
}
|
||||
|
@@ -647,7 +647,11 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
||||
} else {
|
||||
[self.presenter getUserWallInfo];
|
||||
}
|
||||
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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
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 delegateAllTranscationIdsWithUid:uid];
|
||||
}] transcationIdStr:transcationIdStr];
|
||||
[RechargeStorage delegateTranscationId:transcationId uid:uid];
|
||||
}
|
||||
|
||||
} chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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
|
||||
|
263
YuMi/Tools/PIIAPTool/PIIAPPayment.swift
Normal file
263
YuMi/Tools/PIIAPTool/PIIAPPayment.swift
Normal 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] // 用于完成Id的缓存map
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -118,9 +118,13 @@ static NSString *_from = nil;
|
||||
&& ![from isEqualToString:@""]) {
|
||||
_from = from;
|
||||
} else {
|
||||
if (isEnterprise == NO) {
|
||||
_from = @"piko_Enterprise"; // 企业包
|
||||
}else {
|
||||
_from = @"appstore"; // App Store包
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _from;
|
||||
}
|
||||
|
@@ -513,6 +513,7 @@
|
||||
"XPIAPRechargeViewController5" = "如有任何问题请咨询客服,Piko号";
|
||||
"XPIAPRechargeViewController6" = "我的账户";
|
||||
"XPIAPRechargeViewController7" = "未成年禁止充值消费!请勿轻易相信各类刷单、 退款等信息,以免上当受骗";
|
||||
"XPIAPRechargeViewController8" = "储值失败。当前仅支持运行iOS15及以上系统的手机进行储值,请升级系统版本后重试。";
|
||||
|
||||
"XPMineRechargeViewController0" = "购买失败";
|
||||
"XPMineRechargeViewController1" = "出现未知错误,请重新尝试";
|
||||
|
@@ -521,6 +521,7 @@
|
||||
"XPIAPRechargeViewController5" = "如有任何問題請咨詢客服,Piko號";
|
||||
"XPIAPRechargeViewController6" = "我的賬戶";
|
||||
"XPIAPRechargeViewController7" = "未成年禁止充值消費!請勿輕易相信各類刷單、 退款等信息,以免上當受騙";
|
||||
"XPIAPRechargeViewController8" = "儲值失敗。當前僅支持運行iOS15及以上系統的手機進行儲值,請升級系統版本後重試。";
|
||||
|
||||
"XPMineRechargeViewController0" = "購買失敗";
|
||||
"XPMineRechargeViewController1" = "出現未知錯誤,請重新嘗試";
|
||||
|
Reference in New Issue
Block a user