diff --git a/YuMi/Global/YUMIHtmlUrl.h b/YuMi/Global/YUMIHtmlUrl.h index cd26b36f..f484d39d 100644 --- a/YuMi/Global/YUMIHtmlUrl.h +++ b/YuMi/Global/YUMIHtmlUrl.h @@ -100,6 +100,8 @@ typedef NS_ENUM(NSUInteger, URLType) { kTreasureRuleURL, ///夺宝记录 kTreasureRecordURL, + ///第三方充值 + kThirdPartyPay, }; NSString * const URLWithType(URLType type); diff --git a/YuMi/Global/YUMIHtmlUrl.m b/YuMi/Global/YUMIHtmlUrl.m index 8fe89b67..cb883d02 100644 --- a/YuMi/Global/YUMIHtmlUrl.m +++ b/YuMi/Global/YUMIHtmlUrl.m @@ -26,6 +26,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=%@",///第三方充值 }; NSString * newUrl = [newDic objectForKey:@(type)]; if(newUrl != nil){ diff --git a/YuMi/Modules/YMMessage/View/Session/Content/MessageContentTextClickable.m b/YuMi/Modules/YMMessage/View/Session/Content/MessageContentTextClickable.m index 4e811962..9ec5186b 100644 --- a/YuMi/Modules/YMMessage/View/Session/Content/MessageContentTextClickable.m +++ b/YuMi/Modules/YMMessage/View/Session/Content/MessageContentTextClickable.m @@ -26,7 +26,6 @@ #import "XPRoomViewController.h" #import "XPWebViewController.h" #import "XPMineRechargeViewController.h" -#import "XPIAPRechargeViewController.h" #import "XPMineUserInfoViewController.h" #import "XPMineSimpleUserInfoViewController.h" #import "XPMineDressUpViewController.h" @@ -143,9 +142,10 @@ case SecretaryRouterType_Purse: case SecretaryRouterType_Recharge: { -// XPMineRechargeViewController * rechargeVC = [[XPMineRechargeViewController alloc] init]; - XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init]; - [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:rechargeVC animated:YES]; + 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]; } break; case SecretaryRouterType_UserInfo: diff --git a/YuMi/Modules/YMMine/View/DressUp/View/XPDressUpShopViewController.m b/YuMi/Modules/YMMine/View/DressUp/View/XPDressUpShopViewController.m index 0cb5e988..425a2d2d 100644 --- a/YuMi/Modules/YMMine/View/DressUp/View/XPDressUpShopViewController.m +++ b/YuMi/Modules/YMMine/View/DressUp/View/XPDressUpShopViewController.m @@ -28,7 +28,6 @@ #import "XPMineDressUpViewController.h" #import "XPDressUpShopCardViewController.h" #import "XPMineRechargeViewController.h" -#import "XPIAPRechargeViewController.h" @interface XPDressUpShopViewController () @@ -233,9 +232,10 @@ } - (void)rechargeButtonAction:(UIButton *)sender { -// XPMineRechargeViewController *vc = [[XPMineRechargeViewController alloc] init]; - XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init]; - [self.navigationController pushViewController:rechargeVC animated:YES]; + XPWebViewController * webVC =[[XPWebViewController alloc] init]; + webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]]; + webVC.isPush = YES; + [self.navigationController pushViewController:webVC animated:YES]; } #pragma mark - Getters And Setters diff --git a/YuMi/Modules/YMMine/View/IncomeRecord/XPIncomeRecordVC.m b/YuMi/Modules/YMMine/View/IncomeRecord/XPIncomeRecordVC.m index ce63e1a3..0cd9b15b 100644 --- a/YuMi/Modules/YMMine/View/IncomeRecord/XPIncomeRecordVC.m +++ b/YuMi/Modules/YMMine/View/IncomeRecord/XPIncomeRecordVC.m @@ -12,7 +12,6 @@ #import "XPWebViewController.h" #import "XPExchangeDiamondsVC.h" #import "XPIncomeRecordGoldDetailsVC.h" -#import "XPIAPRechargeViewController.h" ///Present #import "XPIncomeRecordPresent.h" ///Protocol @@ -116,7 +115,9 @@ } case ClickType_Diamond_Pay: { - XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; + XPWebViewController * webVC =[[XPWebViewController alloc] init]; + webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]]; + webVC.isPush = YES; [self.navigationController pushViewController:webVC animated:YES]; break; } diff --git a/YuMi/Modules/YMMine/View/Noble/View/XPNobleCenterViewController.m b/YuMi/Modules/YMMine/View/Noble/View/XPNobleCenterViewController.m index aad90d46..0799b920 100644 --- a/YuMi/Modules/YMMine/View/Noble/View/XPNobleCenterViewController.m +++ b/YuMi/Modules/YMMine/View/Noble/View/XPNobleCenterViewController.m @@ -42,7 +42,6 @@ #import "WalletInfoModel.h" #import "XPNobleCenterPayView.h" #import "XPNobleCenterProtocol.h" -#import "XPIAPRechargeViewController.h" @interface XPNobleCenterViewController () ///分页标题 @property (nonatomic, strong) NSArray *titles; @@ -196,8 +195,9 @@ config.message = YMLocalizedString(@"XPNobleCenterViewController3"); config.actionStyle = TTAlertActionBothStyle; [TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{ - - XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; + XPWebViewController * webVC =[[XPWebViewController alloc] init]; + webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"5",[YYUtility deviceID]]; + webVC.isPush = YES; [self.navigationController pushViewController:webVC animated:YES]; } cancelHandler:^{ diff --git a/YuMi/Modules/YMMine/View/XPMineViewController.m b/YuMi/Modules/YMMine/View/XPMineViewController.m index 94b7f66b..08516f5f 100644 --- a/YuMi/Modules/YMMine/View/XPMineViewController.m +++ b/YuMi/Modules/YMMine/View/XPMineViewController.m @@ -55,7 +55,6 @@ #import "XPMineCollectRoomListViewController.h" #import "XPMineMainGuildListVC.h" #import "XPMineGiveDiamondVC.h" -#import "XPIAPRechargeViewController.h" #import "XPIncomeRecordVC.h" #import "XPNobleCenterViewController.h" UIKIT_EXTERN NSString *kRequestRicket; @@ -415,8 +414,10 @@ UIKIT_EXTERN NSString *kRequestRicket; } ///点击充值 -(void)pushThirdPartyPayVC{ - XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; - [self.navigationController pushViewController:webVC animated:YES]; + XPWebViewController * webVC =[[XPWebViewController alloc] init]; + webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]]; + webVC.isPush = YES; + [self.navigationController pushViewController:webVC animated:YES]; } ///点击收益记录 -(void)pushEarningsRecordVC{ diff --git a/YuMi/Modules/YMMine/View/XPSimpleMineViewController.m b/YuMi/Modules/YMMine/View/XPSimpleMineViewController.m index 57599f01..d2fd472c 100644 --- a/YuMi/Modules/YMMine/View/XPSimpleMineViewController.m +++ b/YuMi/Modules/YMMine/View/XPSimpleMineViewController.m @@ -44,7 +44,6 @@ #import "XPMineUserInfoViewController.h" #import "XPMineSimpleUserInfoViewController.h" #import "XPMineRechargeViewController.h" -#import "XPIAPRechargeViewController.h" #import "XPWebViewController.h" #import "XPRoomViewController.h" #import "XPMineDressUpViewController.h" @@ -59,7 +58,6 @@ #import "XPMineCollectRoomListViewController.h" #import "XPMineFeedbackViewController.h" #import "XPMineSimpleUserInfoViewController.h" -#import "XPIAPRechargeViewController.h" @interface XPSimpleMineViewController () @@ -137,9 +135,10 @@ break; case XPMineItemType_Account: { -// XPMineRechargeViewController * rechargeVC = [[XPMineRechargeViewController alloc] init]; - XPIAPRechargeViewController *rechargeVC = [[XPIAPRechargeViewController alloc] init]; - [self.navigationController pushViewController:rechargeVC animated:YES]; + XPWebViewController * webVC =[[XPWebViewController alloc] init]; + webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]]; + webVC.isPush = YES; + [self.navigationController pushViewController:webVC animated:YES]; } break; case XPMineItemType_Personinfo: diff --git a/YuMi/Modules/YMRoom/View/CandyTree/View/XPCandyTreeViewController.m b/YuMi/Modules/YMRoom/View/CandyTree/View/XPCandyTreeViewController.m index 28351ab0..decbffdd 100644 --- a/YuMi/Modules/YMRoom/View/CandyTree/View/XPCandyTreeViewController.m +++ b/YuMi/Modules/YMRoom/View/CandyTree/View/XPCandyTreeViewController.m @@ -29,7 +29,6 @@ #import "XCCurrentVCStackManager.h" #import "XPCandyTreeInsufficientBalanceView.h" #import "XPWebViewController.h" -#import "XPIAPRechargeViewController.h" ///P #import "XPCandyTreePresenter.h" #import "XPCandyTreeProtocol.h" @@ -490,7 +489,14 @@ UIKIT_EXTERN NSString * const kRoomReceivedCandyNotificationKey; } #pragma mark -XPCandyTreeInsufficientBalanceViewDelegate - (void)payBalanceAction{ - XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; + 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]; + }; [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; } - (void)pickButtonAction:(UIButton *)sender { diff --git a/YuMi/Modules/YMRoom/View/FirstRecharge/View/XPFirstRechargeView.h b/YuMi/Modules/YMRoom/View/FirstRecharge/View/XPFirstRechargeView.h index 0633983f..952a7982 100644 --- a/YuMi/Modules/YMRoom/View/FirstRecharge/View/XPFirstRechargeView.h +++ b/YuMi/Modules/YMRoom/View/FirstRecharge/View/XPFirstRechargeView.h @@ -1,8 +1,8 @@ // // XPFirstRechargeView.h -// YuMi +// xplan-ios // -// Created by YuMi on 2023/2/27. +// Created by duoban on 2023/2/27. // #import diff --git a/YuMi/Modules/YMRoom/View/FirstRecharge/View/XPFirstRechargeView.m b/YuMi/Modules/YMRoom/View/FirstRecharge/View/XPFirstRechargeView.m index 5ba9f2d3..8e8eb84d 100644 --- a/YuMi/Modules/YMRoom/View/FirstRecharge/View/XPFirstRechargeView.m +++ b/YuMi/Modules/YMRoom/View/FirstRecharge/View/XPFirstRechargeView.m @@ -1,24 +1,15 @@ // // XPFirstRechargeView.m -// YuMi +// xplan-ios // -// Created by YuMi on 2023/2/27. +// Created by duoban on 2023/2/27. // ///Third #import ///Tool -#import -#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 "XPIAPHelper.h" -#import "RechargeStorage.h" ///Model #import "FirstRechargeModel.h" ///View @@ -34,7 +25,7 @@ #import "Api+FirstRecharge.h" #import "FirstRechargeModel.h" #import "XPSkillCardPlayerManager.h" -@interface XPFirstRechargeView () +@interface XPFirstRechargeView () /// @property (nonatomic,strong) UIButton *backBtn; ///背景图 @@ -65,23 +56,15 @@ @property (nonatomic,weak) UINavigationController * currentNav; /// @property (nonatomic,strong) XPFirstRechargeCollectionView *rechargeView; -@property (nonatomic,strong) FirstRechargeModel *currentInfo; -@property (nonatomic,copy) NSString *orderId; @end @implementation XPFirstRechargeView -- (void)dealloc { - [XPIAPHelper shareHelper].delegate = nil; -} - - -(instancetype)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if(self){ [self initSubViews]; [self initSubViewConstraints]; [self getFirstRechargeRewardList]; - [XPIAPHelper shareHelper].delegate = self; } return self; @@ -189,8 +172,8 @@ NSString * title = model.chargeProdTitle; NSString * giveMoneyStr = [NSString stringWithFormat:@"%ld", model.giveMoney]; - 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]]; + NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:kFontRegular(12), NSForegroundColorAttributeName:UIColorFromRGB(0xBE5AF6)}]; + [attribute addAttribute:NSFontAttributeName value:kFontSemibold(12) range:[title rangeOfString:giveMoneyStr]]; [self.extraButton setAttributedTitle:attribute forState:UIControlStateNormal]; } @@ -199,7 +182,6 @@ 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]; @@ -207,11 +189,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 = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium]; + button.titleLabel.font = kFontMedium(15); [button setTitle:title forState:UIControlStateNormal]; [button setTitle:title forState:UIControlStateSelected]; button.tag = i; @@ -259,100 +241,6 @@ 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"]; - [self requestIAPRechargeOrderSuccess:orderId chargeProdId:chargeProdId]; - } else { - [XNDJTDDLoadingTool hideHUD]; - [XNDJTDDLoadingTool showErrorWithMessage:msg]; - } - } chargeProdId:chargeProdId uid:uid ticket:ticket deviceInfo:deviceInfo clientIp:clientIp]; -} - -- (void)requestIAPRechargeOrderSuccess:(NSString *)orderId chargeProdId:(NSString *)chargeProdId { - if (orderId.length > 0) { - self.orderId = orderId; - [[XPIAPHelper shareHelper] buyAppProductWithAppProductId:chargeProdId]; - } -} -#pragma mark - XPIAPHelperDelegate -///当前充值的状态 -- (void)rechargeProcessStatus:(PaymentStatus)status { - [XNDJTDDLoadingTool hideHUD]; - if (status == PaymentStatus_Purchased) { - [XNDJTDDLoadingTool showLoading]; - } else if (status == PaymentStatus_Purchasing) { - [XNDJTDDLoadingTool showLoading]; - } else if (status == PaymentStatus_Failed) { - [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController0")]; - } else if (status == PaymentStatus_Deferred) { - [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPIAPRechargeViewController1")]; - } -} - -///充值成功回调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]; -} - -///充值成功之后保存订单到钥匙串 -- (void)saveRechageReciptWithTransactionIdentifier:(NSString *)transactionIdentifier { - NSData *receipt = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]]; - NSString *encodeStr = [receipt base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed]; - NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; - [dictionary setObject:transactionIdentifier forKey:@"transcationId"]; - [dictionary setObject:encodeStr forKey:@"recipt"]; - [dictionary setObject:self.orderId forKey:@"orderId"]; - NSString *reciptJson = [dictionary toJSONString]; - NSString * uid = [AccountInfoStorage instance].getUid; - BOOL saveSuccess = [RechargeStorage saveTranscationId:transactionIdentifier recipt:reciptJson uid:uid]; - if (!saveSuccess) { -#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)checkReceiptWithData:(NSString *)receipt orderId:(NSString *)orderId transcationId:(NSString *)transcationId { - NSString * uid = [AccountInfoStorage instance].getUid; - NSString * ticket = [AccountInfoStorage instance].getTicket; - [Api checkReceipt:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { - if (code == 200) { - [self checkReceiptSuccess:transcationId]; - } else { - [XNDJTDDLoadingTool showErrorWithMessage:msg]; - } - [XNDJTDDLoadingTool hideHUD]; - } receipt:receipt chooseEnv:@"true" chargeRecordId:orderId transcationId:transcationId uid:uid ticket:ticket]; -} - -///二次验证成功 -- (void)checkReceiptSuccess:(NSString *)transcationId { - [self deleteRechageReciptWithTransactionIdentifier:transcationId]; - self.orderId = nil; -} - #pragma mark - Event Response @@ -362,14 +250,22 @@ } - (void)rechargeButtonAction { - if (self.currentInfo == nil|| self.currentInfo.chargeProdId == nil) { - return; - } - FirstRechargeModel *model = self.currentInfo; - if (model.chargeProdId) { - [XNDJTDDLoadingTool showLoading]; - [self requestIAPRechargeOrderWithChargeProdId:model.chargeProdId]; - } + if(self.delegate && [self.delegate respondsToSelector:@selector(rechargeHandle)]){ + [self.delegate rechargeHandle]; + } + [self backAction]; + + + + + + + + + + + + } -(void)backAction{ [self removeFromSuperview]; @@ -377,7 +273,6 @@ - (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; @@ -461,7 +356,7 @@ - (UIButton *)extraButton { if (!_extraButton) { _extraButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_extraButton setBackgroundImage:[UIImage imageNamed:@"room_first_recharge_extra"] forState:UIControlStateNormal]; + [_extraButton setBackgroundImage:kImage(@"room_first_recharge_extra") forState:UIControlStateNormal]; } return _extraButton; @@ -516,7 +411,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 = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold]; + _rechargeButton.titleLabel.font = kFontSemibold(18); [_rechargeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [_rechargeButton addTarget:self action:@selector(rechargeButtonAction) forControlEvents:UIControlEventTouchUpInside]; } @@ -525,7 +420,7 @@ - (UIImageView *)typeArrowView{ if (!_typeArrowView){ _typeArrowView = [UIImageView new]; - _typeArrowView.image = [UIImage imageNamed:@"room_first_recharge_recharge_arrow"]; + _typeArrowView.image = kImage(@"room_first_recharge_recharge_arrow"); _typeArrowView.hidden = YES; } return _typeArrowView; diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m index 6779d4ee..92e49f0b 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m @@ -44,7 +44,6 @@ #import "XPGiftProtocol.h" ///VC #import "XPMineRechargeViewController.h" -#import "XPIAPRechargeViewController.h" #import "XPWebViewController.h" UIKIT_EXTERN NSString * kShowFirstRechargeView; @@ -435,11 +434,11 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView; ///充值 - (void)xPGiftBarViewDidClickRecharge:(XPGiftBarView *)view { - [self dismissViewControllerAnimated:NO completion:^{ -// XPMineRechargeViewController * rechargeVC = [[XPMineRechargeViewController alloc] init]; - XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init]; - [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:rechargeVC animated:YES]; - }]; + [self dismissViewControllerAnimated:YES completion:nil]; + XPWebViewController * webVC =[[XPWebViewController alloc] init]; + webVC.isPush = YES; + webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]]; + [self.delegate.getCurrentNav pushViewController:webVC animated:YES]; } - (void)xPGiftBarViewDidClickFirstRecharge:(XPGiftBarView *)view { diff --git a/YuMi/Modules/YMRoom/View/SendRedPacket/XPRoomSendRedPacketViewController.m b/YuMi/Modules/YMRoom/View/SendRedPacket/XPRoomSendRedPacketViewController.m index 10caf3db..8a12f8c2 100644 --- a/YuMi/Modules/YMRoom/View/SendRedPacket/XPRoomSendRedPacketViewController.m +++ b/YuMi/Modules/YMRoom/View/SendRedPacket/XPRoomSendRedPacketViewController.m @@ -21,8 +21,9 @@ #import "XPMinePayPwdViewController.h" #import "BaseNavigationController.h" #import "XPMineRechargeViewController.h" -#import "XPIAPRechargeViewController.h" #import "XPRoomHalfWebView.h" +#import "XPMineVerifIdentityViewController.h" +#import "XPWebViewController.h" ///P #import "XPRoomRedPacketPresenter.h" #import "XPRoomRedPacketProtocol.h" @@ -31,6 +32,7 @@ #import "RoomInfoModel.h" #import "UserInfoModel.h" + @interface XPRoomSendRedPacketViewController () ///host代理 @@ -403,9 +405,10 @@ } - (void)onRechargeButtonClick:(UIButton *)sender { -// XPMineRechargeViewController *rechargeVC = [[XPMineRechargeViewController alloc] init]; - XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init]; - [self.navigationController pushViewController:rechargeVC animated:YES]; + XPWebViewController * webVC =[[XPWebViewController alloc] init]; + webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]]; + webVC.isPush = YES; + [self.navigationController pushViewController:webVC animated:YES]; } - (void)onRuleButtonClick:(UIButton *)sender { diff --git a/YuMi/Modules/YMRoom/View/TreasureFairy/View/XPTreasureFairyViewController.m b/YuMi/Modules/YMRoom/View/TreasureFairy/View/XPTreasureFairyViewController.m index 7baac4c3..38ca44ac 100644 --- a/YuMi/Modules/YMRoom/View/TreasureFairy/View/XPTreasureFairyViewController.m +++ b/YuMi/Modules/YMRoom/View/TreasureFairy/View/XPTreasureFairyViewController.m @@ -32,8 +32,7 @@ ///P #import "XPTreasureFailyPresenter.h" #import "XPTreasureFailyProtocol.h" -#import "XPIAPRechargeViewController.h" -@interface XPTreasureFairyViewController () +@interface XPTreasureFairyViewController () ///点击消失 @property (nonatomic,strong) UIView *dismissView; ///背景 @@ -395,28 +394,36 @@ #pragma mark - XPTreasureFairyWebViewDelegate -(void)payWithFairyHandler{ [TTPopup dismiss]; - - 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) { - - - }]; - + 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]]; + }); + + }]; -} -#pragma mark - XPIAPRechargeViewController -- (void)paySuccess{ - [self ticketRecognizer]; - } #pragma mark - Event Response - (void)dismissVC { diff --git a/YuMi/Modules/YMRoom/View/XPRoomViewController.m b/YuMi/Modules/YMRoom/View/XPRoomViewController.m index 89cdb9b9..200ab02e 100644 --- a/YuMi/Modules/YMRoom/View/XPRoomViewController.m +++ b/YuMi/Modules/YMRoom/View/XPRoomViewController.m @@ -59,7 +59,7 @@ ///P #import "XPRoomPresenter.h" #import "XPRoomProtocol.h" - +#import "XPWebViewController.h" #import "RoomHostDelegate.h" #import "RoomGuestDelegate.h" @@ -1656,7 +1656,14 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出 [self enterRoomFail:0]; } } - +#pragma mark - XPFirstRechargeViewDelegate +-(void)rechargeHandle{ + XPWebViewController * webVC =[[XPWebViewController alloc] initWithCustomizeNav:YES]; + webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"6",[YYUtility deviceID]]; + webVC.isPush = YES; + webVC.modalPresentationStyle = UIModalPresentationFullScreen; + [self presentViewController:webVC animated:YES completion:nil]; +} - (XPRoomBackContainerView *)backContainerView { if (!_backContainerView) { _backContainerView = [[XPRoomBackContainerView alloc] initWithdelegate:self]; diff --git a/YuMi/Modules/YMWeb/XPWebViewController.m b/YuMi/Modules/YMWeb/XPWebViewController.m index b5b7def6..9e5d76fb 100644 --- a/YuMi/Modules/YMWeb/XPWebViewController.m +++ b/YuMi/Modules/YMWeb/XPWebViewController.m @@ -27,7 +27,7 @@ #import "Api+Mine.h" #import "XPSkillCardPlayerManager.h" #import "XPWebViewNavView.h" -#import "XPIAPRechargeViewController.h" + typedef NS_ENUM(NSUInteger, RightNavigationPushType){ ///跳转h5页面 @@ -300,24 +300,30 @@ NSString * const kJSOpenRoomForGiftId = @"openRoomForGiftId"; - [TTPopup dismiss]; - if(self.isPush){ - XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; - [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; - return; - } - UIViewController *controller = [XCCurrentVCStackManager shareManager].getCurrentVC; - if (controller.presentingViewController) { - [controller dismissViewControllerAnimated:NO completion:nil]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - - XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; - [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; - }); - }else { - XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; - [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; - } + [TTPopup dismiss]; + if(self.isPush){ + 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]; + return; + } + UIViewController *controller = [XCCurrentVCStackManager shareManager].getCurrentVC; + if (controller.presentingViewController) { + [controller dismissViewControllerAnimated:NO completion:nil]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + + XPWebViewController * webVC =[[XPWebViewController alloc] init]; + webVC.isPush = YES; + webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]]; + [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; + }); + }else { + XPWebViewController * webVC =[[XPWebViewController alloc] init]; + webVC.isPush = YES; + webVC.url = [NSString stringWithFormat:URLWithType(kThirdPartyPay),@"4",[YYUtility deviceID]]; + [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; + } } else if ([message.name isEqualToString:kOpenPersonPage]) { NSString *uid = [NSString stringWithFormat:@"%@",message.body]; if (uid.integerValue > 0) {