Files
yinmeng-ios/xplan-ios/Main/ModuleKit/SendGiftView/View/XPSendGiftView.m

544 lines
20 KiB
Mathematica
Raw Normal View History

2021-11-10 18:42:27 +08:00
//
// XPSendGiftView.m
// xplan-ios
//
// Created by on 2021/11/9.
//
#import "XPSendGiftView.h"
///Third
#import <Masonry/Masonry.h>
2021-11-16 19:56:37 +08:00
#import <NIMSDK/NIMSDK.h>
2021-11-10 18:42:27 +08:00
///Tool
#import "XPMacro.h"
#import "XPGiftPresenter.h"
2021-11-15 18:59:44 +08:00
#import "TTPopup.h"
2021-11-10 18:42:27 +08:00
#import "ThemeColor+SendGift.h"
2022-01-11 11:28:04 +08:00
#import "StatisticsServiceHelper.h"
2022-05-07 17:58:15 +08:00
#import "XPHtmlUrl.h"
#import "AccountInfoStorage.h"
2021-11-16 16:31:24 +08:00
///Model
#import "GiftInfoModel.h"
#import "XPGiftCountModel.h"
#import "GiftReceiveInfoModel.h"
2021-11-16 19:56:37 +08:00
#import "AttachmentModel.h"
#import "RoomInfoModel.h"
#import "UserInfoModel.h"
2022-04-07 15:28:57 +08:00
#import "XPMessageRemoteExtModel.h"
2021-11-10 18:42:27 +08:00
///View
#import "XPGiftUsersView.h"
#import "XPGiftInfoView.h"
#import "XPGiftBarView.h"
///P
#import "XPGiftProtocol.h"
2021-11-15 18:59:44 +08:00
///VC
#import "XPMineRechargeViewController.h"
#import "XPWebViewController.h"
#import "XPFirstRechargeViewController.h"
#import "XPNobleCenterViewController.h"
2021-11-10 18:42:27 +08:00
2021-11-16 16:31:24 +08:00
@interface XPSendGiftView ()< XPGiftBarViewDelegate, XPGiftProtocol, XPGiftInfoViewDelegate>
///
@property (nonatomic,strong) UIView * topView;
///
@property (nonatomic,strong) UIView *contentView;
2021-11-10 18:42:27 +08:00
///
@property (nonatomic,strong) UIStackView *stackView;
///
@property (nonatomic,strong) XPGiftUsersView *userView;
///
@property (nonatomic,strong) XPGiftInfoView *giftInfoView;
///
@property (nonatomic,strong) XPGiftBarView *giftBarView;
///View
@property (nonatomic,strong) UIView * bottomView;
///uid/ uid
@property (nonatomic,copy) NSString *roomUid;
2021-11-16 16:31:24 +08:00
///使
@property (nonatomic,assign) SendGiftType usingplaceType;
///
@property (nonatomic,assign) int normalGiftRetryCount;
///
@property (nonatomic,assign) int packGiftRetryCount;
2022-04-21 20:06:43 +08:00
///
@property (nonatomic,strong) NSArray<XPGiftUserInfoModel *> *userArray;
2021-11-10 18:42:27 +08:00
@end
@implementation XPSendGiftView
- (XPGiftPresenter *)createPresenter {
return [[XPGiftPresenter alloc] init];
}
2021-11-15 18:59:44 +08:00
- (void)dealloc {
NSLog(@"六面板销毁了");
}
2021-11-10 18:42:27 +08:00
2022-04-21 20:06:43 +08:00
- (instancetype)initWithType:(SendGiftType)type uid:(NSString * __nullable)uid{
2021-11-10 18:42:27 +08:00
if (self = [super init]) {
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
self.roomUid = uid;
2021-11-16 16:31:24 +08:00
self.usingplaceType = type;
2021-11-10 18:42:27 +08:00
}
return self;
}
- (void)viewDidLoad {
[self initSubViews];
[self initSubViewConstraints];
[self initHttpRequest];
}
2021-11-10 18:42:27 +08:00
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.topView];
[self.view addSubview:self.contentView];
[self.contentView addSubview:self.stackView];
2021-11-10 18:42:27 +08:00
[self.stackView addArrangedSubview:self.userView];
[self.stackView addArrangedSubview:self.giftInfoView];
[self.stackView addArrangedSubview:self.giftBarView];
[self.stackView addArrangedSubview:self.bottomView];
2021-11-10 18:42:27 +08:00
}
- (void)initSubViewConstraints {
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self.view);
make.bottom.mas_equalTo(self.contentView.mas_top);;
}];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.stackView.mas_top);
make.left.right.bottom.mas_equalTo(self.view);
2021-11-10 18:42:27 +08:00
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self.contentView);
2021-11-10 18:42:27 +08:00
}];
[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(kSafeAreaBottomHeight);
}];
}
- (void)initHttpRequest {
[self.presenter getUserInfo:[AccountInfoStorage instance].getUid];
[self.presenter getUserWallInfo];
[self.presenter getNormalGiftList:self.roomUid];
[self.presenter getPackGiftList];
}
2021-11-16 19:56:37 +08:00
#pragma mark - Send Custom Message
- (void)sendCustomMessage:(GiftReceiveInfoModel *)receiveModel oringinDic:(NSDictionary *)originDic {
NSDictionary * dict = originDic;
if (receiveModel.roomSendGiftType == RoomSendGiftType_AllMic) { //
NSMutableDictionary *data = [NSMutableDictionary dictionary];
[data addEntriesFromDictionary:dict];
if (receiveModel.gift.giftType == GiftType_Lucky) { //
NSArray *luckyBagGifts = (NSArray *)[data objectForKey:@"luckyBagGifts"];
if (luckyBagGifts.count >0) {
for (int i = 0; i < luckyBagGifts.count; i++) {
NSMutableDictionary * data1 = [NSMutableDictionary dictionary];
[data1 addEntriesFromDictionary:dict];
AttachmentModel * attachment = [[AttachmentModel alloc] init];
attachment.first = CustomMessageType_AllMicroSend;
attachment.second = Custom_Message_Sub_AllMicroLuckySend;
NSDictionary * obj = [luckyBagGifts objectAtIndex:i];
[data1 setObject:i == 0 ? @(YES):@(NO) forKey:@"isShowAnimation"];
[data1 setObject:obj forKey:@"luckyGiftList"];
[data1 setObject:receiveModel.gift.giftName forKey:@"giftName"];
[data1 setObject:[obj valueForKeyPath:@"user.uid"] forKey:@"targetUid"];
[data1 setObject:[dict valueForKeyPath:@"targetUsers.uid"] forKey:@"targetUids"];
[data1 removeObjectForKey:@"luckyBagGifts"];
[data1 removeObjectForKey:@"targetUsers"];
attachment.data = data1;
[self sendCustomMessage:attachment];
}
2021-11-16 19:56:37 +08:00
}
}else { //
AttachmentModel * attachment = [[AttachmentModel alloc] init];
attachment.first = CustomMessageType_AllMicroSend;
attachment.second = Custom_Message_Sub_AllMicroSend;
2021-11-16 19:56:37 +08:00
[data setObject:[dict valueForKeyPath:@"targetUsers.uid"] forKey:@"targetUids"];
attachment.data = data;
[self sendCustomMessage:attachment];
2021-11-16 19:56:37 +08:00
}
} else if (receiveModel.roomSendGiftType == RoomSendGiftType_MutableOnMic) { //
NSMutableDictionary *data = [NSMutableDictionary dictionary];
[data addEntriesFromDictionary:dict];
if (receiveModel.gift.giftType == GiftType_Lucky) { //
NSArray *luckyBagGifts = (NSArray *)[data objectForKey:@"luckyBagGifts"];
if (luckyBagGifts.count >0) {
//
[luckyBagGifts enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
NSMutableDictionary * data1 = [NSMutableDictionary dictionary];
[data1 addEntriesFromDictionary:dict];
AttachmentModel * attachment = [[AttachmentModel alloc] init];
attachment.first = CustomMessageType_AllMicroSend;
attachment.second = Custom_Message_Sub_AllBatchMicroLuckySend;
[data1 setObject:idx == 0 ? @(YES):@(NO) forKey:@"isShowAnimation"];
[data1 setObject:obj forKey:@"luckyGiftList"];
[data1 setObject:receiveModel.gift.giftName forKey:@"giftName"];
[data1 setObject:[obj valueForKeyPath:@"user.uid"] forKey:@"targetUid"];
[data1 setObject:[dict valueForKeyPath:@"targetUsers.uid"] forKey:@"targetUids"];
[data1 removeObjectForKey:@"luckyBagGifts"];
[data1 removeObjectForKey:@"targetUsers"];
attachment.data = data1;
[self sendCustomMessage:attachment];
2021-11-16 19:56:37 +08:00
}];
}
}else { //
AttachmentModel *attachment = [[AttachmentModel alloc] init];
attachment.first = CustomMessageType_AllMicroSend;
attachment.second = Custom_Message_Sub_AllBatchSend;
attachment.data = data;
[self sendCustomMessage:attachment];
2021-11-16 19:56:37 +08:00
}
} else if (receiveModel.roomSendGiftType == RoomSendGiftType_ToOne) { //
NSMutableDictionary *data = [NSMutableDictionary dictionary];
[data addEntriesFromDictionary:dict];
if (receiveModel.gift.giftType == GiftType_Lucky) { //
NSArray *luckyBagGifts = (NSArray *)[data objectForKey:@"luckyBagGifts"];
[luckyBagGifts enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
NSMutableDictionary * data1 = [NSMutableDictionary dictionary];
[data1 addEntriesFromDictionary:dict];
AttachmentModel * attachment = [[AttachmentModel alloc] init];
attachment.first = CustomMessageType_Gift;
attachment.second = Custom_Message_Sub_Gift_LuckySend;
[data1 setObject:idx == 0 ? @(YES):@(NO) forKey:@"isShowAnimation"];
[data1 setObject:obj forKey:@"luckyGiftList"];
[data1 setObject:receiveModel.gift.giftName forKey:@"giftName"];
[data1 setObject:[obj valueForKeyPath:@"user.uid"] forKey:@"targetUid"];
[data1 setObject:[obj valueForKeyPath:@"user.nick"] forKey:@"targetNick"];
[data1 setObject:[dict valueForKeyPath:@"targetUsers.uid"] forKey:@"targetUids"];
[data1 removeObjectForKey:@"luckyBagGifts"];
[data1 removeObjectForKey:@"targetUsers"];
attachment.data = data1;
[self sendCustomMessage:attachment];
2021-11-16 19:56:37 +08:00
}];
}else { //
AttachmentModel *attachment = [[AttachmentModel alloc] init];
attachment.first = CustomMessageType_Gift;
attachment.second = Custom_Message_Sub_Gift_Send;
2021-11-16 19:56:37 +08:00
NSDictionary *targetUsers = ((NSArray *)[data objectForKey:@"targetUsers"]).firstObject;
[data setObject:[targetUsers valueForKeyPath:@"uid"] forKey:@"targetUid"];
[data setObject:[targetUsers valueForKeyPath:@"nick"] forKey:@"targetNick"];
[data setObject:[targetUsers valueForKeyPath:@"avatar"] forKey:@"targetAvatar"];
attachment.data = data;
[self sendCustomMessage:attachment];
2021-11-16 19:56:37 +08:00
}
}
}
- (void)sendCustomMessage:(AttachmentModel *)attachment {
2022-04-21 20:06:43 +08:00
NSString *sessionID = self.usingplaceType == SendGiftType_User ? [NSString stringWithFormat:@"%ld", self.userArray.firstObject.uid] : [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId];
NIMMessage *message = [[NIMMessage alloc]init];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachment;
message.messageObject = object;
2022-04-07 15:28:57 +08:00
UserInfoModel *userInfo = [self.delegate getUserInfo];
XPMessageRemoteExtModel *extModel = [[XPMessageRemoteExtModel alloc] init];
extModel.androidBubbleUrl = userInfo.androidBubbleUrl;
extModel.iosBubbleUrl = userInfo.iosBubbleUrl;
2022-06-07 16:16:27 +08:00
extModel.fromSayHelloChannel = userInfo.fromSayHelloChannel;
2022-04-07 15:28:57 +08:00
NSMutableDictionary *remoteExt = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]];
message.remoteExt = remoteExt;
2022-04-21 20:06:43 +08:00
NIMSessionType sessionType = self.usingplaceType == SendGiftType_Room ? NIMSessionTypeChatroom : NIMSessionTypeP2P;
//
2022-04-21 20:06:43 +08:00
NIMSession *session = [NIMSession session:sessionID type:sessionType];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
}
2021-11-16 16:31:24 +08:00
#pragma mark - Deal Send Gift Data
- (NSString *)dealSendGiftCount:(XPGiftCountModel *)model gift:(GiftInfoModel *)gift {
NSString * count = @"1";
if (model.isTotal) {
count = [NSString stringWithFormat:@"%ld", gift.count];
} else {
count = model.giftNumber;
}
return count;
}
- (NSString *)dealSendGiftUids:(NSArray<NSString *> *)uids {
NSString *uidString = [[NSString alloc] init];
for (NSString *item in uids) {
if (uidString.length > 0) {
uidString = [uidString stringByAppendingString:@","];
}
uidString = [uidString stringByAppendingString:item];
}
return uidString;
}
- (RoomSendGiftType)dealRoomSendGiftType:(GiftInfoModel *)giftInfo giftCount:(XPGiftCountModel *)giftCount {
NSArray * uids = self.userView.selectUserArray;
RoomSendGiftType roomSendGiftType;
if (self.userView.isSelectAll) {
if (giftInfo.sourceType == GiftSourceType_Pack && giftCount.isTotal && giftInfo && uids.count > 1) {
[self showErrorToast:@"只能全部赠送给一人"];
2021-11-16 16:31:24 +08:00
return -1;
}
roomSendGiftType = RoomSendGiftType_AllMic;
} else if(self.userView.selectUserArray.count > 1) {
if (giftInfo.sourceType == GiftSourceType_Pack && giftCount.isTotal) {
[self showErrorToast:@"只能全部赠送给一人"];
2021-11-16 16:31:24 +08:00
return -1;
}
roomSendGiftType = RoomSendGiftType_MutableOnMic;
} else if(self.userView.selectUserArray.count == 1) {
roomSendGiftType = RoomSendGiftType_ToOne;
} else {
roomSendGiftType = -1;
}
return roomSendGiftType;
}
2021-11-15 18:59:44 +08:00
#pragma mark - Public Method
2021-11-17 19:29:14 +08:00
- (void)configGiftUsers:(NSArray<XPGiftUserInfoModel *> *)users {
2022-04-21 20:06:43 +08:00
self.userArray = users;
2021-11-17 19:29:14 +08:00
[self.userView configGiftUsers:users];
}
#pragma mark - XPGiftBarViewDelegate
- (void)xPGiftBarView:(XPGiftBarView *)view didClickSendGift:(XPGiftCountModel *)giftCount {
2021-11-16 16:31:24 +08:00
///
NSArray * uids = self.userView.selectUserArray;
GiftInfoModel * giftInfo = self.giftInfoView.lastSelectGift;
if (self.usingplaceType == SendGiftType_Room) {
if (uids.count > 0) {
///
NSString * uidString = [self dealSendGiftUids:uids];
///
NSString * giftNumber = [self dealSendGiftCount:giftCount gift:giftInfo];
///
NSString * giftId = [NSString stringWithFormat:@"%ld", giftInfo.giftId];
///
GiftSendType sendType = GiftSendType_OnMic;
///
GiftSourceType sourceType = giftInfo.sourceType;
///
RoomSendGiftType roomSendType = [self dealRoomSendGiftType:giftInfo giftCount:giftCount];
if (roomSendType == -1) {
return;
}
self.giftBarView.sendButtonIsEnable = NO;
2021-11-16 16:31:24 +08:00
///
[self.presenter sendGift:uidString giftNum:giftNumber sendType:sendType giftId:giftId giftSource:sourceType giftType:giftInfo.giftType roomSendType:roomSendType roomUid:self.roomUid msg:@""];
2021-11-16 16:31:24 +08:00
} else {
[self showErrorToast:@"请选择至少一个人"];
2021-11-16 16:31:24 +08:00
return;
}
2022-04-21 20:06:43 +08:00
} else if(self.usingplaceType == SendGiftType_User) {
///
NSString * uidString = [self dealSendGiftUids:uids];
///
NSString * giftNumber = [self dealSendGiftCount:giftCount gift:giftInfo];
///
NSString * giftId = [NSString stringWithFormat:@"%ld", giftInfo.giftId];
///
GiftSendType sendType = GiftSendType_Chat;
///
GiftSourceType sourceType = giftInfo.sourceType;
///
RoomSendGiftType roomSendType = RoomSendGiftType_ToOne;
self.giftBarView.sendButtonIsEnable = NO;
[self.presenter sendGift:uidString giftNum:giftNumber sendType:sendType giftId:giftId giftSource:sourceType giftType:giftInfo.giftType roomSendType:roomSendType roomUid:self.roomUid msg:@""];
2021-11-16 16:31:24 +08:00
}
}
///
2021-11-15 18:59:44 +08:00
- (void)xPGiftBarViewDidClickRecharge:(XPGiftBarView *)view {
[self dismissViewControllerAnimated:YES completion:nil];
2021-11-15 18:59:44 +08:00
XPMineRechargeViewController * rechargeVC = [[XPMineRechargeViewController alloc] init];
[self.delegate.getCurrentNav pushViewController:rechargeVC animated:YES];
}
- (void)xPGiftBarViewDidClickFirstRecharge:(XPGiftBarView *)view {
[self dismissViewControllerAnimated:YES completion:nil];
XPFirstRechargeViewController * firstRechargeVC = [[XPFirstRechargeViewController alloc] initWithNavigation:self.delegate.getCurrentNav];
[self.delegate.getCurrentNav presentViewController:firstRechargeVC animated:YES completion:nil];
}
2021-11-15 18:59:44 +08:00
#pragma mark - XPGiftInfoViewDelegate
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickPlayRule:(NSString *)ruleUrl {
[self dismissViewControllerAnimated:YES completion:nil];
2021-11-15 18:59:44 +08:00
XPWebViewController * webVC = [[XPWebViewController alloc] init];
webVC.url = ruleUrl;
[self.delegate.getCurrentNav pushViewController:webVC animated:YES];
}
2021-11-16 16:31:24 +08:00
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickSegment:(GiftSegmentType)type {
self.giftBarView.type = type;
}
- (void)xPGiftInfoViewDidClickNobleEntrance:(XPGiftInfoView *)view {
[self dismissViewControllerAnimated:YES completion:nil];
2022-01-11 11:28:04 +08:00
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventvipEntranceGiftClick];
XPNobleCenterViewController * nobleVC = [[XPNobleCenterViewController alloc] initWithRoomUid:self.delegate.getRoomInfo.uid];
[self.delegate.getCurrentNav pushViewController:nobleVC animated:YES];
}
2022-05-07 17:58:15 +08:00
- (void)xpGiftInfoViewDidClickWeekStarRank:(XPGiftInfoView *)view {
[self dismissViewControllerAnimated:YES completion:nil];
XPWebViewController * webVC = [[XPWebViewController alloc] init];
webVC.roomUid = self.roomUid;
webVC.url = URLWithType(kNewWeekStarURL);
[self.delegate.getCurrentNav pushViewController:webVC animated:YES];
}
#pragma mark - XPGiftProtocol
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
self.giftBarView.isShowFirstRecharge = userInfo.isFirstCharge;
self.giftInfoView.curUserNobleLevel = userInfo.userVipInfoVO.vipLevel;
}
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
self.giftBarView.walletInfoModel = balanceInfo;
}
2021-11-15 18:59:44 +08:00
///
- (void)getPacketGiftListSuccess:(NSArray<GiftInfoModel *> *)giftList {
2021-11-12 19:30:53 +08:00
self.giftInfoView.packOriginArray = giftList;
}
- (void)getPacketGiftListFail:(NSString *)message {
self.packGiftRetryCount ++;
if (self.packGiftRetryCount <= 10) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.presenter getPackGiftList];
});
}
}
2021-11-15 18:59:44 +08:00
/// /
- (void)getNormalGiftListSuccess:(NSArray<GiftInfoModel *> *)giftList {
2021-11-12 19:30:53 +08:00
self.giftInfoView.normalOriginArray = giftList;
2021-11-10 18:42:27 +08:00
}
2021-11-16 16:31:24 +08:00
- (void)getNormalGiftListFail:(NSString *)message {
self.normalGiftRetryCount ++;
if (self.normalGiftRetryCount <= 10) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.presenter getNormalGiftList:self.roomUid];
});
}
}
- (void)sendGiftSuccess:(GiftReceiveInfoModel *)receiveInfo originDic:(NSDictionary *)originDic uidCount:(NSInteger)uidCount{
self.giftBarView.sendButtonIsEnable = YES;
2021-11-16 16:31:24 +08:00
if (receiveInfo.sourceType == GiftSourceType_Pack) {
///
[self.giftInfoView updatePackSource:receiveInfo numberUser:uidCount];
2021-11-16 16:31:24 +08:00
} else {
[self.presenter getUserWallInfo];
2021-11-16 16:31:24 +08:00
}
2021-11-16 19:56:37 +08:00
[self sendCustomMessage:receiveInfo oringinDic:originDic];
2021-11-16 16:31:24 +08:00
}
///
- (void)sendGiftFailWithCode:(NSInteger)code msg:(NSString *)msg {
self.giftBarView.sendButtonIsEnable = YES;
if (code == 31005) {//
[self showNotSufficientFundsWithToast:msg];
} else if (code == 8535) {//
GiftInfoModel * giftInfo = self.giftInfoView.lastSelectGift;
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.actionStyle = TTAlertActionConfirmStyle;
config.message = [NSString stringWithFormat:@"尚未达到赠送%@所需要的贵族等级哦\n所需贵族等级%@", giftInfo.giftName, giftInfo.giftVipInfo.vipName];
[TTPopup alertWithConfig:config confirmHandler:^{
} cancelHandler:^{
}];
} else {
[self showErrorToast:msg];
}
}
///
- (void)showNotSufficientFundsWithToast:(NSString *)msg {
if (self.delegate.getUserInfo.isFirstCharge) {
[self dismissViewControllerAnimated:YES completion:nil];
XPFirstRechargeViewController * firstRechargeVC = [[XPFirstRechargeViewController alloc] initWithNavigation:self.delegate.getCurrentNav];
[self.delegate.getCurrentNav presentViewController:firstRechargeVC animated:YES completion:nil];
} else {
[self showErrorToast:msg];
}
}
#pragma mark - Event Response
- (void)disMissViewRecognizer:(UITapGestureRecognizer *)tap {
[self dismissViewControllerAnimated:YES completion:nil];
}
2021-11-10 18:42:27 +08:00
#pragma mark - Getters And Setters
2022-04-21 20:06:43 +08:00
- (void)setUsingplaceType:(SendGiftType)usingplaceType {
_usingplaceType = usingplaceType;
self.giftInfoView.usingplaceType = _usingplaceType;
}
- (UIView *)topView {
if (!_topView) {
_topView = [[UIView alloc] init];
_topView.backgroundColor = [UIColor clearColor];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMissViewRecognizer:)];
[_topView addGestureRecognizer:tap];
}
return _topView;
}
- (UIView *)contentView {
if (!_contentView) {
_contentView = [[UIView alloc] init];
_contentView.backgroundColor = [ThemeColor giftBackGroundColor];
}
return _contentView;
}
2021-11-10 18:42:27 +08:00
- (XPGiftUsersView *)userView {
if (!_userView) {
_userView = [[XPGiftUsersView alloc] init];
2021-11-10 18:42:27 +08:00
}
return _userView;
}
- (XPGiftInfoView *)giftInfoView {
if (!_giftInfoView) {
_giftInfoView = [[XPGiftInfoView alloc] init];
2021-11-15 18:59:44 +08:00
_giftInfoView.delegate = self;
2021-11-10 18:42:27 +08:00
}
return _giftInfoView;
}
- (XPGiftBarView *)giftBarView {
if (!_giftBarView) {
_giftBarView = [[XPGiftBarView alloc] init];
_giftBarView.delegate = self;
2021-11-10 18:42:27 +08:00
}
return _giftBarView;
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentFill;
_stackView.spacing = 0;
_stackView.backgroundColor = [UIColor clearColor];
}
return _stackView;
}
- (UIView *)bottomView {
if (!_bottomView) {
_bottomView = [[UIView alloc] init];
_bottomView.backgroundColor = [UIColor clearColor];
}
return _bottomView;
}
2021-11-10 18:42:27 +08:00
@end