免费礼物
This commit is contained in:
6
YuMi/Assets.xcassets/yna/FreeGiftsView/Contents.json
Normal file
6
YuMi/Assets.xcassets/yna/FreeGiftsView/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
22
YuMi/Assets.xcassets/yna/FreeGiftsView/free_gifts_view_close.imageset/Contents.json
vendored
Normal file
22
YuMi/Assets.xcassets/yna/FreeGiftsView/free_gifts_view_close.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "free_gifts_view_close@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "free_gifts_view_close@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/yna/FreeGiftsView/free_gifts_view_close.imageset/free_gifts_view_close@2x.png
vendored
Normal file
BIN
YuMi/Assets.xcassets/yna/FreeGiftsView/free_gifts_view_close.imageset/free_gifts_view_close@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 488 B |
BIN
YuMi/Assets.xcassets/yna/FreeGiftsView/free_gifts_view_close.imageset/free_gifts_view_close@3x.png
vendored
Normal file
BIN
YuMi/Assets.xcassets/yna/FreeGiftsView/free_gifts_view_close.imageset/free_gifts_view_close@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 846 B |
@@ -42,6 +42,10 @@ NSString * const kUpdateSoundInfo = @"kUpdateSoundInfo";
|
||||
NSString * const kMineInfoDelTag = @"kMineInfoDelTag";
|
||||
NSString * const kOpenRoomNotification = @"kOpenRoomNotification";///进房
|
||||
NSString * const kRoomRoomLittleGameMiniStageNotificationKey = @"kRoomRoomLittleGameMiniStageNotificationKey";///小游戏最小化坑位的通知的健
|
||||
|
||||
|
||||
NSString * const kFreeGiftCountdownNotification = @"kFreeGiftCountdownNotification";///免费礼物倒计时
|
||||
|
||||
///在里面进行判断当前环境是什么
|
||||
NSString * const KeyWithType(Pi_KeyType type) {
|
||||
BOOL isRelase = NO;
|
||||
|
@@ -98,6 +98,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
|
||||
CustomMessageType_Graffiti_Gift = 94,
|
||||
///星级厨房飘屏
|
||||
CustomMessageType_Graffiti_Star_Kitchen = 95,
|
||||
///免费礼物倒计时重置时间
|
||||
CustomMessageType_Free_Gift_Star_Reset_Time = 96,
|
||||
///精灵密藏
|
||||
CustomMessageType_Treasure_Fairy = 97,
|
||||
///寻爱之旅
|
||||
@@ -372,7 +374,14 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubLuckyBag) {
|
||||
/// 提醒用户收藏房间
|
||||
Custom_Message_Sub_Collect_Room_Remind_User = 592,
|
||||
};
|
||||
|
||||
//first = CustomMessageType_Free_Gift_Star_Reset_Time
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageFreeGiftStarResetTime) {
|
||||
///免费礼物倒计时重置时间
|
||||
Custom_Message_Sub_Free_Gift_Star_Reset_Time = 960,
|
||||
///更新礼物信息
|
||||
Custom_Message_Sub_Update_Gift_Information = 961,
|
||||
|
||||
};
|
||||
///CustomMessageType_Tarot
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageSubTarot) {
|
||||
/// 塔罗中奖消息
|
||||
|
@@ -210,6 +210,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param completion 完成
|
||||
/// @param type type为0 => 屏蔽动态, objId 为 动态id, type为1 => 屏蔽房间, objId 为 用户uid
|
||||
+ (void)requesstShielding:(HttpRequestHelperCompletion)completion type:(NSString *)type objId:(NSString *)objId;
|
||||
///得到免费礼物数据
|
||||
+(void)requestFreeGiftData:(HttpRequestHelperCompletion)completion;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -286,4 +286,7 @@
|
||||
+ (void)requesstShielding:(HttpRequestHelperCompletion)completion type:(NSString *)type objId:(NSString *)objId{
|
||||
[self makeRequest:@"user/black/add" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, type,objId, nil];
|
||||
}
|
||||
+(void)requestFreeGiftData:(HttpRequestHelperCompletion)completion{
|
||||
[self makeRequest:@"roomFreeGift/get" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,nil];
|
||||
}
|
||||
@end
|
||||
|
@@ -63,6 +63,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
-(void)getRoomFirstCharegWindow:(NSString *)roomUid;
|
||||
///更新首充弹窗次数
|
||||
-(void)updateRoomFirstCharegWindow:(NSString *)roomUid;
|
||||
|
||||
///屏蔽
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId;
|
||||
///获取免费礼物
|
||||
-(void)getFreeGiftData;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#import "XPRoomRecommendModel.h"
|
||||
#import "XPRedPacketModel.h"
|
||||
#import "FirstChargeRoomWindowModel.h"
|
||||
#import "XPFreeGiftModel.h"
|
||||
///P
|
||||
#import "XPRoomProtocol.h"
|
||||
|
||||
@@ -253,5 +254,15 @@
|
||||
[Api updateRoomFirstCharegWindow:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
}showLoading:NO errorToast:NO] roomUid:roomUid];
|
||||
}
|
||||
|
||||
- (void)requesstShieldingWtihType:(NSString *)type objId:(NSString *)objId{
|
||||
[Api requesstShielding:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] requesstShieldingSuccess];
|
||||
}] type:type objId:objId];
|
||||
}
|
||||
-(void)getFreeGiftData{
|
||||
[Api requestFreeGiftData:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
XPFreeGiftModel *freeModel = [XPFreeGiftModel modelWithDictionary:data.data];
|
||||
[[self getView]getFreeGiftDataSuccess:freeModel];
|
||||
}]];
|
||||
}
|
||||
@end
|
||||
|
@@ -31,6 +31,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)getRedPacketSuccess:(NSArray *)list;
|
||||
///获取首充弹窗
|
||||
-(void)getRoomFirstChargeWindowSuccess:(FirstChargeRoomWindowModel*)model;
|
||||
///屏蔽
|
||||
-(void)requesstShieldingSuccess;
|
||||
///获取免费礼物成功
|
||||
-(void)getFreeGiftDataSuccess:(XPFreeGiftModel *)freeModel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPFreeGiftsObtainView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by duoban on 2022/12/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "XPFreeGiftModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPFreeGiftsObtainView : UIView
|
||||
@property (nonatomic,strong) XPFreeGiftModel *freeModel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// XPFreeGiftsObtainView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by duoban on 2022/12/6.
|
||||
//
|
||||
|
||||
#import "XPFreeGiftsObtainView.h"
|
||||
@interface XPFreeGiftsObtainView()
|
||||
///背景view
|
||||
@property (nonatomic,strong) UIView *bgView;
|
||||
///返回
|
||||
@property (nonatomic,strong) UIButton *backBtn;
|
||||
///标题
|
||||
@property (nonatomic,strong) UILabel *titleView;
|
||||
///icon图
|
||||
@property (nonatomic,strong) NetImageView *iconView;
|
||||
///说明
|
||||
@property (nonatomic,strong) UILabel *instructionsView;
|
||||
///确认
|
||||
@property (nonatomic,strong) UIButton *knowBtn;
|
||||
|
||||
@end
|
||||
@implementation XPFreeGiftsObtainView
|
||||
|
||||
-(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.bgView];
|
||||
[self.bgView addSubview:self.backBtn];
|
||||
[self.bgView addSubview:self.titleView];
|
||||
[self.bgView addSubview:self.iconView];
|
||||
[self.bgView addSubview:self.instructionsView];
|
||||
[self.bgView addSubview:self.knowBtn];
|
||||
|
||||
}
|
||||
- (void)initSubViewConstraints {
|
||||
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kGetScaleWidth(349));
|
||||
make.left.right.equalTo(self);
|
||||
make.bottom.equalTo(self);
|
||||
}];
|
||||
[self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(26));
|
||||
make.top.mas_equalTo(kGetScaleWidth(10));
|
||||
make.right.mas_equalTo(-kGetScaleWidth(15));
|
||||
}];
|
||||
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(41));
|
||||
make.height.mas_equalTo(kGetScaleWidth(21));
|
||||
make.left.right.equalTo(self.bgView).inset(kGetScaleWidth(0));
|
||||
}];
|
||||
[self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(78));
|
||||
make.width.mas_equalTo(kGetScaleWidth(120));
|
||||
make.height.mas_equalTo(kGetScaleWidth(106));
|
||||
make.centerX.equalTo(self.bgView);
|
||||
}];
|
||||
[self.instructionsView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(206));
|
||||
make.left.right.equalTo(self.bgView).inset(kGetScaleWidth(23));
|
||||
}];
|
||||
[self.knowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.instructionsView.mas_bottom).mas_offset(kGetScaleWidth(14));
|
||||
make.width.mas_equalTo(kGetScaleWidth(200));
|
||||
make.height.mas_equalTo(kGetScaleWidth(46));
|
||||
make.centerX.equalTo(self.bgView);
|
||||
}];
|
||||
}
|
||||
-(void)setFreeModel:(XPFreeGiftModel *)freeModel{
|
||||
_freeModel = freeModel;
|
||||
_instructionsView.text = [NSString stringWithFormat:YMLocalizedString(@"XPFreeGiftsObtainView2"),_freeModel.giftName,_freeModel.maxStage];
|
||||
_iconView.imageUrl = _freeModel.giftUrl;
|
||||
int hours = (_freeModel.firstSecond.integerValue)%(24*3600)/3600;
|
||||
int minutes = (_freeModel.firstSecond.integerValue)%3600/60;
|
||||
int second = (_freeModel.firstSecond.integerValue)%60;
|
||||
NSString *hoursStr = hours > 0 ? [NSString stringWithFormat:@"%d%@",hours,YMLocalizedString(@"XPFreeGiftsObtainView5")] : @"";
|
||||
NSString *minutesStr = minutes > 0 ? [NSString stringWithFormat:@"%d%@",minutes,YMLocalizedString(@"XPFreeGiftsObtainView4")] : @"";
|
||||
NSString *secondStr = second > 0 ? [NSString stringWithFormat:@"%d%@",second,YMLocalizedString(@"XPFreeGiftsObtainView3")] : @"";
|
||||
NSString *time = [NSString stringWithFormat:@"%@%@%@",hoursStr,minutesStr,secondStr];
|
||||
_titleView.text = [NSString stringWithFormat:YMLocalizedString(@"XPFreeGiftsObtainView1"),time];
|
||||
}
|
||||
-(void)backAction{
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
#pragma mark -懒加载
|
||||
- (UIView *)bgView{
|
||||
if (!_bgView){
|
||||
_bgView = [UIView new];
|
||||
_bgView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.9];
|
||||
[_bgView setCornerWithLeftTopCorner:kGetScaleWidth(25) rightTopCorner:kGetScaleWidth(25) bottomLeftCorner:0 bottomRightCorner:0 size:CGSizeMake(KScreenWidth, kGetScaleWidth(349))];
|
||||
}
|
||||
return _bgView;
|
||||
}
|
||||
- (UIButton *)backBtn{
|
||||
if (!_backBtn){
|
||||
_backBtn = [UIButton new];
|
||||
[_backBtn setBackgroundImage:kImage(@"free_gifts_view_close") forState:UIControlStateNormal];
|
||||
[_backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _backBtn;
|
||||
}
|
||||
- (UILabel *)titleView{
|
||||
if (!_titleView){
|
||||
_titleView = [UILabel labelInitWithText:@"" font:kFontMedium(15) textColor:[UIColor whiteColor]];
|
||||
_titleView.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _titleView;
|
||||
}
|
||||
- (NetImageView *)iconView{
|
||||
if (!_iconView){
|
||||
NetImageConfig *config = [[NetImageConfig alloc]init];
|
||||
config.placeHolder = [UIImageConstant defalutEmptyPlaceholder];
|
||||
_iconView = [[NetImageView alloc]initWithConfig:config];
|
||||
|
||||
}
|
||||
return _iconView;
|
||||
}
|
||||
|
||||
- (UILabel *)instructionsView{
|
||||
if (!_instructionsView){
|
||||
_instructionsView = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:[DJDKMIMOMColor disableButtonTextColor]];
|
||||
_instructionsView.textAlignment = NSTextAlignmentCenter;
|
||||
_instructionsView.numberOfLines = 0;
|
||||
}
|
||||
return _instructionsView;
|
||||
}
|
||||
-(UIButton *)knowBtn{
|
||||
if (!_knowBtn){
|
||||
UIImage *image = [UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor],[DJDKMIMOMColor confirmButtonGradientMiddleColor],[DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(kGetScaleWidth(200), kGetScaleWidth(46))];
|
||||
_knowBtn = [UIButton buttonInitWithText:YMLocalizedString(@"XPFreeGiftsObtainView0") font:kFontRegular(16) textColor:[UIColor whiteColor] image:nil bgImage:image];
|
||||
_knowBtn.layer.cornerRadius = kGetScaleWidth(23);
|
||||
_knowBtn.layer.masksToBounds = YES;
|
||||
[_knowBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _knowBtn;
|
||||
}
|
||||
|
||||
@end
|
@@ -9,10 +9,11 @@
|
||||
#import "RoomHostDelegate.h"
|
||||
#import "RoomGuestDelegate.h"
|
||||
#import "XPArrangeMicViewController.h"
|
||||
#import "XPFreeGiftModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomMenuContainerView : UIView<RoomGuestDelegate>
|
||||
|
||||
@property (nonatomic,strong) XPFreeGiftModel *freeModel;
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
|
||||
- (void)menuResignFirstResponder;
|
||||
|
@@ -118,6 +118,7 @@ NSString * const kRoomPlayEnterKey = @"kRoomPlayEnterKey";
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].uid];
|
||||
XPSendGiftView * giftView = [[XPSendGiftView alloc] initWithType:SendGiftType_Room uid:roomUid];
|
||||
giftView.delegate = self.delegate;
|
||||
giftView.freeModel = self.freeModel;
|
||||
NSArray * giftUses = [self configGiftUsers:[self.delegate getMicroQueue]];
|
||||
[giftView configGiftUsers:giftUses];
|
||||
[self.delegate.getCurrentNav presentViewController:giftView animated:YES completion:nil];
|
||||
|
@@ -16,8 +16,7 @@
|
||||
/// @param uid 用户uid
|
||||
/// @param ticket 用户ticket
|
||||
+ (void)requestPackGiftList:(HttpRequestHelperCompletion)complection uid:(NSString *)uid ticket:(NSString *)ticket {
|
||||
NSString * fang = [NSString stringFromBase64String:@"YmFja3BhY2svbGlzdFVzZXJCYWNrcGFja1Yy"];///backpack/listUserBackpackV2
|
||||
[self makeRequest:fang method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, uid, ticket, nil];
|
||||
[self makeRequest:@"backpack/listUserBackpackV3" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, uid, ticket, nil];
|
||||
}
|
||||
|
||||
/// 请求普通礼物列表
|
||||
|
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// XPFreeGiftModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by duoban on 2022/12/13.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPFreeGiftModel : NSObject
|
||||
@property (nonatomic,copy) NSString *uid;
|
||||
@property (nonatomic,copy) NSString *giftId;
|
||||
@property (nonatomic,copy) NSString *giftName;
|
||||
@property (nonatomic,copy) NSString *goldPrice;
|
||||
@property (nonatomic,copy) NSString *giftUrl;
|
||||
@property (nonatomic,copy) NSString *curStage;
|
||||
@property (nonatomic,copy) NSString *curStageSecond;
|
||||
@property (nonatomic,copy) NSString *maxStage;
|
||||
@property (nonatomic,copy) NSString *resetTime;
|
||||
@property (nonatomic,copy) NSString *firstSecond;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// XPFreeGiftModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by duoban on 2022/12/13.
|
||||
//
|
||||
|
||||
#import "XPFreeGiftModel.h"
|
||||
|
||||
@implementation XPFreeGiftModel
|
||||
|
||||
@end
|
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// XPGiftFreeItemCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by duoban on 2022/12/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "XPFreeGiftModel.h"
|
||||
#import "GiftInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
|
||||
|
||||
@interface XPGiftFreeItemCell : UICollectionViewCell
|
||||
@property (nonatomic,strong) GiftInfoModel * giftInfo; ;
|
||||
@property (nonatomic,strong) XPFreeGiftModel *freeModel;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,193 @@
|
||||
//
|
||||
// XPGiftFreeItemCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by duoban on 2022/12/6.
|
||||
//
|
||||
|
||||
#import "XPGiftFreeItemCell.h"
|
||||
#import "ThemeColor+SendGift.h"
|
||||
UIKIT_EXTERN NSString * const kFreeGiftCountdownNotification;
|
||||
|
||||
@interface XPGiftFreeItemCell()
|
||||
///背景
|
||||
@property (nonatomic,strong) UIView *bgView;
|
||||
///数量
|
||||
@property (nonatomic,strong) UILabel *numView;
|
||||
///倒计时
|
||||
@property (nonatomic,strong) UILabel *timeView;
|
||||
///礼物图
|
||||
@property (nonatomic,strong) NetImageView *iconView;
|
||||
///礼物
|
||||
@property (nonatomic,strong) UILabel *nameView;
|
||||
///礼物标题
|
||||
@property (nonatomic,strong) UILabel *titleView;
|
||||
|
||||
@end
|
||||
@implementation XPGiftFreeItemCell
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if(self){
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(getFreeGiftCountdownNotification:) name:kFreeGiftCountdownNotification object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)getFreeGiftCountdownNotification:(NSNotification *)not{
|
||||
NSDictionary *freeDic = not.userInfo;
|
||||
BOOL isCountdownFinish = [freeDic[@"isCountdownFinish"] boolValue];///倒计时完成
|
||||
BOOL isReset = [freeDic[@"isReset"] boolValue];///礼物清零
|
||||
id updateGiftInfo = freeDic[@"updateGiftInfo"];///更新礼物消息
|
||||
BOOL isHiddenCountdown = [freeDic[@"isHiddenCountdown"]boolValue];
|
||||
if(isHiddenCountdown == YES){
|
||||
self.timeView.hidden = YES;
|
||||
return;
|
||||
}
|
||||
if(updateGiftInfo != nil){
|
||||
if([updateGiftInfo isKindOfClass:[NSString class]]){return;}
|
||||
NSDictionary *giftInfo = (NSDictionary *)updateGiftInfo;
|
||||
NSString *giftId = giftInfo[@"giftId"];
|
||||
NSString *giftNamed = giftInfo[@"giftName"];
|
||||
NSString *giftUrl = giftInfo[@"giftUrl"];
|
||||
self.giftInfo.giftId = giftId.integerValue;
|
||||
self.giftInfo.giftName = giftNamed;
|
||||
self.giftInfo.giftUrl = giftUrl;
|
||||
self.freeModel.giftId = giftId;
|
||||
self.freeModel.giftName = giftNamed;
|
||||
self.freeModel.giftUrl = giftUrl;
|
||||
self.iconView.imageUrl = self.freeModel.giftUrl;
|
||||
self.nameView.text = self.freeModel.giftName;
|
||||
return;
|
||||
}
|
||||
|
||||
if(isReset == YES){
|
||||
self.numView.text = [NSString stringWithFormat:@"x%d",0];
|
||||
return;
|
||||
}
|
||||
if(isCountdownFinish == YES){
|
||||
self.timeView.hidden = YES;
|
||||
self.giftInfo.count = self.giftInfo.count + 1;
|
||||
self.numView.text = [NSString stringWithFormat:@"x%ld",_giftInfo.count];
|
||||
return;
|
||||
}
|
||||
if(self.timeView.hidden == YES){
|
||||
self.timeView.hidden = NO;
|
||||
}
|
||||
NSString *text = freeDic[@"text"];
|
||||
self.timeView.text = text;
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
|
||||
|
||||
[self.contentView addSubview:self.bgView];
|
||||
[self.bgView addSubview:self.numView];
|
||||
[self.bgView addSubview:self.timeView];
|
||||
[self.bgView addSubview:self.iconView];
|
||||
[self.bgView addSubview:self.nameView];
|
||||
[self.bgView addSubview:self.titleView];
|
||||
|
||||
}
|
||||
- (void)initSubViewConstraints {
|
||||
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.contentView);
|
||||
}];
|
||||
[self.timeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(4);
|
||||
make.right.mas_equalTo(-6);
|
||||
make.width.mas_equalTo(37);
|
||||
make.height.mas_equalTo(11);
|
||||
}];
|
||||
[self.numView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(6);
|
||||
make.centerY.equalTo(self.timeView);
|
||||
make.right.equalTo(self.timeView.mas_left).mas_offset(-5);
|
||||
}];
|
||||
[self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(17);
|
||||
make.width.mas_equalTo(48);
|
||||
make.height.mas_equalTo(48);
|
||||
make.centerX.equalTo(self.bgView);
|
||||
}];
|
||||
[self.nameView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.iconView.mas_bottom).mas_offset(5);
|
||||
make.height.mas_equalTo(14);
|
||||
make.left.right.equalTo(self.bgView);
|
||||
}];
|
||||
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.nameView.mas_bottom).mas_offset(1);
|
||||
make.right.left.equalTo(self.bgView);
|
||||
}];
|
||||
}
|
||||
-(void)setGiftInfo:(GiftInfoModel *)giftInfo{
|
||||
_giftInfo = giftInfo;
|
||||
_numView.text = [NSString stringWithFormat:@"x%ld",_giftInfo.count];
|
||||
if(_giftInfo.isSelected == YES){
|
||||
_bgView.backgroundColor = [DJDKMIMOMColor giftSelectBgColor];
|
||||
_bgView.layer.borderWidth = 1;
|
||||
}else{
|
||||
_bgView.layer.borderWidth = 0;
|
||||
_bgView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
}
|
||||
-(void)setFreeModel:(XPFreeGiftModel *)freeModel{
|
||||
_freeModel = freeModel;
|
||||
_iconView.imageUrl = _freeModel.giftUrl;
|
||||
_nameView.text = _freeModel.giftName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -懒加载
|
||||
- (UIView *)bgView{
|
||||
if (!_bgView){
|
||||
_bgView = [UIView new];
|
||||
_bgView.backgroundColor = [DJDKMIMOMColor giftSelectBgColor];
|
||||
_bgView.layer.cornerRadius = 5;
|
||||
_bgView.layer.borderColor = [DJDKMIMOMColor appMainColor].CGColor;
|
||||
_bgView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _bgView;
|
||||
}
|
||||
- (UILabel *)numView{
|
||||
if (!_numView){
|
||||
_numView = [UILabel labelInitWithText:@"x0" font:[UIFont systemFontOfSize:8 weight:UIFontWeightRegular] textColor:UIColorFromRGB(0x9E9E9E)];
|
||||
}
|
||||
return _numView;
|
||||
}
|
||||
- (UILabel *)timeView{
|
||||
if (!_timeView){
|
||||
_timeView = [UILabel labelInitWithText:@"00:00:00" font:[UIFont systemFontOfSize:8 weight:UIFontWeightRegular] textColor:[UIColor whiteColor]];
|
||||
_timeView.textAlignment = NSTextAlignmentRight;
|
||||
_timeView.hidden = YES;
|
||||
}
|
||||
return _timeView;
|
||||
}
|
||||
- (NetImageView *)iconView{
|
||||
if (!_iconView){
|
||||
NetImageConfig *config = [[NetImageConfig alloc]init];
|
||||
config.placeHolder = [UIImageConstant defalutEmptyPlaceholder];
|
||||
_iconView = [[NetImageView alloc]initWithConfig:config];
|
||||
|
||||
}
|
||||
return _iconView;
|
||||
}
|
||||
- (UILabel *)nameView{
|
||||
if (!_nameView){
|
||||
_nameView = [UILabel labelInitWithText:YMLocalizedString(@"XPGiftFreeItemCell1") font:[UIFont systemFontOfSize:10 weight:UIFontWeightRegular] textColor:[UIColor whiteColor]];
|
||||
_nameView.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _nameView;
|
||||
}
|
||||
-(UILabel *)titleView{
|
||||
if (!_titleView){
|
||||
_titleView = [UILabel labelInitWithText:YMLocalizedString(@"XPGiftFreeItemCell0") font:[UIFont systemFontOfSize:8 weight:UIFontWeightRegular] textColor:[UIColor colorWithWhite:1 alpha:0.8]];
|
||||
_titleView.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _titleView;
|
||||
}
|
||||
@end
|
@@ -54,6 +54,11 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
|
||||
@property (nonatomic, copy) NSString *defaultSelectGiftId;
|
||||
///房间类型
|
||||
@property (nonatomic,assign) RoomType roomType;
|
||||
///免费礼物送完删除了,不能出现在背包,防止数据更新时重新加进来
|
||||
@property (nonatomic,assign) BOOL isDelFreeGift;
|
||||
///免费礼物
|
||||
|
||||
@property (nonatomic,strong) XPFreeGiftModel *freeModel;
|
||||
///头部礼物类型变更
|
||||
/// - Parameter headType: 1:礼物 2:互动
|
||||
- (void)giftHeadTypeHadChange:(NSInteger)headType;
|
||||
|
@@ -9,11 +9,13 @@
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
///#import "CountDownHelper.h"
|
||||
#import "YUMIMacroUitls.h"
|
||||
#import "YUMIHtmlUrl.h"
|
||||
#import "ThemeColor+SendGift.h"
|
||||
#import "NSArray+Safe.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "CountDownHelper.h"
|
||||
///Model
|
||||
#import "GiftInfoModel.h"
|
||||
#import "GiftReceiveInfoModel.h"
|
||||
@@ -23,7 +25,7 @@
|
||||
#import "XPGiftEmptyCollectionViewCell.h"
|
||||
#import "XPGiftWeekStarCollectionViewCell.h"
|
||||
#import "XPGiftCollectionViewFlowLayout.h"
|
||||
|
||||
#import "XPGiftFreeItemCell.h"
|
||||
static NSString *kSendGiftViewHidePunishNewIcon = @"kSendGiftViewHidePunishNewIcon";///是否隐藏惩罚礼物“新”标识
|
||||
|
||||
@interface XPGiftInfoView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, XPGiftWeekStarCollectionViewCellDelegate>
|
||||
@@ -119,7 +121,14 @@ static NSString *kSendGiftViewHidePunishNewIcon = @"kSendGiftViewHidePunishNewIc
|
||||
GiftInfoModel * giftInfo = [self findGiftInfoByGiftId:giftReceiveInfo.giftId.integerValue];
|
||||
giftInfo.count -= giftReceiveInfo.giftNum * numberUser;
|
||||
if (giftInfo.count == 0) {
|
||||
[self.datasource removeObject:giftInfo];
|
||||
if(self.freeModel.giftId.integerValue == giftInfo.giftId){
|
||||
if([CountDownHelper shareHelper].isCountdownFinish == YES){
|
||||
self.isDelFreeGift = YES;
|
||||
[self.datasource removeObject:giftInfo];
|
||||
}
|
||||
}else{
|
||||
[self.datasource removeObject:giftInfo];
|
||||
}
|
||||
}
|
||||
[self.giftcollectionView reloadData];
|
||||
}
|
||||
@@ -235,7 +244,9 @@ static NSString *kSendGiftViewHidePunishNewIcon = @"kSendGiftViewHidePunishNewIc
|
||||
[self.packOriginArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([obj isKindOfClass:GiftInfoModel.class]) {
|
||||
GiftInfoModel *gift = (GiftInfoModel *)obj;
|
||||
giftTotal += gift.count * gift.goldPrice;
|
||||
if(gift.giftId != self.freeModel.giftId.integerValue){
|
||||
giftTotal += gift.count * gift.goldPrice;
|
||||
}
|
||||
}
|
||||
}];
|
||||
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"XPGiftInfoView0" ) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10],NSForegroundColorAttributeName:[DJDKMIMOMColor textThirdColor]}];
|
||||
@@ -336,10 +347,17 @@ static NSString *kSendGiftViewHidePunishNewIcon = @"kSendGiftViewHidePunishNewIc
|
||||
cell.weekStarGiftList = self.datasource;
|
||||
return cell;
|
||||
}
|
||||
|
||||
GiftInfoModel * giftInfo;
|
||||
giftInfo= [self.datasource safeObjectAtIndex1:indexPath.item];
|
||||
if(self.freeModel != nil && self.segmentType == GiftSegmentType_Pack && giftInfo.giftId == self.freeModel.giftId.integerValue){
|
||||
XPGiftFreeItemCell *itemCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftFreeItemCell class]) forIndexPath:indexPath];
|
||||
itemCell.giftInfo = giftInfo;
|
||||
itemCell.freeModel = self.freeModel;
|
||||
return itemCell;
|
||||
|
||||
}
|
||||
XPGiftItemCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftItemCollectionViewCell class]) forIndexPath:indexPath];
|
||||
GiftInfoModel * giftInfo;
|
||||
giftInfo= [self.datasource safeObjectAtIndex1:indexPath.item];
|
||||
|
||||
cell.usingplaceType = self.usingplaceType;
|
||||
cell.curUserNobleLevel = self.curUserNobleLevel;
|
||||
cell.giftInfo = giftInfo;
|
||||
@@ -408,9 +426,19 @@ static NSString *kSendGiftViewHidePunishNewIcon = @"kSendGiftViewHidePunishNewIc
|
||||
break;
|
||||
case GiftSegmentType_Pack:
|
||||
{
|
||||
[self.datasource addObjectsFromArray:self.packOriginArray];
|
||||
self.totalValueLabel.hidden = NO;
|
||||
self.totalValueLabel.attributedText= self.totalAttribute;
|
||||
if(self.isDelFreeGift == YES){
|
||||
NSMutableArray *originArray = [NSMutableArray array];
|
||||
for (GiftInfoModel *giftModel in self.packOriginArray) {
|
||||
if(giftModel.giftId != self.freeModel.giftId.integerValue){
|
||||
[originArray addObject:giftModel];
|
||||
}
|
||||
}
|
||||
[self.datasource addObjectsFromArray:originArray];
|
||||
}else{
|
||||
[self.datasource addObjectsFromArray:self.packOriginArray];
|
||||
}
|
||||
self.totalValueLabel.hidden = NO;
|
||||
self.totalValueLabel.attributedText= self.totalAttribute;
|
||||
}
|
||||
break;
|
||||
case GiftSegmentType_Graffiti:
|
||||
@@ -774,6 +802,7 @@ static NSString *kSendGiftViewHidePunishNewIcon = @"kSendGiftViewHidePunishNewIc
|
||||
[_giftcollectionView registerClass:[XPGiftItemCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPGiftItemCollectionViewCell class])];
|
||||
[_giftcollectionView registerClass:[XPGiftEmptyCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPGiftEmptyCollectionViewCell class])];
|
||||
[_giftcollectionView registerClass:[XPGiftWeekStarCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPGiftWeekStarCollectionViewCell class])];
|
||||
[_giftcollectionView registerClass:[XPGiftFreeItemCell class] forCellWithReuseIdentifier:NSStringFromClass([XPGiftFreeItemCell class])];
|
||||
_giftcollectionView.showsHorizontalScrollIndicator = NO;
|
||||
}
|
||||
return _giftcollectionView;
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#import "MvpViewController.h"
|
||||
#import "RoomHostDelegate.h"
|
||||
#import "XPGiftUserInfoModel.h"
|
||||
#import "XPFreeGiftModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
typedef NS_ENUM(NSInteger, SendGiftType) {
|
||||
SendGiftType_Room = 1, ///房间内送礼物
|
||||
@@ -15,6 +16,7 @@ typedef NS_ENUM(NSInteger, SendGiftType) {
|
||||
};
|
||||
|
||||
@interface XPSendGiftView : MvpViewController
|
||||
@property (nonatomic,strong) XPFreeGiftModel *freeModel;
|
||||
///房间内才需要
|
||||
@property (nonatomic,weak) id<RoomHostDelegate> delegate;
|
||||
/// 送礼物的
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#import "XPMineRechargeViewController.h"
|
||||
#import "XPIAPRechargeViewController.h"
|
||||
#import "XPWebViewController.h"
|
||||
|
||||
UIKIT_EXTERN NSString * const kFreeGiftCountdownNotification;
|
||||
UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
||||
|
||||
@interface XPSendGiftView ()< XPGiftBarViewDelegate, XPGiftProtocol, XPGiftInfoViewDelegate, XPGraffitiGiftViewDelegate, XPGiftUsersViewDelegate, XPGiftHeadTypeViewDelegate, XPGiftLuckyGiftBroadcastViewDelegate, XPGiftTwelveStarBroadcastViewDelegate>
|
||||
@@ -89,6 +89,8 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
||||
@property (nonatomic,assign) GiftSegmentType segmentType;
|
||||
///福袋礼物全服记录
|
||||
@property (nonatomic,strong) NSArray *records;
|
||||
///背包礼物数据
|
||||
@property (nonatomic,copy) NSArray<GiftInfoModel *> * packGiftList;
|
||||
@end
|
||||
|
||||
@implementation XPSendGiftView
|
||||
@@ -97,7 +99,9 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
||||
return [[XPGiftPresenter alloc] init];
|
||||
}
|
||||
|
||||
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self];
|
||||
}
|
||||
- (instancetype)initWithType:(SendGiftType)type uid:(NSString * __nullable)uid{
|
||||
if (self = [super init]) {
|
||||
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
@@ -125,8 +129,17 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
||||
[self.stackView addArrangedSubview:self.giftInfoView];
|
||||
[self.stackView addArrangedSubview:self.giftBarView];
|
||||
[self.stackView addArrangedSubview:self.bottomView];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(getFreeGiftCountdownNotification:) name:kFreeGiftCountdownNotification object:nil];
|
||||
}
|
||||
-(void)getFreeGiftCountdownNotification:(NSNotification *)not{
|
||||
NSDictionary *freeDic = not.userInfo;
|
||||
BOOL isReset = [freeDic[@"isReset"] boolValue];///礼物清零
|
||||
|
||||
if(isReset == YES){
|
||||
[self.presenter getPackGiftList];
|
||||
self.giftInfoView.isDelFreeGift = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self.view);
|
||||
@@ -614,7 +627,28 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
||||
}
|
||||
///背包礼物
|
||||
- (void)getPacketGiftListSuccess:(NSArray<GiftInfoModel *> *)giftList {
|
||||
self.giftInfoView.packOriginArray = giftList;
|
||||
self.packGiftList = giftList;
|
||||
NSMutableArray<GiftInfoModel *> *giftArray = [NSMutableArray arrayWithArray:self.packGiftList];
|
||||
BOOL isHaveFreeGift = NO;
|
||||
for (int i = 0 ; i < self.packGiftList.count; i++) {
|
||||
GiftInfoModel *infoModel = self.packGiftList[i];
|
||||
if(infoModel.giftId == self.freeModel.giftId.integerValue){
|
||||
[giftArray removeObjectAtIndex:i];
|
||||
[giftArray insertObject:infoModel atIndex:0];
|
||||
isHaveFreeGift = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(isHaveFreeGift == NO && self.freeModel.curStage != nil && self.freeModel.curStage.integerValue == 0 ){
|
||||
GiftInfoModel *infoModel = [GiftInfoModel new];
|
||||
infoModel.giftId = self.freeModel.giftId.integerValue;
|
||||
infoModel.count = 0;
|
||||
infoModel.giftUrl = self.freeModel.giftUrl;
|
||||
infoModel.giftName = self.freeModel.giftName;
|
||||
[giftArray insertObject:infoModel atIndex:0];
|
||||
}
|
||||
self.giftInfoView.freeModel = self.freeModel;
|
||||
self.giftInfoView.packOriginArray = giftArray;
|
||||
}
|
||||
|
||||
- (void)getPacketGiftListFail:(NSString *)message {
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#import "NSMutableDictionary+Saft.h"
|
||||
#import "XPSkillCardPlayerManager.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "CountDownHelper.h"
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
@@ -36,6 +37,7 @@
|
||||
#import "XPReceiveRedPacketModel.h"
|
||||
#import "XPRedPacketModel.h"
|
||||
#import "FirstChargeRoomWindowModel.h"
|
||||
#import "XPFreeGiftModel.h"
|
||||
///View
|
||||
#import "BaseNavigationController.h"
|
||||
#import "XPRoomActivityContainerView.h"
|
||||
@@ -58,6 +60,7 @@
|
||||
#import "XPFirstRechargeView.h"
|
||||
#import "XPWebViewController.h"
|
||||
#import "SessionViewController.h"
|
||||
#import "XPFreeGiftsObtainView.h"
|
||||
///P
|
||||
#import "XPRoomPresenter.h"
|
||||
#import "XPRoomProtocol.h"
|
||||
@@ -75,11 +78,11 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
|
||||
UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
|
||||
UIKIT_EXTERN NSString * kNewUserRechargeKey;
|
||||
UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
||||
|
||||
UIKIT_EXTERN NSString * const kFreeGiftCountdownNotification;
|
||||
NSString * const kHadShowAnchorRoomTipKey = @"kHadShowAnchorRoomTipKey";//是否展示过个播房上划用户引导
|
||||
NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出过非自己房间
|
||||
|
||||
@interface XPRoomViewController ()<XPRoomProtocol, RoomHostDelegate, NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate, XPRoomSettingInputViewDelegate, AnchorRoomScrollViewDelegate, XPFirstRechargeViewDelegate,NIMBroadcastManagerDelegate,XPRoomLittleGameContainerViewDelegate>
|
||||
@interface XPRoomViewController ()<XPRoomProtocol, RoomHostDelegate, NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate, XPRoomSettingInputViewDelegate, AnchorRoomScrollViewDelegate, XPFirstRechargeViewDelegate,NIMBroadcastManagerDelegate,XPRoomLittleGameContainerViewDelegate,CountDownHelperDelegate>
|
||||
///背景
|
||||
@property (nonatomic,strong) XPRoomBackContainerView *backContainerView;
|
||||
|
||||
@@ -134,6 +137,10 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
@property (nonatomic,assign) NSInteger anchorIndex;
|
||||
@property (nonatomic,strong) XPFirstRechargeView *firstRechargeView;
|
||||
@property (nonatomic,assign) BOOL isShowFirstRecharge;
|
||||
///免费礼物数量
|
||||
@property (nonatomic,strong) XPFreeGiftModel *freeModel;
|
||||
///免费礼物弹窗
|
||||
@property (nonatomic,strong) XPFreeGiftsObtainView *freeView;
|
||||
@end
|
||||
|
||||
@implementation XPRoomViewController
|
||||
@@ -207,6 +214,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
if([[XPRoomMiniManager shareManager] getRoomInfo]==nil){
|
||||
[XPSkillCardPlayerManager shareInstance].isMineInMic = NO;
|
||||
}
|
||||
[[CountDownHelper shareHelper] stopCountDown];
|
||||
[CountDownHelper shareHelper].delegate = nil;
|
||||
[[NIMSDK sharedSDK].chatroomManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
|
||||
[[NIMSDK sharedSDK].loginManager removeDelegate:self];
|
||||
@@ -239,6 +248,8 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
[self.presenter getNormalGiftList:self.roomUid];
|
||||
///获取房间超管列表
|
||||
[self.presenter getRoomSuperAdmin:self.roomUid];
|
||||
///获取免费礼物
|
||||
[self.presenter getFreeGiftData];
|
||||
///获取首充次数
|
||||
[self.presenter getRoomFirstCharegWindow:self.roomUid];
|
||||
//监听云信消息x
|
||||
@@ -247,6 +258,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
[[NIMSDK sharedSDK].loginManager addDelegate:self];
|
||||
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
|
||||
[[NIMSDK sharedSDK].broadcastManager addDelegate:self];
|
||||
[CountDownHelper shareHelper].delegate = self;
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myGiftEffectUpdate:) name:kRoomGiftEffectUpdateNotificationKey object:nil];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(showRoomFirstChargeWindowFormNot:) name:kShowFirstRechargeView object:nil];
|
||||
[XPSkillCardPlayerManager shareInstance].isInRoom = YES;
|
||||
@@ -260,12 +272,18 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
[super viewWillAppear:animated];
|
||||
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
|
||||
}
|
||||
-(void)viewWillDisappear:(BOOL)animated{
|
||||
[super viewWillDisappear:animated];
|
||||
self.freeView.hidden = YES;
|
||||
}
|
||||
- (void)viewDidDisappear:(BOOL)animated{
|
||||
[super viewDidDisappear:animated];
|
||||
|
||||
[XPSkillCardPlayerManager shareInstance].isInRoomVC = NO;
|
||||
}
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
self.freeView.hidden = NO;
|
||||
[XPSkillCardPlayerManager shareInstance].isInRoomVC = YES;
|
||||
if([XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge == YES && self.isShowFirstRecharge == NO){
|
||||
[XPSkillCardPlayerManager shareInstance].isInRoomFirstRecharge = NO;
|
||||
@@ -569,6 +587,29 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - CountDownHelperDelegate
|
||||
- (void)onCountdownFinish {
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"isCountdownFinish":@(YES)}];
|
||||
if(self.freeModel.curStage.integerValue < self.freeModel.maxStage.integerValue){
|
||||
[self.presenter getFreeGiftData];
|
||||
}
|
||||
if(self.freeModel.curStage.intValue == 0){
|
||||
self.freeView.freeModel = self.freeModel;
|
||||
if(!self.freeView.superview){
|
||||
[kWindow addSubview:self.freeView];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
- (void)onCountdownOpen:(int)time {
|
||||
NSInteger seconds = time;
|
||||
int hours = (seconds)%(24*3600)/3600;
|
||||
int minutes = (seconds)%3600/60;
|
||||
int second = (seconds)%60;
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"text":[NSString stringWithFormat:@"%02d:%02d:%02d",hours,minutes,second],@"isCountdownFinish":@(NO)}];
|
||||
|
||||
|
||||
}
|
||||
-(void)showRoomFirstChargeWindowFormNot:(NSNotification *)not{
|
||||
if(not != nil){
|
||||
NSDictionary *parameter = not.object;
|
||||
@@ -1115,7 +1156,29 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
[self.view bringSubviewToFront:view];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)getFreeGiftDataSuccess:(XPFreeGiftModel *)freeModel{
|
||||
self.freeModel = freeModel;
|
||||
self.menuContainerView.freeModel = freeModel;
|
||||
if(self.freeModel.curStage.integerValue < self.freeModel.maxStage.integerValue){
|
||||
[CountDownHelper shareHelper].isCountdownFinish = NO;
|
||||
[[CountDownHelper shareHelper] openCountdownWithTime:freeModel.curStageSecond.intValue];
|
||||
}else{
|
||||
if([CountDownHelper shareHelper].isCountdownFinish == NO){
|
||||
[CountDownHelper shareHelper].isCountdownFinish = YES;
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"isHiddenCountdown":@(YES)}];
|
||||
[[CountDownHelper shareHelper] stopCountDown];
|
||||
}
|
||||
|
||||
if(self.freeModel.curStage.intValue > 0 && [[XPRoomMiniManager shareManager].curState isEqualToString:@"0"]){
|
||||
self.freeView.freeModel = self.freeModel;
|
||||
if(!self.freeView.superview){
|
||||
[kWindow addSubview:self.freeView];
|
||||
}
|
||||
[XPRoomMiniManager shareManager].curState = nil;
|
||||
}
|
||||
|
||||
}
|
||||
- (void)getRoomFirstChargeWindowSuccess:(FirstChargeRoomWindowModel *)model{
|
||||
if(model.needToShow == NO || model.showAfterSecond <= 0 || self.isShowFirstRecharge == YES)return;
|
||||
self.isShowFirstRecharge = YES;
|
||||
@@ -1358,7 +1421,16 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
[self.view addSubview:view];
|
||||
[self.view bringSubviewToFront:view];
|
||||
}
|
||||
}
|
||||
}else if(attachment.first == CustomMessageType_Free_Gift_Star_Reset_Time){
|
||||
if(attachment.second == Custom_Message_Sub_Free_Gift_Star_Reset_Time){
|
||||
[self.presenter getFreeGiftData];
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"isReset":@(YES)}];
|
||||
}else if(attachment.second == Custom_Message_Sub_Update_Gift_Information){
|
||||
[self.presenter getFreeGiftData];
|
||||
[[NSNotificationCenter defaultCenter]postNotificationName:kFreeGiftCountdownNotification object:nil userInfo:@{@"updateGiftInfo":attachment.data ?: @""}];
|
||||
}
|
||||
|
||||
}
|
||||
[self.messageContainerView handleNIMCustomMessage:message];
|
||||
}
|
||||
} else if(message.messageType == NIMMessageTypeText) {
|
||||
@@ -1579,7 +1651,9 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
}
|
||||
|
||||
- (void)miniRoom {
|
||||
|
||||
if(self.freeModel != nil){
|
||||
[XPRoomMiniManager shareManager].curState = self.freeModel.curStage;
|
||||
}
|
||||
[self.menuContainerView menuResignFirstResponder];
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(showRoomFirstChargeWindow) object:nil];
|
||||
NSDictionary *roomInfoDic = self.roomInfo.model2dictionary != nil ? self.roomInfo.model2dictionary : @{};
|
||||
@@ -1945,5 +2019,10 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
}
|
||||
return _firstRechargeView;
|
||||
}
|
||||
|
||||
-(XPFreeGiftsObtainView *)freeView{
|
||||
if (!_freeView){
|
||||
_freeView = [[XPFreeGiftsObtainView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
}
|
||||
return _freeView;
|
||||
}
|
||||
@end
|
||||
|
@@ -3054,6 +3054,16 @@
|
||||
"XPSessionMainViewController1" = "好友";
|
||||
"XPSessionMainViewController2" = "关注";
|
||||
"XPSessionMainViewController3" = "粉丝";
|
||||
///XPFreeGiftsObtainView
|
||||
"XPFreeGiftsObtainView0"="我知道啦";
|
||||
"XPFreeGiftsObtainView1"="今天观看直播满%@啦,送你一个礼物";
|
||||
"XPFreeGiftsObtainView2"="每天观看直播达到特定时长,即可获得一个\"%@\",每日上限%@个,礼物当日有效";
|
||||
"XPFreeGiftsObtainView3"="秒";
|
||||
"XPFreeGiftsObtainView4"="分钟";
|
||||
"XPFreeGiftsObtainView5"="小时";
|
||||
///XPGiftFreeItemCell
|
||||
"XPGiftFreeItemCell0"="免费礼物";
|
||||
"XPGiftFreeItemCell1"="礼物名称";
|
||||
///不能脚本生成的
|
||||
"App_Common_And" = "和";
|
||||
"App_Common_Male" = "男";
|
||||
|
@@ -3064,6 +3064,16 @@
|
||||
"XPSessionMainViewController1" = "好友";
|
||||
"XPSessionMainViewController2" = "關註";
|
||||
"XPSessionMainViewController3" = "粉絲";
|
||||
///XPFreeGiftsObtainView
|
||||
"XPFreeGiftsObtainView0"="我知道啦";
|
||||
"XPFreeGiftsObtainView1"="今天觀看直播滿%@啦,送你一個禮物";
|
||||
"XPFreeGiftsObtainView2"="每天觀看直播達到特定時長,即可獲得一個\"%@\",每日上限%@個,禮物當日有效";
|
||||
"XPFreeGiftsObtainView3"="秒";
|
||||
"XPFreeGiftsObtainView4"="分鐘";
|
||||
"XPFreeGiftsObtainView5"="小時";
|
||||
///XPGiftFreeItemCell
|
||||
"XPGiftFreeItemCell0"="免費禮物";
|
||||
"XPGiftFreeItemCell1"="禮物名稱";
|
||||
///不能腳本生成的
|
||||
"App_Common_And" = "和";
|
||||
"App_Common_Male" = "男";
|
||||
|
Reference in New Issue
Block a user