首充成功的弹框

This commit is contained in:
fengshuo
2021-12-24 18:01:30 +08:00
parent a4d554b720
commit 0f725500fc
5 changed files with 246 additions and 4 deletions

View File

@@ -121,6 +121,7 @@
E80DE4072775665000BE5BCB /* XPFirstRechargeCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E80DE4062775665000BE5BCB /* XPFirstRechargeCollectionViewCell.m */; }; E80DE4072775665000BE5BCB /* XPFirstRechargeCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E80DE4062775665000BE5BCB /* XPFirstRechargeCollectionViewCell.m */; };
E80DE40A277568D300BE5BCB /* ThemeColor+FirstRecharge.m in Sources */ = {isa = PBXBuildFile; fileRef = E80DE409277568D300BE5BCB /* ThemeColor+FirstRecharge.m */; }; E80DE40A277568D300BE5BCB /* ThemeColor+FirstRecharge.m in Sources */ = {isa = PBXBuildFile; fileRef = E80DE409277568D300BE5BCB /* ThemeColor+FirstRecharge.m */; };
E80DE40D2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = E80DE40C2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.m */; }; E80DE40D2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = E80DE40C2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.m */; };
E80DE4102775C34E00BE5BCB /* XPFirstRechargeSuccessView.m in Sources */ = {isa = PBXBuildFile; fileRef = E80DE40F2775C34E00BE5BCB /* XPFirstRechargeSuccessView.m */; };
E811FFF72742367B00918544 /* XPGiftEmptyCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E811FFF62742367B00918544 /* XPGiftEmptyCollectionViewCell.m */; }; E811FFF72742367B00918544 /* XPGiftEmptyCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E811FFF62742367B00918544 /* XPGiftEmptyCollectionViewCell.m */; };
E8133916273E532D00708B66 /* XPGiftItemCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8133915273E532D00708B66 /* XPGiftItemCollectionViewCell.m */; }; E8133916273E532D00708B66 /* XPGiftItemCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8133915273E532D00708B66 /* XPGiftItemCollectionViewCell.m */; };
E81366E326F0A1FC0076364C /* LoginBindPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E81366E226F0A1FC0076364C /* LoginBindPhoneViewController.m */; }; E81366E326F0A1FC0076364C /* LoginBindPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E81366E226F0A1FC0076364C /* LoginBindPhoneViewController.m */; };
@@ -626,6 +627,8 @@
E80DE409277568D300BE5BCB /* ThemeColor+FirstRecharge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "ThemeColor+FirstRecharge.m"; sourceTree = "<group>"; }; E80DE409277568D300BE5BCB /* ThemeColor+FirstRecharge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "ThemeColor+FirstRecharge.m"; sourceTree = "<group>"; };
E80DE40B2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPFirstRechargeFlowLayout.h; sourceTree = "<group>"; }; E80DE40B2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPFirstRechargeFlowLayout.h; sourceTree = "<group>"; };
E80DE40C2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFirstRechargeFlowLayout.m; sourceTree = "<group>"; }; E80DE40C2775ABA500BE5BCB /* XPFirstRechargeFlowLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFirstRechargeFlowLayout.m; sourceTree = "<group>"; };
E80DE40E2775C34E00BE5BCB /* XPFirstRechargeSuccessView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPFirstRechargeSuccessView.h; sourceTree = "<group>"; };
E80DE40F2775C34E00BE5BCB /* XPFirstRechargeSuccessView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFirstRechargeSuccessView.m; sourceTree = "<group>"; };
E811FFF52742367B00918544 /* XPGiftEmptyCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftEmptyCollectionViewCell.h; sourceTree = "<group>"; }; E811FFF52742367B00918544 /* XPGiftEmptyCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftEmptyCollectionViewCell.h; sourceTree = "<group>"; };
E811FFF62742367B00918544 /* XPGiftEmptyCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftEmptyCollectionViewCell.m; sourceTree = "<group>"; }; E811FFF62742367B00918544 /* XPGiftEmptyCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftEmptyCollectionViewCell.m; sourceTree = "<group>"; };
E8133914273E532D00708B66 /* XPGiftItemCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftItemCollectionViewCell.h; sourceTree = "<group>"; }; E8133914273E532D00708B66 /* XPGiftItemCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftItemCollectionViewCell.h; sourceTree = "<group>"; };
@@ -2282,6 +2285,8 @@
E80DE4042775663500BE5BCB /* Cell */, E80DE4042775663500BE5BCB /* Cell */,
E84150B627747B8B00A7F548 /* XPFirstRechargeViewController.h */, E84150B627747B8B00A7F548 /* XPFirstRechargeViewController.h */,
E84150B727747B8B00A7F548 /* XPFirstRechargeViewController.m */, E84150B727747B8B00A7F548 /* XPFirstRechargeViewController.m */,
E80DE40E2775C34E00BE5BCB /* XPFirstRechargeSuccessView.h */,
E80DE40F2775C34E00BE5BCB /* XPFirstRechargeSuccessView.m */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -3559,6 +3564,7 @@
9B7D80562753C595003DAC0C /* SendMessageView.m in Sources */, 9B7D80562753C595003DAC0C /* SendMessageView.m in Sources */,
E84B0E3F2727EDF6008818C6 /* XPRoomMessageTableViewCell.m in Sources */, E84B0E3F2727EDF6008818C6 /* XPRoomMessageTableViewCell.m in Sources */,
E82325FC274E4735003A3332 /* XPUserCardItemModel.m in Sources */, E82325FC274E4735003A3332 /* XPUserCardItemModel.m in Sources */,
E80DE4102775C34E00BE5BCB /* XPFirstRechargeSuccessView.m in Sources */,
E8EEB8F226FC2050007C6EBA /* SDPhotoBrowser.m in Sources */, E8EEB8F226FC2050007C6EBA /* SDPhotoBrowser.m in Sources */,
E81C27AB26EF2D920031E639 /* ThirdUserInfo.m in Sources */, E81C27AB26EF2D920031E639 /* ThirdUserInfo.m in Sources */,
E8788950273A699900BF1D57 /* ThemeColor+SendGift.m in Sources */, E8788950273A699900BF1D57 /* ThemeColor+SendGift.m in Sources */,

View File

@@ -18,12 +18,15 @@
#import "UserInfoModel.h" #import "UserInfoModel.h"
#import "RoomInfoModel.h" #import "RoomInfoModel.h"
#import "ActivityInfoModel.h" #import "ActivityInfoModel.h"
#import "AttachmentModel.h"
#import "FirstRechargeModel.h"
///View ///View
#import "XPRoomHalfWebView.h" #import "XPRoomHalfWebView.h"
#import "XPCandyTreeViewController.h" #import "XPCandyTreeViewController.h"
#import "XPWebViewController.h" #import "XPWebViewController.h"
#import "XPRoomViewController.h" #import "XPRoomViewController.h"
#import "XPFirstRechargeViewController.h" #import "XPFirstRechargeViewController.h"
#import "XPFirstRechargeSuccessView.h"
@interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate> @interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate>
/// ///
@@ -129,6 +132,15 @@
[self configCandyTree]; [self configCandyTree];
self.firstRechargeImageView.hidden = !self.hostDelegate.getUserInfo.isFirstCharge; self.firstRechargeImageView.hidden = !self.hostDelegate.getUserInfo.isFirstCharge;
} }
- (void)handleNIMCustomMessage:(AttachmentModel *)attachment {
if (attachment.first == CustomMessageType_First_Recharge_Reward && attachment.second == Custom_Message_Sub_Room_First_Recharge_Reward) {
FirstRechargeModel *model = [FirstRechargeModel modelWithJSON:attachment.data];
XPFirstRechargeSuccessView * firstRechargeView= [[XPFirstRechargeSuccessView alloc] init];
firstRechargeView.rechargeInfo = model;
[TTPopup popupView:firstRechargeView style:TTPopupStyleAlert];
}
}
#pragma mark - SDCycleScrollViewDelegate #pragma mark - SDCycleScrollViewDelegate
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index { - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
if (self.activityList.count > index) { if (self.activityList.count > index) {
@@ -173,7 +185,7 @@
_cycleScrollView.pageDotImage = [UIImage imageNamed:@"room_activity_banner_normal"]; _cycleScrollView.pageDotImage = [UIImage imageNamed:@"room_activity_banner_normal"];
_cycleScrollView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.00]; _cycleScrollView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.00];
_cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit; _cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
_cycleScrollView.pageControlBottomOffset = -20; _cycleScrollView.pageControlBottomOffset = -10;
_cycleScrollView.hidden = YES; _cycleScrollView.hidden = YES;
} }
return _cycleScrollView; return _cycleScrollView;

View File

@@ -0,0 +1,17 @@
//
// XPFirstRechargeSuccessView.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/24.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class FirstRechargeModel;
@interface XPFirstRechargeSuccessView : UIView
@property (nonatomic,strong) FirstRechargeModel *rechargeInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,200 @@
//
// XPFirstRechargeSuccessView.m
// xplan-ios
//
// Created by on 2021/12/24.
//
#import "XPFirstRechargeSuccessView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "UIImage+Utils.h"
#import "ThemeColor+FirstRecharge.h"
#import "XPFirstRechargeFlowLayout.h"
#import "TTPopup.h"
///Model
#import "FirstRechargeModel.h"
///View
#import "XPFirstRechargeCollectionViewCell.h"
@interface XPFirstRechargeSuccessView ()<UICollectionViewDelegate, UICollectionViewDataSource>
///
@property (nonatomic,strong) UIImageView *backImageView;
///
@property (nonatomic,strong) UIImageView * rewardBackView;
///
@property (nonatomic,strong) UIButton *extraButton;
///
@property (nonatomic,strong) UICollectionView *collectionView;
///
@property (nonatomic,strong) UILabel *descriptionLabel;
///
@property (nonatomic,strong) UIButton *knownButton;
///
@property (nonatomic,strong) NSArray *datasource;
@end
@implementation XPFirstRechargeSuccessView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.backImageView];
[self addSubview:self.knownButton];
[self.backImageView addSubview:self.rewardBackView];
[self.backImageView addSubview:self.descriptionLabel];
[self.rewardBackView addSubview:self.extraButton];
[self.rewardBackView addSubview:self.collectionView];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(290);
make.bottom.mas_equalTo(self.knownButton.mas_bottom);
}];
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.top.mas_equalTo(self);
make.height.mas_equalTo(375);
make.width.mas_equalTo(290);
}];
[self.knownButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(185, 45));
make.centerX.mas_equalTo(self);
make.centerY.mas_equalTo(self.backImageView.mas_bottom);
}];
[self.descriptionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self);
make.top.mas_equalTo(self.collectionView.mas_bottom).offset(21);
}];
[self.rewardBackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backImageView).inset(20);
make.top.mas_equalTo(self.backImageView).offset(70);
make.height.mas_equalTo(235);
}];
[self.extraButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(245, 18));
make.top.mas_equalTo(self.rewardBackView).offset(10);
make.centerX.mas_equalTo(self.rewardBackView);
}];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.extraButton.mas_bottom);
make.left.right.mas_equalTo(self.rewardBackView);
make.bottom.mas_equalTo(self.rewardBackView);
}];
}
#pragma mark - UICollectionViewDelegate And UICollectionViewDatasource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.datasource.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPFirstRechargeCollectionViewCell * cell= [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPFirstRechargeCollectionViewCell class]) forIndexPath:indexPath];
cell.rewardInfo = [self.datasource objectAtIndex:indexPath.row];
return cell;
}
#pragma mark - Event Response
- (void)knowButtonAction:(UIButton *)sender {
[TTPopup dismiss];
}
#pragma mark - Getters And Setters
- (void)setRechargeInfo:(FirstRechargeModel *)rechargeInfo {
_rechargeInfo = rechargeInfo;
self.datasource = _rechargeInfo.firstChargeRewardList;
[self.collectionView reloadData];
NSString * title = rechargeInfo.chargeProdTitle;
NSString * chargeMoneyStr = [NSString stringWithFormat:@"%ld", rechargeInfo.chargeMoney];
NSString * giveMoneyStr = [NSString stringWithFormat:@"%ld", rechargeInfo.giveMoney];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12], NSForegroundColorAttributeName:[ThemeColor rewardSegmentTextColor]}];
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor rewardReminderTextColor] range:[title rangeOfString:chargeMoneyStr]];
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor rewardReminderTextColor] range:[title rangeOfString:giveMoneyStr]];
[self.extraButton setAttributedTitle:attribute forState:UIControlStateNormal];
}
- (UICollectionView *)collectionView{
if (!_collectionView) {
XPFirstRechargeFlowLayout *layout = [[XPFirstRechargeFlowLayout alloc] init];
layout.itemSize = CGSizeMake(70, 70+ 16);
layout.minimumLineSpacing = 12;
layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_collectionView.dataSource = self;
_collectionView.delegate = self;
_collectionView.backgroundColor = [UIColor clearColor];
[_collectionView registerClass:[XPFirstRechargeCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPFirstRechargeCollectionViewCell class])];
}
return _collectionView;
}
- (UIImageView *)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.userInteractionEnabled = YES;
_backImageView.image = [UIImage imageNamed:@"room_first_recharge_success_bg"];
}
return _backImageView;
}
- (UILabel *)descriptionLabel {
if (!_descriptionLabel) {
_descriptionLabel = [[UILabel alloc] init];
_descriptionLabel.text = @"装扮类物品可进入“我的一我的装扮”使用哦";
_descriptionLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:10];
_descriptionLabel.textAlignment = NSTextAlignmentCenter;
_descriptionLabel.textColor = [ThemeColor firstRechargeTextColor];
}
return _descriptionLabel;
}
- (UIButton *)knownButton {
if (!_knownButton) {
_knownButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_knownButton setBackgroundImage:[UIImage imageNamed:@"room_first_recharge_recharge"] forState:UIControlStateNormal];
[_knownButton setBackgroundImage:[UIImage imageNamed:@"room_first_recharge_recharge"] forState:UIControlStateSelected];
[_knownButton setTitle:@"我知道了" forState:UIControlStateNormal];
_knownButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Bold" size:20];
[_knownButton setTitleColor:[ThemeColor firstRechargeTextColor] forState:UIControlStateNormal];
[_knownButton addTarget:self action:@selector(knowButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _knownButton;
}
- (UIButton *)extraButton {
if (!_extraButton) {
_extraButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_extraButton setBackgroundImage:[UIImage imageNamed:@"room_first_recharge_reward_extra_bg"] forState:UIControlStateNormal];
}
return _extraButton;
}
- (UIImageView *)rewardBackView {
if (!_rewardBackView) {
_rewardBackView = [[UIImageView alloc] init];
_rewardBackView.image = [UIImage gradientColorImageFromColors:@[[ThemeColor rewardBackgroundGradientTopColor], [ThemeColor rewardBackgroundGradientMiddleColor], [ThemeColor rewardBackgroundGradientTopColor]] gradientType:GradientTypeTopToBottom imgSize:CGSizeMake(10, 10)];
_rewardBackView.layer.masksToBounds = YES;
_rewardBackView.layer.cornerRadius = 10;
}
return _rewardBackView;
}
@end

View File

@@ -330,9 +330,16 @@
} else if (message.messageType == NIMMessageTypeCustom) { } else if (message.messageType == NIMMessageTypeCustom) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
[self.stageView handleNIMCustomMessage:obj.attachment]; AttachmentModel * attachment = obj.attachment;
[self.animationView handleNIMCustomMessage:obj.attachment]; [self.stageView handleNIMCustomMessage:attachment];
[self.menuContainerView handleNIMCustomMessage:obj.attachment]; [self.animationView handleNIMCustomMessage:attachment];
[self.menuContainerView handleNIMCustomMessage:attachment];
[self.activityContainerView handleNIMCustomMessage:attachment];
if (attachment.first == CustomMessageType_First_Recharge_Reward && attachment.second == Custom_Message_Sub_Room_First_Recharge_Reward) {
self.userInfo.isFirstCharge = NO;
[self.menuContainerView onRoomUpdate];
[self.activityContainerView onRoomUpdate];
}
} }
} }
} }