feat: 完成 代充页面修改 | 开屏 & 首页banner 支持 svga

This commit is contained in:
edwinQQQ
2024-12-31 15:09:44 +08:00
parent 4abb686790
commit 81a0094dbf
39 changed files with 801 additions and 115 deletions

View File

@@ -513,6 +513,7 @@
4C815A172CFEB758002A46A6 /* SuperBlockViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C815A162CFEB758002A46A6 /* SuperBlockViewController.m */; };
4CC6195A2CEC7770008C1EE8 /* MyDressingDataPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC619592CEC7770008C1EE8 /* MyDressingDataPresent.m */; };
4CC6195D2CEC996E008C1EE8 /* MyDressingDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC6195C2CEC996E008C1EE8 /* MyDressingDataModel.m */; };
4CE3A9462D22754C003F0796 /* RechargeUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE3A9452D22754C003F0796 /* RechargeUserModel.m */; };
4CEB9EA72D09643E00443480 /* UserRoomCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EA62D09643E00443480 /* UserRoomCardViewController.m */; };
4CEB9EAA2D097E8400443480 /* MoliAvatar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EA92D097E8400443480 /* MoliAvatar.m */; };
4CEB9EAD2D09AA0400443480 /* SexAgeLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EAC2D09AA0400443480 /* SexAgeLabel.m */; };
@@ -2629,6 +2630,8 @@
4CC619592CEC7770008C1EE8 /* MyDressingDataPresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDressingDataPresent.m; sourceTree = "<group>"; };
4CC6195B2CEC996E008C1EE8 /* MyDressingDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyDressingDataModel.h; sourceTree = "<group>"; };
4CC6195C2CEC996E008C1EE8 /* MyDressingDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDressingDataModel.m; sourceTree = "<group>"; };
4CE3A9442D22754C003F0796 /* RechargeUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RechargeUserModel.h; sourceTree = "<group>"; };
4CE3A9452D22754C003F0796 /* RechargeUserModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RechargeUserModel.m; sourceTree = "<group>"; };
4CEB9EA52D09643E00443480 /* UserRoomCardViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserRoomCardViewController.h; sourceTree = "<group>"; };
4CEB9EA62D09643E00443480 /* UserRoomCardViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserRoomCardViewController.m; sourceTree = "<group>"; };
4CEB9EA82D097E8400443480 /* MoliAvatar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MoliAvatar.h; sourceTree = "<group>"; };
@@ -11089,6 +11092,8 @@
54C9A11E2C3DA08000C6D970 /* XPMineGamePartnerInfoModel.m */,
54CE5EF72CCA4A2600A67898 /* LocationModel.h */,
54CE5EF82CCA4A2600A67898 /* LocationModel.m */,
4CE3A9442D22754C003F0796 /* RechargeUserModel.h */,
4CE3A9452D22754C003F0796 /* RechargeUserModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -12200,6 +12205,7 @@
E8A3540A28FEC0510014A784 /* XPWishGiftListView.m in Sources */,
238B37BF2AC55A2C00BFC9D5 /* XPTreasureFairyStoreResultView.m in Sources */,
E88863CF278EC393004BCFAB /* XPAcrossRoomPKPrizeView.m in Sources */,
4CE3A9462D22754C003F0796 /* RechargeUserModel.m in Sources */,
239D0FFD2C05D086002977CE /* MSRoomGameQuitGameView.m in Sources */,
23E9EA8E2A84BC9000B792F2 /* XPMineUserInfoHeaderTagCell.m in Sources */,
E87DF5082A42CE79009C1185 /* XPInRoomRecordPresenter.m in Sources */,

View File

@@ -179,10 +179,12 @@ UIKIT_EXTERN NSString * adImageName;
}
if (isExist) {//
if ([kUserDefaults integerForKey:@"adShow"] > 4) {
if ([kUserDefaults integerForKey:@"adShow"] > 4 || [kUserDefaults integerForKey:@"adShow"] == 0) {
@kWeakify(self);
AdvertiseModel *info = [XPAdImageTool.shareImageTool getAdInfoFromCacheInMainWith:adName];
XPAdvertiseView *advertiseView = [[XPAdvertiseView alloc] initWithFrame:self.window.bounds];
advertiseView.type = info.type;
advertiseView.fileModel = info.fillVo;
advertiseView.filePath = filePath;
advertiseView.dismissHandler = ^(BOOL shouldJump) {
@kStrongify(self)
@@ -217,7 +219,10 @@ UIKIT_EXTERN NSString * adImageName;
}
}
break;
case SplashInfoSkipTypeWeb: {
case SplashInfoSkipTypeWeb:
case SplashInfoSkipTypeWeb_CP:
case SplashInfoSkipTypeWeb_Custom:
case SplashInfoSkipTypeWeb_WeekStar: {
// H5
if (info.link.length > 0) {
XPWebViewController *webView = [[XPWebViewController alloc] initWithRoomUID:nil];

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "切图 31@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "椭圆 6@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@@ -13,12 +13,30 @@ typedef NS_ENUM(NSInteger, SplashInfoSkipType) {
SplashInfoSkipTypePage = 1,
SplashInfoSkipTypeRoom = 2,
SplashInfoSkipTypeWeb = 3,
SplashInfoSkipTypeWeb_CP = 4,
SplashInfoSkipTypeWeb_WeekStar = 5,
SplashInfoSkipTypeWeb_Custom = 6,
};
@interface AdvertiseFillModel : PIBaseModel<NSCoding>
@property(nonatomic, copy) NSString *loverNick;
@property(nonatomic, copy) NSString *loverErbanNo;
@property(nonatomic, copy) NSString *loverAvatar;
@property(nonatomic, copy) NSString *nick;
@property(nonatomic, copy) NSString *erbanNo;
@property(nonatomic, copy) NSString *avatar;
@property(nonatomic, copy) NSString *picUrl;
@property(nonatomic, copy) NSString *giftName;
@property(nonatomic, copy) NSString *giftId;
@end
@interface AdvertiseModel : PIBaseModel<NSCopying>
@property (nonatomic, strong) NSString *link;
@property (nonatomic, assign) SplashInfoSkipType type;// 1跳app页面2跳聊天室3跳h5页面
@property (nonatomic, assign) SplashInfoSkipType type;// 1跳app页面2跳聊天室3跳h5页面,
@property (nonatomic, copy) NSString *pict;
@property(nonatomic, strong) AdvertiseFillModel *fillVo;
@end

View File

@@ -7,6 +7,17 @@
#import "AdvertiseModel.h"
@implementation AdvertiseModel
@implementation AdvertiseFillModel
@end
@implementation AdvertiseModel
+ (NSDictionary *)objectClassInArray {
return @{
@"fillVo": [AdvertiseFillModel class],
};
}
@end

View File

@@ -7,6 +7,7 @@
#import "XPAdImageTool.h"
#import <YYCache/YYCache.h>
#import "UploadFile.h"
#define CACHENAME @"XPUserCache"
@@ -100,20 +101,32 @@ static XPAdImageTool* tool;
*/
- (void)downloadAdImageWithUrl:(NSString *)imageUrl imageName:(NSString *)imageName {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSString *filePath = [self getFilePathWithImageName:imageName]; //
if ([imageUrl.lowercaseString hasSuffix:@"svga"]) {
@kWeakify(self);
[[UploadFile share] download:imageUrl path:filePath complete:^{
@kStrongify(self);
[self deleteOldImage];
[[NSUserDefaults standardUserDefaults] setValue:imageName forKey:adImageName];
[[NSUserDefaults standardUserDefaults] synchronize];
} failure:^{
@kStrongify(self);
[self deleteOldImage];
}];
} else {
NSString *encode = [imageUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:encode]];
UIImage *image = [UIImage imageWithData:data];
NSString *encode = [imageUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:encode]];
UIImage *image = [UIImage imageWithData:data];
NSString *filePath = [self getFilePathWithImageName:imageName]; //
if ([UIImagePNGRepresentation(image) writeToFile:filePath atomically:YES]) {//
[self deleteOldImage];
[[NSUserDefaults standardUserDefaults] setValue:imageName forKey:adImageName];
[[NSUserDefaults standardUserDefaults] synchronize];
}else{
[self deleteOldImage];
}
if ([UIImagePNGRepresentation(image) writeToFile:filePath atomically:YES]) {//
[self deleteOldImage];
[[NSUserDefaults standardUserDefaults] setValue:imageName forKey:adImageName];
[[NSUserDefaults standardUserDefaults] synchronize];
}else{
[self deleteOldImage];
}
}
});
}

View File

@@ -6,7 +6,7 @@
//
#import <UIKit/UIKit.h>
#import "AdvertiseModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPAdvertiseView : UIView
@@ -16,7 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
/** 图片路径*/
@property (nonatomic, copy) NSString *filePath;
@property(nonatomic, assign) SplashInfoSkipType type;
@property(nonatomic, strong) AdvertiseFillModel *fileModel;
@property (nonatomic, strong) UIImage *adImage;
@property (nonatomic, copy) void(^dismissHandler)(BOOL shouldJump); //闪屏消失回调

View File

@@ -8,6 +8,7 @@
#import "XPAdvertiseView.h"
#import "AppDelegate.h"
//tool
#import <SVGA.h>
#import <sys/sysctl.h>
#import <sys/utsname.h>
#import "YUMIMacroUitls.h"
@@ -18,7 +19,9 @@ NSString *const adUrl = @"adUrl";
// 广
static int const showtime = 3;
@interface XPAdvertiseView()
@interface XPAdvertiseView() <SVGAPlayerDelegate>
@property(nonatomic, strong) SVGAImageView *svgaView;
@property (nonatomic, strong) UIImageView *adView;//广
@@ -33,6 +36,8 @@ static int const showtime = 3;
@end
// TODO: svga SVGA
@implementation XPAdvertiseView
#pragma mark - Initialize Methods
@@ -94,6 +99,7 @@ static int const showtime = 3;
// GCD
- (void)gcdCoundownHander {
__block int timeout = showtime;
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(_timer, DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC, 0); //
@@ -170,8 +176,62 @@ static int const showtime = 3;
#pragma mark - Setter
- (void)setFilePath:(NSString *)filePath {
_filePath = filePath;
UIImage *image = [UIImage imageWithContentsOfFile:filePath];
_adView.image = [image cutImage:[UIScreen mainScreen].bounds.size];
if (self.type == SplashInfoSkipTypeWeb_CP || self.type == SplashInfoSkipTypeWeb_Custom || self.type == SplashInfoSkipTypeWeb_WeekStar) {
_svgaView = [[SVGAImageView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
_svgaView.delegate = self;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTapAdViewAction)];
[_svgaView addGestureRecognizer:tap];
[self addSubview:_svgaView];
SVGAParser *p = [[SVGAParser alloc] init];
@kWeakify(self);
[p parseWithURL:[[NSURL alloc] initFileURLWithPath:filePath] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@kStrongify(self);
if (videoItem) {
self.svgaView.autoPlay = YES;
self.svgaView.clearsAfterStop = YES;
self.svgaView.videoItem = videoItem;
if (self.fileModel) {
[self updateSvgaImage:self.fileModel.avatar key:@"avatar"];
[self updateSvgaImage:self.fileModel.picUrl key:@"gift"];
[self updateSvgaImage:self.fileModel.avatar key:@"avatar_1"];
[self updateSvgaImage:self.fileModel.loverAvatar key:@"avatar_2"];
[self updateSvgaText:[NSString stringWithFormat:@"ID: %@", self.fileModel.erbanNo] key:@"id"];
[self updateSvgaText:self.fileModel.giftName key:@"name"];
[self updateSvgaText:[NSString stringWithFormat:@"ID: %@", self.fileModel.erbanNo] key:@"id_1"];
[self updateSvgaText:[NSString stringWithFormat:@"ID: %@", self.fileModel.loverErbanNo] key:@"id_2"];
}
[self.svgaView startAnimation];
}
} failureBlock:^(NSError * _Nullable error) {
@kStrongify(self);
UIImage *image = [UIImage imageWithContentsOfFile:filePath];
self.adView.image = [image cutImage:[UIScreen mainScreen].bounds.size];
}];
} else {
UIImage *image = [UIImage imageWithContentsOfFile:filePath];
self.adView.image = [image cutImage:[UIScreen mainScreen].bounds.size];
}
}
- (void)updateSvgaImage:(NSString *)imagePath key:(NSString *)key {
if (self.svgaView && ![NSString isEmpty:imagePath] && ![NSString isEmpty:key]) {
[self.svgaView setImageWithURL:[NSURL URLWithString:imagePath] forKey:key];
}
}
- (void)updateSvgaText:(NSString *)content key:(NSString *)key {
if (self.svgaView && ![NSString isEmpty:content] && ![NSString isEmpty:key]) {
NSAttributedString *string = [[NSAttributedString alloc] initWithString:content
attributes:@{
NSFontAttributeName: kFontMedium(36),
NSForegroundColorAttributeName: UIColorFromRGB(0xF9F8CF)
}];
[self.svgaView setAttributedText:string
forKey:key];
}
}
- (void)setAdImage:(UIImage *)adImage {
@@ -180,6 +240,9 @@ static int const showtime = 3;
}
#pragma mark - SVGAPlayerDelegate
#pragma mark - Getter
- (UIWindow *)window {

View File

@@ -0,0 +1,29 @@
//
// RechargeUserModel.h
// YuMi
//
// Created by P on 2024/12/30.
//
#import "PIBaseModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface RechargeUserModel : PIBaseModel
@property(nonatomic, copy) NSString *avatar;
@property(nonatomic, copy) NSString *erbanNo;
@property(nonatomic, assign) NSInteger giveGold;
@property(nonatomic, copy) NSString *id;
@property(nonatomic, assign) BOOL isOnline;
@property(nonatomic, copy) NSString *nick;
@property(nonatomic, assign) NSInteger roomId;
@property(nonatomic, assign) NSInteger starLevel;
@property(nonatomic, assign) NSInteger type;
@property(nonatomic, assign) NSInteger uid;
+ (RechargeUserModel *)testModel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,19 @@
//
// RechargeUserModel.m
// YuMi
//
// Created by P on 2024/12/30.
//
#import "RechargeUserModel.h"
@implementation RechargeUserModel
+ (RechargeUserModel *)testModel {
RechargeUserModel *model = [[RechargeUserModel alloc] init];
model.starLevel = 3;
return model;
}
@end

View File

@@ -43,6 +43,9 @@ NS_ASSUME_NONNULL_BEGIN
/// @param giftId 礼物id
/// @param giftNum 礼物数量
+(void)giveGift:(HttpRequestHelperCompletion)completion toUid:(NSString *)toUid giftId:(NSString *)giftId giftNum:(NSString *)giftNum;
+(void)rechargeUserInfo:(HttpRequestHelperCompletion)completion;
@end
NS_ASSUME_NONNULL_END

View File

@@ -25,4 +25,7 @@
+(void)giveGift:(HttpRequestHelperCompletion)completion toUid:(NSString *)toUid giftId:(NSString *)giftId giftNum:(NSString *)giftNum{
[self makeRequest:@"user/diamond/giveGift" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, toUid,giftId,giftNum, nil];
}
+(void)rechargeUserInfo:(HttpRequestHelperCompletion)completion {
[self makeRequest:@"recharge/user/info" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil];
}
@end

View File

@@ -25,6 +25,9 @@ NS_ASSUME_NONNULL_BEGIN
-(void)getPackGiftList;
///转赠礼物
-(void)giveGiftWithToUid:(NSString *)toUid giftId:(NSString *)giftId giftNum:(NSString *)giftNum;
///充值代理信息
- (void)rechargeUserInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -15,7 +15,7 @@
#import "XPMineGiveDiamondDetailsModel.h"
#import "UserGiftWallInfoModel.h"
#import "GiftInfoModel.h"
#import "RechargeUserModel.h"
#import "XPMineGiveDiamondProtocol.h"
#import "XPHomeSearchProtocol.h"
@@ -72,18 +72,31 @@
-(void)getPackGiftList{
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
@kWeakify(self);
[Api requestPackGiftList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
NSArray * info = [GiftInfoModel modelsWithArray:data.data];
[[self getView] getPacketGiftListSuccess:info];
}fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
[[self getView] getPacketGiftListFail:msg];
}] uid:uid ticket:ticket];
}
-(void)giveGiftWithToUid:(NSString *)toUid giftId:(NSString *)giftId giftNum:(NSString *)giftNum{
@kWeakify(self);
[Api giveGift:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
[[self getView] giveGiftSuccess];
}] toUid:toUid giftId:giftId giftNum:giftNum];
}
- (void)rechargeUserInfo {
[Api rechargeUserInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] loadRechargeUserSuccess:[RechargeUserModel modelWithJSON:data.data]];
} fail:^(NSInteger code, NSString * _Nullable msg) {
} showLoading:YES errorToast:YES]];
}
@end

View File

@@ -6,7 +6,7 @@
//
#import <Foundation/Foundation.h>
@class WalletInfoModel,XPMineGiveDiamondSearchModel,XPMineGiveDiamondDetailsModel,GiftInfoModel;
@class WalletInfoModel,XPMineGiveDiamondSearchModel,XPMineGiveDiamondDetailsModel,GiftInfoModel, RechargeUserModel;
NS_ASSUME_NONNULL_BEGIN
@protocol XPMineGiveDiamondProtocol <NSObject>
@@ -37,6 +37,9 @@ NS_ASSUME_NONNULL_BEGIN
- (void)getPacketGiftListFail:(NSString *)message;
///转赠礼物
-(void)giveGiftSuccess;
- (void)loadRechargeUserSuccess:(RechargeUserModel *)userModel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -76,8 +76,6 @@
[self.typeStackView addArrangedSubview:self.diamondBtn];
[self.typeStackView addArrangedSubview:self.giftBtn];
[self addSubview:self.numIcon];
[self addSubview:self.diamondNumView];
[self addSubview:self.lineView];
@@ -85,9 +83,7 @@
[self addSubview:self.myDiamondNumView];
[self addSubview:self.confirmBtn];
[self addSubview:self.giveGiftView];
}
- (void)initSubViewConstraints {
[self.headView mas_makeConstraints:^(MASConstraintMaker *make) {

View File

@@ -24,6 +24,8 @@
#import "XPHomeSearchProtocol.h"
#import "DJDKMIMOMColor.h"
#import "RechargeUserModel.h"
@interface XPMineGiveDiamondVC ()<XPMineChooseGiveDiamondVCDelegate,UITableViewDelegate,UITableViewDataSource,XPMineGiveDiamondProtocol>
@property (nonatomic,strong) UITableView *tableView;
@@ -35,12 +37,17 @@
@property(nonatomic, strong) UILabel *idLabel;
@property(nonatomic, strong) UIStackView *starsStack;
@property(nonatomic, strong) UIButton *helpButton;
@property(nonatomic, strong) UIButton *star_1;
@property(nonatomic, strong) UIButton *star_2;
@property(nonatomic, strong) UIButton *star_3;
@property(nonatomic, strong) UIButton *star_4;
@property(nonatomic, strong) UIButton *star_5;
///
@property (nonatomic,strong) XPMineGiveDiamondSearchView *searchView;
///
@property (nonatomic,strong) NSMutableArray *datasource;
@property (nonatomic,strong) UIView *headView;
//@property (nonatomic,strong) UIView *headView;
///id
@property (nonatomic,copy) NSString *text;
///tag
@@ -56,25 +63,95 @@
[self initSubViews];
[self initSubViewConstraints];
[self.presenter getGiveDiamondRecord];
[self.presenter rechargeUserInfo];
}
- (void)initSubViews {
self.view.backgroundColor = [UIColor whiteColor];
self.title = YMLocalizedString(@"XPMineGiveDiamondVC0");
[self.view addSubview: self.infoContainer];
[self.view addSubview:self.searchView];
[self.view addSubview:self.tableView];
[self.view addSubview:self.tagView];
[self.infoContainer addSubview:self.avatarImageView];
[self.infoContainer addSubview:self.nameLabel];
[self.infoContainer addSubview:self.icon1ImageView];
[self.infoContainer addSubview:self.icon2ImageView];
[self.infoContainer addSubview:self.idLabel];
[self.infoContainer addSubview:self.starsStack];
[self.infoContainer addSubview:self.helpButton];
}
- (void)initSubViewConstraints {
[self.infoContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view);
make.leading.trailing.equalTo(self.view).inset(15);
make.height.mas_equalTo(kGetScaleWidth(81));
}];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.infoContainer);
make.leading.mas_equalTo(self.infoContainer).offset(12);
make.width.height.mas_equalTo(kGetScaleWidth(59));
}];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(10);
make.top.mas_equalTo(self.avatarImageView);
make.height.mas_equalTo(22);
}];
[self.icon1ImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.nameLabel);
make.leading.mas_equalTo(self.nameLabel.mas_trailing).offset(4);
make.size.mas_equalTo(CGSizeMake(38, 18));
}];
[self.icon2ImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.nameLabel);
make.leading.mas_equalTo(self.icon1ImageView.mas_trailing).offset(4);
make.size.mas_equalTo(CGSizeMake(38, 18));
}];
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(10);
make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(4);
make.height.mas_equalTo(18);
}];
[self.starsStack mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(10);
make.top.mas_equalTo(self.idLabel.mas_bottom).offset(4);
make.height.mas_equalTo(15);
}];
[self.star_1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(15, 15));
}];
[self.star_2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(15, 15));
}];
[self.star_3 mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(15, 15));
}];
[self.star_4 mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(15, 15));
}];
[self.star_5 mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(15, 15));
}];
[self.helpButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.starsStack);
make.leading.mas_equalTo(self.starsStack.mas_trailing).offset(8);
make.size.mas_equalTo(CGSizeMake(22, 22));
}];
[self.searchView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.leading.trailing.equalTo(self.view);
make.height.mas_equalTo(kGetScaleWidth(32));
make.top.equalTo(self.infoContainer.mas_bottom).offset(14);
make.leading.trailing.equalTo(self.view);
make.height.mas_equalTo(kGetScaleWidth(32));
}];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.mas_equalTo(self.view);
make.bottom.mas_equalTo(-kGetScaleWidth(148));
make.top.mas_equalTo(kGetScaleWidth(32));
make.top.mas_equalTo(self.searchView.mas_bottom).offset(14);
}];
[self.tagView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(kGetScaleWidth(14));
@@ -82,6 +159,15 @@
make.bottom.mas_equalTo(-kGetScaleWidth(73));
}];
}
- (void)didTapHelp {
TTAlertConfig *config = [[TTAlertConfig alloc]init];
config.title = YMLocalizedString(@"1.0.33_text_16");
config.message = YMLocalizedString(@"1.0.33_text_17");
config.actionStyle = TTAlertActionConfirmStyle;
[TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{} cancelHandler:^{}];
}
#pragma mark -XPMineChooseGiveDiamondVCDelegate
- (void)xpMineChooseGiveDiamondVCCompleteWithModel:(XPMineGiveDiamondModel *)model{
if(model != nil){
@@ -101,16 +187,17 @@
[self.tableView reloadData];
}
}
#pragma mark - UITableViewDelegate
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return self.datasource.count > 0 ? kGetScaleWidth(70) : self.tableView.frame.size.height;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.datasource.count > 0 ? self.datasource.count : 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if(self.datasource.count > 0){
XPMineGiveDiamondCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineGiveDiamondCell class]) forIndexPath:indexPath];
@@ -131,13 +218,14 @@
vc.toUid = model.targetUid;
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - XPMineGiveDiamondProtocol
-(void)getGiveDiamondListSuccess:(NSArray *)array{
self.datasource = [NSMutableArray arrayWithArray:array];
[self.tableView reloadData];
}
#pragma mark - XPHomeSearchProtocol
#pragma mark - XPHomeSearchProtocol
-(void)searchGivePeopleWihtModel:(XPMineGiveDiamondSearchModel *)model{
[self hideHUD];
if(model != nil){
@@ -154,7 +242,6 @@
}
}
-(void)searchEndWithText:(NSString *)text{
if(text.length == 0){
[self showErrorToast:YMLocalizedString(@"XPMineGiveDiamondSearchView1")];
@@ -164,6 +251,35 @@
[self showLoading];
[self.presenter searchGivePeopleWith:text];
}
- (void)loadRechargeUserSuccess:(RechargeUserModel *)userModel {
if (!userModel) {
return;
}
self.avatarImageView.imageUrl = userModel.avatar;
self.nameLabel.text = userModel.nick;
self.icon1ImageView.imageUrl = self.userInfo.userLevelVo.charmUrl;
self.icon2ImageView.imageUrl = self.userInfo.userLevelVo.experUrl;
self.idLabel.text = [NSString stringWithFormat:@"ID: %@", userModel.erbanNo];
if (userModel.starLevel > 0) {
[self.star_1 setSelected:YES];
}
if (userModel.starLevel > 1) {
[self.star_2 setSelected:YES];
}
if (userModel.starLevel > 2) {
[self.star_3 setSelected:YES];
}
if (userModel.starLevel > 3) {
[self.star_4 setSelected:YES];
}
if (userModel.starLevel > 4) {
[self.star_5 setSelected:YES];
}
}
#pragma mark - Getters And Setters
- (UITableView *)tableView {
if (!_tableView) {
@@ -173,7 +289,7 @@
_tableView.showsVerticalScrollIndicator = NO;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor = [UIColor clearColor];
_tableView.tableHeaderView = self.headView;
// _tableView.tableHeaderView = self.headView;
[_tableView registerClass:[XPMineGiveDiamondCell class] forCellReuseIdentifier:NSStringFromClass([XPMineGiveDiamondCell class])];
[_tableView registerClass:[XPMineFriendEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineFriendEmptyTableViewCell class])];
}
@@ -186,17 +302,17 @@
}
return _searchView;
}
-(UIView *)headView{
if (!_headView){
_headView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, kGetScaleWidth(64))];
UILabel *titleView = [[UILabel alloc]initWithFrame:CGRectMake(kGetScaleWidth(15), kGetScaleWidth(25), KScreenWidth - kGetScaleWidth(30), kGetScaleWidth(19))];
titleView.text = YMLocalizedString(@"XPMineGiveDiamondVC1");
titleView.font = [UIFont systemFontOfSize:kGetScaleWidth(16) weight:UIFontWeightMedium];
titleView.textColor = [DJDKMIMOMColor mainTextColor];
[_headView addSubview:titleView];
}
return _headView;
}
//-(UIView *)headView{
// if (!_headView){
// _headView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, kGetScaleWidth(64))];
// UILabel *titleView = [[UILabel alloc]initWithFrame:CGRectMake(kGetScaleWidth(15), kGetScaleWidth(25), KScreenWidth - kGetScaleWidth(30), kGetScaleWidth(19))];
// titleView.text = YMLocalizedString(@"XPMineGiveDiamondVC1");
// titleView.font = [UIFont systemFontOfSize:kGetScaleWidth(16) weight:UIFontWeightMedium];
// titleView.textColor = [DJDKMIMOMColor mainTextColor];
// [_headView addSubview:titleView];
// }
// return _headView;
//}
-(UILabel *)tagView{
if (!_tagView){
_tagView = [UILabel new];
@@ -210,6 +326,7 @@
- (UIView *)infoContainer {
if (!_infoContainer) {
_infoContainer = [[UIView alloc] init];
_infoContainer.backgroundColor = UIColorFromRGB(0xf7f7f7);
[_infoContainer setCornerRadius:10];
}
return _infoContainer;
@@ -219,6 +336,7 @@
if (!_avatarImageView) {
_avatarImageView = [[NetImageView alloc] init];
_avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
[_avatarImageView setCornerRadius:kGetScaleWidth(59/2)];
}
return _avatarImageView;
}
@@ -253,9 +371,66 @@
return _icon2ImageView;
}
- (UIStackView *)starsStack {
if (!_starsStack) {
_starsStack = [[UIStackView alloc] initWithArrangedSubviews:@[
self.star_1,
self.star_2,
self.star_3,
self.star_4,
self.star_5,
]];
_starsStack.spacing = 4;
}
return _starsStack;
}
- (UIButton *)star_1 {
if (!_star_1) {
_star_1 = [UIButton buttonWithType:UIButtonTypeCustom];
[_star_1 setBackgroundImage:kImage(@"star_white") forState:UIControlStateNormal];
[_star_1 setBackgroundImage:kImage(@"star_yellow") forState:UIControlStateSelected];
}
return _star_1;
}
- (UIButton *)star_2 {
if (!_star_2) {
_star_2 = [UIButton buttonWithType:UIButtonTypeCustom];
[_star_2 setBackgroundImage:kImage(@"star_white") forState:UIControlStateNormal];
[_star_2 setBackgroundImage:kImage(@"star_yellow") forState:UIControlStateSelected];
}
return _star_2;
}
- (UIButton *)star_3 {
if (!_star_3) {
_star_3 = [UIButton buttonWithType:UIButtonTypeCustom];
[_star_3 setBackgroundImage:kImage(@"star_white") forState:UIControlStateNormal];
[_star_3 setBackgroundImage:kImage(@"star_yellow") forState:UIControlStateSelected];
}
return _star_3;
}
- (UIButton *)star_4 {
if (!_star_4) {
_star_4 = [UIButton buttonWithType:UIButtonTypeCustom];
[_star_4 setBackgroundImage:kImage(@"star_white") forState:UIControlStateNormal];
[_star_4 setBackgroundImage:kImage(@"star_yellow") forState:UIControlStateSelected];
}
return _star_4;
}
- (UIButton *)star_5 {
if (!_star_5) {
_star_5 = [UIButton buttonWithType:UIButtonTypeCustom];
[_star_5 setBackgroundImage:kImage(@"star_white") forState:UIControlStateNormal];
[_star_5 setBackgroundImage:kImage(@"star_yellow") forState:UIControlStateSelected];
}
return _star_5;
}
- (UIButton *)helpButton {
if (!_helpButton) {
_helpButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_helpButton setBackgroundImage:kImage(@"diamond_help") forState:UIControlStateNormal];
[_helpButton addTarget:self action:@selector(didTapHelp) forControlEvents:UIControlEventTouchUpInside];
}
return _helpButton;
}

View File

@@ -587,9 +587,6 @@ UIKIT_EXTERN NSString *kRequestTicket;
[self.functionArray removeAllObjects];
[self.functionArray addObjectsFromArray:items];
#if DEBUG
self.isHavePermission = YES;
#endif
for (XPMineFunctionItemModel * _Nonnull obj in self.functionArray) {
if(obj.skipType == XPMineItemType_My_Gift && self.isHavePermission == NO){
[self.functionArray removeObject:obj];

View File

@@ -16,10 +16,29 @@ typedef NS_ENUM(NSUInteger, HomeBannerInfoSkipType) {
HomeBannerInfoSkipType_Room = 2,
/// 跳转h5
HomeBannerInfoSkipType_Web = 3,
/// SVGA
HomeBannerInfoSkipType_Web_CP = 4,
/// WeekStar
HomeBannerInfoSkipType_Web_WeekStar = 5,
HomeBannerInfoSkipType_Web_Custom = 6,
/// 無跳轉
HomeBannerInfoSkipType_None = 100,
};
@interface HomeBannerFillVoInfoModel : PIBaseModel
@property(nonatomic, copy) NSString *loverNick;
@property(nonatomic, copy) NSString *loverErbanNo;
@property(nonatomic, copy) NSString *loverAvatar;
@property(nonatomic, copy) NSString *nick;
@property(nonatomic, copy) NSString *erbanNo;
@property(nonatomic, copy) NSString *avatar;
@property(nonatomic, copy) NSString *picUrl;
@property(nonatomic, copy) NSString *giftName;
@property(nonatomic, copy) NSString *giftId;
@end
@interface HomeBannerInfoModel : PIBaseModel
///ID
@property (nonatomic,copy)NSString *bannerId;
@@ -31,6 +50,9 @@ typedef NS_ENUM(NSUInteger, HomeBannerInfoSkipType) {
@property (nonatomic, copy)NSString *skipUri;
///跳转的类型
@property (nonatomic, assign)HomeBannerInfoSkipType skipType;
@property(nonatomic, strong) HomeBannerFillVoInfoModel *fillVo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -7,6 +7,14 @@
#import "HomeBannerInfoModel.h"
@implementation HomeBannerInfoModel
@implementation HomeBannerFillVoInfoModel
@end
@implementation HomeBannerInfoModel
+ (NSDictionary *)objectClassInArray {
return @{
@"fillVo": [HomeBannerFillVoInfoModel class],
};
}
@end

View File

@@ -9,6 +9,114 @@
#import <SDCycleScrollView/SDCycleScrollView.h>
#import "XPNewHomeItemCell.h"
#import "PIPageControl.h"
#import <SVGA.h>
@interface HomeBannerCell : UICollectionViewCell
@property(nonatomic, assign) HomeBannerInfoSkipType type;
@property(nonatomic, strong) HomeBannerFillVoInfoModel *cellFillVoMode;
@property(nonatomic, strong) NSString *imageURLString;
@property(nonatomic, strong) NetImageView *imageView;
@property(nonatomic, strong) SVGAImageView *svgaImageView;
@property(nonatomic, strong) SVGAVideoEntity *videoItem;
@end
@implementation HomeBannerCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
_imageView = [[NetImageView alloc] init];
[self.contentView addSubview:self.imageView];
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.contentView);
}];
_svgaImageView = [[SVGAImageView alloc] init];
self.svgaImageView.loops = -1;
self.svgaImageView.autoPlay = YES;
self.svgaImageView.clearsAfterStop = NO;
[self.contentView addSubview:self.svgaImageView];
[self.svgaImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.contentView);
}];
}
return self;
}
- (void)prepareForReuse {
[super prepareForReuse];
}
- (void)setImageURLString:(NSString *)imageURLString {
if (self.type == HomeBannerInfoSkipType_Web_CP ||
self.type == HomeBannerInfoSkipType_Web_Custom ||
self.type == HomeBannerInfoSkipType_Web_WeekStar) {
self.imageView.hidden = YES;
if (self.videoItem) {
[self playSVGAWith:self.videoItem];
} else {
SVGAParser *p = [[SVGAParser alloc] init];
@kWeakify(self);
[p parseWithURL:[NSURL URLWithString:imageURLString] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@kStrongify(self);
if (videoItem) {
self.videoItem = videoItem;
[self playSVGAWith:videoItem];
}
} failureBlock:^(NSError * _Nullable error) {
@kStrongify(self);
self.imageView.hidden = NO;
self.imageView.imageUrl = imageURLString;
}];
}
} else {
self.imageView.hidden = NO;
self.imageView.imageUrl = imageURLString;
}
}
- (void)playSVGAWith:(SVGAVideoEntity *)videoItem {
self.svgaImageView.videoItem = videoItem;
if (self.cellFillVoMode) {
[self updateSvgaImage:self.cellFillVoMode.avatar key:@"avatar"];
[self updateSvgaImage:self.cellFillVoMode.picUrl key:@"gift"];
[self updateSvgaImage:self.cellFillVoMode.avatar key:@"avatar_1"];
[self updateSvgaImage:self.cellFillVoMode.loverAvatar key:@"avatar_2"];
[self updateSvgaText:[NSString stringWithFormat:@"ID: %@", self.cellFillVoMode.erbanNo] key:@"id"];
[self updateSvgaText:self.cellFillVoMode.giftName key:@"name"];
[self updateSvgaText:[NSString stringWithFormat:@"ID: %@", self.cellFillVoMode.erbanNo] key:@"id_1"];
[self updateSvgaText:[NSString stringWithFormat:@"ID: %@", self.cellFillVoMode.loverErbanNo] key:@"id_2"];
}
[self.svgaImageView startAnimation];
}
- (void)updateSvgaImage:(NSString *)imagePath key:(NSString *)key {
if (self.svgaImageView && ![NSString isEmpty:imagePath] && ![NSString isEmpty:key]) {
[self.svgaImageView setImageWithURL:[NSURL URLWithString:imagePath] forKey:key];
}
}
- (void)updateSvgaText:(NSString *)content key:(NSString *)key {
if (self.svgaImageView && ![NSString isEmpty:content] && ![NSString isEmpty:key]) {
NSAttributedString *string = [[NSAttributedString alloc] initWithString:content
attributes:@{
NSFontAttributeName: kFontMedium(30),
NSForegroundColorAttributeName: UIColorFromRGB(0xF9F8CF)
}];
[self.svgaImageView setAttributedText:string
forKey:key];
}
}
@end
@interface XPNewHomeHeadView ()<SDCycleScrollViewDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
@property(nonatomic,strong) UICollectionView *collectionView;
///
@@ -44,6 +152,19 @@
}];
}
#pragma mark - SDCycleScrollViewDelegate
- (Class)customCollectionViewCellClassForCycleScrollView:(SDCycleScrollView *)view {
return [HomeBannerCell class];
}
- (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view {
HomeBannerCell *bannerCell = (HomeBannerCell *)cell;
HomeBannerInfoModel * bannerInfo = [self.bannerList xpSafeObjectAtIndex:index];
bannerCell.type = bannerInfo.skipType;
bannerCell.cellFillVoMode = bannerInfo.fillVo;
bannerCell.imageURLString = bannerInfo.bannerPic;
}
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
HomeBannerInfoModel * bannerInfo = [self.bannerList xpSafeObjectAtIndex:index];
if(bannerInfo != nil && self.delegate && [self.delegate respondsToSelector:@selector(selectBannerListWithModel:)]){

View File

@@ -790,7 +790,11 @@ XPHomeRecommendViewControllerDelegate>
}
}
break;
case HomeBannerInfoSkipType_Web:{
case HomeBannerInfoSkipType_Web:
case HomeBannerInfoSkipType_Web_CP:
case HomeBannerInfoSkipType_Web_Custom:
case HomeBannerInfoSkipType_Web_WeekStar:
{
XPWebViewController *vc = [[XPWebViewController alloc] initWithRoomUID:nil];
vc.url = model.skipUri;
[self.navigationController pushViewController:vc animated:YES];

View File

@@ -27,13 +27,13 @@
#import "XPRoomAnimationView.h"
#import "XPWebViewController.h"
#import "XPRoomViewController.h"
#import "PIRoomActivityWebView.h"
#import "BoomInfoViewController.h"
#import "XPSailingViewController.h"
#import "XCCurrentVCStackManager.h"
#import "XPCandyTreeViewController.h"
#import "XPFirstRechargeSuccessView.h"
#import "XPArrangeMicViewController.h"
#import "PIRoomActivityWebView.h"
#import "XPTreasureFairyViewController.h"
UIKIT_EXTERN NSString *kShowFirstRechargeView;
@@ -51,6 +51,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
@property (nonatomic,strong) UIImageView *joinView;
@property(nonatomic,strong) PIRoomEnterRedPacketView *redPacketView;
@property(nonatomic, strong) UIView *scrollContain;
@property(nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic,strong) SDCycleScrollView *cycleScrollView;
@property (nonatomic, weak) id<RoomHostDelegate> hostDelegate;
@@ -69,8 +70,6 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
@end
// TODO:
@implementation RoomSideMenu
- (void)dealloc {
@@ -92,8 +91,11 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
#pragma mark - Setup
- (void)setupViews {
self.scrollContain = [[UIView alloc] init];
self.scrollContain.backgroundColor = [UIColor purpleColor];
[self addSubview:self.cycleScrollView];
[self addSubview:self.scrollView];
[self.scrollView addSubview:self.scrollContain];
[self addSubview:self.expandButton];
[self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -130,7 +132,13 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
}
- (void)updateMenuItem:(UIView *)itemView isRemove:(BOOL)isRemove {
if (itemView.tag == 0) {
return;
}
if (isRemove) {
if (itemView.superview == nil) {
return;
}
if ([self.menuItemViews containsObject:itemView]) {
[self.menuItemViews removeObject:itemView];
}
@@ -151,7 +159,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
}
}];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.menuItemViewsSubject sendNext:self.menuItemViews];
});
}
@@ -200,29 +208,53 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
}
- (void)updateScrollView:(NSArray *)data {
// scrollView subviews
[self.scrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
if (data.count == 0) {
return;
}
// contentSize
CGFloat inset = 15;
CGFloat width = self.scrollView.bounds.size.width - 30;
self.scrollView.contentSize = CGSizeMake(self.scrollView.bounds.size.width,
MAX(self.scrollView.bounds.size.height, width * data.count));
CGFloat spacing = 4;
CGSize size = CGSizeMake(self.scrollView.bounds.size.width-30, self.scrollView.bounds.size.width-30);
// subviews
CGFloat yOffset = self.scrollView.contentSize.height; //
// NSLog(@"--------------- blkaa 1 blkaa: %@", [NSValue valueWithCGRect:self.scrollView.frame]);
CGFloat totalHeight = size.height * data.count + spacing * data.count;
if (totalHeight > self.scrollView.bounds.size.height) {
[self.scrollView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.cycleScrollView.mas_bottom);
make.bottom.leading.trailing.mas_equalTo(self);
}];
} else {
[self.scrollView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.bottom.leading.trailing.mas_equalTo(self);
make.height.mas_equalTo(totalHeight);
}];
}
[self layoutIfNeeded];
// NSLog(@"--------------- blkaa 2 blkaa: %@", [NSValue valueWithCGRect:self.scrollView.frame]);
self.scrollView.contentSize = CGSizeMake(self.scrollView.bounds.size.width, totalHeight);
UIView *lastItemView = nil;
CGFloat yOffset = totalHeight; //
for (UIView *view in data) {
yOffset -= size.height;
[self.scrollView addSubview:view];
yOffset -= width;
view.frame = CGRectMake(inset, yOffset, width, width);
[view layoutIfNeeded];
}
//
if (self.scrollView.contentSize.height > self.scrollView.bounds.size.height) {
[self.scrollView setContentOffset:CGPointMake(0, self.scrollView.contentSize.height - self.scrollView.bounds.size.height)
animated:NO];
view.frame = CGRectMake(inset, yOffset, size.width, size.height);
yOffset -= spacing;
lastItemView = view;
// NSLog(@"--------------- blkaa %@ blkaa: %@", @(view.tag), [NSValue valueWithCGRect:view.frame]);
}
dispatch_async(dispatch_get_main_queue(), ^{
CGFloat bottomOffset = self.scrollView.contentSize.height - self.scrollView.bounds.size.height;
if (bottomOffset > 0) {
[self.scrollView setContentOffset:CGPointMake(0, bottomOffset) animated:YES];
}
});
}
- (void)configLittleGameActivity {
@@ -401,6 +433,9 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
if(self.openRedPacketHandle){
self.openRedPacketHandle(nil,self.hostDelegate.getRoomInfo.type,YES);
}
if (self.redPacketList.count > 0) {
[self updateMenuItem:self.redPacketView isRemove:NO];
}
}
#pragma mark - User Response
@@ -509,7 +544,10 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
- (void)onRoomUpdate {
RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo;
[self.menuItemViews removeAllObjects];
[self.menuItemViewsSubject sendNext:self.menuItemViews];
switch (roomInfo.type) {
case RoomType_MiniGame:
[self displayForMiniGame];
@@ -517,12 +555,10 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
break;
case RoomType_19Mic:
case RoomType_20Mic: {
[self.menuItemViews removeAllObjects];
[self.menuItemViewsSubject sendNext:self.menuItemViews];
[self displayExpandButton:YES];
[self dealWithData];
if (self.isExpand) {
[self loadPKView:roomInfo];
[self loadJoinView:roomInfo];
@@ -537,6 +573,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
[self displayExpandButton:NO];
[self dealWithData];
[self loadPKView:roomInfo];
[self loadJoinView:roomInfo];
[self loadRedPacket:roomInfo];
@@ -555,15 +592,22 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
}
- (void)loadRedPacket:(RoomInfoModel *)roomInfo {
self.redPacketView.type = roomInfo.type;
self.redPacketView.redPacketList = self.redPacketList;
[self updateMenuItem:self.redPacketView isRemove:NO];
if (self.redPacketList.count > 0) {
self.redPacketView.type = roomInfo.type;
self.redPacketView.redPacketList = self.redPacketList;
[self updateMenuItem:self.redPacketView isRemove:NO];
}
}
- (void)loadPKView:(RoomInfoModel *)roomInfo {
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode &&
(roomInfo.type == RoomType_Anchor || roomInfo.roomModeType == RoomModeType_Open_Blind)) {
[self updateMenuItem:self.pkMenuButton isRemove:NO];
if (roomInfo.type == RoomType_Anchor || roomInfo.roomModeType == RoomModeType_Open_Blind) {
[self updateMenuItem:self.pkMenuButton isRemove:YES];
} else {
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
[self updateMenuItem:self.pkMenuButton isRemove:NO];
} else {
[self updateMenuItem:self.pkMenuButton isRemove:YES];
}
}
}
@@ -861,6 +905,7 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
if(!_redPacketView){
_redPacketView = [[PIRoomEnterRedPacketView alloc]initWithFrame:CGRectZero];
_redPacketView.hidden = YES;
_redPacketView.tag = 106;
_redPacketView.delegate = self;
}
return _redPacketView;

View File

@@ -19,7 +19,7 @@ static const CGFloat kBannerHeight = 82.5f;
static const CGFloat kBannerTopMargin = 80.0f;
static const CGFloat kAvatarSize = 43.0f;
static const CGFloat kAnimationDuration = 0.25f;
static const CGFloat kDisplayDuration = 2.5f;
static const CGFloat kDisplayDuration = 2.0f;
static const CGFloat kRoomTransitionDelay = 2.0f;
@interface LuckyGiftWinningBannerViewModel : PIBaseModel
@@ -56,6 +56,7 @@ static const CGFloat kRoomTransitionDelay = 2.0f;
@property (nonatomic, strong) LuckyGiftWinningBannerViewModel *model;
@property (nonatomic, strong) UIImageView *backgroundImageView;
@property (nonatomic, strong) UIImageView *ballImageView;
@property (nonatomic, strong) UIImageView *bigBallImageView;
@property (nonatomic, strong) NetImageView *avatarImageView;
@property (nonatomic, strong) UILabel *giftNameLabel;
@property (nonatomic, strong) UILabel *timesLabel;
@@ -135,7 +136,14 @@ exitCurrentRoom:(void(^)(void))exit {
self.avatarImageView.imageUrl = model.avatar;
self.giftNameLabel.text = [model giftName];
self.timesLabel.text = model.times;
self.coinsLabel.text = [NSString formatNumberToKOrM:model.coins];
self.coinsLabel.text = model.coins;
if (self.coinsLabel.text.integerValue > 9999) {
self.bigBallImageView.hidden = NO;
} else {
self.ballImageView.hidden = NO;
}
}
- (instancetype)initWithFrame:(CGRect)frame {
@@ -176,6 +184,12 @@ exitCurrentRoom:(void(^)(void))exit {
make.edges.mas_equalTo(self);
}];
[self addSubview:self.bigBallImageView];
[self.bigBallImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.trailing.mas_equalTo(self);
make.width.height.mas_equalTo(kGetScaleWidth(91));
}];
[self addSubview:self.ballImageView];
[self.ballImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.bottom.top.mas_equalTo(self);
@@ -227,7 +241,7 @@ exitCurrentRoom:(void(^)(void))exit {
make.centerX.mas_equalTo(self.ballImageView);
make.top.mas_equalTo(self).offset(kGetScaleWidth(18));
make.height.mas_equalTo(kGetScaleWidth(28));
make.width.mas_equalTo(self.ballImageView);
make.width.mas_lessThanOrEqualTo(self.bigBallImageView).multipliedBy(0.8);
}];
UILabel *titleLabel_4 = [UILabel labelInitWithText:YMLocalizedString(@"Combo_5") font:kFontSemibold(14) textColor:[UIColor whiteColor]];
@@ -251,10 +265,20 @@ exitCurrentRoom:(void(^)(void))exit {
if (!_ballImageView) {
_ballImageView = [[UIImageView alloc] initWithImage:kImage(@"luck_gift_flag_ball")];
_ballImageView.contentMode = UIViewContentModeScaleAspectFill;
_ballImageView.hidden = YES;
}
return _ballImageView;
}
- (UIImageView *)bigBallImageView {
if (!_bigBallImageView) {
_bigBallImageView = [[UIImageView alloc] initWithImage:kImage(@"luck_gift_flag_ball_BIG")];
_bigBallImageView.contentMode = UIViewContentModeScaleAspectFill;
_bigBallImageView.hidden = YES;
}
return _bigBallImageView;
}
- (NetImageView *)avatarImageView {
if (!_avatarImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
@@ -270,14 +294,14 @@ exitCurrentRoom:(void(^)(void))exit {
- (UILabel *)giftNameLabel {
if (!_giftNameLabel) {
_giftNameLabel = [UILabel labelInitWithText:@"Gift" font:kFontSemibold(14) textColor:UIColorFromRGB(0xffe375)];
_giftNameLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(14) textColor:UIColorFromRGB(0xffe375)];
}
return _giftNameLabel;
}
- (UILabel *)coinsLabel {
if (!_coinsLabel) {
_coinsLabel = [UILabel labelInitWithText:@"14K" font:kFontSemibold(20) textColor:UIColorFromRGB(0xffe375)];
_coinsLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(20) textColor:UIColorFromRGB(0xffe375)];
_coinsLabel.adjustsFontSizeToFitWidth = YES;
_coinsLabel.minimumScaleFactor = 0.5;
_coinsLabel.textAlignment = NSTextAlignmentCenter;
@@ -287,7 +311,7 @@ exitCurrentRoom:(void(^)(void))exit {
- (UILabel *)timesLabel {
if (!_timesLabel) {
_timesLabel = [UILabel labelInitWithText:@"913" font:kFontSemibold(14) textColor:UIColorFromRGB(0xffe375)];
_timesLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(14) textColor:UIColorFromRGB(0xffe375)];
}
return _timesLabel;
}

View File

@@ -108,6 +108,8 @@
[self addSubview:stackView];
[stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.backgroundImageView);
make.width.mas_lessThanOrEqualTo(self.backgroundImageView);
// make.leading.trailing.mas_equalTo(self.backgroundImageView).inset(4);
make.top.mas_equalTo(self.winLabel.mas_bottom).offset(11);
make.height.mas_equalTo(35);
}];
@@ -120,6 +122,8 @@
[self addSubview:stackView_2];
[stackView_2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.backgroundImageView);
make.width.mas_lessThanOrEqualTo(self.backgroundImageView);
// make.leading.trailing.mas_equalTo(self.backgroundImageView).inset(4);
make.top.mas_equalTo(stackView.mas_bottom).offset(11);
make.height.mas_equalTo(17);
}];
@@ -135,7 +139,7 @@
- (void)setModel:(LuckyGiftWinningFlagViewModel *)model {
_model = model;
self.winPriceLabel.text = model.coins;
self.winTimesLabel.text = model.times;
self.winTimesLabel.text = model.times;
self.backgroundImageView.image = model.level == 1 ? kImage(@"luck_gift_gold") : kImage(@"luck_gift_pruple");
[[NSNotificationCenter defaultCenter] postNotificationName:@"receiveLuckGiftWinning" object:model.coins];
@@ -169,6 +173,7 @@
- (UILabel *)winPriceLabel {
if (!_winPriceLabel) {
_winPriceLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(26) textColor:UIColorFromRGB(0xffe375)];
_winPriceLabel.adjustsFontSizeToFitWidth = YES;
_winPriceLabel.minimumScaleFactor = 0.5f;
}
return _winPriceLabel;
@@ -177,6 +182,8 @@
- (UILabel *)winTimesLabel {
if (!_winTimesLabel) {
_winTimesLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(14) textColor:UIColorFromRGB(0xffe375)];
_winTimesLabel.adjustsFontSizeToFitWidth = YES;
_winTimesLabel.minimumScaleFactor = 0.5f;
}
return _winTimesLabel;
}

View File

@@ -57,16 +57,10 @@
options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
context:nil].size;
self.updateLayoutSize(size);
#if DEBUG
NSLog(@" ;;;; content ! size: %@ ||| %@", attributedTextCopy.string, [NSValue valueWithCGSize:size]);
#endif
}else {
YYTextLayout *lastlayout = [YYTextLayout layoutWithContainerSize:maxSize
text:attributedTextCopy];
self.updateLayoutSize(lastlayout.textBoundingSize);
#if DEBUG
NSLog(@"content ! size: %@ ||| %@", attributedTextCopy.string, [NSValue valueWithCGSize:layout.textBoundingSize]);
#endif
}
}
} else {
@@ -104,16 +98,10 @@
CGSize size = [updatedAttributes boundingRectWithSize:maxSize
options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
context:nil].size;
#if DEBUG
NSLog(@"---- ;;;; content ! size: %@ ||| %@", updatedAttributes.string, [NSValue valueWithCGSize:size]);
#endif
if (self.updateLayoutSize) {
self.updateLayoutSize(size);
}
} else {
#if DEBUG
NSLog(@"---- content ! size: %@ ||| %@", updatedAttributes.string, [NSValue valueWithCGSize:layout.textBoundingSize]);
#endif
if (self.updateLayoutSize) {
self.updateLayoutSize(layout.textBoundingSize);
}

View File

@@ -11,6 +11,7 @@
#import "RoomModePresenter.h"
#import "RoomResourceManager.h"
#import "XPWebViewController.h"
@interface RoomModeCollectionCell : UICollectionViewCell
@property(nonatomic, strong) RoomMicInfoModel *micInfoModel;
@@ -44,6 +45,10 @@
}
}
- (void)layoutSubviews {
[super layoutSubviews];
}
- (void)setMicInfoModel:(RoomMicInfoModel *)micInfoModel {
_micInfoModel = micInfoModel;
@@ -52,7 +57,7 @@
self.imageView.image = kImage(@"room_mode_default_skin");
}else {
self.imageView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.5];
[self.imageView setCornerRadius:20
[self.imageView setCornerRadius:kGetScaleWidth(27)
corners:kCALayerMaxXMaxYCorner | kCALayerMaxXMinYCorner | kCALayerMinXMaxYCorner | kCALayerMinXMinYCorner
borderWidth:1
borderColor:[UIColor whiteColor]];
@@ -70,7 +75,9 @@
if (!_svgaImageView) {
[self.contentView addSubview:self.svgaImageView];
[self.svgaImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.imageView);
// make.edges.mas_equalTo(self.imageView);
make.center.mas_equalTo(self.statusView);
make.width.height.mas_equalTo(self.statusView.mas_height).multipliedBy(0.85);
}];
}
@kWeakify(self);
@@ -108,14 +115,15 @@
[self.contentView addSubview:self.imageView];
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.statusView);
make.width.height.mas_equalTo(self.statusView.mas_height).multipliedBy(0.7);
make.width.height.mas_equalTo(self.statusView.mas_height).multipliedBy(0.65);
}];
}
return self;
}
- (void)setSelected:(BOOL)selected {
self.statusView.backgroundColor = selected ? UIColorFromRGB(0xFF8C03) : UIColorFromRGB(0x1b1b1d);
self.statusView.layer.borderWidth = selected ? 1 : 0;
self.statusView.backgroundColor = selected ? UIColorRGBAlpha(0xFF8C03, 0.1) : UIColorFromRGB(0x1b1b1d);
self.nameLabel.textColor = [UIColor colorWithWhite:1 alpha:selected ? 1 : 0.5];
}
@@ -123,6 +131,8 @@
if (!_statusView) {
_statusView = [[UIView alloc] init];
_statusView.backgroundColor = UIColorFromRGB(0x1b1b1d);
_statusView.layer.borderColor = UIColorFromRGB(0xFF8C03).CGColor;
_statusView.layer.borderWidth = 0;
[_statusView setCornerRadius:12];
}
return _statusView;
@@ -856,7 +866,9 @@
}
- (void)didTapHelp {
XPWebViewController *vc = [[XPWebViewController alloc] initWithRoomUID:@(self.roomInfo.uid).stringValue];
vc.url = @"https://jandan.net/pic";
[self.navigationController pushViewController:vc animated:YES];
}
- (void)didTapUse {

View File

@@ -53,8 +53,6 @@
///()
@property (nonatomic, strong) NSMutableDictionary * blueTeamGiftPersonDic;
@property (nonatomic, strong) UIImageView *backgroundImageView;
@property (nonatomic, strong) UIImageView *topImageView;
@property (nonatomic, strong) UIButton *minionButton;
@@ -114,7 +112,10 @@
}
- (void)setupUI {
self.frame = CGRectMake(0, 0, UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height - 86);
self.frame = CGRectMake(0,
0,
KScreenWidth,
KScreenHeight - 86);
[self addSubview:self.pkPanelContentView];
[self.pkPanelContentView mas_makeConstraints:^(MASConstraintMaker *make) {

View File

@@ -267,9 +267,6 @@
- (void)userSpeaking {
UserInfoModel * userInfo = self.microModel.userInfo;
#if DEBUG
userInfo.micCircle = @"";
#endif
if (userInfo.micCircle.length) {
[self.nobleWaveView startWaveAnimationWithUrl:userInfo.micCircle];
} else if ([[RoomResourceManager sharedManager] loadMicEffect]) {

View File

@@ -875,6 +875,23 @@ XPCandyTreeInsufficientBalanceViewDelegate>
if (!self.stageView.superview) {
[self.view insertSubview:self.stageView
belowSubview:self.roomHeaderView];
//
NSInteger index_sideMenu = -1;
NSInteger index_stageView = -1;
for (UIView *view in self.view.subviews) {
if (index_sideMenu == -1 || index_stageView == -1) {
if (view == self.sideMenu) {
index_sideMenu = [self.view.subviews indexOfObject:view];
}
if (view == self.stageView) {
index_stageView = [self.view.subviews indexOfObject:view];
}
} else {
[self.view exchangeSubviewAtIndex:index_sideMenu withSubviewAtIndex:index_stageView];
break;
}
}
}
self.stageView.alpha = 1;

View File

@@ -44,6 +44,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)pauseBatchDownload;
- (void)resumeBatchDownload;
- (void)download:(NSString *)targetURLString path:(NSString *)localFilePath complete:(void(^)(void))complete failure:(void(^)(void))failure;
@end
NS_ASSUME_NONNULL_END

View File

@@ -377,4 +377,34 @@ static UploadFile* manager;
return [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) xpSafeObjectAtIndex:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"];
}
- (void)download:(NSString *)targetURLString path:(NSString *)localFilePath complete:(void(^)(void))complete failure:(void(^)(void))failure {
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
NSURL *pathURL = [NSURL fileURLWithPath:localFilePath];
if ([[NSFileManager defaultManager] fileExistsAtPath:pathURL.path]) {
return;
}
NSURL *url = [NSURL URLWithString:targetURLString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
@kWeakify(self);
NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request
progress:nil
destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
return pathURL;
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
if (error) {
if (failure) {
failure();
}
} else {
if (complete) {
complete();
}
}
}];
[downloadTask resume];
}
@end

View File

@@ -4052,3 +4052,5 @@ ineHeadView12" = "الحمل";
"1.0.33_text_13" = "Celebration";
"1.0.33_text_14" = "Unique";
"1.0.33_text_15" = "房間等級不夠,不能使用該皮膚。";
"1.0.33_text_16" = "Rules";
"1.0.33_text_17" = "1. You can contact the official customer service and provide relevant evidence to improve the star rating. \n2. The star rating is divided into 1~5 stars.5 stars is the best recharge agent. \n3. The star rating will be displayed when the user found the recharge agent. \n4. The higher the star rating, the higher the ranking in the transfer list. \n5. All interpretation rights belong to the official and have nothing to do with Google or Apple.";

View File

@@ -3845,3 +3845,5 @@
"1.0.33_text_13" = "Celebration";
"1.0.33_text_14" = "Unique";
"1.0.33_text_15" = "房間等級不夠,不能使用該皮膚。";
"1.0.33_text_16" = "Rules";
"1.0.33_text_17" = "1. You can contact the official customer service and provide relevant evidence to improve the star rating. \n2. The star rating is divided into 1~5 stars.5 stars is the best recharge agent. \n3. The star rating will be displayed when the user found the recharge agent. \n4. The higher the star rating, the higher the ranking in the transfer list. \n5. All interpretation rights belong to the official and have nothing to do with Google or Apple.";

View File

@@ -3631,3 +3631,5 @@
"1.0.33_text_13" = "Celebration";
"1.0.33_text_14" = "Unique";
"1.0.33_text_15" = "房間等級不夠,不能使用該皮膚。";
"1.0.33_text_16" = "Rules";
"1.0.33_text_17" = "1. You can contact the official customer service and provide relevant evidence to improve the star rating. \n2. The star rating is divided into 1~5 stars.5 stars is the best recharge agent. \n3. The star rating will be displayed when the user found the recharge agent. \n4. The higher the star rating, the higher the ranking in the transfer list. \n5. All interpretation rights belong to the official and have nothing to do with Google or Apple.";

View File

@@ -3503,3 +3503,5 @@
"1.0.33_text_13" = "Celebration";
"1.0.33_text_14" = "Unique";
"1.0.33_text_15" = "房間等級不夠,不能使用該皮膚。";
"1.0.33_text_16" = "Rules";
"1.0.33_text_17" = "1. You can contact the official customer service and provide relevant evidence to improve the star rating. \n2. The star rating is divided into 1~5 stars.5 stars is the best recharge agent. \n3. The star rating will be displayed when the user found the recharge agent. \n4. The higher the star rating, the higher the ranking in the transfer list. \n5. All interpretation rights belong to the official and have nothing to do with Google or Apple.";