Commit 203b1947 by ludi

Merge branch 'feature/UI修改版本' of http://git.yabolive.net:88/pidan/FuSiLive into feature/UI修改版本

parents 8bd897a8 c3d07420
Showing with 276 additions and 44 deletions
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "视聊-小星-半星@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "视聊-小星-亮@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "视聊-小星-暗@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -91,12 +91,13 @@ if (@available(iOS 11.0, *)) {height = 80 + UIView.fus_SafeBottom;}\
// 是否能点击at按钮
@property (nonatomic, assign) BOOL enableAtBtn;
//#pragma mark - 评分
#pragma mark - 评分
// credit
//@property (nonatomic, strong) UILabel *creditLabel;
//@property (nonatomic, strong) UILabel *remarkLabel;
//@property (nonatomic, strong) UIView *starBgView;
//@property (nonatomic, strong) NSMutableArray *starImageViews;
@property (nonatomic, strong) UIView *creditView;
@property (nonatomic, strong) UILabel *creditLabel;
@property (nonatomic, strong) UILabel *remarkLabel;
@property (nonatomic, strong) UIView *starBgView;
@property (nonatomic, strong) NSMutableArray *starImageViews;
#pragma mark - Tags
// tagView的列表
......@@ -300,7 +301,7 @@ if (@available(iOS 11.0, *)) {height = 80 + UIView.fus_SafeBottom;}\
[self fus_initLevLabel];
[self fus_initSignLabel];
[self fus_initBottomBgView];
// [self fus_initCreditUI];
[self fus_initCreditUI];
[self.bgView fusrtl_setSubViewsToRTL];
......@@ -743,7 +744,7 @@ if (@available(iOS 11.0, *)) {height = 80 + UIView.fus_SafeBottom;}\
[self fus_updateBtnsWithModel:model];
// [self fus_setCreditInfoWithCurrentModel];
[self fus_setCreditInfoWithCurrentModel];
[self fus_resetTagWithModel:model];
[self fus_updateControlViewWithModel:model];
[[FUSLiveHelper shareInstance].currentFunctionView addSubview:self];
......@@ -1108,6 +1109,133 @@ if (@available(iOS 11.0, *)) {height = 80 + UIView.fus_SafeBottom;}\
if (_didClickUserInfoViewBtnBlock) _didClickUserInfoViewBtnBlock (FUSUserInfoViewBtnTypeUserHead, _currentModel);
}
#pragma mark - 视讯评分相关的逻辑
- (void)fus_initCreditUI {
self.creditView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 117, 37)];
self.creditView.layer.cornerRadius = 6;
self.creditView.layer.masksToBounds = YES;
self.creditView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2];
[self.clearBgView insertSubview:self.creditView belowSubview:self.bgView];
self.creditView.centerY = self.bgView.y;
self.creditLabel = [[UILabel alloc] init];
self.creditLabel.font = [UIFont fus_themeMediumFont:8];
self.creditLabel.text = [NSString fus_localString:@"私房信用:"];
self.creditLabel.textColor = [UIColor whiteColor];
[self.creditLabel sizeToFit];
[self.creditView addSubview:self.creditLabel];
_remarkLabel = [[UILabel alloc] init];
_remarkLabel.font = [UIFont fus_themeBoldFont:8];
_remarkLabel.textColor = [UIColor colorWithHex:@"#53B9F3"];
[self.creditView addSubview:_remarkLabel];
_starBgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 8)];
[self.creditView addSubview:_starBgView];
_starImageViews = [NSMutableArray array];
for (int i = 0; i < 5; i ++) {
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((_starBgView.height+2)*i, 0, _starBgView.height, _starBgView.height)];
imageView.contentMode = UIViewContentModeScaleAspectFit;
[_starBgView addSubview:imageView];
[_starImageViews addObject:imageView];
}
_starBgView.width = _starBgView.height*5 + 2*4;
[_starBgView fusrtl_setSubViewsToRTL];
}
- (void)fus_setCreditInfoWithCurrentModel {
if (FUSConfig.sharedInstanced.devConfigs.appStatus) {
self.creditView.hidden = YES;
return;
}
self.creditView.hidden = NO;
[self.creditLabel sizeToFit];
self.creditLabel.x = 7;
self.creditLabel.centerY = self.creditView.height / 4.0f;
if (self.currentModel.chatWith.avgLevel > 0 && !FUSConfig.sharedInstanced.devConfigs.appStatus) {//设置评分
self.starBgView.hidden = NO;
[self fus_setStarCountWithMark:self.currentModel.chatWith.avgLevel];
self.remarkLabel.text = [NSString stringWithFormat:@"%.1lf", self.currentModel.chatWith.avgLevel];
[self.remarkLabel sizeToFit];
self.remarkLabel.centerY = self.creditLabel.centerY;
self.remarkLabel.x = self.creditLabel.right;
self.starBgView.x = self.remarkLabel.right + 3;
self.starBgView.centerY = self.creditLabel.centerY;
self.remarkLabel.textColor = [UIColor colorWithHex:@"#53B9F3"];
self.creditView.width = self.starBgView.right + 7;
self.creditView.x = self.width - self.creditView.width - 7;
[self.creditLabel fusrtl_resetFrameToFitRTL];
[self.starBgView fusrtl_resetFrameToFitRTL];
[self.remarkLabel fusrtl_resetFrameToFitRTL];
} else {
self.starBgView.hidden = YES;
self.remarkLabel.text = [NSString fus_localString:@"暂无评分"];
[self.remarkLabel sizeToFit];
self.remarkLabel.x = self.creditLabel.right;
self.remarkLabel.centerY = self.creditLabel.centerY;
self.remarkLabel.textColor = [UIColor colorWithHex:@"#DDDDDD"];
self.creditView.width = self.remarkLabel.right + 7;
self.creditView.x = self.width - self.creditView.width - 7;
[self.creditLabel fusrtl_resetFrameToFitRTL];
[self.remarkLabel fusrtl_resetFrameToFitRTL];
}
[self.creditView fusrtl_resetFrameToFitRTL];
}
- (void)fus_setStarCountWithMark:(CGFloat )mark {
if (mark > 0.0) {
self.creditLabel.hidden = NO;
_starBgView.hidden = NO;
_remarkLabel.hidden = NO;
}else{
self.creditLabel.hidden = YES;
_starBgView.hidden = YES;
_remarkLabel.hidden = YES;
return;
}
//整数
NSInteger integer = floor(mark);
//余数
CGFloat remainder = mark - integer;
if (remainder < 0.5) {
remainder = 0;
}
for (int i = 0; i < _starImageViews.count; i++) {
UIImageView *imageView = _starImageViews[i];
if (i < integer) {
imageView.image = [UIImage imageNamed:@"live_user_video_remark_star_light"];
}else{
imageView.image = [UIImage imageNamed:@"live_user_video_remark_star_whole_gray"];
}
}
if (remainder != 0 && integer < _starImageViews.count) {
UIImageView *imageView = _starImageViews[integer];
imageView.image = [[UIImage imageNamed:@"live_user_video_remark_star_half"] fusrtl_imageFlippedForRightToLeftLayoutDirection];
}
}
#pragma mark - 标签信息相关的逻辑
- (void)fus_resetTagWithModel:(FUSRoomUserInfoModel *)model {
for (UIView *tagView in self.tagViewList) {
......
......@@ -459,15 +459,15 @@
+ (void)fus_createLevelImgs {
// NSString *document = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingString:@"/ATest"];
// [FUSFileHelper createDirectoryAtPath:document];
//
//
// for (NSInteger i = 1; i <= 99;i++) {
// NSString *filePath = [document stringByAppendingPathComponent:[NSString stringWithFormat:@"fus_time_level_%zd.png",i]];
//
//
// if (![FUSFileHelper fus_isExistFileAtPath:filePath]) {
// CGFloat width = 20;
//
//
// /// 生成等级图片。保存在本地,然后再将路径加入HTML里面
// UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width, 14)];
// UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(4, 0, 20, 14)];
// timeLabel.text = @(i).stringValue;
// timeLabel.backgroundColor = [UIColor colorWithWhite:1 alpha:0.32];
// timeLabel.textColor = [UIColor whiteColor];
......@@ -475,28 +475,26 @@
// timeLabel.layer.cornerRadius = 7;
// timeLabel.textAlignment = NSTextAlignmentCenter;
// timeLabel.layer.masksToBounds = YES;
//
// UIGraphicsBeginImageContextWithOptions(timeLabel.bounds.size, NO, [UIScreen mainScreen].scale);
// [timeLabel drawViewHierarchyInRect:timeLabel.bounds afterScreenUpdates:YES];
//
// UIGraphicsBeginImageContextWithOptions(CGSizeMake(28, 14), NO, [UIScreen mainScreen].scale);
// [timeLabel drawViewHierarchyInRect:timeLabel.frame afterScreenUpdates:YES];
// UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
// UIGraphicsEndImageContext();
//
//
// if (screenImage) {
// NSData *imageData = UIImagePNGRepresentation(screenImage);
// [FUSFileHelper fus_writeDataToFile:imageData filePath:filePath];
// }
// }
// }
//
//
//
//
// for (NSInteger i = 1; i <= 99;i++) {
// NSString *filePath = [document stringByAppendingPathComponent:[NSString stringWithFormat:@"fus_time_gray_level_%zd.png",i]];
//
//
// if (![FUSFileHelper fus_isExistFileAtPath:filePath]) {
// CGFloat width = 20;
//
// /// 生成等级图片。保存在本地,然后再将路径加入HTML里面
// UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width, 14)];
// UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(4, 0, 20, 14)];
// timeLabel.text = @(i).stringValue;
// timeLabel.backgroundColor = [UIColor colorWithHex:@"#D6D6D7"];
// timeLabel.textColor = [UIColor whiteColor];
......@@ -504,12 +502,12 @@
// timeLabel.layer.cornerRadius = 7;
// timeLabel.textAlignment = NSTextAlignmentCenter;
// timeLabel.layer.masksToBounds = YES;
//
// UIGraphicsBeginImageContextWithOptions(timeLabel.bounds.size, NO, [UIScreen mainScreen].scale);
// [timeLabel drawViewHierarchyInRect:timeLabel.bounds afterScreenUpdates:YES];
//
// UIGraphicsBeginImageContextWithOptions(CGSizeMake(28, 14), NO, [UIScreen mainScreen].scale);
// [timeLabel drawViewHierarchyInRect:timeLabel.frame afterScreenUpdates:YES];
// UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
// UIGraphicsEndImageContext();
//
//
// if (screenImage) {
// NSData *imageData = UIImagePNGRepresentation(screenImage);
// [FUSFileHelper fus_writeDataToFile:imageData filePath:filePath];
......
......@@ -245,6 +245,8 @@
make.width.mas_equalTo(37);
}];
} else {
[self.genderAndAgeBtn setTitle:nil forState:UIControlStateNormal];
if (userModel.sex.integerValue != 0 && userModel.sex.integerValue != 1) {
self.genderAndAgeBtn.hidden = YES;
}
......
......@@ -612,7 +612,7 @@ FUSLinkMicUserListDelegate
self.popularView = [[FUSPopularProgressView alloc] initWithFrame:CGRectMake(12, self.headView.bottom, 48, 48)];
__weak typeof(self) weakSelf = self;
self.popularView.tapPopularViewHandler = ^{
[weakSelf fus_showAudiencePopViewStartWithContribute:YES];
[weakSelf fus_headViewClickHeatPower];
};
[[self fus_viewWithLayer:FUSLiveFunctionLayerRoomInfos] addSubview:self.popularView];
}
......@@ -979,7 +979,7 @@ FUSLinkMicUserListDelegate
self.pusherPopularView = [[FUSPopularProgressView alloc] initWithFrame:CGRectMake(12, self.pusherHeadView.bottom, 48, 48)];
self.pusherPopularView.tapPopularViewHandler = ^{
[weakSelf fus_showAudiencePopViewStartWithContribute:YES];
[weakSelf fus_headViewClickHeatPower];
};
[self.pusherContentView addSubview:self.pusherPopularView];
}
......
......@@ -68,8 +68,7 @@
#pragma mark - UI Update
- (void)initial {
self.backgroundColor = [UIColor fus_appBGColor];
[self addRoundedCorners:UIRectCornerTopLeft|UIRectCornerTopRight withRadii:CGSizeMake(12, 12)];
self.backgroundColor = [[UIColor colorWithHex:@"11121A"] colorWithAlphaComponent:0.88];
CGSize faceIconSize = CGSizeMake(kUserIconWidth, kUserIconWidth);
......
......@@ -30,6 +30,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
// 是否正在加入
@property (nonatomic, assign) BOOL isJoining;
@property (nonatomic, assign) BOOL localMicEnable;
// 自己是否在麦上
@property (nonatomic, assign) BOOL myselfIsOnMic;
......@@ -43,6 +45,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
// 声网连麦对方的预览 View
@property (nonatomic, strong) UIView *agoraOtherPreview;
@end
@implementation FUSAgoraHelper
......@@ -86,8 +89,12 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
/// @param mute 是否静音
/// @param uid 相关流的ID
- (void)fus_muteAudioStreams:(BOOL)mute uid:(NSString *)uid{
[self.agoraEngine muteRemoteAudioStream:uid.integerValue mute:mute];
if (uid.integerValue != FUSCacheDataShare.shareStore.userDetailInfo.uid.integerValue) {
[self.agoraEngine muteRemoteAudioStream:uid.integerValue mute:mute];
} else {
[self switchLocalMic:!mute];
}
}
- (void)fus_registNotification {
......@@ -142,7 +149,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
}else{
[self.agoraEngine disableVideo];
[self.agoraEngine enableAudio];
[self.agoraEngine enableLocalAudio:YES];
[self switchLocalMic:self.localMicEnable];
}
}
......@@ -396,21 +403,39 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
}else{
[_agoraEngine enableLocalVideo:NO];
}
[_agoraEngine enableLocalAudio:YES];
[self switchLocalMic:YES];
[self updateToSpeakerPlay];
}
- (void)fus_closeMicro{
[self fus_switchRole:AgoraClientRoleAudience];
[_agoraEngine muteLocalAudioStream:YES];
[_agoraEngine enableLocalAudio:NO];
[self switchLocalMic:NO];
[self updateToSpeakerPlay];
}
- (void)switchLocalMic:(BOOL)open{
- (void)switchLocalMic:(BOOL)open {
if ([FUSLiveHelper shareInstance].liveType == FUSLiveTypeAnchor) {
open = ![FUSLiveHelper fus_livePushMuteState];
}
// [_agoraEngine muteLocalAudioStream:!open];
[_agoraEngine enableLocalAudio:open];
/// 如果自己关麦了。不管后台传过来的是什么。都设置为NO
if (FUSLiveHelper.shareInstance.selfCloseMic) {
open = NO;
}
[_agoraEngine muteLocalAudioStream:!open];
//TODO: ludy:对应bugYBCH-28179 連麥的時候,開麥閉麥會断一下。 7580版本因为测试时间有限,先不改,下版本直接打开下面的注释,把上面的代码注释,修改测试
// [_agoraEngine enableLocalAudio:open];
self.localMicEnable = open;
}
- (void)setLocalMicEnable:(BOOL)localMicEnable {
_localMicEnable = localMicEnable;
[_agoraEngine enableLocalAudio:localMicEnable];
}
- (void)setAgoraHelperDelegate:(id<FUSAgoraHelperDelegate>)agoraHelperDelegate{
......@@ -463,7 +488,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
[_agoraEngine setChannelProfile:AgoraChannelProfileLiveBroadcasting];
[_agoraEngine enableVideo];
[_agoraEngine enableAudio];
[_agoraEngine enableLocalAudio:YES];
[self switchLocalMic:YES];
[_agoraEngine enableLocalVideo:YES];
_agoraEngine.delegate = self;
// [_agoraEngine setAudioSessionOperationRestriction:AgoraAudioSessionOperationRestrictionConfigureSession];
......@@ -741,7 +767,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
}
}
[engine enableLocalAudio:YES];
[self switchLocalMic:YES];
if (oldRole != newRole) {
[[NSNotificationCenter defaultCenter] postNotificationName:kLiveLinkMicRoleDidChanged object:nil userInfo:@{@"role":@(newRole)}];
}else{
......
......@@ -513,7 +513,8 @@
#pragma mark - getter
- (FUSEmptyView *)emptyView{
if (!_emptyView) {
_emptyView = [[FUSEmptyView alloc] initWithFrame:CGRectMake(self.width, 0, self.width, _onlineTableView.height)];
_emptyView = [[FUSEmptyView alloc] initWithFrame:CGRectMake(self.width, 0, self.width, _onlineTableView.height * 2.0 / 3.0)];
// _emptyView.contentVerticalOffset = -15;
_emptyView.backgroundColor = [UIColor clearColor];
}
return _emptyView;
......@@ -521,7 +522,8 @@
- (FUSEmptyView *)onliveEmptyView{
if (!_onliveEmptyView) {
_onliveEmptyView = [[FUSEmptyView alloc] initWithFrame:CGRectMake(0, 0, self.width, _onlineTableView.height)];
_onliveEmptyView = [[FUSEmptyView alloc] initWithFrame:CGRectMake(0, 0, self.width, _onlineTableView.height * 2.0 / 3.0)];
_onliveEmptyView.contentVerticalOffset = -15;
_onliveEmptyView.backgroundColor = [UIColor clearColor];
}
return _onliveEmptyView;
......
......@@ -1195,6 +1195,11 @@
if (![self.linkMicAgoraHelper fus_inChannel]) { //确保已加入频道
[self fus_joinChannelSuccess:^{
[weakSelf.linkMicAgoraHelper fus_switchRole:AgoraClientRoleBroadcaster];
if (!weakSelf.selfCloseMic) {
// 这里如果不先关掉再打开,他声网就会有问题,你说他辣鸡不辣鸡
[weakSelf.linkMicAgoraHelper switchLocalMic:NO];
[weakSelf.linkMicAgoraHelper switchLocalMic:YES];
}
} failure:nil];
}
......@@ -1207,6 +1212,11 @@
}else{
[FUSDialogView fus_showDialog:[NSString fus_localString:@"连麦成功"]];
}
if (!weakSelf.selfCloseMic) {
// 这里如果不先关掉再打开,他声网就会有问题,你说他辣鸡不辣鸡
[weakSelf.linkMicAgoraHelper switchLocalMic:NO];
[weakSelf.linkMicAgoraHelper switchLocalMic:YES];
}
} failure:^(NSString * _Nonnull msg, int code) {
[FUSDialogView fus_showDialog:msg];
......
......@@ -1155,15 +1155,15 @@ NSInteger const kPKMainViewAdditionHeight = 51;
_onceAgainBtn.centerX = self.width / 2;
_onceAgainBtn.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
[_onceAgainBtn addTarget:self action:@selector(clickOnceAgainBtnAction:) forControlEvents:UIControlEventTouchUpInside];
_onceAgainBtn.titleLabel.font = [UIFont fus_themeMediumFont:10];
_onceAgainBtn.titleLabel.font = [UIFont fus_themeMediumFont:14];
[_onceAgainBtn setTitle:[NSString fus_localString:@"再来一次"] forState:UIControlStateNormal];
[_onceAgainBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_onceAgainBtn sizeToFit];
_onceAgainBtn.height = 21;
_onceAgainBtn.height = 26;
_onceAgainBtn.layer.cornerRadius = 10.5;
_onceAgainBtn.layer.masksToBounds = YES;
if (_onceAgainBtn.width > 61) {
_onceAgainBtn.width = _onceAgainBtn.width + 20;
_onceAgainBtn.width = _onceAgainBtn.width + 30;
}else{
_onceAgainBtn.width = 61;
}
......
......@@ -2192,3 +2192,5 @@
"发送验证码" = "獲取驗證碼";
"私房信用:" = "私房信用:";
......@@ -2192,3 +2192,4 @@
"发送验证码" = "獲取驗證碼";
"私房信用:" = "私房信用:";
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