Compare commits

..

3 Commits

Author SHA1 Message Date
liyuhua
6fbb428b6b 修复bug 2023-10-10 18:37:35 +08:00
liyuhua
ad27327d13 修复bug 2023-10-10 16:34:47 +08:00
liyuhua
1169c38300 优化 2023-10-10 15:47:30 +08:00
31 changed files with 2887 additions and 2447 deletions

View File

@@ -23,7 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
///开箱子 大于等级 展示
@property (nonatomic, assign) NSInteger openCandyTreeLimitLevel;
@property (nonatomic,assign) BOOL canOpen;
@property(nonatomic,assign) BOOL isLoad;
///是否刷新了
@property (nonatomic,assign) BOOL isLoad;
///房间id用于分享房间跳转到房间
@property (nonatomic, copy) NSString *__nullable roomId;
///用户id用于外部h5跳转到聊天页面

View File

@@ -42,7 +42,7 @@
if (code == 200) {
self.retryCount = 0;
NSDictionary * initData = data.data;
self.canOpen = YES;
self.canOpen = ![initData[@"aModel"] boolValue];
self.iosPhoneBind = [initData[@"iosPhoneBind"] boolValue];
//
self.openCandyTree = [initData[@"openBoxSwitch"] boolValue];

View File

@@ -100,8 +100,7 @@ typedef NS_ENUM(NSUInteger, URLType) {
kTreasureRuleURL,
///夺宝记录
kTreasureRecordURL,
///第三方充值
kThirdPartyPay,
kChannelUrl,
};
NSString * const URLWithType(URLType type);

View File

@@ -17,6 +17,8 @@ NSString * const URLWithType(URLType type) {
prefix = [NSString stringWithFormat:@"%@k",prefix];
prefix = [NSString stringWithFormat:@"%@o",prefix];
NSDictionary *newDic = @{
@(kTreasureTicketBuyURL) : @"modules/act-treasureSnatching/index.html",///
@@ -26,7 +28,7 @@ NSString * const URLWithType(URLType type) {
@(kNobleRankURL) : @"modules/noble/index.html",///
@(kGoldEarningsRecord) : @"modules/myincome/index.html#/GoldLog",///
@(kCandyTreeRuleURL) : @"modules/rule/newWishingWellRule.html",/// modules/rank/index.html#/wishingWellRule
@(kThirdPartyPay) : @"modules/pay/index.html?channelType=%@&deviceId=%@",///
@(kChannelUrl) : @"modules/%@/index.html?channelType=%@&deviceId=%@",
};
NSString * newUrl = [newDic objectForKey:@(type)];
if(newUrl != nil){

View File

@@ -54,7 +54,7 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
///qq
@property (nonatomic, strong) UIButton *lineButtonView;
@property (nonatomic, strong) UIButton *appleButton;
///
@property (nonatomic,strong) GIDConfiguration *configuration;
@@ -89,10 +89,10 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
}
- (void)createUI {
self.view.backgroundColor = [UIColor whiteColor];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:@"hadAgree" forKey:HadAgreePrivacy];
[defaults synchronize];
self.view.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.bgImageView];
[self.view addSubview:self.logoView];
[self.view addSubview:self.stackView];
@@ -104,7 +104,9 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
[self.view addSubview:self.authBubbleView];
[self.authBubbleView addSubview:self.authBubbleLabel];
if (@available(iOS 13.0, *)) {
[self.stackView addArrangedSubview:self.appleButton];
}
[self.stackView addArrangedSubview:self.googleButtonView];
[self.stackView addArrangedSubview:self.fbButtonView];
[self.stackView addArrangedSubview:self.lineButtonView];
@@ -122,7 +124,7 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.self.logoView.mas_bottom).offset(kGetScaleWidth(122));
make.top.mas_equalTo(self.self.logoView.mas_bottom).offset(kGetScaleWidth(60));
make.centerX.mas_equalTo(self.view);
}];
@@ -158,7 +160,10 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
make.bottom.mas_equalTo(self.authBubbleView).mas_offset(-6);
}];
[self.appleButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(295));
make.height.mas_equalTo(kGetScaleWidth(46));
}];
[self.googleButtonView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(295));
make.height.mas_equalTo(kGetScaleWidth(46));
@@ -174,17 +179,21 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
id type = [[NSUserDefaults standardUserDefaults]valueForKey:@"kLoginSuccessType"];
if(type != nil){
[self.view addSubview:self.nextView];
[self.nextView addSubview:self.nextLabel];
UIButton *typeButton ;
if([type intValue] == 8){
if([type intValue] == ThirdLoginType_Apple){
typeButton = self.appleButton;
}else if([type intValue] == ThirdLoginType_Gmail){
typeButton = self.googleButtonView;
}else if([type intValue] == 10){
}else if([type intValue] == ThirdLoginType_FB){
typeButton = self.fbButtonView;
}else{
}else if([type intValue] == ThirdLoginType_Line){
typeButton = self.lineButtonView;
}
if(typeButton == nil){
return;
}
[self.view addSubview:self.nextView];
[self.nextView addSubview:self.nextLabel];
[self.nextView mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(-kGetScaleWidth(28));
make.width.mas_equalTo(kGetScaleWidth(70));
@@ -436,7 +445,22 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy";
}
return _lineButtonView;
}
- (UIButton *)appleButton {
if (!_appleButton) {
_appleButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_appleButton setImage: [UIImage imageNamed:@"login_apple"] forState:UIControlStateNormal];
[_appleButton setTitle:YMLocalizedString(@"XPLoginViewController12") forState:UIControlStateNormal];
_appleButton.titleLabel.font = kFontMedium(16);
[_appleButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_appleButton setImageEdgeInsets:UIEdgeInsetsMake(0, kGetScaleWidth(28), 0, kGetScaleWidth(200))];
_appleButton.backgroundColor = UIColorFromRGB(0x141414);
_appleButton.layer.cornerRadius = kGetScaleWidth(46)/2;
_appleButton.layer.masksToBounds = YES;
_appleButton.tag = 1000 + ThirdLoginType_Apple;
[_appleButton addTarget:self action:@selector(loginDidClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _appleButton;
}
- (GIDConfiguration *)configuration{

View File

@@ -26,6 +26,7 @@
#import "XPRoomViewController.h"
#import "XPWebViewController.h"
#import "XPMineRechargeViewController.h"
#import "XPIAPRechargeViewController.h"
#import "XPMineUserInfoViewController.h"
#import "XPMineSimpleUserInfoViewController.h"
#import "XPMineDressUpViewController.h"
@@ -142,10 +143,10 @@
case SecretaryRouterType_Purse:
case SecretaryRouterType_Recharge:
{
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]];
webVC.isPush = YES;
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES];
// XPMineRechargeViewController * rechargeVC = [[XPMineRechargeViewController alloc] init];
XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init];
rechargeVC.type = @"4";
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:rechargeVC animated:YES];
}
break;
case SecretaryRouterType_UserInfo:

View File

@@ -28,6 +28,7 @@
#import "XPMineDressUpViewController.h"
#import "XPDressUpShopCardViewController.h"
#import "XPMineRechargeViewController.h"
#import "XPIAPRechargeViewController.h"
@interface XPDressUpShopViewController ()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate, SDCycleScrollViewDelegate>
@@ -232,10 +233,10 @@
}
- (void)rechargeButtonAction:(UIButton *)sender {
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]];
webVC.isPush = YES;
[self.navigationController pushViewController:webVC animated:YES];
// XPMineRechargeViewController *vc = [[XPMineRechargeViewController alloc] init];
XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init];
rechargeVC.type = @"4";
[self.navigationController pushViewController:rechargeVC animated:YES];
}
#pragma mark - Getters And Setters

View File

@@ -12,6 +12,7 @@
#import "XPWebViewController.h"
#import "XPExchangeDiamondsVC.h"
#import "XPIncomeRecordGoldDetailsVC.h"
#import "XPIAPRechargeViewController.h"
///Present
#import "XPIncomeRecordPresent.h"
///Protocol
@@ -115,9 +116,8 @@
}
case ClickType_Diamond_Pay:
{
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]];
webVC.isPush = YES;
XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init];
webVC.type = @"4";
[self.navigationController pushViewController:webVC animated:YES];
break;
}
@@ -138,16 +138,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;
}
}

View File

@@ -38,7 +38,7 @@
UserInfoModel * infoModel = [UserInfoModel modelWithDictionary:data.data];
[[self getView] onGetUserInfoSuccess:infoModel];
} fail:^(NSInteger code, NSString * _Nullable msg) {
NSLog(@"111");
}] uid:uid];
}

View File

@@ -51,7 +51,7 @@
}];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.leading.bottom.equalTo(self);
make.height.mas_equalTo(319);
make.height.mas_equalTo(375);
}];
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(24);
@@ -158,7 +158,7 @@
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.rowHeight = 56;
_tableView.scrollEnabled = NO;
_tableView.backgroundColor = [UIColor whiteColor];
[_tableView registerClass:[XPNobleCenterPayCell class] forCellReuseIdentifier:NSStringFromClass([XPNobleCenterPayCell class])];
}
@@ -180,7 +180,7 @@
}
- (NSArray *)listData{
if(!_listData){
_listData = @[YMLocalizedString(@"XPNobleCenterPayView2")];
_listData = @[YMLocalizedString(@"XPNobleCenterPayView2"),@"Apple Pay"];
}
return _listData;
}

View File

@@ -17,7 +17,7 @@
#import "DJDKMIMOMColor.h"
#import "ThemeColor+NobleCenter.h"
#import "Api+NobleCenter.h"
#import "Api+Main.h"
#import "RechargeStorage.h"
#import "AccountInfoStorage.h"
@@ -31,6 +31,7 @@
#import "XPWebViewController.h"
#import "XPNobleSettingViewController.h"
#import "XPSkillCardPlayerManager.h"
#import "SessionViewController.h"
///P
#import "XPNobleCenterPresenter.h"
#import "Api+Gift.h"
@@ -42,6 +43,9 @@
#import "WalletInfoModel.h"
#import "XPNobleCenterPayView.h"
#import "XPNobleCenterProtocol.h"
#import "XPIAPRechargeViewController.h"
#import "YuMi-swift.h"
#import "ClientConfig.h"
@interface XPNobleCenterViewController ()<XPNobleCenterProtocol,XPNobleCenterPayViewDelegate,JXCategoryViewDelegate, JXCategoryListContainerViewDelegate,XPNobleCenterNavViewDelegate, NIMSystemNotificationManagerDelegate>
///
@property (nonatomic, strong) NSArray<NSString *> *titles;
@@ -78,6 +82,7 @@
@property (nonatomic, assign) NSInteger roomUid;
@property (nonatomic,strong) WalletInfoModel * infoModel;
@property(nonatomic,strong) UIButton *rankBtn;
@property(nonatomic,assign) BOOL pi_IsNative;
@end
@implementation XPNobleCenterViewController
@@ -96,14 +101,13 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.pi_IsNative = YES;
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
[self requestHttp];
[self initSubViews];
[self initSubViewConstraints];
}
- (BOOL)isHiddenNavBar {
return YES;
}
@@ -115,8 +119,8 @@
[self.presenter getUserInfo];
}
if([XPSkillCardPlayerManager shareInstance].isInRoom == YES && [XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge == NO){
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = YES;
}
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = YES;
}
}
- (XPNobleCenterPresenter *)createPresenter {
@@ -143,7 +147,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);
@@ -153,7 +157,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);
@@ -177,7 +181,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);
@@ -185,7 +189,7 @@
make.trailing.mas_equalTo(-24);
make.top.mas_equalTo(139);
}];
}
#pragma mark - XPNobleCenterPayViewDelegate
- (void)payWithType:(NobleCenterPayType)type{
@@ -195,12 +199,11 @@
config.message = YMLocalizedString(@"XPNobleCenterViewController3");
config.actionStyle = TTAlertActionBothStyle;
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"5",[YYUtility deviceID]];
webVC.isPush = YES;
XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init];
[self.navigationController pushViewController:webVC animated:YES];
} cancelHandler:^{
}];
return;
}
@@ -208,10 +211,22 @@
[self.presenter openVipWithDiamondRoomUid:roomUid];
return;
}
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"5",[YYUtility deviceID]];
webVC.isPush = YES;
[self.navigationController pushViewController:webVC animated:YES];
if(self.pi_IsNative == NO){
XPWebViewController *vc = [[XPWebViewController alloc]init];
NSString *channel = @"p";
channel = [NSString stringWithFormat:@"%@a",channel];
channel = [NSString stringWithFormat:@"%@y",channel];
NSString *url = [NSString stringWithFormat:URLWithType(kChannelUrl),channel,@"5",[YYUtility deviceID]];
vc.url = url;
[self.navigationController pushViewController:vc animated:YES];
return;
}
if(self.rechargeModel.list.count == 0)return;
[XNDJTDDLoadingTool showOnlyView:kWindow];
RechargeListModel *rechargeModel = [self.rechargeModel.list safeObjectAtIndex1:0];
[self.presenter requestNobleIAPRechargeOrderWithChargeProdId:rechargeModel.chargeProdId roomUid:self.roomUid ? [NSString stringWithFormat:@"%zd", self.roomUid] : nil];
}
-(void)openVipWithDiamondSuccess{
[self requestHttp];
@@ -222,6 +237,7 @@
///
- (void)requestHttp {
[self.presenter getUserInfo];
[self checkTranscationIds];
[self.presenter getNobleChargeProductListWithChannelType:@"9"];
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
@@ -231,9 +247,36 @@
self.infoModel = model;
}
} uid:uid ticket:ticket];
if([ClientConfig shareConfig].canOpen){
[Api requestMineChannel:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
if(data.data[@"isNative"] != nil){
self.pi_IsNative = [data.data[@"isNative"] boolValue];
}
}
}];
}
}
///
- (void)checkTranscationIds {
NSString * uid = [AccountInfoStorage instance].getUid;
NSArray * array = [RechargeStorage getAllReciptsWithUid:uid];
for (NSDictionary *transcation in array) {
NSString *orderId = transcation[@"orderId"];
NSString *transcationId = transcation[@"transcationId"];
///
[self.presenter checkReceiptWithOrderId:orderId transcationId:transcationId errorToast:NO];
}
}
#pragma mark - XPNobleCenterProtocol
///
@@ -276,29 +319,183 @@
self.openNobleButton.text = title;
}
///id
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid{
if (orderId.length > 0) {
self.orderId = orderId;
if (@available(iOS 15.0, *)) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap demandCommodityThingWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
}];
@kWeakify(self);
iap.ConditionBlock = ^(enum StoreConditionResult state, NSDictionary<NSString *,id> * _Nullable result) {
@kStrongify(self);
[self rechargeNewProcessStatus:state];
switch (state) {
case StoreConditionResultVerifiedServer:
{
NSString *transactionId = result[@"transactionId"];
[self rechargeSuccess:transactionId];
}
break;
default:
{
}
break;
}
};
} else {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController10")];
}
} else {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
}
}
///
- (void)requestIAPRechargeOrderFail:(NSString *)message code:(NSInteger)code {
[self hideHUD];
[XNDJTDDLoadingTool hideOnlyView:kWindow];
if(code == 50000){
TTAlertConfig *config = [[TTAlertConfig alloc]init];
config.title = YMLocalizedString(@"XPIAPRechargeViewController7");
config.message = YMLocalizedString(@"XPIAPRechargeViewController8");
TTAlertButtonConfig *confirmButtonConfig = [[TTAlertButtonConfig alloc]init];
confirmButtonConfig.title = YMLocalizedString(@"XPIAPRechargeViewController9");
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x13E2F5),UIColorFromRGB(0x9DB4FF),UIColorFromRGB(0xCC67FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(200, 200)];
confirmButtonConfig.backgroundColor = [UIColor colorWithPatternImage:image];
confirmButtonConfig.cornerRadius = 38/2;
config.confirmButtonConfig = confirmButtonConfig;
[TTPopup alertWithConfig:config confirmHandler:^{
[self.presenter getContactCustomerService];
} cancelHandler:^{
}];
return;
}
[self showErrorToast:message];
}
- (void)getContactCustomerServiceSuccessWithUid:(NSString *)uid{
[self hideHUD];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NIMSession * session = [NIMSession session:uid type:NIMSessionTypeP2P];
SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session];
[self.navigationController pushViewController:sessionVC animated:YES];
});
}
///
- (void)checkReceiptSuccess:(NSString *)transcationId {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
if (@available(iOS 15.0, *)) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
self.orderId = nil;
//5
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (!self.userInfo.userVipInfoVO) {
///
[self.presenter getUserInfo];
}
});
}
- (void)checkReceiptFailWithCode:(NSInteger)code transcationId:(NSString *)transcationId{
[XNDJTDDLoadingTool hideOnlyView:kWindow];
if(code == 1444){
if (@available(iOS 15.0, *)) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
}
}
///
- (void)deleteRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier {
NSString * uid = [AccountInfoStorage instance].getUid;
BOOL deleteSuccess = [RechargeStorage delegateTranscationId:transactionIdentifier uid:uid];
if (deleteSuccess) {
#warning to do
}
}
- (void)checkTranscationIdsSuccess {
NSString * uid = [AccountInfoStorage instance].getUid;
[RechargeStorage delegateAllTranscationIdsWithUid:uid];
}
-(void)rankAction{
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = URLWithType(kNobleRankURL);
[self.navigationController pushViewController:webVC animated:YES];
}
#pragma mark - XPIAPHelperDelegate
///
- (void)rechargeNewProcessStatus:(StoreConditionResult)status {
if (status == StoreConditionResultPay || status == StoreConditionResultStart || status == StoreConditionResultVerifiedServer) {
}else if (status == StoreConditionResultUnowned) {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
}else{
[XNDJTDDLoadingTool hideOnlyView:kWindow];
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController0")];
}
}
///id
- (void)rechargeSuccess:(NSString *)transactionIdentifier {
///
[self saveRechageReciptWithTransactionIdentifier:transactionIdentifier];
///
[self.presenter 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];
if(transactionIdentifier != nil){
[dictionary setObject:transactionIdentifier forKey:@"transcationId"];
}
if(encodeStr != nil){
[dictionary setObject:encodeStr forKey:@"recipt"];
}
if(self.orderId != nil){
[dictionary setObject:self.orderId forKey:@"orderId"];
}
if(dictionary.allKeys.count == 0)return;
NSString *reciptJson = [dictionary toJSONString];
NSString * uid = [AccountInfoStorage instance].getUid;
BOOL saveSuccess = [RechargeStorage saveTranscationId:transactionIdentifier recipt:reciptJson uid:uid];
if (!saveSuccess) {
#warning to do
}
}
#pragma mark - JXCategoryViewDelegate
@@ -371,7 +568,7 @@
payView.delegate = self;
[self.view addSubview:payView];
}
#pragma mark - Getters And Setters
@@ -448,7 +645,7 @@
_openNobleButton.textColor = [DJDKMIMOMColor mainTextColor];
_openNobleButton.numberOfLines = 0;
_openNobleButton.textAlignment = NSTextAlignmentCenter;
}
return _openNobleButton;
}

View File

@@ -119,7 +119,7 @@
NSString *channel = @"p";
channel = [NSString stringWithFormat:@"%@a",channel];
channel = [NSString stringWithFormat:@"%@y",channel];
NSString *url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),self.type,[YYUtility deviceID]];
NSString *url = [NSString stringWithFormat:URLWithType(kChannelUrl),channel,self.type,[YYUtility deviceID]];
vc.url = url;
[self addChildViewController:vc];
vc.view.frame = self.view.frame;
@@ -355,7 +355,7 @@
if (@available(iOS 15.0, *)) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap demandShopedThingWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
[iap demandCommodityThingWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
}];
@kWeakify(self);
@@ -430,7 +430,7 @@
[XNDJTDDLoadingTool hideHUDInView:kWindow];
if (@available(iOS 15.0, *)) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
@@ -448,7 +448,7 @@
if(code == 1444){
if (@available(iOS 15.0, *)) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}

View File

@@ -55,8 +55,13 @@
#import "XPMineCollectRoomListViewController.h"
#import "XPMineMainGuildListVC.h"
#import "XPMineGiveDiamondVC.h"
#import "XPIAPRechargeViewController.h"
#import "XPIncomeRecordVC.h"
#import "XPNobleCenterViewController.h"
#import "LittleGameInfoModel.h"
#import "HomeLittleGameRoomModel.h"
#import "XPLittleGameRoomOpenView.h"
#import "XPMineGameTableViewCell.h"
UIKIT_EXTERN NSString *kRequestRicket;
@interface XPMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineProtocol, XPMineHeadItemTableViewCellDelegate, XPMineHeadViewDelegate, XPHomeBannerTableViewCellDelegate>
@@ -82,6 +87,10 @@ UIKIT_EXTERN NSString *kRequestRicket;
@property (nonatomic,assign) BOOL isRefreshRoomInfo;
///,
@property (nonatomic,assign) BOOL isRequestData;
///
@property (nonatomic, strong) NSMutableArray<LittleGameInfoModel *> *littleGameArray;
@end
@implementation XPMineViewController
@@ -219,8 +228,22 @@ UIKIT_EXTERN NSString *kRequestRicket;
break;
case XPMineItemType_My_Room:
{
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
[XPRoomViewController openRoom:roomUid viewController:self];
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
[Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
RoomInfoModel * roomInfo = [RoomInfoModel modelWithJSON:data.data];
if (roomInfo.isReselect) {
XPLittleGameRoomOpenView * roomOpenView = [[XPLittleGameRoomOpenView alloc] init];
roomOpenView.roomInfo = roomInfo;
roomOpenView.currentVC = self;
[TTPopup popupView:roomOpenView style:TTPopupStyleActionSheet];
} else {
[XPRoomViewController openRoom:roomUid viewController:self];
}
} else {
[self showErrorToast:msg];
}
} uid:roomUid intoUid:roomUid];
}
break;
case XPMineItemType_Collect_Room://
@@ -408,10 +431,9 @@ UIKIT_EXTERN NSString *kRequestRicket;
}
///
-(void)pushThirdPartyPayVC{
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]];
webVC.isPush = YES;
[self.navigationController pushViewController:webVC animated:YES];
XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init];
webVC.type = @"4";
[self.navigationController pushViewController:webVC animated:YES];
}
///
-(void)pushEarningsRecordVC{
@@ -425,9 +447,24 @@ UIKIT_EXTERN NSString *kRequestRicket;
///
-(void)pushMyRoomVC{
if(self.isRefreshRoomInfo == YES)return;
self.isRefreshRoomInfo = YES;
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
[XPRoomViewController openRoom:roomUid viewController:self];
self.isRefreshRoomInfo = YES;
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
[Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
self.isRefreshRoomInfo = NO;
if (code == 200) {
RoomInfoModel * roomInfo = [RoomInfoModel modelWithJSON:data.data];
if (roomInfo.isReselect) {
XPLittleGameRoomOpenView * roomOpenView = [[XPLittleGameRoomOpenView alloc] init];
roomOpenView.roomInfo = roomInfo;
roomOpenView.currentVC = self;
[TTPopup popupView:roomOpenView style:TTPopupStyleActionSheet];
} else {
[XPRoomViewController openRoom:roomUid viewController:self];
}
} else {
[self showErrorToast:msg];
}
} uid:roomUid intoUid:roomUid];
}
#pragma mark - XPMineHeadViewDelegate
///
@@ -485,7 +522,21 @@ UIKIT_EXTERN NSString *kRequestRicket;
- (void)onGetMineFuntionItemFailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
}
///
- (void)onGetLittleGameListSuccess:(NSArray<LittleGameInfoModel *> *)items WithGroup:(nonnull dispatch_group_t)group{
[self.littleGameArray removeAllObjects];
[self.littleGameArray addObjectsFromArray:items];
dispatch_group_leave(group);
NSMutableArray *array = [NSMutableArray array];
for (LittleGameInfoModel *item in self.littleGameArray) {
[array addObject:item.name];
}
NSString *trackName = [array componentsJoinedByString:@","];
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_quick_entry_show eventAttributes:@{@"gameName" : trackName}];
}
- (void)onGetLittleGameListFailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
}
///banner
- (void)onGetPersonalBannerListSuccess:(NSArray<HomeBannerInfoModel *> *)items WithGroup:(nonnull dispatch_group_t)group{
[self.bannerArray removeAllObjects];
@@ -534,7 +585,10 @@ UIKIT_EXTERN NSString *kRequestRicket;
dispatch_group_async(group, queue, ^{
[self.presenter getPersonItemListWithGroup:group];
});
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getLittleGameListWithGroup:group];
});
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getMineBannerListWithGroup:group];
@@ -543,6 +597,8 @@ UIKIT_EXTERN NSString *kRequestRicket;
dispatch_group_async(group, queue, ^{
[self.presenter getNobleInfoWithGroup:group];
});
dispatch_group_notify(group,dispatch_get_main_queue(), ^{
self.isRequestData = NO;
self.userInfo = userInfo;
@@ -580,6 +636,58 @@ UIKIT_EXTERN NSString *kRequestRicket;
- (void)onGetClanDetailInfofailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
}
///
- (void)quickMatchLittleGameRoomSuccess:(HomeLittleGameRoomModel *)roomInfo mgId:(NSString *)mgId {
if (roomInfo.isPick && roomInfo.uid.length > 0) {
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_quick_entrysuccess_click eventAttributes:@{@"roomUid" : roomInfo.uid}];
[XPRoomViewController openRoom:roomInfo.uid viewController:self];
} else if (roomInfo.needOpenSelfRoom) {
NSString* roomUid = [NSString stringWithFormat:@"%ld", (long)self.userInfo.uid];
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_quick_entrysuccess_click eventAttributes:@{@"roomUid" : roomUid}];
[Api getRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
RoomInfoModel * roomInfo = [RoomInfoModel modelWithJSON:data.data];
if (roomInfo.mgId != [mgId intValue]) {///
NSMutableDictionary * params = [NSMutableDictionary dictionary];
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[params setObject:ticket forKey:@"ticket"];
[params setObject:uid forKey:@"uid"];
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.uid] forKey:@"roomUid"];
if (roomInfo.title.length > 0) {
[params setObject:roomInfo.title forKey:@"title"];
}
if (roomInfo.roomPwd.length > 0) {
[params setObject:roomInfo.roomPwd forKey:@"roomPwd"];
} else{
[params setObject:@"" forKey:@"roomPwd"];
}
if (roomInfo.tagId > 0) {
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.tagId] forKey:@"tagId"];
}
[params setObject:@(RoomType_MiniGame) forKey:@"type"];
[params setObject:mgId forKey:@"mgId"];
[params setObject:@(roomInfo.hasAnimationEffect) forKey:@"hasAnimationEffect"];
[Api ownerUpdateRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
[XPRoomViewController openRoom:[AccountInfoStorage instance].getUid mgId:mgId viewController:self];
}
} params:params];
}
} else {
[self showErrorToast:msg];
}
} uid:roomUid intoUid:roomUid];
}
}
///
- (void)quickMatchLittleGameRoomFail:(NSString *)mgId {
[XPRoomViewController openRoom:[NSString stringWithFormat:@"%ld", self.userInfo.uid] mgId:mgId viewController:self];
}
#pragma mark - XPMineHeadItemTableViewCellDelegate
- (void)xPMineHeadItemTableViewCell:(XPMineHeadItemTableViewCell *)cell didSelectItem:(XPMineFuntionItemModel *)item {
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_function_click eventAttributes:@{@"functionName" : item.centerName}];
@@ -609,7 +717,11 @@ UIKIT_EXTERN NSString *kRequestRicket;
break;
}
}
#pragma mark - XPMineGameTableViewCellDelegate
///
- (void)xPMineGameTableViewCell:(XPMineGameTableViewCell *)cell didSelectItem:(LittleGameInfoModel *)item {
[self.presenter quickMatchLittleGameWithMgId:item.mgId];
}
#pragma mark - NSNotification
- (void)onVisitorUnReadCountUpdate:(NSNotification *)noti {
@@ -623,7 +735,6 @@ UIKIT_EXTERN NSString *kRequestRicket;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.contentInset = UIEdgeInsetsMake(0, 0, 100, 0);
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;;
[_tableView registerClass:[XPMineTheGuildCell class] forCellReuseIdentifier:NSStringFromClass([XPMineTheGuildCell class])];
[_tableView registerClass:[XPMinePersonalCenterCell class] forCellReuseIdentifier:NSStringFromClass([XPMinePersonalCenterCell class])];
@@ -656,6 +767,12 @@ UIKIT_EXTERN NSString *kRequestRicket;
}
return _functionArray;
}
- (NSMutableArray<LittleGameInfoModel *> *)littleGameArray {
if (!_littleGameArray) {
_littleGameArray = [NSMutableArray array];
}
return _littleGameArray;
}
- (NSMutableArray<HomeBannerInfoModel *> *)bannerArray {
if (!_bannerArray) {

View File

@@ -44,6 +44,7 @@
#import "XPMineUserInfoViewController.h"
#import "XPMineSimpleUserInfoViewController.h"
#import "XPMineRechargeViewController.h"
#import "XPIAPRechargeViewController.h"
#import "XPWebViewController.h"
#import "XPRoomViewController.h"
#import "XPMineDressUpViewController.h"
@@ -58,6 +59,7 @@
#import "XPMineCollectRoomListViewController.h"
#import "XPMineFeedbackViewController.h"
#import "XPMineSimpleUserInfoViewController.h"
#import "XPIAPRechargeViewController.h"
@interface XPSimpleMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPHomeBannerTableViewCellDelegate, XPMineProtocol, XPSimpleMineHeaderViewDelegate>
@@ -135,10 +137,10 @@
break;
case XPMineItemType_Account:
{
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]];
webVC.isPush = YES;
[self.navigationController pushViewController:webVC animated:YES];
// XPMineRechargeViewController * rechargeVC = [[XPMineRechargeViewController alloc] init];
XPIAPRechargeViewController *rechargeVC = [[XPIAPRechargeViewController alloc] init];
rechargeVC.type = @"4";
[self.navigationController pushViewController:rechargeVC animated:YES];
}
break;
case XPMineItemType_Personinfo:
@@ -439,7 +441,7 @@
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
[_tableView registerClass:[XPMineItemTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineItemTableViewCell class])];
[_tableView registerClass:[XPHomeBannerTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPHomeBannerTableViewCell class])];
_tableView.contentInset = UIEdgeInsetsMake(0, 0, 100, 0);
}
return _tableView;
}

View File

@@ -25,7 +25,7 @@
#import "XPMonentsPublishViewController.h"
@interface XPMonentTopicContainerViewController ()<JXPagerViewDelegate,JXCategoryViewDelegate>
@property (nonatomic,strong) JXCategoryTitleView *categoryView;
@property (nonatomic,strong) JXCategoryTitleView *pi_categoryView;
@property (nonatomic,strong) JXCategoryIndicatorLineView *lineView;
@property (nonatomic,strong) JXPagerListRefreshView *pagerContentView;
@property (nonatomic,strong) NSArray<NSString *> *titles;
@@ -101,7 +101,7 @@
}
- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
return self.categoryView;
return self.pi_categoryView;
}
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
@@ -137,27 +137,27 @@
self.latestVC.worldId = _worldId;
}
- (JXCategoryTitleView *)categoryView {
if (!_categoryView) {
_categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 46)];
_categoryView.titles = self.titles;
_categoryView.backgroundColor = [UIColor whiteColor];
_categoryView.delegate = self;
_categoryView.titleSelectedColor = [DJDKMIMOMColor mainTextColor];
_categoryView.titleColor = [DJDKMIMOMColor secondTextColor];
_categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:18];
_categoryView.titleFont = [UIFont systemFontOfSize:15];
_categoryView.titleColorGradientEnabled = YES;
_categoryView.titleLabelZoomEnabled = NO;
_categoryView.indicators = @[self.lineView];
_categoryView.listContainer = (id<JXCategoryViewListContainer>)self.pagerContentView.listContainerView;
_categoryView.averageCellSpacingEnabled = NO;
_categoryView.contentEdgeInsetLeft = 20;
_categoryView.contentEdgeInsetRight = 20;
_categoryView.cellSpacing = 30;
- (JXCategoryTitleView *)pi_categoryView {
if (!_pi_categoryView) {
_pi_categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 46)];
_pi_categoryView.titles = self.titles;
_pi_categoryView.backgroundColor = [UIColor whiteColor];
_pi_categoryView.delegate = self;
_pi_categoryView.titleSelectedColor = [DJDKMIMOMColor mainTextColor];
_pi_categoryView.titleColor = [DJDKMIMOMColor secondTextColor];
_pi_categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:18];
_pi_categoryView.titleFont = [UIFont systemFontOfSize:15];
_pi_categoryView.titleColorGradientEnabled = YES;
_pi_categoryView.titleLabelZoomEnabled = NO;
_pi_categoryView.indicators = @[self.lineView];
_pi_categoryView.listContainer = (id<JXCategoryViewListContainer>)self.pagerContentView.listContainerView;
_pi_categoryView.averageCellSpacingEnabled = NO;
_pi_categoryView.contentEdgeInsetLeft = 20;
_pi_categoryView.contentEdgeInsetRight = 20;
_pi_categoryView.cellSpacing = 30;
}
return _categoryView;
return _pi_categoryView;
}
- (JXCategoryIndicatorLineView *)lineView {

View File

@@ -46,7 +46,6 @@ NS_ASSUME_NONNULL_BEGIN
//是否为周榜top1
@property(nonatomic,assign) BOOL isWeekTop1;
@property(nonatomic,copy) NSString *inRoomUid;
//是否在麦位
@property(nonatomic,assign) BOOL inMic;
///是否在线

View File

@@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface XPNewHomePartyTableViewCell : UITableViewCell
@property (nonatomic,strong) HomePlayRoomModel *roomInfo;
@property (nonatomic,strong) HomeRecommendRoomModel *roomInfo1;
@property(nonatomic,weak) id<XPNewHomePartyTableViewCellDelegate>delegate;
///声音卡时svga是否播放动画
-(void)setPlaySoundStatus:(BOOL)isPlay;

View File

@@ -243,14 +243,7 @@
-(void)setPlaySoundTime:(NSInteger)time{
_audioView.voiceDura = @(time).stringValue;
}
- (void)setRoomInfo1:(HomeRecommendRoomModel *)roomInfo1 {
_roomInfo1 = roomInfo1;
if (_roomInfo1) {
}
}
-(void)didSelectItemAction{

View File

@@ -461,6 +461,7 @@ UIKIT_EXTERN NSString * const kShieldingNotification;
-(void)xPNewHomePartyTableViewCell:(XPNewHomePartyTableViewCell *_Nullable)cell didSelectChat:(HomePlayRoomModel *_Nonnull)roomModel{
if(roomModel.inMic == YES){
[XPRoomViewController openRoom:roomModel.inRoomUid fromNick:roomModel.nick fromType:UserEnterRoomFromType_Follow_User fromUid:roomModel.uid viewController:self];
return;
}

View File

@@ -30,12 +30,10 @@
#import "XCCurrentVCStackManager.h"
#import "XPCandyTreeInsufficientBalanceView.h"
#import "XPWebViewController.h"
#import "XPIAPRechargeViewController.h"
#import "XPCandyTreeBuyView.h"
#import "XPCandyTreeConfirmBuyView.h"
#import "XPCandyTreeBuySuccessView.h"
///P
#import "XPCandyTreePresenter.h"
#import "XPCandyTreeProtocol.h"
@@ -456,14 +454,9 @@ UIKIT_EXTERN NSString * const kRoomReceivedCandyNotificationKey;
#pragma mark -XPCandyTreeInsufficientBalanceViewDelegate
- (void)payBalanceAction{
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]];
webVC.isPush = YES;
@kWeakify(self)
webVC.CloseWebViewBlock = ^(BOOL result){
@kStrongify(self)
[self.presenter getCandyTreeInfo];
};
XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init];
webVC.delegate = self;
webVC.type = @"4";
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES];
}
#pragma mark - XPIAPRechargeViewControllerDelegate

View File

@@ -1,8 +1,8 @@
//
// XPFirstRechargeView.h
// xplan-ios
// YuMi
//
// Created by duoban on 2023/2/27.
// Created by YuMi on 2023/2/27.
//
#import <UIKit/UIKit.h>

View File

@@ -1,15 +1,26 @@
//
// XPFirstRechargeView.m
// xplan-ios
// YuMi
//
// Created by duoban on 2023/2/27.
// Created by YuMi on 2023/2/27.
//
///Third
#import <Masonry/Masonry.h>
#import <NIMSDK/NIMSDK.h>
///Tool
#import <Base64/MF_Base64Additions.h>
#import "YUMIMacroUitls.h"
#import "ThemeColor+FirstRecharge.h"
#import "UIImage+Utils.h"
#import "XPFirstRechargeFlowLayout.h"
#import "NSArray+Safe.h"
#import "XNDJTDDLoadingTool.h"
#import "AccountInfoStorage.h"
#import "YYUtility.h"
#import "Api+Mine.h"
#import "Api+Main.h"
#import "RechargeStorage.h"
///Model
#import "FirstRechargeModel.h"
///View
@@ -20,11 +31,14 @@
#import "XPFirstRechargeProtocol.h"
///VC
#import "XPMineRechargeViewController.h"
#import "XPWebViewController.h"
#import "XPFirstRechargeView.h"
#import "Api+FirstRecharge.h"
#import "FirstRechargeModel.h"
#import "XPSkillCardPlayerManager.h"
#import "YuMi-swift.h"
#import "ClientConfig.h"
@interface XPFirstRechargeView ()<UICollectionViewDelegate, UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
///
@property (nonatomic,strong) UIButton *backBtn;
@@ -56,16 +70,25 @@
@property (nonatomic,weak) UINavigationController * currentNav;
///
@property (nonatomic,strong) XPFirstRechargeCollectionView *rechargeView;
@property (nonatomic,strong) FirstRechargeModel *currentInfo;
@property (nonatomic,copy) NSString *orderId;
@property(nonatomic,assign) BOOL pi_IsNative;
@end
@implementation XPFirstRechargeView
- (void)dealloc {
}
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self initSubViews];
[self initSubViewConstraints];
[self getFirstRechargeRewardList];
}
return self;
}
@@ -81,6 +104,22 @@
}
[XNDJTDDLoadingTool showErrorWithMessage:msg];
} channelType:@"3"];
[self checkTranscationIds];
if([ClientConfig shareConfig].canOpen){
[Api requestMineChannel:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if(code == 200){
if(data.data[@"isNative"] != nil){
self.pi_IsNative = [data.data[@"isNative"] boolValue];
}
}
}];
}
}
#pragma mark - Private Method
- (void)initSubViews {
@@ -172,8 +211,8 @@
NSString * title = model.chargeProdTitle;
NSString * giveMoneyStr = [NSString stringWithFormat:@"%ld", model.giveMoney];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:kFontRegular(12), NSForegroundColorAttributeName:UIColorFromRGB(0xBE5AF6)}];
[attribute addAttribute:NSFontAttributeName value:kFontSemibold(12) range:[title rangeOfString:giveMoneyStr]];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12], NSForegroundColorAttributeName:UIColorFromRGB(0xBE5AF6)}];
[attribute addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12 weight:UIFontWeightSemibold] range:[title rangeOfString:giveMoneyStr]];
[self.extraButton setAttributedTitle:attribute forState:UIControlStateNormal];
}
@@ -182,6 +221,7 @@
if (array.count <= 0) return;
self.typeArrowView.hidden = NO;
self.originArray = array;
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];
@@ -189,11 +229,11 @@
}
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];
button.titleLabel.font = kFontMedium(15);
button.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
[button setTitle:title forState:UIControlStateNormal];
[button setTitle:title forState:UIControlStateSelected];
button.tag = i;
@@ -241,15 +281,205 @@
return cell;
}
#pragma mark -
///
/// @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"];
NSString *uuid = (NSString *)data.data[@"appAccountToken"];
[self requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId uuid:uuid];
} else {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
if(code == 50000){
if(self.delegate && [self.delegate respondsToSelector:@selector(contactCustomerService)]){
[self.delegate contactCustomerService];
}
[self backAction];
return;
}
[XNDJTDDLoadingTool showErrorWithMessage:msg];
}
} chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp];
}
- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId uuid:(NSString *)uuid{
if (orderId.length > 0) {
self.orderId = orderId;
if (@available(iOS 15.0, *)) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap demandCommodityThingWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
}];
@kWeakify(self);
iap.ConditionBlock = ^(enum StoreConditionResult state, NSDictionary<NSString *,id> * _Nullable result) {
@kStrongify(self);
[self rechargeNewProcessStatus:state];
switch (state) {
case StoreConditionResultVerifiedServer:
{
NSString *transactionId = result[@"transactionId"];
[self rechargeSuccess:transactionId];
}
break;
default:
{
}
break;
}
};
} else {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController10")];
}
}else{
[XNDJTDDLoadingTool hideOnlyView:kWindow];
}
}
#pragma mark - XPIAPHelperDelegate
///
- (void)rechargeNewProcessStatus:(StoreConditionResult)status {
if (status == StoreConditionResultPay || status == StoreConditionResultStart || status == StoreConditionResultVerifiedServer) {
}else if (status == StoreConditionResultUnowned) {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController1")];
}else{
[XNDJTDDLoadingTool hideOnlyView:kWindow];
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController0")];
}
}
///id
- (void)rechargeSuccess:(NSString *)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];
if(transactionIdentifier != nil){
[dictionary setObject:transactionIdentifier forKey:@"transcationId"];
}
if(encodeStr != nil){
[dictionary setObject:encodeStr forKey:@"recipt"];
}
if(self.orderId != nil){
[dictionary setObject:self.orderId forKey:@"orderId"];
}
if(dictionary.allKeys.count == 0)return;
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) {
#warning to do
}
}
///
- (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, *)) {
// PIIAPRegulate *iap = [PIIAPRegulate 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) {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
if (code == 200) {
[self checkReceiptSuccess:transcationId];
} else {
if(code == 1444){
if (@available(iOS 15.0, *)) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
}
if(errorToast == YES){
[XNDJTDDLoadingTool showErrorWithMessage:msg];
}
}
} chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket];
}
///
- (void)checkReceiptSuccess:(NSString *)transcationId {
if (@available(iOS 15.0, *)) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessAccomplishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
[self deleteRechageReciptWithTransactionIdentifier:transcationId];
self.orderId = nil;
}
#pragma mark - Event Response
@@ -260,10 +490,23 @@
}
- (void)rechargeButtonAction {
if(self.delegate && [self.delegate respondsToSelector:@selector(rechargeHandle)]){
[self.delegate rechargeHandle];
if(self.pi_IsNative == NO){
if(self.delegate && [self.delegate respondsToSelector:@selector(rechargeHandle)]){
[self.delegate rechargeHandle];
}
[self backAction];
return;
}
if (self.currentInfo == nil|| self.currentInfo.chargeProdId == nil) {
return;
}
FirstRechargeModel *model = self.currentInfo;
if (model.chargeProdId) {
[XNDJTDDLoadingTool showOnlyView:kWindow];
[self requestIAPRechargeOrderWithChargeProdId:model.chargeProdId];
}
[self backAction];
}
-(void)backAction{
[self removeFromSuperview];
@@ -271,6 +514,7 @@
- (void)buttonAction:(UIButton *)sender {
if (sender.tag <= self.originArray.count) {
FirstRechargeModel * model = [self.originArray safeObjectAtIndex1:sender.tag];
self.currentInfo = model;
[self createExtraRewardAttrebute:model];
self.rewardArray = model.firstChargeRewardList;
self.collectionView.hidden = self.rewardArray.count < 2;
@@ -354,7 +598,7 @@
- (UIButton *)extraButton {
if (!_extraButton) {
_extraButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_extraButton setBackgroundImage:kImage(@"room_first_recharge_extra") forState:UIControlStateNormal];
[_extraButton setBackgroundImage:[UIImage imageNamed:@"room_first_recharge_extra"] forState:UIControlStateNormal];
}
return _extraButton;
@@ -409,7 +653,7 @@
[_rechargeButton setBackgroundImage:[UIImage imageNamed:@"room_first_recharge_recharge"] forState:UIControlStateNormal];
[_rechargeButton setBackgroundImage:[UIImage imageNamed:@"room_first_recharge_recharge"] forState:UIControlStateSelected];
[_rechargeButton setTitle:YMLocalizedString(@"XPFirstRechargeViewController1") forState:UIControlStateNormal];
_rechargeButton.titleLabel.font = kFontSemibold(18);
_rechargeButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold];
[_rechargeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_rechargeButton addTarget:self action:@selector(rechargeButtonAction) forControlEvents:UIControlEventTouchUpInside];
}
@@ -418,7 +662,7 @@
- (UIImageView *)typeArrowView{
if (!_typeArrowView){
_typeArrowView = [UIImageView new];
_typeArrowView.image = kImage(@"room_first_recharge_recharge_arrow");
_typeArrowView.image = [UIImage imageNamed:@"room_first_recharge_recharge_arrow"];
_typeArrowView.hidden = YES;
}
return _typeArrowView;
@@ -434,7 +678,7 @@
if (!_backBtn){
_backBtn = [UIButton new];
[_backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
}
return _backBtn;
}

View File

@@ -98,7 +98,6 @@
}
+ (NSString *)getSDKVersion {
return [NSString stringWithFormat:@"v%@",[SudMGP getVersion]];
}

View File

@@ -8,7 +8,7 @@
#import "XPRoomLittleGameContainerView.h"
///Third
#import <Masonry/Masonry.h>
#import <SudMGP/SudMGP.h>
#import <NIMSDK/NIMSDK.h>
///Tool
#import "Api+LittleGame.h"
@@ -27,9 +27,10 @@
#import "XPKickUserModel.h"
#import "GuildSuperAdminInfoModel.h"
///P
#import <SudMGP/SudMGP-umbrella.h>
#import <SudMGP/ISudFSMMG.h>
#import <SudMGP/ISudFSTAPP.h>
#import <SudMGP/SudMGP.h>
#import <SudMGP/ISudFSMStateHandle.h>
@interface XPRoomLittleGameContainerView ()<RoomGuestDelegate,ISudFSMMG>
///ID
@property (nonatomic, assign) int64_t currentmgId;
@@ -102,7 +103,6 @@
#else
isTestEnv = NO;
#endif
[[SudMGP getCfg]setBackgroundMode:NO];
[SudMGP initSDK:KeyWithType(KeyType_SudGameAppID) appKey:KeyWithType(KeyType_SudGameAppKey) isTestEnv:isTestEnv listener:^(int retCode, const NSString *retMsg) {
if (retCode == 0) {
if (!self.currentmgId) {
@@ -124,7 +124,6 @@
language = @"zh-Hant"; //
}
self.fsmAPP2MG = [SudMGP loadMG:userId roomId:roomId code:self.code mgId:self.currentmgId language:[language isEqualToString:@"zh-Hant"]? @"zh-TW" : @"zh-CN" fsmMG:self rootView:self];
} else {
/// ,
NSLog(@"ISudFSMMG:initGameSDKWithAppID:初始化sdk失败 :%@",retMsg);

File diff suppressed because it is too large Load Diff

View File

@@ -21,11 +21,8 @@
#import "XPMinePayPwdViewController.h"
#import "BaseNavigationController.h"
#import "XPMineRechargeViewController.h"
#import "XPIAPRechargeViewController.h"
#import "XPRoomHalfWebView.h"
#import "XPWebViewController.h"
///P
#import "XPRoomRedPacketPresenter.h"
#import "XPRoomRedPacketProtocol.h"
@@ -34,7 +31,6 @@
#import "RoomInfoModel.h"
#import "UserInfoModel.h"
@interface XPRoomSendRedPacketViewController ()<YYTextViewDelegate, XPRoomRedPacketProtocol, XPRoomRedPacketPwdViewDelegate>
///host
@@ -407,10 +403,10 @@
}
- (void)onRechargeButtonClick:(UIButton *)sender {
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]];
webVC.isPush = YES;
[self.navigationController pushViewController:webVC animated:YES];
// XPMineRechargeViewController *rechargeVC = [[XPMineRechargeViewController alloc] init];
XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init];
rechargeVC.type = @"4";
[self.navigationController pushViewController:rechargeVC animated:YES];
}
- (void)onRuleButtonClick:(UIButton *)sender {

View File

@@ -32,7 +32,8 @@
///P
#import "XPTreasureFailyPresenter.h"
#import "XPTreasureFailyProtocol.h"
@interface XPTreasureFairyViewController ()<XPTreasureFailyProtocol, NIMSystemNotificationManagerDelegate, XPTreasureFairyMoreViewDelegate,XPTreasureFairyWebViewDelegate>
#import "XPIAPRechargeViewController.h"
@interface XPTreasureFairyViewController ()<XPTreasureFailyProtocol, NIMSystemNotificationManagerDelegate, XPTreasureFairyMoreViewDelegate,XPTreasureFairyWebViewDelegate,XPIAPRechargeViewControllerDelegate>
///
@property (nonatomic,strong) UIView *dismissView;
///
@@ -394,36 +395,28 @@
#pragma mark - XPTreasureFairyWebViewDelegate
-(void)payWithFairyHandler{
[TTPopup dismiss];
XPWebViewController *payVC = [[XPWebViewController alloc] initWithCustomizeNav:YES];
payVC.view.backgroundColor = [UIColor whiteColor];
payVC.webview.opaque = NO;
payVC.isFairyPay = YES;
[self addChildViewController:payVC];
[self.view addSubview:payVC.view];
@kWeakify(payVC);
payVC.CloseWebViewBlock = ^(BOOL result) {
@kStrongify(payVC);
dispatch_async(dispatch_get_main_queue(), ^{
[UIView animateWithDuration:0.5 animations:^{
payVC.view.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight);
}completion:^(BOOL finished) {
[payVC.view removeFromSuperview];
[self ticketRecognizer];
}];
});
};
payVC.view.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight);
[UIView animateWithDuration:0.5 animations:^{
payVC.view.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
}completion:^(BOOL finished) {
dispatch_async(dispatch_get_main_queue(), ^{
payVC.roomUid = self.roomUid;
payVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]];
});
}];
XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init];
rechargeVC.delegate = self;
rechargeVC.isFairyPay = YES;
rechargeVC.view.backgroundColor = [UIColor whiteColor];
[self addChildViewController:rechargeVC];
[self.view addSubview:rechargeVC.view];
rechargeVC.view.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight);
[UIView animateWithDuration:0.5 animations:^{
rechargeVC.view.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
}completion:^(BOOL finished) {
}];
}
#pragma mark - XPIAPRechargeViewController
- (void)paySuccess{
[self ticketRecognizer];
}
#pragma mark - Event Response
- (void)dismissVC {

File diff suppressed because it is too large Load Diff

View File

@@ -138,10 +138,9 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
[self.presenter autoLogin];
[self configTheme];
[self initTabs:NO];
if([ClientConfig shareConfig].isLoad == NO){
[ClientConfig shareConfig].isLoad = YES;
[[ClientConfig shareConfig] clientInit];
[ClientConfig shareConfig].isLoad = YES;
}
[[NIMSDK sharedSDK].loginManager addDelegate:self];
[[NIMSDK sharedSDK].chatManager addDelegate:self];
@@ -712,11 +711,15 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
if (logined) {
msg = [[XPSessionMainViewController alloc] init];
if ([ClientConfig shareConfig].canOpen) {
home = [[XPNewHomeViewController alloc] init];
monents = [[XPMonentsViewController alloc] init];
me = [[XPMineViewController alloc] init];
}else{
home = [[XPHomeSloganViewController alloc] init];
monents = [[XPMomentListViewController alloc] init];
me = [[XPSimpleMineViewController alloc] init];
}
} else {
game = [[XPBlankViewController alloc]init];
msg = [[XPSessionMainViewController alloc]init];

File diff suppressed because it is too large Load Diff

View File

@@ -76,7 +76,7 @@ public class PIIAPRegulate: NSObject {
//
@objc public func demandShopedThing(productId:String, uuid: String) async throws {
@objc public func demandCommodityThing(productId:String, uuid: String) async throws {
if(ConditionBlock != nil ){
ConditionBlock(StoreConditionResult.start,nil)
}
@@ -123,7 +123,7 @@ public class PIIAPRegulate: NSObject {
switch result {
case .success(let verification): //
let transaction = try await verifiedAndFinish(verification)
let transaction = try await verifiedAndAccomplish(verification)
return transaction
case .userCancelled: //
if(ConditionBlock != nil ){
@@ -161,7 +161,7 @@ public class PIIAPRegulate: NSObject {
}
// &
func verifiedAndFinish(_ verification:VerificationResult<Transaction>) async throws -> Transaction?{
func verifiedAndAccomplish(_ 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)
@@ -207,7 +207,7 @@ public class PIIAPRegulate: NSObject {
}
//
@objc public func verifyBusinessFinish(transaction:String) async{
@objc public func verifyBusinessAccomplish(transaction:String) async{
if(transactionMap[transaction] != nil){
await transactionMap[transaction]!.finish()
transactionMap.removeValue(forKey: transaction)
@@ -234,7 +234,7 @@ public class PIIAPRegulate: NSObject {
do {
print("iap: updates")
print("result:\(result)")
try await self.verifiedAndFinish(result)
try await self.verifiedAndAccomplish(result)
} catch {
//StoreKit has a transaction that fails verification. Don't deliver content to the user.
print("Transaction failed verification")