diff --git a/YuMi/CustomUI/InputView/InputView/QEmotionHelper.m b/YuMi/CustomUI/InputView/InputView/QEmotionHelper.m index 156fe5f3..e66b28d1 100644 --- a/YuMi/CustomUI/InputView/InputView/QEmotionHelper.m +++ b/YuMi/CustomUI/InputView/InputView/QEmotionHelper.m @@ -76,7 +76,9 @@ //把整段String:@"害~你好[微笑]", 转为 @"害~你好😊" - (NSMutableAttributedString *)attributedStringByText:(NSString *)text font:(UIFont *)font { - + if(text.length == 0){ + return [[NSMutableAttributedString alloc] initWithString:@""];; + } NSArray *emojis = [self.regularExpression matchesInString:text options:NSMatchingWithTransparentBounds range:NSMakeRange(0, [text length])]; NSMutableAttributedString *intactAttributeString = [[NSMutableAttributedString alloc] initWithString:text]; @@ -175,7 +177,8 @@ } - (NSArray *)emojiHantList{ if(!_emojiHantList){ - _emojiHantList = @[@"[可愛]", + _emojiHantList = @[ + @"[可愛]", @"[大笑]", @"[色]", @"[噓]", diff --git a/YuMi/Modules/YMRTC/RtcImpl/AgoraRtcImpl.m b/YuMi/Modules/YMRTC/RtcImpl/AgoraRtcImpl.m index df86012f..dc7e48cc 100644 --- a/YuMi/Modules/YMRTC/RtcImpl/AgoraRtcImpl.m +++ b/YuMi/Modules/YMRTC/RtcImpl/AgoraRtcImpl.m @@ -32,8 +32,8 @@ [_engine enableAudio]; [_engine disableVideo]; [_engine enableAudioVolumeIndication:900 smooth:3 reportVad:YES]; - [_engine setAudioProfile:AgoraAudioProfileMusicStandard]; + [_engine setAudioScenario:AgoraAudioScenarioGameStreaming]; #ifdef DEBUG [_engine setLogFilter:AgoraLogFilterInfo]; #else diff --git a/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.m b/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.m index b90e0115..b8965703 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.m +++ b/YuMi/Modules/YMRoom/View/MoreView/Presenter/XPMoreMenuPresenter.m @@ -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]; }]; } diff --git a/YuMi/Modules/YMRoom/View/SendRedPacket/PIRoomEnterRedPacketView.m b/YuMi/Modules/YMRoom/View/SendRedPacket/PIRoomEnterRedPacketView.m index 885ea8a9..0ddd272f 100644 --- a/YuMi/Modules/YMRoom/View/SendRedPacket/PIRoomEnterRedPacketView.m +++ b/YuMi/Modules/YMRoom/View/SendRedPacket/PIRoomEnterRedPacketView.m @@ -7,6 +7,7 @@ #import "PIRoomEnterRedPacketView.h" #import "CountDownHelper.h" + @interface PIRoomEnterRedPacketView () @property(nonatomic,strong) UIImageView *bgImageView; @property(nonatomic,strong) UIButton *robBtn; diff --git a/YuMi/Modules/YMRoom/View/SendRedPacket/PIRoomSendRedPacketVC.m b/YuMi/Modules/YMRoom/View/SendRedPacket/PIRoomSendRedPacketVC.m index fc10a181..e5d7b8dd 100644 --- a/YuMi/Modules/YMRoom/View/SendRedPacket/PIRoomSendRedPacketVC.m +++ b/YuMi/Modules/YMRoom/View/SendRedPacket/PIRoomSendRedPacketVC.m @@ -11,6 +11,8 @@ #import #import #import "PIRoomSendRedPacketItemVC.h" +#import "XPRoomRedPacketPresenter.h" +#import "WalletInfoModel.h" @interface PIRoomSendRedPacketVC () ///host代理 @property (nonatomic,weak) idhostDelegate; @@ -20,15 +22,28 @@ @property (nonatomic, strong) JXCategoryTitleView *titleView; ///分页lineView @property (nonatomic, strong) JXPagerView *contentView; +///返回 @property(nonatomic,strong) UIButton *pi_backBtn; +///背景 @property(nonatomic,strong) UIView *bgView; +///背景图片 @property(nonatomic,strong) UIImageView *topImageView; +///红包提示 @property(nonatomic,strong) UIButton *tipsBtn; +///钻石背景 @property(nonatomic,strong) UIImageView *diamondNumView; +///钻石数量 @property(nonatomic,strong) UILabel *diamondNumTextView; +///钻石icom +@property(nonatomic,strong) UIImageView *diamondIconView; +//加号 +@property(nonatomic,strong) UIImageView *addIconView; @end @implementation PIRoomSendRedPacketVC +- (XPRoomRedPacketPresenter *)createPresenter { + return [[XPRoomRedPacketPresenter alloc] init]; +} - (instancetype)initWithDelegate:(id)delegate { if (self = [super init]) { self.hostDelegate = delegate; @@ -38,6 +53,10 @@ - (BOOL)isHiddenNavBar { return YES; } +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [self.presenter getUserWalletInfo]; +} - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor clearColor]; @@ -52,8 +71,9 @@ [self.view addSubview:self.topImageView]; [self.view addSubview:self.tipsBtn]; [self.view addSubview:self.diamondNumView]; + [self.diamondNumView addSubview:self.diamondIconView]; [self.diamondNumView addSubview:self.diamondNumTextView]; - + [self.diamondNumView addSubview:self.addIconView]; [self.view addSubview:self.contentView]; } -(void)installConstraints{ @@ -70,29 +90,43 @@ make.height.mas_equalTo(kGetScaleWidth(243)); }]; - [self.diamondNumView mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(self.bgView.mas_top).mas_offset(kGetScaleWidth(13)); - make.trailing.mas_equalTo(-kGetScaleWidth(0)); - make.width.mas_equalTo(kGetScaleWidth(81)); - make.height.mas_equalTo(kGetScaleWidth(30)); - }]; + [self.tipsBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.width.height.mas_equalTo(kGetScaleWidth(24)); make.trailing.mas_equalTo(-kGetScaleWidth(12)); make.top.equalTo(self.topImageView.mas_top).mas_offset(kGetScaleWidth(71)); }]; - [self.diamondNumTextView mas_makeConstraints:^(MASConstraintMaker *make) { + [self.diamondNumView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.bgView.mas_top).mas_offset(kGetScaleWidth(13)); + make.trailing.mas_equalTo(-kGetScaleWidth(0)); + make.width.mas_greaterThanOrEqualTo(kGetScaleWidth(10)); + make.height.mas_equalTo(kGetScaleWidth(30)); + }]; + [self.diamondIconView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(kGetScaleWidth(20)); make.centerY.equalTo(self.diamondNumView); make.leading.mas_equalTo(kGetScaleWidth(6)); - make.trailing.mas_equalTo(-kGetScaleWidth(5)); }]; - + [self.addIconView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.equalTo(self.diamondNumView); + make.width.height.mas_equalTo(kGetScaleWidth(16)); + make.trailing.mas_equalTo(-kGetScaleWidth(6)); + }]; + [self.diamondNumTextView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.equalTo(self.diamondNumView); + make.leading.mas_equalTo(kGetScaleWidth(25)); + make.trailing.mas_equalTo(-kGetScaleWidth(23)); + }]; + [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.bgView.mas_top).mas_offset(kGetScaleWidth(52)); make.left.right.bottom.mas_equalTo(self.view); }]; } - +///获取用户钱包信息成功 +- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo { + self.diamondNumTextView.text = balanceInfo.diamonds; +} #pragma mark - JXCategoryViewDelegate - (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView { @@ -145,6 +179,21 @@ -(void)hiddenViewAction{ [self dismissViewControllerAnimated:YES completion:nil]; } +-(NSTextAttachment *)getDiamondNumAtt:(NSString *)image{ + NSTextAttachment * diamondAttachment = [[NSTextAttachment alloc] init]; + UIImage *diamondIconImage = [UIImage imageNamed:image];; + diamondAttachment.bounds = CGRectMake(0, roundf(kFontMedium(13).capHeight - diamondIconImage.size.height)/2.f, diamondIconImage.size.width, diamondIconImage.size.height); + diamondAttachment.image = diamondIconImage; + return diamondAttachment; +} +- (UIImage*)resizableImage:(UIImage *)image { + //图片拉伸区域 + CGFloat top = (image.size.height - 1) / 2; + CGFloat left = (image.size.width - 1) / 2; + CGFloat right = (image.size.width - 1) / 2; + CGFloat bottom = (image.size.height - 1) / 2; + return [image resizableImageWithCapInsets:UIEdgeInsetsMake(top, left, bottom, right) resizingMode:UIImageResizingModeStretch]; +} #pragma mark - 懒加载 - (UIView *)bgView{ if(!_bgView){ @@ -179,33 +228,31 @@ - (UIImageView *)diamondNumView{ if(!_diamondNumView){ _diamondNumView = [UIImageView new]; - _diamondNumView.image = kImage(@"pi_red_packet_top_diamond_bg"); + _diamondNumView.image = [self resizableImage:kImage(@"pi_red_packet_top_diamond_bg")]; } return _diamondNumView; } - (UILabel *)diamondNumTextView{ if(!_diamondNumTextView){ - _diamondNumTextView = [UILabel new]; - NSMutableAttributedString *numAtt = [[NSMutableAttributedString alloc]initWithString:@"9999" attributes:@{NSFontAttributeName:kFontMedium(13),NSForegroundColorAttributeName:[UIColor whiteColor]}]; - NSTextAttachment * diamondAttachment = [[NSTextAttachment alloc] init]; - UIImage *diamondIconImage = [UIImage imageNamed:@"pi_red_packet_top_diamond_icon"];; - diamondAttachment.bounds = CGRectMake(0, roundf(kFontMedium(13).capHeight - diamondIconImage.size.height)/2.f, diamondIconImage.size.width, diamondIconImage.size.height); - - diamondAttachment.image = diamondIconImage; - NSAttributedString * diamondAtt = [NSMutableAttributedString attributedStringWithAttachment:(NSTextAttachment *)diamondAttachment]; - [numAtt insertAttributedString:diamondAtt atIndex:0]; - - NSTextAttachment * addAttachment = [[NSTextAttachment alloc] init]; - UIImage *addIconImage = [UIImage imageNamed:@"pi_red_packet_top_diamond_add"];; - addAttachment.bounds = CGRectMake(0, roundf(kFontMedium(13).capHeight - addIconImage.size.height)/2.f, addIconImage.size.width, addIconImage.size.height); - - addAttachment.image = addIconImage; - NSAttributedString * addAtt = [NSMutableAttributedString attributedStringWithAttachment:(NSTextAttachment *)addAttachment]; - [numAtt insertAttributedString:addAtt atIndex:numAtt.length]; - _diamondNumTextView.attributedText = numAtt; + _diamondNumTextView = [UILabel labelInitWithText:@"0" font:kFontMedium(13) textColor:[UIColor whiteColor]]; + _diamondNumTextView.textAlignment = NSTextAlignmentCenter; } return _diamondNumTextView; } +- (UIImageView *)diamondIconView{ + if(!_diamondIconView){ + _diamondIconView = [UIImageView new]; + _diamondIconView.image = kImage(@"pi_red_packet_top_diamond_icon"); + } + return _diamondIconView; +} +-(UIImageView *)addIconView{ + if(!_addIconView){ + _addIconView = [UIImageView new]; + _addIconView.image = kImage(@"pi_red_packet_top_diamond_add"); + } + return _addIconView; +} - (JXCategoryTitleView *)titleView { if (!_titleView) { _titleView = [[JXCategoryTitleView alloc] init]; diff --git a/YuMi/Modules/YMTabbar/View/TabbarViewController.m b/YuMi/Modules/YMTabbar/View/TabbarViewController.m index e7697ac7..2f22f517 100644 --- a/YuMi/Modules/YMTabbar/View/TabbarViewController.m +++ b/YuMi/Modules/YMTabbar/View/TabbarViewController.m @@ -172,12 +172,12 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - PIReceiveRedPacketSuccessView *view = [[PIReceiveRedPacketSuccessView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; - - - [kWindow addSubview:view]; - }); +// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ +// PIReceiveRedPacketSuccessView *view = [[PIReceiveRedPacketSuccessView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; +// +// +// [kWindow addSubview:view]; +// }); }