Commit 1eb0470e by ludi

完成新版本ui调整

parent 74f7e096
Showing with 277 additions and 266 deletions
......@@ -501,7 +501,7 @@
"$(PROJECT_DIR)/FuSiLive/Classes/FUSModules/FUSLiveModule/NewLive/Main/View/StreamView/Beauty/ByteDanceBeauty",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = NO;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1;
OTHER_CFLAGS = (
"$(inherited)",
"-isystem",
......@@ -769,7 +769,7 @@
"$(PROJECT_DIR)/FuSiLive/Classes/FUSModules/FUSLiveModule/NewLive/Main/View/StreamView/Beauty/ByteDanceBeauty",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = NO;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1;
OTHER_CFLAGS = (
"$(inherited)",
"-isystem",
......
......@@ -7,12 +7,12 @@
<key>FUSChatCenterBundle.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>75</integer>
<integer>76</integer>
</dict>
<key>FUSChatCenterModule.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>72</integer>
<integer>71</integer>
</dict>
</dict>
</dict>
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "live_chat_icon_gift_type2@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "live_chat_icon_gift_type2@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "live_head_follow_tick_btn@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "live_head_follow_tick_btn@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -16,6 +16,7 @@
#import "FUSAgoraHelper.h"
#import "FUSLiveStreamView.h"
#import "FUSRoomQuickChatListModel.h"
#import "FUSBaoFangAnchorModel.h"
typedef enum : NSInteger {
defaultRoom = 0
......
......@@ -364,12 +364,14 @@
case FUSLiveBottomToolTypeGift:
{
if (isSelect){
image = [UIImage fus_liveGiftImage_normal];
// image = [UIImage fus_liveGiftImage_normal];
image = [FUSShowRoomCenterBunble imageNamed:@"live_chat_icon_gift_type2"];
[self.giftBtn setImage:image forState:UIControlStateHighlighted];
}
else
{
image = [UIImage fus_liveGiftImage_normal];
// image = [UIImage fus_liveGiftImage_normal];
image = [FUSShowRoomCenterBunble imageNamed:@"live_chat_icon_gift_type2"];
[self.giftBtn setImage:image forState:UIControlStateNormal];
btn = self.giftBtn;
......
......@@ -605,7 +605,7 @@ UIGestureRecognizerDelegate
_headView.delegate = self;
[[self fus_viewWithLayer:FUSLiveFunctionLayerRoomInfos] addSubview:_headView];
self.popularView = [[FUSPopularProgressView alloc] initWithFrame:CGRectMake(12, self.headView.bottom, 48, 48)];
self.popularView = [[FUSPopularProgressView alloc] initWithFrame:CGRectMake(12, self.headView.bottom, 60, 60)];
__weak typeof(self) weakSelf = self;
self.popularView.tapPopularViewHandler = ^{
[weakSelf fus_headViewClickHeatPower];
......
......@@ -160,6 +160,9 @@ typedef NS_ENUM(NSInteger, FUSLiveHeadViewType) {
*/
- (void)fus_setupLiked:(BOOL)liked;
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用,这个会弹出关注成功的toast,与fus_setupLiked的区别就是,fus_setupLiked仅仅作为更新其状态
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow;
/**
清除 HeadView 的数据
*/
......@@ -204,7 +207,5 @@ typedef NS_ENUM(NSInteger, FUSLiveHeadViewType) {
- (void)fus_updateUserListModel:(id)userListModel;
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow;
@end
......@@ -605,11 +605,7 @@ NSString * const kDidHotScoreChangeNotification = @"kDidHotScoreChangeNotificati
*/
- (void)fus_setupLiked:(BOOL)liked
{
if (!liked) {
[_portraitView fus_showLikeButtonWithAnimation:YES];
} else {
[_portraitView fus_dismissLikeButtonWithAnimation:YES];
}
[_portraitView fus_setLike:liked];
}
- (void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow{
......
......@@ -52,19 +52,13 @@
@property (nonatomic, copy) void(^clickPortraitViewHandler)(void);
#pragma mark - Method
/**
显示追踪按钮
@param animate 是否动画显示
*/
- (void)fus_showLikeButtonWithAnimation:(BOOL)animate;
/**
隐藏追踪按钮
@param animate 是否动画显示
*/
- (void)fus_dismissLikeButtonWithAnimation:(BOOL)animate;
/// 设置是否关注
/// @param isLike 是否关注
-(void)fus_setLike:(BOOL)isLike;
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用,说白了,就是会显示动画,比如多一个toast提示
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow;
/**
根据 model 设置 PortraitView
......@@ -81,9 +75,6 @@
*/
- (void)fus_onClickLikeButton:(UIButton *)sender;
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow;
- (void)fus_anchorOffline:(BOOL)offline;
......
......@@ -14,8 +14,9 @@
#import "FUSLiveHelper.h"
#import "CBAutoScrollLabel.h"
#import "FUSRadarAnimImageViewView.h"
#import <SJAttributesFactory/SJAttributesFactory.h>
#define LIKE_BTN_MARGIN 9
#define LIKE_BTN_MARGIN 4
#define MAX_NICKNAME_WIDTH 90
@interface FUSLivePortraitView ()
......@@ -42,10 +43,8 @@
//@property (nonatomic, strong) UILabel *nicknameLabel;
@property (nonatomic, strong) CBAutoScrollLabel *autoScrollNicknameLabel;
/**
围观人数 Lable
*/
@property (nonatomic, strong) UIButton *audienceBtn;
/// 信息label
@property (nonatomic, strong) CBAutoScrollLabel *autoScrollMsgLabel;
/**
“围观”Label
......@@ -79,7 +78,7 @@
if (self) {
// 初始化参数
minXDistance = 6;
minXDistance = 0;
toleranceSpace = 4;
bgXPosition = 0;
rightSpace = 8;
......@@ -102,11 +101,13 @@
[self initBgView];
[self initFaceImageView];
[self initNicknameLabel];
[self initAudienceLabel];
[self initAutoScrollMsgLabel];
[self initLikeBtn];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_focusStateDidChangedNotification:) name:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:nil];
[self addSubview:_grayView];
[self updateFrameWithAnimate:NO];
}
/**
......@@ -185,17 +186,37 @@
/**
搭建围观人数 Label
*/
- (void)initAudienceLabel
- (void)initAutoScrollMsgLabel
{
self.audienceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_audienceBtn.frame = CGRectMake(_autoScrollNicknameLabel.x, CGRectGetMaxY(_autoScrollNicknameLabel.frame) + 0, 50, 13);
_audienceBtn.titleLabel.numberOfLines = 1;
_audienceBtn.titleLabel.font = [UIFont fus_themeFont:9];
_audienceBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 2, 0, 0);
_audienceBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[_audienceBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_audienceBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_head_audience_icon"] forState:UIControlStateNormal];
[self addSubview:_audienceBtn];
self.autoScrollMsgLabel = [[CBAutoScrollLabel alloc]initWithFrame:CGRectMake(_autoScrollNicknameLabel.x, CGRectGetMaxY(_autoScrollNicknameLabel.frame) + 0, 50, 13)];
_autoScrollMsgLabel.font = [UIFont fus_themeFont:11];
_autoScrollMsgLabel.textColor = [UIColor whiteColor];
_autoScrollMsgLabel.labelSpacing = 20;
_autoScrollMsgLabel.pauseInterval = 5;
_autoScrollMsgLabel.scrollSpeed = 15;
_autoScrollMsgLabel.fadeLength = 12;
_autoScrollMsgLabel.scrollDirection = CBAutoScrollDirectionLeft;
[self addSubview:_autoScrollMsgLabel];
}
-(void)initLikeBtn{
// 已经添加,不需要在加载
if (!self.likeBtn.superview) {
self.likeBtn = [FUSStyleButton buttonWithType:UIButtonTypeCustom];
_likeBtn.titleLabel.font = [UIFont fus_themeFont:12];
[_likeBtn addTarget:self action:@selector(fus_onClickLikeButton:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_likeBtn];
}
[_likeBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_head_follow_btn"] forState:UIControlStateNormal];
[_likeBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_head_follow_tick_btn"] forState:UIControlStateSelected];
_likeBtn.hidden = NO;
CGRect frame = CGRectMake(CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_wordLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(_wordLabel.frame) + LIKE_BTN_MARGIN, 5, self.height - 10, self.height - 10);
_likeBtn.frame = frame;
_likeBtn.centerY = self.bgView.centerY;
}
#pragma mark - Setter
......@@ -227,18 +248,19 @@
*/
- (void)setAudience:(NSString *)audience
{
// ludy:新版本不显示这个了
// 赋值实例变量
_audience = audience;
// 赋值文字内容
[_audienceBtn setTitle:audience forState:UIControlStateNormal];
// 更新 Frame
[_audienceBtn sizeToFit];
_audienceBtn.height = 13;
_audienceBtn.width += 5;
[self updateFrameWithAnimate:YES];
// _audience = audience;
//
// // 赋值文字内容
// [_audienceBtn setTitle:audience forState:UIControlStateNormal];
//
// // 更新 Frame
// [_audienceBtn sizeToFit];
// _audienceBtn.height = 13;
// _audienceBtn.width += 5;
//
// [self updateFrameWithAnimate:YES];
}
......@@ -252,103 +274,13 @@
if (roomId.integerValue != _currentModel.roomId.integerValue) {
return;
}
if (like) {
[self fus_dismissLikeButtonWithAnimation:YES];
} else {
[self fus_showLikeButtonWithAnimation:YES];
}
[self fus_setLike:like];
}
#pragma mark - Method
/**
显示追踪按钮
@param animate 是否动画显示
*/
- (void)fus_showLikeButtonWithAnimation:(BOOL)animate
{
// 已经添加,不需要在加载
if (!self.likeBtn.superview) {
self.likeBtn = [FUSStyleButton buttonWithType:UIButtonTypeCustom];
_likeBtn.titleLabel.font = [UIFont fus_themeFont:12];
[_likeBtn addTarget:self action:@selector(fus_onClickLikeButton:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_likeBtn];
}
[_likeBtn addTarget:self action:@selector(fus_onClickLikeButton:) forControlEvents:UIControlEventTouchUpInside];
[_likeBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_head_follow_btn"] forState:UIControlStateNormal];
- (void)fus_setLike:(BOOL)isLike{
_likeBtn.hidden = NO;
CGRect frame = CGRectMake(CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_wordLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(_wordLabel.frame) + LIKE_BTN_MARGIN, 5, self.height - 10, self.height - 10);
_likeBtn.frame = frame;
_likeBtn.centerY = self.bgView.centerY;
[self updateFrameWithAnimate:NO];
}
/**
隐藏追踪按钮
@param animate 是否动画显示
*/
- (void)fus_dismissLikeButtonWithAnimation:(BOOL)animate
{
if (!self.likeBtn.superview) {
self.likeBtn = [FUSStyleButton buttonWithType:UIButtonTypeCustom];
_likeBtn.titleLabel.font = [UIFont fus_themeFont:12];
[self addSubview:_likeBtn];
}
[_likeBtn removeTarget:self action:@selector(fus_onClickLikeButton:) forControlEvents:UIControlEventTouchUpInside];
_likeBtn.hidden = YES;
// // 没有追踪按钮
// if (!self.likeBtn || !self.likeBtn.superview) return;
//
// if (animate) {
//
//// CGFloat targetWidth = CGRectGetMaxX(_nicknameLabel.frame) > CGRectGetMaxX(_audienceLabel.frame) ? CGRectGetMaxX(_nicknameLabel.frame) + 8 : CGRectGetMaxX(_audienceLabel.frame) + rightSpace;
//
// // 获取最大 X 值
// CGFloat maxX = CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_wordLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) : CGRectGetMaxX(_wordLabel.frame);
//
// CGFloat targetWidth = (maxX + rightSpace + 5) > 80 ? (maxX + rightSpace + 5) : 80;//targetWidth > 80 ? targetWidth : 80;
//
// if (self.frameDidChange) {
// self.frameDidChange(self.x + targetWidth);
// }
//
// [UIView animateWithDuration:.35 animations:^{
//
// _likeBtn.width = 0;
// _likeBtn.x -= 0;
// self.width = targetWidth;
// self.bgView.width = self.width - bgXPosition;
// _bgImageView.frame = _bgView.frame;
//
// } completion:^(BOOL finished) {
//
// [_likeBtn removeFromSuperview];
// self.likeBtn = nil;
// [self updateFrameWithAnimate:YES];
//
// }];
//
// }else{
//
// [_likeBtn removeFromSuperview];
// self.likeBtn = nil;
//
CGRect frame = CGRectMake(CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_wordLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(_wordLabel.frame) + LIKE_BTN_MARGIN, 5, self.height - 10, self.height - 10);
_likeBtn.frame = frame;
_likeBtn.centerY = self.bgView.centerY;
[self updateFrameWithAnimate:NO];
//
// }
_likeBtn.selected = isLike;
}
/**
......@@ -370,45 +302,82 @@
// 设置头像
[_faceImageView.imageView setLiveFaceWebImageWithSubURLString:model.face placeholder:nil];
// // 赋值文字内容
// _autoScrollNicknameLabel.text = model.nickName;
// // 更新 Frame
// [_autoScrollNicknameLabel sizeToFit];
// _autoScrollNicknameLabel.height = 13;
//
// // 如果超过最大长度,
// if (_autoScrollNicknameLabel.width > MAX_NICKNAME_WIDTH) {
// _autoScrollNicknameLabel.width = MAX_NICKNAME_WIDTH;
// }
// if (![NSDictionary isNull:model.popular[@"score"]]) {
// // 赋值文字内容
// [_audienceBtn setTitle:model.popular[@"score"] forState:UIControlStateNormal];
// } else {
//
// // 赋值文字内容
// [_audienceBtn setTitle:0 forState:UIControlStateNormal];
// }
NSString *ageStr = @"0";
NSString *addrStr = @"";
if ([model.roomId isEqualToString:[FUSCacheDataShare shareStore].userDetailInfo.roomId]) {
ageStr = [FUSCacheDataShare shareStore].userDetailInfo.age;
addrStr = [FUSCacheDataShare shareStore].userDetailInfo.addr;
}else {
for (FUSBaoFangAnchorModel *tempModel in [FUSLiveHelper shareInstance].rooms) {
if ([model.roomId isEqualToString:tempModel.roomId]) {
ageStr = tempModel.age;
addrStr = tempModel.addr;
break;
}
}
}
_autoScrollMsgLabel.attributedText = [NSAttributedString sj_UIKitText:^(id<SJUIKitTextMakerProtocol> _Nonnull make) {
make.appendImage(^(id<SJUTImageAttachment> _Nonnull make) {
make.image = [UIImage fus_boyIcon];
make.alignment = SJUTVerticalAlignmentCenter;
make.bounds = CGRectMake(0, 0, 10, 10);
});
make.append(@" ");
make.append(ageStr).textColor([UIColor colorWithHex:@"#76C4FF"]);
make.append(@" ");
make.append(addrStr).textColor([UIColor colorWithHex:@"#BBBAB8"]);
make.font([UIFont fus_themeFont:10]);
}];
// 更新 Frame
[_autoScrollMsgLabel sizeToFit];
_autoScrollMsgLabel.height = 13;
// 赋值文字内容
_autoScrollNicknameLabel.text = model.nickName;
// 更新 Frame
[_autoScrollNicknameLabel sizeToFit];
_autoScrollNicknameLabel.height = 13;
NSLog(@"_autoScrollNicknameLabel.width :%f _autoScrollMsgLabel.width: %f",_autoScrollNicknameLabel.width, _autoScrollMsgLabel.width);
// 如果超过最大长度,
if (_autoScrollNicknameLabel.width > MAX_NICKNAME_WIDTH) {
if (MAX(_autoScrollNicknameLabel.width, _autoScrollMsgLabel.width) > MAX_NICKNAME_WIDTH) {
_autoScrollNicknameLabel.width = MAX_NICKNAME_WIDTH;
_autoScrollMsgLabel.width = MAX_NICKNAME_WIDTH;
}else if (_autoScrollNicknameLabel.width < _autoScrollMsgLabel.width) {
_autoScrollNicknameLabel.width = _autoScrollMsgLabel.width;
}
if (![NSDictionary isNull:model.popular[@"score"]]) {
// 赋值文字内容
[_audienceBtn setTitle:model.popular[@"score"] forState:UIControlStateNormal];
} else {
// 赋值文字内容
[_audienceBtn setTitle:0 forState:UIControlStateNormal];
}
// 更新 Frame
[_audienceBtn sizeToFit];
_audienceBtn.height = 13;
_audienceBtn.width += 5;
// 更新 View
[self updateFrameWithAnimate:animate];
// [self fus_showLikeButtonWithAnimation:animate];
if (![model.roomId isEqualToString:[[FUSCacheDataShare shareStore]userDetailInfo].uid] &&
model.liked &&
![model.liked boolValue]) {
// 未追踪
[self fus_showLikeButtonWithAnimation:animate];
// 自动消失
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(30.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [self fus_dismissLikeButtonWithAnimation:YES];
// });
}
// if (![model.roomId isEqualToString:[[FUSCacheDataShare shareStore]userDetailInfo].uid] &&
// model.liked &&
// ![model.liked boolValue]) {
// // 未追踪
// [self fus_setLike:NO];
// }
[self fus_setLike:[model.liked boolValue]];
// // 设置富豪等级 头像边框
// if (model.level.integerValue == 0) {
......@@ -547,12 +516,17 @@
[_autoScrollNicknameLabel sizeToFit];
// 赋值实例变量
_audience = @"";
[_audienceBtn setTitle:_audience forState:UIControlStateNormal];
[_audienceBtn sizeToFit];
_audienceBtn.width += 5;
// _audience = @"";
// [_audienceBtn setTitle:_audience forState:UIControlStateNormal];
// [_audienceBtn sizeToFit];
// _audienceBtn.width += 5;
_autoScrollMsgLabel.attributedText = [NSAttributedString sj_UIKitText:^(id<SJUIKitTextMakerProtocol> _Nonnull make) {
make.append(@"");
}];
[_autoScrollMsgLabel sizeToFit];
// _autoScrollMsgLabel.width += 5;
[self fus_dismissLikeButtonWithAnimation:NO];
_likeBtn.hidden = YES;
_autoScrollNicknameLabel.textColor = [UIColor whiteColor];
_faceImageView.imageView.image = UIImage.fus_defaultIcon;
......@@ -636,7 +610,7 @@
- (void)updateFrameWithAnimate:(BOOL)animate
{
// 获取最大 X 值
CGFloat maxX = CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_audienceBtn.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) : CGRectGetMaxX(_audienceBtn.frame);
CGFloat maxX = CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_autoScrollMsgLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) : CGRectGetMaxX(_autoScrollMsgLabel.frame);
[self.layer removeAllAnimations];
......@@ -652,7 +626,7 @@
if (animate) {
[UIView animateWithDuration:.35 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{
self.likeBtn.x = CGRectGetMaxX(self.autoScrollNicknameLabel.frame) > CGRectGetMaxX(self.audienceBtn.frame) ? CGRectGetMaxX(self.autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(self.audienceBtn.frame) + LIKE_BTN_MARGIN;
self.likeBtn.x = CGRectGetMaxX(self.autoScrollNicknameLabel.frame) > CGRectGetMaxX(self.autoScrollMsgLabel.frame) ? CGRectGetMaxX(self.autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(self.autoScrollMsgLabel.frame) + LIKE_BTN_MARGIN;
self.width = (maxX + self->rightSpace + 5) > 80 ? (maxX + self->rightSpace + 5) : 80;
self.bgView.width = self.width - self->bgXPosition;
// self.bgImageView.frame = self.bgView.frame;
......@@ -661,7 +635,7 @@
}];
}else{
_likeBtn.x = CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_audienceBtn.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(_audienceBtn.frame) + LIKE_BTN_MARGIN;
_likeBtn.x = CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_autoScrollMsgLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(_autoScrollMsgLabel.frame) + LIKE_BTN_MARGIN;
self.width = (maxX + rightSpace + 5) > 80 ? (maxX + rightSpace + 5) : 80;
self.bgView.width = self.width - bgXPosition;
// _bgImageView.frame = _bgView.frame;
......@@ -727,101 +701,102 @@
[activityView startAnimating];
[sender addSubview:activityView];
[FUSTalkingData fus_trackEvent:FUSLiveEventTrackParams.fus_EVENT_ROOM_FOLLOW label:@"" parameters:nil];
// 请求追踪
[FUSLiveHttpHelper fus_likeRoomWithRoomId:_currentModel.roomId success:^{
MJWeakSelf
if (sender.isSelected) {
// 取消追踪
// 设置图片动画
CGFloat framePerSecond = 12.0;
NSMutableArray *imageArr = [NSMutableArray array];
for (int i = 0; i <= 5; i++) {
UIImage *image = [FUSShowRoomCenterBunble imageNamed:[NSString stringWithFormat:@"live_head_follow_btn_anim_%d", i]];
if (image) {
[imageArr addObject:image];
}
}
CGFloat duration = imageArr.count / framePerSecond;
self.likeBtn.imageView.animationImages = imageArr;
self.likeBtn.imageView.animationDuration = duration;
self.likeBtn.imageView.animationRepeatCount = 1;
[self.likeBtn.imageView startAnimating];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.likeBtn.imageView stopAnimating];
[FUSLiveHttpHelper fus_unlikeRoomWithRoomId:_currentModel.roomId success:^{
sender.enabled = YES;
[activityView stopAnimating];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"追踪成功"]];
[[FUSLiveHelper shareInstance]roomInfoModel].liked = @"1";
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:@{@"roomId":self.currentModel.roomId,@"like":@(YES)}];
[self fus_dismissLikeButtonWithAnimation:YES];
[weakSelf fus_showClickLikeAnimateWithIsFollow:NO];
sender.enabled = YES;
} failure:^(NSString *msg, int code) {
if (self.clickLikeHandler) {
self.clickLikeHandler();
}
});
} failure:^(NSString *msg, int code) {
[FUSDialogView fus_showDialog:msg];
[activityView stopAnimating];
sender.enabled = YES;
}];
[FUSDialogView fus_showDialog:msg];
}else {
sender.enabled = YES;
[FUSTalkingData fus_trackEvent:FUSLiveEventTrackParams.fus_EVENT_ROOM_FOLLOW label:@"" parameters:nil];
if (code == -11022) {
// 已经追踪了
[self fus_dismissLikeButtonWithAnimation:YES];
// 请求追踪
[FUSLiveHttpHelper fus_likeRoomWithRoomId:_currentModel.roomId success:^{
// 设置图片动画
// CGFloat framePerSecond = 12.0;
// NSMutableArray *imageArr = [NSMutableArray array];
// for (int i = 0; i <= 5; i++) {
// UIImage *image = [FUSShowRoomCenterBunble imageNamed:[NSString stringWithFormat:@"live_head_follow_btn_anim_%d", i]];
// if (image) {
// [imageArr addObject:image];
// }
// }
//
// CGFloat duration = imageArr.count / framePerSecond;
// self.likeBtn.imageView.animationImages = imageArr;
// self.likeBtn.imageView.animationDuration = duration;
// self.likeBtn.imageView.animationRepeatCount = 1;
// [self.likeBtn.imageView startAnimating];
//
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [self.likeBtn.imageView stopAnimating];
//
// [activityView stopAnimating];
// [FUSDialogView fus_showDialog:[NSString fus_localString:@"追踪成功"]];
// [[FUSLiveHelper shareInstance]roomInfoModel].liked = @"1";
// [[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:@{@"roomId":self.currentModel.roomId,@"like":@(YES)}];
// [self fus_dismissLikeButtonWithAnimation:YES];
//
// sender.enabled = YES;
//
// if (self.clickLikeHandler) {
// self.clickLikeHandler();
// }
// });
sender.enabled = YES;
[activityView stopAnimating];
[weakSelf fus_showClickLikeAnimateWithIsFollow:YES];
if (self.clickLikeHandler) {
self.clickLikeHandler();
}
}else{
} failure:^(NSString *msg, int code) {
[FUSDialogView fus_showDialog:msg];
[activityView stopAnimating];
[sender setTitle:[NSString fus_localString:@"追踪"] forState:UIControlStateNormal];
}
}];
sender.enabled = YES;
if (code == -11022) {
// 已经追踪了
[weakSelf fus_setLike:YES];
if (self.clickLikeHandler) {
self.clickLikeHandler();
}
}else{
[sender setTitle:[NSString fus_localString:@"追踪"] forState:UIControlStateNormal];
}
}];
}
}
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow{
if (isFollow) {
// 设置图片动画
CGFloat framePerSecond = 12.0;
NSMutableArray *imageArr = [NSMutableArray array];
for (int i = 0; i <= 5; i++) {
UIImage *image = [FUSShowRoomCenterBunble imageNamed:[NSString stringWithFormat:@"live_head_follow_btn_anim_%d", i]];
if (image) {
[imageArr addObject:image];
}
}
CGFloat duration = imageArr.count / framePerSecond;
self.likeBtn.imageView.animationImages = imageArr;
self.likeBtn.imageView.animationDuration = duration;
self.likeBtn.imageView.animationRepeatCount = 1;
[self.likeBtn.imageView startAnimating];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.likeBtn.imageView stopAnimating];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"追踪成功"]];
[[FUSLiveHelper shareInstance]roomInfoModel].liked = @"1";
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:@{@"roomId":self.currentModel.roomId,@"like":@(YES)}];
[self fus_dismissLikeButtonWithAnimation:YES];
self.likeBtn.enabled = YES;
});
}else {
// ludy:这个居然是取消,我也不知道前面的人怎么写的,很夸张
[self fus_showLikeButtonWithAnimation:YES];
self.likeBtn.hidden = NO;
self.likeBtn.selected = isFollow;
if (isFollow == YES) {
// [self.likeBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_head_follow_tick_btn"] forState:UIControlStateNormal];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"追踪成功"]];
[[FUSLiveHelper shareInstance]roomInfoModel].liked = @"1";
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:@{@"roomId":self.currentModel.roomId,@"like":@(YES)}];
}
}
......
......@@ -44,13 +44,14 @@
self.progressView.y = self.progressBGView.height;
[self.progressBGView addSubview:self.progressView];
CGFloat iconWidth = 20;
self.iconImageView = [[UIImageView alloc] initWithImage:[FUSShowRoomCenterBunble imageNamed:@"live_heat_progress_icon"]];
self.iconImageView.frame = CGRectMake((self.width - 15) / 2.0, 9, 15, 15);
self.iconImageView.frame = CGRectMake((self.width - iconWidth) / 2.0, 12, iconWidth, iconWidth);
[self addSubview:self.iconImageView];
self.numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.iconImageView.bottom, self.width, 16)];
self.numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.iconImageView.bottom + 4, self.width, 16)];
self.numberLabel.textColor = [UIColor whiteColor];
self.numberLabel.font = [UIFont fus_themeBoldFont:9];
self.numberLabel.font = [UIFont fus_themeBoldFont:12];
self.numberLabel.textAlignment = NSTextAlignmentCenter;
self.numberLabel.text = @"0";
[self addSubview:self.numberLabel];
......
......@@ -7,12 +7,12 @@
<key>FUSUserCenterModule.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>76</integer>
<integer>72</integer>
</dict>
<key>FUSUserCenterModuleBundle.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>71</integer>
<integer>75</integer>
</dict>
</dict>
</dict>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment