修复bug

This commit is contained in:
liyuhua
2023-10-24 19:01:30 +08:00
parent d0f6157bc8
commit be77a3a048
28 changed files with 309 additions and 90 deletions

View File

@@ -570,8 +570,9 @@
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
[self.view.superview.layer addAnimation:transition forKey:nil];
[self removeFromParentViewController];
[self.view removeFromSuperview];
[self willMoveToParentViewController:nil]; //1
[self.view removeFromSuperview]; //2
[self removeFromParentViewController]; //3
return;
}
[self.navigationController popViewControllerAnimated:YES];

View File

@@ -201,8 +201,9 @@
[UIView animateWithDuration:0.5 animations:^{
self.view.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight);
}completion:^(BOOL finished) {
[self.view removeFromSuperview];
[self removeFromParentViewController];
[self willMoveToParentViewController:nil]; //1
[self.view removeFromSuperview]; //2
[self removeFromParentViewController]; //3
}];
return;
}

View File

@@ -168,6 +168,8 @@ typedef NS_ENUM(NSInteger, RoomDatingStateChangeType) {
@property(nonatomic,strong) CandyTreeSwitchModel *seizeTreasureSwitchVo;
///是否有房间相册权限
@property(nonatomic,assign) BOOL hasRoomAlbum;
//1 厅内红包 2 全服红包 3 厅内红包+全服红包
@property(nonatomic,assign) NSInteger redEnvelopeType;
@end
NS_ASSUME_NONNULL_END

View File

@@ -35,6 +35,7 @@
#import "XCCurrentVCStackManager.h"
#import "XPTreasureFairyViewController.h"
#import "PIRoomEnterRedPacketView.h"
#import "BaseNavigationController.h"
UIKIT_EXTERN NSString *kShowFirstRechargeView;
@interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate>
///
@@ -369,10 +370,20 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
} else if(info.activityType == ActivityType_First) {
[self firstRechargeTapRecognizer];
}else if(info.activityType == ActivityType_Fairy){
XPTreasureFairyViewController * fairyVC = [[XPTreasureFairyViewController alloc] initWithdelegate:self.hostDelegate];
fairyVC.roomUid =[NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
fairyVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
[self.hostDelegate.getCurrentNav presentViewController:fairyVC animated:YES completion:nil];
fairyVC.view.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight);
[[XCCurrentVCStackManager shareManager].getCurrentVC addChildViewController:fairyVC];
[fairyVC.navigationController setNavigationBarHidden:YES animated:NO];
[[XCCurrentVCStackManager shareManager].getCurrentVC.view addSubview:fairyVC.view];
[UIView animateWithDuration:0.2 animations:^{
fairyVC.view.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
}completion:^(BOOL finished) {
}];
}else {
if (info.skipType == ActivitySkipType_Room) {
[self.hostDelegate exitRoom];

View File

@@ -1612,7 +1612,6 @@
XPRoomLuckyBigPrizeView * luckyGiftEffectView = [[XPRoomLuckyBigPrizeView alloc] initWithFrame:CGRectMake(KScreenWidth, top, 375, 60)];
luckyGiftEffectView.delegate = self;
[self.highLevleView addSubview:luckyGiftEffectView];
luckyGiftEffectView.giftInfo = prizeModel;
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];

View File

@@ -205,12 +205,12 @@
#pragma mark - Getters And Setters
- (void)setBroadcastModel:(GiftReceiveInfoModel *)broadcastModel {
_broadcastModel = broadcastModel;
NSString *sendUserNick = @"";
NSString *recvUserNick = @"";
if (_broadcastModel) {
NSString *sendUserNick = _broadcastModel.sendUserNick ?: @"";
NSString *recvUserNick = _broadcastModel.recvUserNick ?: @"";
self.senderAvatarView.imageUrl = _broadcastModel.sendUserAvatar;
sendUserNick = _broadcastModel.sendUserNick.length > 6 ? [_broadcastModel.sendUserNick substringToIndex:6] : _broadcastModel.sendUserNick;
recvUserNick = _broadcastModel.recvUserNick.length > 6 ? [_broadcastModel.recvUserNick substringToIndex:6] : _broadcastModel.recvUserNick;
sendUserNick = sendUserNick.length > 6 ? [sendUserNick substringToIndex:6] : sendUserNick;
recvUserNick = recvUserNick.length > 6 ? [recvUserNick substringToIndex:6] : recvUserNick;
NSString *giftName = [NSString stringWithFormat:@"%@ %@ %@ %@",_broadcastModel.sendUserNick,YMLocalizedString(@"XPRoomYearActivityView0"),_broadcastModel.recvUserNick,_broadcastModel.giftName];
NSMutableAttributedString *giftNameAtt = [[NSMutableAttributedString alloc]initWithString:giftName attributes:@{NSFontAttributeName:kFontMedium(14),NSForegroundColorAttributeName:[UIColor whiteColor]}];
[giftNameAtt addAttributes:@{NSFontAttributeName:kFontMedium(14),NSForegroundColorAttributeName:UIColorFromRGB(0xFFE468)} range:[giftName rangeOfString:sendUserNick]];

View File

@@ -64,8 +64,9 @@
if (nick.length > 6) {
nick = [nick substringToIndex:6];
}
NSString *goldPrice = giftInfo.goldPrice ?: @"";
NSString *giftName = giftInfo.giftName ?: @"";
NSString *goldPrice = _giftInfo.goldPrice ?: @"";
NSString *giftName = _giftInfo.giftName ?: @"";
NSString *luckyBagName = _giftInfo.luckyBagName ?: @"";
CGFloat fontSize = 22;
NSDictionary * dic = @{NSFontAttributeName:[UIFont systemFontOfSize:fontSize], NSForegroundColorAttributeName:[UIColor whiteColor]};
NSDictionary * mainDic = @{NSFontAttributeName:[UIFont systemFontOfSize:fontSize], NSForegroundColorAttributeName:[DJDKMIMOMColor appMainColor]};
@@ -75,7 +76,7 @@
[attributedString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:nick attributes:mainDic]];
[attributedString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:YMLocalizedString(@"XPRoomLuckyBigPrizeView1"),_giftInfo.luckyBagName] attributes:dic]];
[attributedString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:YMLocalizedString(@"XPRoomLuckyBigPrizeView1"),luckyBagName] attributes:dic]];
[attributedString appendAttributedString:[[NSMutableAttributedString alloc] initWithString:goldPrice attributes:mainDic]];

View File

@@ -477,7 +477,9 @@ UIKIT_EXTERN NSString * const kRoomReceivedCandyNotificationKey;
- (void)dismissTapRecognizer{
[[NSNotificationCenter defaultCenter]postNotificationName:kRoomReceivedCandyNotificationKey object:nil userInfo:@{@"isHidden":@(YES)}];
[self.view removeFromSuperview];
[self willMoveToParentViewController:nil]; //1
[self.view removeFromSuperview]; //2
[self removeFromParentViewController]; //3
}
#pragma mark - XPCandyTreeBuyViewDelegate

View File

@@ -204,9 +204,9 @@
if(roomInfo.hasRoomAlbum == YES){
[array insertObject:roomPhotoAlbum atIndex:1];
}
// if ([ClientConfig shareConfig].configInfo.redEnvelopeConfig.open && roomInfo.redEnvelopeOpen) {
if ([ClientConfig shareConfig].configInfo.redEnvelopeConfig.open && roomInfo.redEnvelopeOpen) {
[array insertObject:redPacket atIndex:1];
// }
}
[[self getView] getMoreMenuDataSuccess:array];
}];
}

View File

@@ -32,7 +32,6 @@
#import "XPRoomSettingViewController.h"
#import "XPReleaseRadioViewController.h"
#import "XPRoomPKViewController.h"
#import "XPRoomSendRedPacketViewController.h"
#import "BaseNavigationController.h"
#import "XPWishGiftCreateViewController.h"
#import "XPAnchorPKSelectTypeController.h"

View File

@@ -57,34 +57,36 @@
if (arrary.count > 0) {
[[self getView] getNormalGiftListSuccess:arrary];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[Api requestNormalGiftList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray *luckyBagGift = [GiftInfoModel modelsWithArray:data.data[@"luckyBagGift"]]; //
NSArray *vipGift = [GiftInfoModel modelsWithArray:data.data[@"vipGift"]]; //
NSArray *luckyPoolGift = [GiftInfoModel modelsWithArray:data.data[@"luckyPoolGift"]];//
NSArray *normalGift = [GiftInfoModel modelsWithArray:data.data[@"normalGift"]]; //
NSArray *weekStarGift = [GiftInfoModel modelsWithArray:data.data[@"weekStarGift"]]; //
NSArray *drawGift = [GiftInfoModel modelsWithArray:data.data[@"drawGift"]]; //
NSArray *penaltyGift = [GiftInfoModel modelsWithArray:data.data[@"penaltyGift"]]; //
NSArray *anchorGift = [GiftInfoModel modelsWithArray:data.data[@"singlePopularGift"]]; //
NSMutableArray *info = [NSMutableArray array];
NSMutableArray *totalInfo = [NSMutableArray array];
[info addObjectsFromArray:luckyBagGift];
[info addObjectsFromArray:vipGift];
[info addObjectsFromArray:normalGift];
[info addObjectsFromArray:weekStarGift];
[info addObjectsFromArray:drawGift];
[info addObjectsFromArray:anchorGift];
[info addObjectsFromArray:penaltyGift];
[totalInfo addObjectsFromArray:info];
[totalInfo addObjectsFromArray:luckyPoolGift];
///
[[XPGiftStorage shareStorage] saveGiftDatasource:info roomUid:roomUid];
[[XPGiftStorage shareStorage] writeGiftToDirectory:totalInfo];
[[self getView] getNormalGiftListSuccess:info];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] getNormalGiftListFail:msg];
}] roomUid:roomUid];
});
[Api requestNormalGiftList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray *luckyBagGift = [GiftInfoModel modelsWithArray:data.data[@"luckyBagGift"]]; //
NSArray *vipGift = [GiftInfoModel modelsWithArray:data.data[@"vipGift"]]; //
NSArray *luckyPoolGift = [GiftInfoModel modelsWithArray:data.data[@"luckyPoolGift"]];//
NSArray *normalGift = [GiftInfoModel modelsWithArray:data.data[@"normalGift"]]; //
NSArray *weekStarGift = [GiftInfoModel modelsWithArray:data.data[@"weekStarGift"]]; //
NSArray *drawGift = [GiftInfoModel modelsWithArray:data.data[@"drawGift"]]; //
NSArray *penaltyGift = [GiftInfoModel modelsWithArray:data.data[@"penaltyGift"]]; //
NSArray *anchorGift = [GiftInfoModel modelsWithArray:data.data[@"singlePopularGift"]]; //
NSMutableArray *info = [NSMutableArray array];
NSMutableArray *totalInfo = [NSMutableArray array];
[info addObjectsFromArray:luckyBagGift];
[info addObjectsFromArray:vipGift];
[info addObjectsFromArray:normalGift];
[info addObjectsFromArray:weekStarGift];
[info addObjectsFromArray:drawGift];
[info addObjectsFromArray:anchorGift];
[info addObjectsFromArray:penaltyGift];
[totalInfo addObjectsFromArray:info];
[totalInfo addObjectsFromArray:luckyPoolGift];
///
[[XPGiftStorage shareStorage] saveGiftDatasource:info roomUid:roomUid];
[[XPGiftStorage shareStorage] writeGiftToDirectory:totalInfo];
[[self getView] getNormalGiftListSuccess:info];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] getNormalGiftListFail:msg];
}] roomUid:roomUid];
}

View File

@@ -128,6 +128,27 @@ static NSString *kSendGiftViewHidePunishNewIcon = @"kSendGiftViewHidePunishNewIc
}
}else{
[self.datasource removeObject:giftInfo];
}
if(self.segmentType == GiftSegmentType_Pack && self.datasource.count > 0){
NSInteger index = self.pageController.currentPage * 8 + 1;
if(self.datasource.count >= index){
GiftInfoModel * gift = [self.datasource safeObjectAtIndex1:index - 1];
[self dealSelectGift:gift];
}else{
NSInteger page = 0;
if (self.datasource.count % 8 == 0) { //
page = self.datasource.count / 8;
} else {
page = self.datasource.count / 8 + 1;
}
[self.pageController setNumberOfPages:page];
GiftInfoModel * gift = [self.datasource firstObject];
self.pageController.hidden = page <= 1 || _segmentType == GiftSegmentType_WeekStar;
self.pageController.currentPage = page > 1 ? page - 1 : 0;
[self dealSelectGift:gift];
}
}
}
[self.giftcollectionView reloadData];
@@ -462,22 +483,22 @@ static NSString *kSendGiftViewHidePunishNewIcon = @"kSendGiftViewHidePunishNewIc
}
NSInteger currentPage = 0;
if (self.datasource.count > 0) {
if (self.defaultSelectGiftId.length && (self.segmentType == GiftSegmentType_Normal | self.segmentType == GiftSegmentType_Pack)) {
for (int i = 0 ; i <self.datasource.count; i++) {
GiftInfoModel * gift = [self.datasource safeObjectAtIndex1:i];
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
[self dealSelectGift:gift];
self.selectIndex = [self.datasource indexOfObject:gift];
NSInteger page = i / 8;
currentPage = page;
break;
}
}
} else {
// if (self.defaultSelectGiftId.length && (self.segmentType == GiftSegmentType_Normal | self.segmentType == GiftSegmentType_Pack)) {
// for (int i = 0 ; i <self.datasource.count; i++) {
// GiftInfoModel * gift = [self.datasource safeObjectAtIndex1:i];
// if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
// [self dealSelectGift:gift];
// self.selectIndex = [self.datasource indexOfObject:gift];
// NSInteger page = i / 8;
// currentPage = page;
// break;
// }
// }
//
// } else {
GiftInfoModel * gift = [self.datasource firstObject];
[self dealSelectGift:gift];
}
// }
}
NSInteger page = 0;
if (self.datasource.count % 8 == 0) { //

View File

@@ -19,7 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
/// @param type 类型 1房间 2全服
/// @param password 密码
/// @param message 消息
+ (void)sendRedPacket:(HttpRequestHelperCompletion)completion num:(NSString *)num goldNum:(NSString *)goldNum roomUId:(NSString *)roomUId type:(NSNumber *)type password:(NSString *)password message:(NSString *)message;
/// @param kind 红包种类 0 旧版本 1 无门槛红包 2 关注红包 3 分享红包 4 弹幕红包
+ (void)sendRedPacket:(HttpRequestHelperCompletion)completion num:(NSString *)num goldNum:(NSString *)goldNum roomUId:(NSString *)roomUId type:(NSString *)type password:(NSString *)password message:(NSString *)message kind:(NSString *)kind;
/// 抢红包

View File

@@ -9,9 +9,9 @@
#import <Base64/MF_Base64Additions.h>
@implementation Api (RedPacket)
+ (void)sendRedPacket:(HttpRequestHelperCompletion)completion num:(NSString *)num goldNum:(NSString *)goldNum roomUId:(NSString *)roomUId type:(NSNumber *)type password:(NSString *)password message:(NSString *)message {
+ (void)sendRedPacket:(HttpRequestHelperCompletion)completion num:(NSString *)num goldNum:(NSString *)goldNum roomUId:(NSString *)roomUId type:(NSString *)type password:(NSString *)password message:(NSString *)message kind:(NSString *)kind{
NSString * fang = [NSString stringFromBase64String:@"cmVkLWVudmVsb3Bl"];///red-envelope
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, num, goldNum, roomUId, type, password, message, nil];
[self makeRequest:fang method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, num, goldNum, roomUId, type, password, message, kind,nil];
}
+ (void)openRedPacket:(HttpRequestHelperCompletion)completion redEnvelopeId:(NSString *)redEnvelopeId {

View File

@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface PIInputEntireServerScrollingView : UIView
@property(nonatomic,copy) NSString *getContent;
@end
NS_ASSUME_NONNULL_END

View File

@@ -40,7 +40,24 @@
}];
}
#pragma mark -UITextFieldDelegate
- (void)textFieldDidChange:(UITextField *)textField {
if(textField.text.integerValue <= 0){
textField.text = @"";
self.pi_numView.text = [NSString stringWithFormat:@"0/20"];
return;
}
if(textField.text.integerValue > 10){
textField.text = [textField.text substringToIndex:10];
}
textField.text = [textField.text stringByReplacingOccurrencesOfString:@" " withString:@""];
self.pi_numView.text = [NSString stringWithFormat:@"%ld/10",textField.text.length];
}
#pragma mark -
- (NSString *)getContent{
return self.pi_textField.text;
}
- (UITextField *)pi_textField{
if(!_pi_textField){
_pi_textField = [[UITextField alloc]init];
@@ -48,12 +65,13 @@
_pi_textField.textColor = UIColorFromRGB(0x322F4D);
_pi_textField.font = kFontRegular(16);
_pi_textField.textAlignment = NSTextAlignmentCenter;
[_pi_textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
}
return _pi_textField;
}
- (UILabel *)pi_numView{
if(!_pi_numView){
_pi_numView = [UILabel labelInitWithText:@"0/20" font:kFontRegular(12) textColor:UIColorFromRGB(0x94959C)];
_pi_numView = [UILabel labelInitWithText:@"0/10" font:kFontRegular(12) textColor:UIColorFromRGB(0x94959C)];
}
return _pi_numView;
}

View File

@@ -12,7 +12,9 @@ NS_ASSUME_NONNULL_BEGIN
@interface PIInputRedPacketView : UIView
@property(nonatomic,copy) NSString *pi_title;
@property(nonatomic,assign) BOOL isHiddenIcon;
@property(nonatomic,strong) NSString *unitTitle;
@property(nonatomic,copy) NSString *unitTitle;
///红包数量
@property(nonatomic,copy) NSString *redPacketNum;
@end
NS_ASSUME_NONNULL_END

View File

@@ -6,7 +6,7 @@
//
#import "PIInputRedPacketView.h"
@interface PIInputRedPacketView()
@interface PIInputRedPacketView()<UITextFieldDelegate>
///
@property(nonatomic,strong) UIStackView *pi_stackView;
///
@@ -86,7 +86,31 @@
_unitTitle = unitTitle;
_pi_unitView.text = _unitTitle;
}
#pragma mark -UITextFieldDelegate
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
return [self validateNumber:string];
}
- (BOOL)validateNumber:(NSString*)number {
BOOL res = YES;
NSCharacterSet* tmpSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
int i = 0;
while (i < number.length) {
NSString * string = [number substringWithRange:NSMakeRange(i, 1)];
NSRange range = [string rangeOfCharacterFromSet:tmpSet];
if (range.length == 0) {
res = NO;
break;
}
i++;
}
return res;
}
#pragma mark -
- (NSString *)redPacketNum{
return self.pi_textField.text;
}
- (UIStackView *)pi_stackView {
if (!_pi_stackView) {
_pi_stackView = [[UIStackView alloc] init];
@@ -118,6 +142,7 @@
_pi_textField.font = kFontMedium(16);
_pi_textField.keyboardType = UIKeyboardTypeNumberPad;
_pi_textField.textAlignment = NSTextAlignmentRight;
_pi_textField.delegate = self;
}
return _pi_textField;
}

View File

@@ -7,6 +7,7 @@
#import "MvpViewController.h"
#import <JXPagingView/JXPagerView.h>
#import "RoomHostDelegate.h"
typedef enum : NSUInteger {
Room_Send_Red_Packet_Type_Lobby = 0,///大厅红包
@@ -17,7 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface PIRoomSendRedPacketItemVC : MvpViewController<JXPagerViewListViewDelegate>
@property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
-(instancetype)initWithType:(PIRoomSendRedPacketItemVCType)type;
@property (nonatomic, copy) NSString *roomUid;
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate type:(PIRoomSendRedPacketItemVCType)type;
@end
NS_ASSUME_NONNULL_END

View File

@@ -10,7 +10,14 @@
#import "PIRedPacketChooseTypeView.h"
#import "PIInputScrollingView.h"
#import "PIInputEntireServerScrollingView.h"
@interface PIRoomSendRedPacketItemVC ()<PIRedPacketChooseTypeViewDelegate>
#import "XPRoomRedPacketPresenter.h"
#import "UserInfoModel.h"
#import "XPRoomRedPacketPwdView.h"
#import "XPMinePayPwdViewController.h"
#import "RoomInfoModel.h"
@interface PIRoomSendRedPacketItemVC ()<PIRedPacketChooseTypeViewDelegate,XPRoomRedPacketPwdViewDelegate>
///host
@property (nonatomic,weak) id<RoomHostDelegate>hostDelegate;
///
@property(nonatomic,strong) PIInputRedPacketView *pi_priceView;
///
@@ -29,16 +36,25 @@
@property(nonatomic,strong) PIInputScrollingView *scrollingView;
///
@property(nonatomic,strong) PIInputEntireServerScrollingView *serverInputView;
///
@property(nonatomic,assign) PIRoomSendRedPacketItemVCType type;
///
@property(nonatomic,assign) PIRedPacketChooseTypeViewType sendRedType;
@property(nonatomic,strong) UserInfoModel *userInfo;
@property(nonatomic,assign) BOOL pi_isHaveUser;
@end
@implementation PIRoomSendRedPacketItemVC
- (XPRoomRedPacketPresenter *)createPresenter {
return [[XPRoomRedPacketPresenter alloc] init];
}
- (BOOL)isHiddenNavBar {
return YES;
}
-(instancetype)initWithType:(PIRoomSendRedPacketItemVCType)type{
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate type:(PIRoomSendRedPacketItemVCType)type{
self = [super init];
if(self){
self.hostDelegate = delegate;
self.type = type;
}
return self;
@@ -47,8 +63,11 @@
[super viewDidLoad];
[self installUI];
[self installConstraints];
[self.presenter getUserModel];
}
-(void)installUI{
self.sendRedType = Red_Packet_Choose_type_Normal;
self.view.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.pi_priceView];
[self.view addSubview:self.pi_numView];
@@ -128,6 +147,14 @@
make.centerX.equalTo(self.view);
}];
}
///
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
if(self.pi_isHaveUser == NO){
self.userInfo = userInfo;
return;
}
}
#pragma mark - JXPagingViewListViewDelegate
- (UIScrollView *)listScrollView {
return self.chooseTypeView.collectionView;
@@ -142,14 +169,8 @@
}
#pragma mark- PIRedPacketChooseTypeViewDelegate
- (void)chooseRedPacketType:(PIRedPacketChooseTypeViewType)type{
self.sendRedType = type;
switch (type) {
case Red_Packet_Choose_type_Normal:
{
self.scrollingView.hidden = YES;
self.promptlyBtn.hidden = NO;
self.limitBtn.hidden = NO;
}
break;
case Red_Packet_Choose_type_Scrolling:
{
self.scrollingView.hidden = NO;
@@ -158,9 +179,96 @@
}
break;
default:
{
self.scrollingView.hidden = YES;
self.promptlyBtn.hidden = NO;
self.limitBtn.hidden = NO;
}
break;
}
}
-(void)choooseEffectiveConditionAction:(UIButton *)sender{
if(sender == self.promptlyBtn){
self.promptlyBtn.selected = YES;
self.promptlyBtn.layer.borderWidth = 1;
self.promptlyBtn.backgroundColor = UIColorRGBAlpha(0xFF285C, 0.06);
self.promptlyBtn.titleLabel.font = kFontMedium(16);
self.limitBtn.selected = NO;
self.limitBtn.layer.borderWidth = 0;
self.limitBtn.backgroundColor = UIColorFromRGB(0xF8F8FA);
self.limitBtn.titleLabel.font = kFontRegular(16);
return;
}
self.limitBtn.selected = YES;
self.limitBtn.layer.borderWidth = 1;
self.limitBtn.backgroundColor = UIColorRGBAlpha(0xFF285C, 0.06);
self.limitBtn.titleLabel.font = kFontMedium(16);
self.promptlyBtn.selected = NO;
self.promptlyBtn.layer.borderWidth = 0;
self.promptlyBtn.backgroundColor = UIColorFromRGB(0xF8F8FA);
self.promptlyBtn.titleLabel.font = kFontRegular(16);
}
-(void)onReleaseButtonClick{
//
NSInteger packetCount = [self.pi_priceView.redPacketNum integerValue];
if (packetCount <= 0) {
[self showErrorToast:YMLocalizedString(@"XPRoomSendRedPacketViewController17")];
return;
}
//
NSInteger diamonCount = [self.pi_numView.redPacketNum integerValue];
if (diamonCount <= 0) {
[self showErrorToast:YMLocalizedString(@"XPRoomSendRedPacketViewController18")];
return;
}
if (diamonCount % 10 != 0) {
[self showErrorToast:YMLocalizedString(@"XPRoomSendRedPacketViewController19")];
return;
}
self.pi_isHaveUser = YES;
if(self.userInfo == nil){
[self.presenter getUserModel];
return;
}
if (self.userInfo.isBindPaymentPwd) {
XPRoomRedPacketPwdView *pwdView = [[XPRoomRedPacketPwdView alloc] init];
pwdView.diamonCount = @(packetCount * diamonCount).stringValue;
pwdView.delegate = self;
[TTPopup popupView:pwdView style:TTPopupStyleAlert];
} else {
XPMinePayPwdViewController *vc = [[XPMinePayPwdViewController alloc] init];
vc.userInfo = self.userInfo;
[self.navigationController pushViewController:vc animated:YES];
}
}
#pragma mark - XPRoomRedPacketPwdViewDelegate
- (void)xPRoomRedPacketPwdViewPwdComplete:(NSString *)pwd {
[TTPopup dismiss];
NSString *roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
NSString *type = self.type == Room_Send_Red_Packet_Type_Lobby ? @"1" : @"2";
NSArray *kindList = @[@"1",@"2",@"3",@"4"];
NSString *kind = [kindList safeObjectAtIndex1:self.sendRedType];
NSString *message = self.serverInputView.getContent.length ? self.serverInputView.getContent : YMLocalizedString(@"XPRoomSendRedPacketViewController4");
if(self.sendRedType == Red_Packet_Choose_type_Scrolling && self.serverInputView.getContent.length == 0){
[self showErrorToast:YMLocalizedString(@"PIRoomSendRedPacketItemVC7")];
return;
}
[self.presenter sendRedPacketWithNum:self.pi_numView.redPacketNum goldNum:self.pi_priceView.redPacketNum roomUid:roomUid type:type password:pwd message:message kind:kind];
}
- (void)xPRoomRedPacketPwdViewPwdForgetBtnClick {
XPMinePayPwdViewController *vc = [[XPMinePayPwdViewController alloc] init];
vc.userInfo = self.hostDelegate.getUserInfo;
[self.navigationController pushViewController:vc animated:YES];
}
///
- (void)sendRedPacketSuccess {
[self showSuccessToast:YMLocalizedString(@"XPRoomSendRedPacketViewController3")];
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark -
- (PIInputRedPacketView *)pi_priceView{
if(!_pi_priceView){
@@ -200,6 +308,7 @@
_promptlyBtn.layer.masksToBounds = YES;
_promptlyBtn.layer.borderColor = UIColorFromRGB(0xFF285C).CGColor;
_promptlyBtn.layer.borderWidth = 1;
[_promptlyBtn addTarget:self action:@selector(choooseEffectiveConditionAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _promptlyBtn;
}
@@ -215,6 +324,7 @@
_limitBtn.layer.masksToBounds = YES;
_limitBtn.layer.borderColor = UIColorFromRGB(0xFF285C).CGColor;
_limitBtn.layer.borderWidth = 0;
[_limitBtn addTarget:self action:@selector(choooseEffectiveConditionAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _limitBtn;
}
@@ -222,6 +332,7 @@
if(!_sendBtn){
_sendBtn = [UIButton new];
[_sendBtn setBackgroundImage:kImage(@"pi_red_packet_send") forState:UIControlStateNormal];
[_sendBtn addTarget:self action:@selector(onReleaseButtonClick) forControlEvents:UIControlEventTouchUpInside];
}
return _sendBtn;
}

View File

@@ -13,6 +13,7 @@
#import "PIRoomSendRedPacketItemVC.h"
#import "XPRoomRedPacketPresenter.h"
#import "WalletInfoModel.h"
#import "RoomInfoModel.h"
@interface PIRoomSendRedPacketVC ()<JXPagerViewDelegate,JXPagerMainTableViewGestureDelegate,JXCategoryViewDelegate,JXPagerMainTableViewGestureDelegate>
///host
@property (nonatomic,weak) id<RoomHostDelegate>hostDelegate;
@@ -62,6 +63,14 @@
self.view.backgroundColor = [UIColor clearColor];
self.navigationController.view.backgroundColor = [UIColor clearColor];
[self.navigationController setNavigationBarHidden:YES];
RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo;
if(roomInfo.redEnvelopeType == 1){
self.titles = @[YMLocalizedString(@"PIRoomSendRedPacketVC0")];
}else if(roomInfo.redEnvelopeType == 2){
self.titles = @[YMLocalizedString(@"PIRoomSendRedPacketVC1")];
}else{
self.titles = @[YMLocalizedString(@"PIRoomSendRedPacketVC0"),YMLocalizedString(@"PIRoomSendRedPacketVC1")];
}
[self installUI];
[self installConstraints];
}
@@ -153,7 +162,7 @@
if (list) {
return list;
} else {
PIRoomSendRedPacketItemVC *vc = [[PIRoomSendRedPacketItemVC alloc]initWithType:index];
PIRoomSendRedPacketItemVC *vc = [[PIRoomSendRedPacketItemVC alloc]initWithDelegate:self.hostDelegate type:index];
return vc;
}
@@ -285,9 +294,7 @@
}
return _titleView;
}
- (NSArray<NSString *> *)titles{
return @[YMLocalizedString(@"PIRoomSendRedPacketVC0"),YMLocalizedString(@"PIRoomSendRedPacketVC1")];
}
- (JXPagerView *)contentView {
if (!_contentView) {

View File

@@ -24,7 +24,8 @@ NS_ASSUME_NONNULL_BEGIN
/// @param type 类型 1房间 2全服
/// @param pwd 密码
/// @param message 消息
- (void)sendRedPacketWithNum:(NSString *)num goldNum:(NSString *)goldNum roomUid:(NSString *)roomUid type:(NSNumber *)type password:(NSString *)pwd message:(NSString *)message;
/// @param kind 红包种类 0 旧版本 1 无门槛红包 2 关注红包 3 分享红包 4 弹幕红包
- (void)sendRedPacketWithNum:(NSString *)num goldNum:(NSString *)goldNum roomUid:(NSString *)roomUid type:(NSString *)type password:(NSString *)pwd message:(NSString *)message kind:(NSString *)kind;
@end

View File

@@ -38,11 +38,11 @@
} showLoading:NO] uid:uid];
}
- (void)sendRedPacketWithNum:(NSString *)num goldNum:(NSString *)goldNum roomUid:(NSString *)roomUid type:(NSNumber *)type password:(NSString *)pwd message:(NSString *)message {
- (void)sendRedPacketWithNum:(NSString *)num goldNum:(NSString *)goldNum roomUid:(NSString *)roomUid type:(NSString *)type password:(NSString *)pwd message:(NSString *)message kind:(NSString *)kind{
NSString *password = [DESEncrypt encryptUseDES:pwd key:KeyWithType(KeyType_PasswordEncode)];
[Api sendRedPacket:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] sendRedPacketSuccess];
}] num:num goldNum:goldNum roomUId:roomUid type:type password:password message:message];
}showLoading:YES errorToast:YES] num:num goldNum:goldNum roomUId:roomUid type:type password:password message:message kind:kind];
}
@end

View File

@@ -357,7 +357,7 @@
NSString *roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
NSNumber *type = self.roomButton.isSelected ? @(1) : @(2);
NSString *message = self.wishTextView.text.length ? self.wishTextView.text :YMLocalizedString(@"XPRoomSendRedPacketViewController4");
[self.presenter sendRedPacketWithNum:self.packetTextField.text goldNum:self.diamondTextField.text roomUid:roomUid type:type password:pwd message:message];
[self.presenter sendRedPacketWithNum:self.packetTextField.text goldNum:self.diamondTextField.text roomUid:roomUid type:type password:pwd message:message kind:@""];
}
- (void)xPRoomRedPacketPwdViewPwdForgetBtnClick {

View File

@@ -100,6 +100,9 @@
@end
@implementation XPTreasureFairyViewController
- (BOOL)isHiddenNavBar {
return YES;
}
-(void)dealloc{
[[NSNotificationCenter defaultCenter]removeObserver:self];
}
@@ -504,7 +507,13 @@
}
#pragma mark - Event Response
- (void)dismissVC {
[self dismissViewControllerAnimated:YES completion:nil];
[UIView animateWithDuration:0.2 animations:^{
self.view.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight);
} completion:^(BOOL finished) {
[self willMoveToParentViewController:nil]; //1
[self.view removeFromSuperview]; //2
[self removeFromParentViewController]; //3
}];
}
- (void)ticketRecognizer {

View File

@@ -186,7 +186,9 @@ NSString * const kJSOpenAppConcernedChat = @"openAppConcernedChat";
}
- (void)xPWebViewNavView:(XPWebViewNavView *)view didClickBack:(UIButton *)sender{
if(self.is_Pi_FairyPay){
[self.view removeFromSuperview];
[self willMoveToParentViewController:nil]; //1
[self.view removeFromSuperview]; //2
[self removeFromParentViewController]; //3
return;
}
if(self.isFairyPay){

View File

@@ -1648,8 +1648,8 @@
"XPRoomSendRedPacketViewController14" = "未抢完的红包将在30分钟后返还你的钱包";
"XPRoomSendRedPacketViewController15" = "恭喜发财,大吉大利";
"XPRoomSendRedPacketViewController16" = "充值鑽石";
"XPRoomSendRedPacketViewController17" = "红包数量不能小于1或大于100";
"XPRoomSendRedPacketViewController18" = "钻石数量不能小于100或大于999999";
"XPRoomSendRedPacketViewController17" = "红包金额不能小于0";
"XPRoomSendRedPacketViewController18" = "钻石数量不能小于0";
"XPRoomSendRedPacketViewController19" = "钻石数必须为10的倍数";
@@ -3145,6 +3145,7 @@
"PIRoomSendRedPacketItemVC4"="立即生效";
"PIRoomSendRedPacketItemVC5"="限时生效";
"PIRoomSendRedPacketItemVC6"="未抢完的红包将在12小时后返还你的钱包";
"PIRoomSendRedPacketItemVC7"="请输入弹幕内容";
///PIInputScrollingView
"PIInputScrollingView0"="输入指定弹幕内容最多10个字符";
///PIInputEntireServerScrollingView

View File

@@ -1649,8 +1649,8 @@
"XPRoomSendRedPacketViewController14" = "未搶完的紅包將在30分鐘後返還你的錢包";
"XPRoomSendRedPacketViewController15" = "恭喜發財,大吉大利";
"XPRoomSendRedPacketViewController16" = "充值鑽石";
"XPRoomSendRedPacketViewController17" = "紅包數量不能小於1或大於100";
"XPRoomSendRedPacketViewController18" = "鉆石數量不能小於100或大於999999";
"XPRoomSendRedPacketViewController17" = "紅包金額不能小於0";
"XPRoomSendRedPacketViewController18" = "鉆石數量不能小於0";
"XPRoomSendRedPacketViewController19" = "鉆石數必須為10的倍數";
@@ -3150,6 +3150,7 @@
"PIRoomSendRedPacketItemVC4"="立即生效";
"PIRoomSendRedPacketItemVC5"="限時生效";
"PIRoomSendRedPacketItemVC6"="未搶完的紅包將在12小時後返還你的錢包";
"PIRoomSendRedPacketItemVC7"="請輸入彈幕內容";
///PIInputScrollingView
"PIInputScrollingView0"="輸入指定彈幕內容最多10個字符";
///PIInputEntireServerScrollingView