-- 客户端“我的装扮”入口

-- 礼物面板 API 调试
-- 礼物面板调整
This commit is contained in:
eggmanQQQ
2024-08-02 21:09:02 +08:00
parent d3ce09517b
commit fb30106c63
20 changed files with 347 additions and 127 deletions

View File

@@ -12956,7 +12956,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 20.20.31;
MARKETING_VERSION = 20.20.32;
PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -12998,7 +12998,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 20.20.31;
MARKETING_VERSION = 20.20.32;
PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@@ -49,7 +49,7 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns
///内置版本号
#define PI_App_Version @"1.0.17"
#define PI_App_Version @"1.0.18"
///渠道
#define PI_App_Source @"appstore"
#define PI_Test_Flight @"TestFlight"

View File

@@ -196,12 +196,19 @@
delayDuration = 0.25;
}
// load
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayDuration * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
[Api requestNormalGiftList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
if (data.data) {
[Api requestAllTagsAndNormalGifts:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200 && data.data) {
[[XPGiftStorage shareStorage] cacheWith:data.data inRoom:roomUid];
[[XPGiftStorage shareStorage] cacheTagsWith:data.data inRoom:roomUid];
}
}fail:^(NSInteger code, NSString * _Nullable msg) {}] roomUid:roomUid];
} roomUid:roomUid];
// [Api requestNormalGiftList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
// if (data.data) {
// [[XPGiftStorage shareStorage] cacheWith:data.data inRoom:roomUid];
// }
// }fail:^(NSInteger code, NSString * _Nullable msg) {}] roomUid:roomUid];
});
}

View File

@@ -151,6 +151,9 @@
@property(nonatomic,assign) CGFloat broadCastHieght;
@property (nonatomic, strong) NetImageView *imageLoader;
@property (nonatomic, copy) NSString *GiftDynamicEffectListPath;
@end
@implementation XPRoomAnimationView
@@ -180,7 +183,8 @@
[self initSubViews];
[self initSubViewConstraints];
_GiftDynamicEffectListPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) xpSafeObjectAtIndex:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
}
return self;
}
@@ -2022,12 +2026,11 @@
if ([self isInSudGame]) {return;}
NSString *encodingUrl = [vggUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
NSString *fileName = [[encodingUrl componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) xpSafeObjectAtIndex:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
NSString *fullPath = [self.GiftDynamicEffectListPath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){
NSData *data = [NSData dataWithContentsOfFile:fullPath options:0 error:NULL];
@kWeakify(self);
[self.parser parseWithData:data cacheKey:@"" completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
[self.parser parseWithData:data cacheKey:fileName completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
if (videoItem != nil) {
self.giftEffectView.hidden = NO;
@@ -2132,8 +2135,7 @@
- (void)playGiftEffectWithVapUrl:(NSString *)vapUrl {
NSString *encodingUrl = [vapUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
NSString *fileName = [[encodingUrl componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) xpSafeObjectAtIndex:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
NSString *fullPath = [self.GiftDynamicEffectListPath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){
vapUrl = fullPath;
@@ -2176,8 +2178,7 @@
NSString *encodingUrl = [vggUrl.absoluteString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
NSString *fileName = [[encodingUrl componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) xpSafeObjectAtIndex:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
NSString *fullPath = [self.GiftDynamicEffectListPath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){
NSData *data=[NSData dataWithContentsOfFile:fullPath options:0 error:NULL];
[self.parser parseWithData:data cacheKey:@"" completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@@ -2255,8 +2256,7 @@
- (void)playLuckyGiftEffectWithVapUrl:(NSString *)vapUrl {
NSString *encodingUrl = [vapUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"`#%^{}\"[]|\\<> "].invertedSet];
NSString *fileName = [[encodingUrl componentsSeparatedByString:@"/"] lastObject];
NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) xpSafeObjectAtIndex:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
NSString *fullPath = [self.GiftDynamicEffectListPath stringByAppendingPathComponent:fileName];
if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){
vapUrl = fullPath;
self.luckyVapGiftEffectView.hidden = NO;
@@ -2300,8 +2300,6 @@
if (self.isLargeGiftAnimating == YES) {
self.isLargeGiftAnimating = NO;
}
} else if (player == self.luckyGiftEffectView) {
self.luckyGiftEffectView.hidden = YES;
} else if(player == self.carEffectView) {

View File

@@ -63,7 +63,9 @@
make.leading.mas_equalTo(12);
make.bottom.mas_equalTo(-20);
make.top.mas_equalTo(10);
make.width.mas_equalTo(20);
if (isMSRTL()) {
make.width.mas_equalTo(20);
}
}];
}
@@ -109,32 +111,35 @@
UIImage *image1 = [UIImage imageWithCGImage:image.CGImage scale:2.0 orientation:UIImageOrientationUp];
self.bubbleImageView.image = [self resizableImage:image1];
}];
[self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.bubbleImageView).offset(self.messageInfo.contentLeftMargin);
make.top.mas_equalTo(self.bubbleImageView).offset(self.messageInfo.contentTopMargin);
make.bottom.mas_equalTo(self.bubbleImageView).offset(-self.messageInfo.contentBottomMargin);
if (isMSRTL()) { // MARK: 使 layout
make.width.mas_equalTo([self RTLLabelWidth]);
}
}];
} else {
_bubbleImageView.image = [UIImage imageWithColor:[DJDKMIMOMColor messageBubbleColor]];
}
// else {
// _bubbleImageView.image = [UIImage imageWithColor:[DJDKMIMOMColor messageBubbleColor]];
//
// [self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
// make.leading.mas_equalTo(12);
// make.bottom.mas_equalTo(-20);
// make.top.mas_equalTo(10);
// // MARK: 使 layout
// make.width.mas_equalTo([self RTLLabelWidth]);
// }];
//
// }
[self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(12);
make.bottom.mas_equalTo(-20);
make.top.mas_equalTo(10);
// MARK: 使 layout
[self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.bubbleImageView).offset(self.messageInfo.contentLeftMargin);
make.top.mas_equalTo(self.bubbleImageView).offset(self.messageInfo.contentTopMargin);
make.bottom.mas_equalTo(self.bubbleImageView).offset(-self.messageInfo.contentBottomMargin);
if (isMSRTL()) { // MARK: 使 layout
make.width.mas_equalTo([self RTLLabelWidth]);
}];
}
}];
}
_bubbleImageView.hidden = _messageInfo.isHiddenBubble;
}
}
- (CGFloat)RTLLabelWidth {
return MIN(self.contentLabel.textWidth + self.messageInfo.contentLeftMargin + self.messageInfo.contentRightMargin + 4, self.contentLabel.maxWidth);
return MIN(self.contentLabel.textWidth + self.messageInfo.contentLeftMargin + self.messageInfo.contentRightMargin + 8, self.contentLabel.maxWidth);
}
- (UIImage *)scaleToSize:(UIImage *)img {

View File

@@ -25,6 +25,12 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)requestNormalGiftList:(HttpRequestHelperCompletion)complection
roomUid:(NSString *)roomUid;
/// 请求礼物面板全部 Tags 和普通礼物列表
/// @param complection 完成
/// @param roomUid 房间的roomuid
+ (void)requestAllTagsAndNormalGifts:(HttpRequestHelperCompletion)complection
roomUid:(NSString *)roomUid;
/// 送礼物的接口
/// @param complection 完成
/// @param targetUids 送给谁的

View File

@@ -25,6 +25,11 @@
+ (void)requestNormalGiftList:(HttpRequestHelperCompletion)complection roomUid:(NSString *)roomUid {
[self makeRequest:@"gift/listV5" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, roomUid, nil];
}
+ (void)requestAllTagsAndNormalGifts:(HttpRequestHelperCompletion)complection roomUid:(NSString *)roomUid {
[self makeRequest:@"gift/getPanel" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, roomUid, nil];
}
///
/// @param complection
+ (void)requestCacheGiftList:(HttpRequestHelperCompletion)complection {

View File

@@ -23,6 +23,7 @@ typedef NS_ENUM(NSUInteger, GiftType) {
GiftType_Punish = 12, //惩罚礼物
GiftType_Twelve_Star = 13, //星座礼物
GiftType_super = 16, //超级礼物
GiftType_Country = 17, //国家礼物
};
//礼物类型
@@ -129,4 +130,22 @@ typedef NS_ENUM(NSUInteger, RoomSendGiftType) {
@end
@interface GiftPanelTabModel : PIBaseModel
/// 标题, 同时也是礼物类型
@property (nonatomic, copy) NSString *key;
/// 排序
@property (nonatomic, assign) NSInteger seq;
///多语言标题
@property (nonatomic, strong) i18nGiftNameMap *nameMap;
@property (nonatomic, copy) NSArray <GiftInfoModel *> *gifts;
@end
//@interface GiftPanelModel : PIBaseModel
//@property (nonatomic, copy) NSArray<GiftPanelTabModel *> *tabList;
//@end
NS_ASSUME_NONNULL_END

View File

@@ -11,3 +11,7 @@
@implementation GiftInfoModel
MJCodingImplementation
@end
@implementation GiftPanelTabModel
MJCodingImplementation
@end

View File

@@ -17,7 +17,12 @@ NS_ASSUME_NONNULL_BEGIN
- (void)getUserWallInfo;
/// 获取普通的礼物
/// @param roomUid 房主的uid 获取房间专属礼物
- (void)getNormalGiftList:(NSString *)roomUid;
//- (void)getNormalGiftList:(NSString *)roomUid;
/// 获取面板 Tags 和所有普通礼物,替代 getNormalGiftList:
/// @param roomUid 房主的uid 获取房间专属礼物
- (void)getTagsAndGifts:(NSString *)roomUid;
/// 获取背包礼物
- (void)getPackGiftList;
/// 送礼物
@@ -46,6 +51,9 @@ NS_ASSUME_NONNULL_BEGIN
///星座礼物
- (void)getTwelveStarLastRankFirst:(NSString *)roomUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -75,6 +75,27 @@
});
}
- (void)getTagsAndGifts:(NSString *)roomUid {
CGFloat delayDuration = 0.0;
NSArray * arrary = [[XPGiftStorage shareStorage] getGiftPanelTagsDatasource:roomUid];
if (arrary.count > 0) {
delayDuration = 1;
[[self getView] getTagsSuccess:arrary];
}
@kWeakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayDuration * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
[Api requestAllTagsAndNormalGifts:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[XPGiftStorage shareStorage] cacheWith:data.data inRoom:roomUid];
[[self getView] getTagsSuccess:[[XPGiftStorage shareStorage] cacheTagsWith:data.data inRoom:roomUid]];
}fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
[[self getView] getNormalGiftListFail:msg];
}] roomUid:roomUid];
});
}
///
- (void)getPackGiftList {

View File

@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class GiftInfoModel;
@class GiftInfoModel, GiftPanelTabModel;
@interface XPGiftStorage : NSObject
+ (instancetype)shareStorage;
- (instancetype)init NS_UNAVAILABLE;
@@ -16,8 +16,10 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)mutableCopy NS_UNAVAILABLE;
- (NSArray<GiftInfoModel *> *)getGiftDatasource:(NSString *)roomUid;
- (NSArray<GiftPanelTabModel *> *)getGiftPanelTagsDatasource:(NSString *)roomUid;
- (void)saveGiftDatasource:(NSArray<GiftInfoModel *> *)giftArray roomUid:(NSString *)roomUid;
- (void)saveGiftPanelTagsDatasource:(NSArray<GiftPanelTabModel *> *)giftArray roomUid:(NSString *)roomUid;
/**
这个不是最好的获取方式 可能由于没有房间uid 导致获取失败
@@ -31,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)writeGiftToDirectory:(NSArray *)array;
- (NSArray *)cacheWith:(NSDictionary *)response inRoom:(NSString *)roomUid;
- (NSArray *)cacheTagsWith:(NSDictionary *)response inRoom:(NSString *)roomUid;
@end

View File

@@ -12,6 +12,9 @@
@interface XPGiftStorage ()
///key:id value:
@property (nonatomic, strong) NSCache<NSString *, NSArray<GiftInfoModel *> *> *roomGiftCache;
@property (nonatomic, strong) NSCache<NSString *, NSArray<GiftPanelTabModel *> *> *roomGiftPanelTagsCache;
///uid
@property (nonatomic,copy) NSString *currentRoomUid;
///
@@ -25,7 +28,7 @@
static XPGiftStorage * storage;
dispatch_once(&onceToken, ^{
storage = [[XPGiftStorage alloc] init];
[storage loadCache];
// [storage loadCache];
});
return storage;
}
@@ -40,6 +43,12 @@
}
}
- (void)saveGiftPanelTagsDatasource:(NSArray<GiftPanelTabModel *> *)tagsArray roomUid:(NSString *)roomUid {
if (tagsArray.count > 0 && roomUid.length > 0) {
[self.roomGiftPanelTagsCache setObject:tagsArray forKey:roomUid];
}
}
- (NSArray<GiftInfoModel *> *)getGiftDatasource:(NSString *)roomUid {
if (roomUid.length > 0) {
self.currentRoomUid = roomUid;
@@ -51,10 +60,21 @@
return nil;
}
- (NSArray<GiftPanelTabModel *> *)getGiftPanelTagsDatasource:(NSString *)roomUid {
if (roomUid.length > 0) {
self.currentRoomUid = roomUid;
NSArray *tagsList = [self.roomGiftPanelTagsCache objectForKey:roomUid];
if (tagsList.count >= 0) {
return tagsList;
}
}
return nil;
}
///
/// @param giftId id
- (GiftInfoModel *)findGiftInfo:(NSString *)giftId {
// MARK:
// MARK:
// GiftInfoModel * giftInfo = [self getGiftInfoFromDirectory:giftId];
// if (giftInfo) {
// return giftInfo;
@@ -81,11 +101,20 @@
if (!_roomGiftCache) {
_roomGiftCache = [[NSCache alloc] init];
//
_roomGiftCache.countLimit = 10;
_roomGiftCache.countLimit = 20;
}
return _roomGiftCache;
}
- (NSCache<NSString *,NSArray<GiftPanelTabModel *> *> *)roomGiftPanelTagsCache {
if (!_roomGiftPanelTagsCache) {
_roomGiftPanelTagsCache = [[NSCache alloc] init];
//
_roomGiftPanelTagsCache.countLimit = 20;
}
return _roomGiftPanelTagsCache;
}
- (void)writeGiftToDirectory:(NSArray *)array {
///IO
if (self.isWriteToFile) {
@@ -118,16 +147,56 @@
});
}
- (NSArray *)cacheTagsWith:(NSDictionary *)response inRoom:(NSString *)roomUid {
NSArray *tabModels = [GiftPanelTabModel modelsWithArray:response[@"tabList"]];
[self saveGiftPanelTagsDatasource:tabModels roomUid:roomUid];
NSDictionary *contents = response;
if ([[response allKeys] containsObject:@"giftTabMap"]) {
contents = [response objectForKey:@"giftTabMap"];
}
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"seq" ascending:YES];
NSMutableArray <GiftPanelTabModel *>*mutableTabs = [tabModels sortedArrayUsingDescriptors:@[sortDescriptor]].mutableCopy;
for (GiftPanelTabModel *model in mutableTabs) {
NSString *key = model.key;
NSArray *giftsArray = [contents objectForKey:key];
if (giftsArray.count > 0) {
NSArray *giftModels = [GiftInfoModel modelsWithArray:giftsArray];
model.gifts = giftModels;
}
}
[self saveGiftPanelTagsDatasource:mutableTabs roomUid:roomUid];
return mutableTabs;
}
- (NSArray *)cacheWith:(NSDictionary *)response inRoom:(NSString *)roomUid {
NSArray *luckyBagGift = [GiftInfoModel modelsWithArray:response[@"luckyGift"]]; //
NSArray *vipGift = [GiftInfoModel modelsWithArray:response[@"vipGift"]]; // VIP
NSArray *luckyPoolGift = [GiftInfoModel modelsWithArray:response[@"luckyPoolGift"]];//
NSArray *normalGift = [GiftInfoModel modelsWithArray:response[@"normalGift"]]; //
NSArray *weekStarGift = [GiftInfoModel modelsWithArray:response[@"weekStarGift"]]; //
NSArray *drawGift = [GiftInfoModel modelsWithArray:response[@"drawGift"]]; //
NSArray *penaltyGift = [GiftInfoModel modelsWithArray:response[@"penaltyGift"]]; //
NSArray *anchorGift = [GiftInfoModel modelsWithArray:response[@"singlePopularGift"]]; //
NSDictionary *contents = response;
if ([[response allKeys] containsObject:@"giftTabMap"]) {
contents = [response objectForKey:@"giftTabMap"];
}
NSMutableArray *totalInfo = [NSMutableArray array];
for (NSArray *value in contents.allValues) {
NSArray *giftInfoModels = [GiftInfoModel modelsWithArray:value];
[totalInfo addObjectsFromArray:giftInfoModels];
}
[self saveGiftDatasource:totalInfo roomUid:roomUid];
/*
NSArray *luckyBagGift = [GiftInfoModel modelsWithArray:contents[@"luckyGift"]]; //
NSArray *vipGift = [GiftInfoModel modelsWithArray:contents[@"vipGift"]]; // VIP
NSArray *luckyPoolGift = [GiftInfoModel modelsWithArray:contents[@"luckyPoolGift"]];//
NSArray *normalGift = [GiftInfoModel modelsWithArray:contents[@"normalGift"]]; //
NSArray *weekStarGift = [GiftInfoModel modelsWithArray:contents[@"weekStarGift"]]; //
NSArray *drawGift = [GiftInfoModel modelsWithArray:contents[@"drawGift"]]; //
NSArray *penaltyGift = [GiftInfoModel modelsWithArray:contents[@"penaltyGift"]]; //
NSArray *anchorGift = [GiftInfoModel modelsWithArray:contents[@"singlePopularGift"]]; //
NSMutableArray *info = [NSMutableArray array];
[info addObjectsFromArray:luckyBagGift];
[info addObjectsFromArray:vipGift];
@@ -142,12 +211,12 @@
[totalInfo addObjectsFromArray:luckyPoolGift];
///
[self saveGiftDatasource:info roomUid:roomUid];
[self saveGiftDatasource:totalInfo roomUid:roomUid];
*/
// MARK:
// [self writeGiftToDirectory:totalInfo];
return info.copy;
return @[].copy;
}
- (GiftInfoModel *)getGiftInfoFromDirectory:(NSString *)giftId {

View File

@@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
///获取周星礼物成功
- (void)getTwelveStarLastRankFirstSuccess:(GiftTwelveStarFirstModel *)model;
- (void)getTagsSuccess:(NSArray<GiftPanelTabModel*> *)tags;
@end
NS_ASSUME_NONNULL_END

View File

@@ -12,7 +12,7 @@
#import "XPSendGiftView.h"
#import "XPGiftInfoView.h"
NS_ASSUME_NONNULL_BEGIN
@class GiftInfoModel,PIGiftInfoSegmentedView, GiftReceiveInfoModel;
@class GiftInfoModel, GiftPanelTabModel, PIGiftInfoSegmentedView, GiftReceiveInfoModel;
@protocol PIGiftInfoSegmentedViewDelegate <NSObject>
///点击了切换不同礼物的tabbar
@@ -27,11 +27,14 @@ NS_ASSUME_NONNULL_BEGIN
@interface PIGiftInfoSegmentedView : UIView
@property(nonatomic,weak) id<PIGiftInfoSegmentedViewDelegate>delegate;
@property (nonatomic,assign) SendGiftType usingplaceType;
@property (nonatomic,assign) SendGiftType usingPlaceType;
@property (nonatomic, copy) NSArray <GiftPanelTabModel *>*tagsArray;
///普通礼物/幸运礼物/VIP礼物
@property (nonatomic,strong) NSArray *normalOriginArray;
@property (nonatomic, copy) NSArray *normalOriginArray;
///背包礼物
@property (nonatomic,strong) NSArray *packOriginArray;
@property (nonatomic, copy) NSArray *packOriginArray;
///免费礼物
@property (nonatomic,strong) XPFreeGiftModel *freeModel;
///免费礼物送完删除了,不能出现在背包,防止数据更新时重新加进来

View File

@@ -88,7 +88,6 @@
[self addSubview:self.pi_containerView];
[self addSubview:self.packGiftButton];
[self addSubview:self.packGiftView];
}
-(void)installConstraints{
[self mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -128,13 +127,13 @@
if(vc.segmentType == GiftSegmentType_Noble){
vc.curUserNobleLevel = self.curUserNobleLevel;
}
vc.usingplaceType = self.usingplaceType;
vc.usingPlaceType = self.usingPlaceType;
vc.normalOriginArray = [self.giftList xpSafeObjectAtIndex:index];
return vc;
}
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index{
if (self.usingplaceType == SendGiftType_User) {
if (self.usingPlaceType == SendGiftType_User) {
self.titleView.titleColor = [DJDKMIMOMColor secondTextColor];
self.titleView.titleSelectedColor = [DJDKMIMOMColor mainTextColor];
[self.packGiftButton setTitleColor:[DJDKMIMOMColor secondTextColor] forState:UIControlStateNormal];
@@ -160,7 +159,7 @@
}
-(XPGiftInfoView *)getListVC:(NSInteger)index{
if(self.usingplaceType == SendGiftType_User){
if(self.usingPlaceType == SendGiftType_User){
return [@[self.normalVC,self.weekStarVC,self.nobleVC] xpSafeObjectAtIndex:index];
}
if(self.roomType == RoomType_Anchor){
@@ -170,7 +169,7 @@
}
-(NSInteger)getIndex{
if(self.usingplaceType == SendGiftType_User){
if(self.usingPlaceType == SendGiftType_User){
if(self.segmentType == GiftSegmentType_Normal){
return 0;
}else if (self.segmentType == GiftSegmentType_WeekStar){
@@ -188,7 +187,7 @@
}
-(void)didClickGiftSegmentAction:(UIButton *)sender{
if (self.usingplaceType == SendGiftType_User) {
if (self.usingPlaceType == SendGiftType_User) {
[self.packGiftButton setTitleColor:[DJDKMIMOMColor mainTextColor] forState:UIControlStateNormal];
self.titleView.titleColor = [DJDKMIMOMColor secondTextColor];
self.titleView.titleSelectedColor = [DJDKMIMOMColor secondTextColor];
@@ -223,37 +222,76 @@
}
return numStr;
}
- (void)setTagsArray:(NSArray<GiftPanelTabModel *> *)tagsArray {
[self hideLoading];
_tagsArray = tagsArray;
NSMutableArray *tempTitles = @[].mutableCopy;
NSMutableArray *tempGifts = @[].mutableCopy;
for (GiftPanelTabModel *tab in tagsArray) {
// /
if (self.usingPlaceType == SendGiftType_User && ([tab.key isEqualToString:@"luckyBagGift"] || [tab.key isEqualToString:@"superLuckyGift"] || [tab.key isEqualToString:@"singlePopularGift"])) {
continue;
}
if (isMSRTL()) {
[tempTitles addObject:tab.nameMap.ar];
} else if (isMSEN()) {
[tempTitles addObject:tab.nameMap.en];
} else {
[tempTitles addObject:tab.nameMap.zh];
}
[tempGifts addObject:tab.gifts ? tab.gifts : @[]];
}
self.pi_titles = tempTitles.copy;
self.titleView.titles = self.pi_titles;
self.giftList = tempGifts;
[self.titleView reloadData];
// @kWeakify(self);
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// @kStrongify(self);
[self.pi_containerView reloadData];
// });
}
- (void)setNormalOriginArray:(NSArray *)normalOriginArray {
[self hideLoading];
_normalOriginArray = normalOriginArray;
NSMutableArray * normaleArray = [NSMutableArray array];
NSMutableArray * luckyArray = [NSMutableArray array];
NSMutableArray * weekStarArray = [NSMutableArray array];
NSMutableArray * nobleArray = [NSMutableArray array];
NSMutableArray * anchorArray = [NSMutableArray array];
[_normalOriginArray enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.giftType == GiftType_Lucky || obj.giftType == GiftType_super) {
[luckyArray addObject:obj];
} else if(obj.giftType == GiftType_Game) {
[normaleArray addObject:obj];
} else if (obj.giftType == GiftType_Noble) {
[nobleArray addObject:obj];
} else if (obj.giftType == GiftType_WeekStar) {
[weekStarArray addObject:obj];
}else if(obj.giftType == GiftType_Anchor){
[anchorArray addObject:obj];
}
}];
if (self.usingplaceType == SendGiftType_User) {
_giftList = [[NSMutableArray alloc]initWithArray:@[normaleArray, weekStarArray, nobleArray]];
}else{
_giftList = [[NSMutableArray alloc]initWithArray:@[normaleArray,luckyArray, weekStarArray, nobleArray, anchorArray]];
}
@kWeakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@kStrongify(self);
[self.pi_containerView reloadData];
});
// __block NSMutableArray * normalArray = [NSMutableArray array];
// __block NSMutableArray * luckyArray = [NSMutableArray array];
// __block NSMutableArray * weekStarArray = [NSMutableArray array];
// __block NSMutableArray * nobleArray = [NSMutableArray array];
// __block NSMutableArray * anchorArray = [NSMutableArray array];
// [self.normalOriginArray enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
// if (obj.giftType == GiftType_Lucky || obj.giftType == GiftType_super) {
// [luckyArray addObject:obj];
// } else if(obj.giftType == GiftType_Game) {
// [normalArray addObject:obj];
// } else if (obj.giftType == GiftType_Noble) {
// [nobleArray addObject:obj];
// } else if (obj.giftType == GiftType_WeekStar) {
// [weekStarArray addObject:obj];
// }else if(obj.giftType == GiftType_Anchor){
// [anchorArray addObject:obj];
// }
// }];
// if (self.usingPlaceType == SendGiftType_User) {
// _giftList = [[NSMutableArray alloc]initWithArray:@[normalArray, weekStarArray, nobleArray]];
// }else{
// _giftList = [[NSMutableArray alloc]initWithArray:@[normalArray, luckyArray, weekStarArray, nobleArray, anchorArray]];
// }
// @kWeakify(self);
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// @kStrongify(self);
// [self.pi_containerView reloadData];
// });
}
-(void)setPackOriginArray:(NSArray *)packOriginArray{
@@ -270,27 +308,27 @@
}
-(void)setRoomType:(RoomType)roomType{
_roomType = roomType;
if(_roomType == RoomType_Anchor){
self.pi_titles = @[YMLocalizedString(@"XPGiftInfoView2"),
YMLocalizedString(@"XPGiftInfoView3"),
YMLocalizedString(@"XPGiftInfoView4"),
YMLocalizedString(@"XPGiftInfoView9"),
YMLocalizedString(@"XPGiftInfoView8")];
self.titleView.titles = self.pi_titles;
[self.titleView reloadData];
}
// if(_roomType == RoomType_Anchor){
// self.pi_titles = @[YMLocalizedString(@"XPGiftInfoView2"),
// YMLocalizedString(@"XPGiftInfoView3"),
// YMLocalizedString(@"XPGiftInfoView4"),
// YMLocalizedString(@"XPGiftInfoView9"),
// YMLocalizedString(@"XPGiftInfoView8")];
//
// self.titleView.titles = self.pi_titles;
//
// [self.titleView reloadData];
// }
}
- (void)setUsingplaceType:(SendGiftType)usingplaceType {
_usingplaceType = usingplaceType;
self.packGiftView.usingplaceType = _usingplaceType;
if (_usingplaceType == SendGiftType_User) {
self.pi_titles = @[YMLocalizedString(@"XPGiftInfoView2"),
YMLocalizedString(@"XPGiftInfoView4"),
YMLocalizedString(@"XPGiftInfoView9")];
self.titleView.titles = self.pi_titles;
[self.titleView reloadData];
- (void)setUsingPlaceType:(SendGiftType)usingPlaceType {
_usingPlaceType = usingPlaceType;
self.packGiftView.usingPlaceType = _usingPlaceType;
if (_usingPlaceType == SendGiftType_User) {
// self.pi_titles = @[YMLocalizedString(@"XPGiftInfoView2"),
// YMLocalizedString(@"XPGiftInfoView4"),
// YMLocalizedString(@"XPGiftInfoView9")];
// self.titleView.titles = self.pi_titles;
// [self.titleView reloadData];
self.titleView.titleColor = [DJDKMIMOMColor secondTextColor];
self.titleView.titleSelectedColor = [DJDKMIMOMColor mainTextColor];
self.segmentBgView.hidden = NO;
@@ -321,7 +359,8 @@
}
- (NSArray<NSString *> *)pi_titles{
if(!_pi_titles){
_pi_titles = @[YMLocalizedString(@"XPGiftInfoView2"),YMLocalizedString(@"XPGiftInfoView3"),YMLocalizedString(@"XPGiftInfoView4"),YMLocalizedString(@"XPGiftInfoView9")];
// _pi_titles = @[YMLocalizedString(@"XPGiftInfoView2"),YMLocalizedString(@"XPGiftInfoView3"),YMLocalizedString(@"XPGiftInfoView4"),YMLocalizedString(@"XPGiftInfoView9")];
_pi_titles = @[];
}
return _pi_titles;
}

View File

@@ -37,7 +37,7 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
@interface XPGiftInfoView : UIView<JXCategoryListContentViewDelegate>
///使用的地方
@property (nonatomic,assign) SendGiftType usingplaceType;
@property (nonatomic,assign) SendGiftType usingPlaceType;
///普通礼物/幸运礼物/VIP礼物
@property (nonatomic,strong) NSArray *normalOriginArray;
///背包礼物

View File

@@ -189,7 +189,7 @@
if (self.segmentType == GiftSegmentType_WeekStar) {
XPGiftWeekStarCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftWeekStarCollectionViewCell class]) forIndexPath:indexPath];
cell.delegate = self;
cell.usingplaceType = self.usingplaceType;
cell.usingplaceType = self.usingPlaceType;
cell.weekStarGiftList = self.datasource;
return cell;
}
@@ -207,7 +207,7 @@
}
XPGiftItemCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftItemCollectionViewCell class]) forIndexPath:indexPath];
cell.usingplaceType = self.usingplaceType;
cell.usingplaceType = self.usingPlaceType;
cell.curUserNobleLevel = self.curUserNobleLevel;
cell.giftInfo = giftInfo;
return cell;

View File

@@ -120,7 +120,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
- (void)viewDidLoad {
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(getFreeGiftCountdownNotification:) name:kFreeGiftCountdownNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getFreeGiftCountdownNotification:) name:kFreeGiftCountdownNotification object:nil];
[self initSubViews];
[self initSubViewConstraints];
@@ -139,7 +139,6 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
[self.stackView addArrangedSubview:self.giftInfoView];
[self.stackView addArrangedSubview:self.giftBarView];
[self.stackView addArrangedSubview:self.bottomView];
}
-(void)getFreeGiftCountdownNotification:(NSNotification *)not{
NSDictionary *freeDic = not.userInfo;
@@ -174,7 +173,8 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
}
- (void)initHttpRequest {
[self.presenter getNormalGiftList:self.roomUid];
// [self.presenter getNormalGiftList:self.roomUid];
[self.presenter getTagsAndGifts:self.roomUid];
[self.presenter getUserInfo:[AccountInfoStorage instance].getUid];
[self.presenter getUserWallInfo];
@@ -325,7 +325,6 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
}
- (void)sendCustomMessage:(AttachmentModel *)attachment {
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];
@@ -404,6 +403,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
self.userView.hidden = NO;
}
}
#pragma mark - XPGiftBarViewDelegate
- (void)xPGiftBarView:(XPGiftBarView *)view didClickSendGift:(XPGiftCountModel *)giftCount {
///
@@ -460,7 +460,9 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
///
- (void)xPGiftBarViewDidClickRecharge:(XPGiftBarView *)view {
@kWeakify(self);
[self dismissViewControllerAnimated:NO completion:^{
@kStrongify(self);
XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init];
rechargeVC.type = @"4";
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:rechargeVC animated:YES];
@@ -497,7 +499,9 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
#pragma mark - XPGiftWeekStarBroadcastViewDelegate
///
- (void)xPGiftWeekStarBroadcastViewWeekStarClick {
@kWeakify(self);
[self dismissViewControllerAnimated:NO completion:^{
@kStrongify(self);
XPWebViewController * webVC = [[XPWebViewController alloc] init];
webVC.roomUid = self.roomUid;
webVC.url = URLWithType(kNewWeekStarURL);
@@ -508,7 +512,9 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
#pragma mark - XPGiftHeadTypeViewDelegate
///VIP
- (void)xPGiftHeadTypeViewDidClickNoble:(XPGiftHeadTypeView *)view {
@kWeakify(self);
[self dismissViewControllerAnimated:NO completion:^{
@kStrongify(self);
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventvipEntranceGiftClick];
XPNobleCenterViewController * nobleVC = [[XPNobleCenterViewController alloc] initWithRoomUid:self.delegate.getRoomInfo.uid];
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:nobleVC animated:YES];
@@ -516,7 +522,9 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
}
///
- (void)xPGiftHeadTypeViewDidClickFirstRecharge:(XPGiftHeadTypeView *)view {
@kWeakify(self);
[self dismissViewControllerAnimated:NO completion:^{
@kStrongify(self);
[[NSNotificationCenter defaultCenter]postNotificationName:kShowFirstRechargeView object:@{@"type":@"1",@"diamonds": self.giftBarView.walletInfoModel.diamonds ?: @"0"}];
}];
@@ -590,7 +598,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
if (!self.didLoadPackGiftList) {
self.didLoadPackGiftList = YES;
[self.giftInfoView showLoading];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
[self.presenter getPackGiftList];
});
}
@@ -634,7 +642,12 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
self.graffitiView.price = info.goldPrice;
self.giftBarView.drawGiftCount = 0;
self.graffitiView.selectUidNumber = [self.userView getSelectUserList].count;
[[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:info.giftUrl] options:SDWebImageProgressiveLoad progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
@kWeakify(self);
[[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:info.giftUrl]
options:SDWebImageProgressiveLoad
progress:nil
completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
@kStrongify(self);
if (error == nil && image) {
self.graffitiView.image = image;
} else {
@@ -726,8 +739,12 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
[self.giftInfoView hideLoading];
self.packGiftRetryCount ++;
if (self.packGiftRetryCount <= 10) {
@kWeakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.presenter getPackGiftList];
@kStrongify(self);
if (self) {
[self.presenter getPackGiftList];
}
});
}
}
@@ -737,11 +754,19 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
self.giftInfoView.normalOriginArray = giftList;
}
- (void)getTagsSuccess:(NSArray<GiftPanelTabModel*> *)tags {
self.giftInfoView.tagsArray = tags;
}
- (void)getNormalGiftListFail:(NSString *)message {
self.normalGiftRetryCount ++;
if (self.normalGiftRetryCount <= 10) {
@kWeakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.presenter getNormalGiftList:self.roomUid];
@kStrongify(self);
if (self) {
[self.presenter getTagsAndGifts:self.roomUid];
}
});
}
}
@@ -754,9 +779,13 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
} else {
self.giftBarView.walletInfoModel = receiveInfo.userPurse;
}
@kWeakify(self);
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC));
dispatch_after(delayTime, dispatch_get_main_queue(), ^{
[self sendCustomMessage:receiveInfo oringinDic:originDic];
@kStrongify(self);
if (self) {
[self sendCustomMessage:receiveInfo oringinDic:originDic];
}
});
///
@@ -800,7 +829,6 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
}
}
- (void)luckyGiftBroadcastRecordSuccess:(NSArray *)records {
self.records = records;
self.luckyBroadcastView.records = records;
@@ -819,7 +847,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
- (void)setUsingplaceType:(SendGiftType)usingplaceType {
_usingplaceType = usingplaceType;
self.giftBarView.usingplaceType = usingplaceType;
self.giftInfoView.usingplaceType = _usingplaceType;
self.giftInfoView.usingPlaceType = _usingplaceType;
self.headTypeView.hidden = _usingplaceType == SendGiftType_User;
self.userView.hidden = _usingplaceType == SendGiftType_User;
self.effectView.hidden = _usingplaceType == SendGiftType_User;

View File

@@ -73,6 +73,8 @@ NSString * const kMSGameLoaded = @"gameLoaded";
[super viewDidLoad];
[self installUI];
[self setupBackButton];
[self showLoading];
}
- (void)setupBackButton {
@@ -132,6 +134,7 @@ NSString * const kMSGameLoaded = @"gameLoaded";
}
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
[self hideHUD];
#if DEBUG
NSString *fileName = @"vconsole.min.js"; //
NSString *directory = [[NSBundle mainBundle] resourcePath];