Commit 19dcca3a by pidan

分享相关需求

parent ae92fae4
......@@ -192,8 +192,13 @@
NSString *roomName;
NSString *roomId;
NSString *faceImgStr;
NSString *roomPassword = @"";
BOOL isPusher = FUSConfig.sharedInstanced.liveConfigs.isAnchor;
if (isPusher) {
roomPassword = FUSRouter.liveRouter.liveRoomPassword;
}
// 根据入口不同赋值
switch (fromWhere) {
case FUSLiveShareFromPrepareView:
......@@ -238,7 +243,9 @@
content = [[[[[FUSCacheDataShare shareStore]pusherShareTipsModel]content]stringByReplacingOccurrencesOfString:@"#nickname#" withString:roomName]stringByReplacingOccurrencesOfString:@"#uid#" withString:roomId];
title = [[[[[FUSCacheDataShare shareStore]pusherShareTipsModel]title]stringByReplacingOccurrencesOfString:@"#nickname#" withString:roomName]stringByReplacingOccurrencesOfString:@"#uid#" withString:roomId];
url = [[[[FUSCacheDataShare shareStore]pusherShareTipsModel]href]stringByReplacingOccurrencesOfString:@"#uid#" withString:roomId];
if ([NSString isNullWithString:roomPassword] == NO) {
url = [NSString stringWithFormat:@"%@&password=%@",url, roomPassword];
}
if ([[[[FUSCacheDataShare shareStore] pusherShareTipsModel] img] isEqualToString:@"#face#"]) {
// 请求链接不为空
......
......@@ -69,7 +69,8 @@
- (void)fus_sendLiveRoomShareWith:(FUSRoomInfoModel *)roomModel
toUser:(NSString *)userID
userFace:(NSString *)userFace
userNick:(NSString *)userNick;
userNick:(NSString *)userNick
password:(NSString *)password;
- (void)fus_loginSuccess;
......
......@@ -144,6 +144,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 上一次设置的开播密码
+ (NSString *)fus_lastLivePasswordUDKEY;
/// 已知的密码房的密码
+ (NSString *)fus_LiveRoomPasswordCacheUDKEY:(NSString *)roomId;
@end
@interface FUSLiveNotificationKeys : NSObject
......
......@@ -235,6 +235,11 @@
return @"fus_lastLivePasswordUDKEY";
}
/// 已知的密码房的密码
+ (NSString *)fus_LiveRoomPasswordCacheUDKEY:(NSString *)roomId {
return [NSString stringWithFormat:@"fus_LiveRoomPasswordCacheUDKEY_%@",roomId];
}
@end
......
......@@ -275,8 +275,18 @@ static NSString *const kGtAppSecret = @"OSSSWqbWY0ACJiUv4AHdW7";
break;//进入首页
case 1: // 进入直播间
{
NSString *password = info[@"password"];
/// 如果跳进来的时候有带密码,先将密码保存到缓存中。打开的时候弹出密码弹窗会去获取
if ([NSString isNullWithString:password] == false) {
NSString *cacheUDKey = [FUSLiveUDKeys fus_LiveRoomPasswordCacheUDKEY:userId];
[[NSUserDefaults standardUserDefaults] setValue:password forKey:cacheUDKey];
}
[FUSRouter.liveRouter fus_enterLiveRoom:userId];
break;
}
case 2: // 进入任务中心
case 4: // 进入动态内容详情页
[FUSRouter.userRouter fus_handlerUserModulePushEvent:type infor:info];
......
......@@ -1120,6 +1120,7 @@
roomName:infoModel.liveName
content:infoModel.liveDetailStr
roomCover:infoModel.iconUrl
password:infoModel.liveRoomPassword
toUser:_talkID
userFace:_talkIcon
userNick:_talkName
......@@ -1996,7 +1997,15 @@
if(roomModel.roomId == [FUSCacheDataShare shareStore].userDetailInfo.uid) {
[FUSRouter.liveRouter fus_pushLive];
return;
} else if(FUSConfig.sharedInstanced.liveConfigs.isAudience){
} else {
if ([NSString isNullWithString:frameModel.msgModel.liveRoomPassword] == false) {
NSString *cacheUDKey = [FUSLiveUDKeys fus_LiveRoomPasswordCacheUDKEY:frameModel.msgModel.liveRoomId];
[[NSUserDefaults standardUserDefaults] setValue:frameModel.msgModel.liveRoomPassword forKey:cacheUDKey];
}
}
if(FUSConfig.sharedInstanced.liveConfigs.isAudience) {
[self fus_showJumpAlertWithRoomModel:roomModel];
return;
......
......@@ -311,5 +311,6 @@ typedef NS_ENUM(NSInteger,FUSSystemNoticeType){
@property (nonatomic, copy) NSString *liveRoomId;
@property (nonatomic, copy) NSString *publishUrl;
@property (nonatomic, copy) NSString *iconUrl;
@property (nonatomic, copy) NSString *liveRoomPassword;
@end
......@@ -432,6 +432,7 @@ needRefreshGiftListBlock:(void(^)(void))needRefreshGiftListBlock;
toUser:(NSString *)userID
userFace:(NSString *)userFace
userNick:(NSString *)userNick
password:(NSString *)password
currentLastIndex:(NSInteger)currentLastIndex
begin:(void(^)(FUSChatDetailFrameModel *frameModel))begin
success:(void(^)(FUSSendMsgInfoModel *msgInfoModel,EMMessage *message))success
......@@ -443,6 +444,7 @@ needRefreshGiftListBlock:(void(^)(void))needRefreshGiftListBlock;
roomName:(NSString *)roomName
content:(NSString *)content
roomCover:(NSString *)roomCover
password:(NSString *)password
toUser:(NSString *)userID
userFace:(NSString *)userFace
userNick:(NSString *)userNick
......
......@@ -1258,6 +1258,7 @@
msgModel.liveName = infoDict[@"liveName"];
msgModel.liveDetailStr = infoDict[@"content"];
msgModel.iconUrl = infoDict[@"roomCover"];
msgModel.liveRoomPassword = infoDict[@"password"];
}
break;
default:
......@@ -2455,6 +2456,7 @@
roomName:(NSString *)roomName
content:(NSString *)content
roomCover:(NSString *)roomCover
password:(NSString *)password
toUser:(NSString *)userID
userFace:(NSString *)userFace
userNick:(NSString *)userNick
......@@ -2473,6 +2475,9 @@
infoDict[@"content"] = content;
infoDict[@"roomCover"] = roomCover;
infoDict[@"liveName"] = roomName;
if ([NSString isNullWithString:password] == false) {
infoDict[@"password"] = password;
}
cmdDict[@"cmd_msg_live"] = infoDict;
//获取对方的个人信息(陌生人和好友都有记录)
......@@ -2507,16 +2512,20 @@
toUser:(NSString *)userID
userFace:(NSString *)userFace
userNick:(NSString *)userNick
password:(NSString *)password
currentLastIndex:(NSInteger)currentLastIndex
begin:(void(^)(FUSChatDetailFrameModel *frameModel))begin
success:(void(^)(FUSSendMsgInfoModel *msgInfoModel,EMMessage *message))success
failure:(void(^)(NSInteger refreshIndex,NSString *msgID,NSString *errorMsg))failure {
NSString *liveTitle = nil;
NSString *liveContent = nil;
if ([FUSRouter.liveRouter fus_liveScopeType] == 0) {
liveTitle = [NSString fus_localString:@"我的直播開始啦"];
liveContent = [NSString fus_localString:@"房間已開好,快來一起玩耍吧"];
} else {
liveTitle = [NSString fus_localString:@"我在私密直播"];
liveTitle = [NSString fus_versionLocalString:@"我在私密屋直播"];
liveContent = [NSString fus_versionLocalString:@"需要输入密码进入直播屋"];
}
[self fus_sendLiveRoomShareWithRoomId:roomModel.roomId
pullFlowUrl:roomModel.publishUrl
......@@ -2524,6 +2533,7 @@
roomName:roomModel.nickName
content:[NSString fus_localString:@"房間已開好,快來一起玩耍吧"]
roomCover:roomModel.face
password:password
toUser:userID
userFace:userFace
userNick:userNick
......
......@@ -20,6 +20,8 @@
// 背景图片
@property (nonatomic, strong) UIImageView *bgImageView;
@property (nonatomic, strong) UIView *lineView;
// 直播间的封面
@property (nonatomic, strong) UIImageView *roomIconImageView;
......@@ -35,6 +37,9 @@
// 提示语 點擊查看>
@property (nonatomic, strong) UILabel *tipsLabel;
// 直播间的封面
@property (nonatomic, strong) UIImageView *arrowImageView;
@end
@implementation FUSIMChatLiveRoomCellView
......@@ -53,6 +58,13 @@
_roomTitleLabel.textColor = [UIColor fus_textColorRich];
_roomTitleLabel.font = title_font;
_arrowImageView = [[UIImageView alloc] initWithImage:UIImage.fus_rightArrowIcon];
_lineView = [[UIView alloc] init];
_lineView.backgroundColor = UIColor.fus_lineColor;
_roomDetailLabel = [[UILabel alloc] init];
_roomDetailLabel.numberOfLines = 0;
_roomDetailLabel.textColor = [UIColor fus_textColorMedium];
......@@ -80,6 +92,8 @@
[self.backgroundView addSubview:_clickBtn];
[self.backgroundView addSubview:_roomTitleLabel];
[self.backgroundView addSubview:_arrowImageView];
[self.backgroundView addSubview:_lineView];
[self.backgroundView addSubview:_roomDetailLabel];
[self.backgroundView addSubview:_roomIconImageView];
[self.backgroundView addSubview:_separatorLine];
......@@ -98,13 +112,39 @@
_clickBtn.frame = self.bounds;
_roomTitleLabel.frame = CGRectMake(13, 11, self.width - icon_W - 26, 15);
_roomDetailLabel.frame = CGRectMake(_roomTitleLabel.x, CGRectGetMaxY(_roomTitleLabel.frame) + 6, _roomTitleLabel.width, _roomTitleLabel.height*3);
_roomIconImageView.frame = CGRectMake(self.width - icon_W - 12, self.height - icon_W - 36, icon_W, icon_W);
CGFloat arrowSize = 18;
_arrowImageView.left = self.width - arrowSize - 8;
_arrowImageView.size = CGSizeMake(arrowSize, arrowSize);
_arrowImageView.centerY = _roomTitleLabel.centerY;
self.lineView.frame = CGRectMake(13, CGRectGetMaxY(_roomTitleLabel.frame) + 6, self.width - 26, 0.5);
_roomDetailLabel.frame = CGRectMake(_roomTitleLabel.x, CGRectGetMaxY(self.lineView.frame), _roomTitleLabel.width, _roomTitleLabel.height*3);
_roomIconImageView.frame = CGRectMake(self.width - icon_W - 12, _roomDetailLabel.y + 6, icon_W, icon_W);
if ([NSString isNullWithString:frameModel.msgModel.liveRoomPassword]) {
_tipsLabel.text = [NSString fus_localString:@"进入房间"];
[_tipsLabel sizeToFit];
_tipsLabel.x = self.width - _tipsLabel.width - 12;
_tipsLabel.y = self.height - _tipsLabel.height - 8;
} else {
_tipsLabel.text = @"";
NSString *passwordDesc = [NSString fus_versionLocalString:@"密码:"];
NSString *passwordStr = [NSString stringWithFormat:@"%@%@",passwordDesc,frameModel.msgModel.liveRoomPassword];
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:passwordStr attributes:@{NSForegroundColorAttributeName:messageBgColor, NSFontAttributeName:tips_font}];
NSRange range = [passwordStr rangeOfString:frameModel.msgModel.liveRoomPassword];
if (range.location != kCFNotFound) {
[attr addAttributes:@{NSForegroundColorAttributeName:UIColor.fus_themeColor} range:range];
}
self.tipsLabel.attributedText = attr;
[_tipsLabel sizeToFit];
_tipsLabel.x = 13;
_tipsLabel.y = self.height - _tipsLabel.height - 8;
}
_separatorLine.frame = CGRectMake(10, _tipsLabel.y - 5, self.width - 10*2, 1);
......
......@@ -158,8 +158,9 @@
- (void)fus_sendLiveRoomShareWith:(FUSRoomInfoModel *)roomModel
toUser:(NSString *)userID
userFace:(NSString *)userFace
userNick:(NSString *)userNick {
[[FUSIMChatService shareInstance] fus_sendLiveRoomShareWith:roomModel toUser:userID userFace:userFace userNick:userNick currentLastIndex:0 begin:nil success:nil failure:nil];
userNick:(NSString *)userNick
password:(NSString *)password {
[[FUSIMChatService shareInstance] fus_sendLiveRoomShareWith:roomModel toUser:userID userFace:userFace userNick:userNick password:password currentLastIndex:0 begin:nil success:nil failure:nil];
}
- (void)fus_loginSuccess {
......
......@@ -1059,16 +1059,17 @@ UIGestureRecognizerDelegate
[self initPusherActivityView];
[self initPusherTableView];
[self fus_updateRewardViewIfNeeded];
}
- (void)fus_updateRewardViewIfNeeded {
if (!self.anchorRewardView.superview) {
__weak typeof(self) weakSelf = self;
[FusAnchorRewardView fus_showAnchorRewardViewIfNeeded:^(FusAnchorRewardView * _Nonnull view) {
view.y = weakSelf.pusherPopularView.bottom;
weakSelf.anchorRewardView = view;
}];
}
}
/**
......
......@@ -327,7 +327,7 @@
[dict enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, FUSLiveShareToChatModel *_Nonnull model, BOOL * _Nonnull stop) {
[FUSRouter.chatRouter fus_sendLiveRoomShareWith:roomModel toUser:model.uid userFace:model.face userNick:model.nickname];
[FUSRouter.chatRouter fus_sendLiveRoomShareWith:roomModel toUser:model.uid userFace:model.face userNick:model.nickname password:roomModel.encryptionData.password];
}];
[FUSLoadingView fus_dismissProgressView];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"分享成功"]];
......
......@@ -30,7 +30,9 @@ import RxSwift
guard let showVC = UINavigationController.fus_top() else { return }
let view = FUSLiveStartSetPasswordView(frame: showVC.view.bounds, isAudience: true, password: "")
let password = UserDefaults.standard.string(forKey: FUSLiveUDKeys.fus_LiveRoomPasswordCacheUDKEY(FUSLiveHelper.shareInstance().roomInfoModel?.roomId ?? "")) ?? ""
let view = FUSLiveStartSetPasswordView(frame: showVC.view.bounds, isAudience: true, password: password)
view.clickWithSucceedHandler = { succeed, password in
clickHandler(succeed, password)
}
......@@ -169,6 +171,8 @@ import RxSwift
if let roomModel = FUSLiveHelper.shareInstance().roomInfoModel {
FUSLiveHttpHelper.fus_verifyPassword(withRoomId: roomModel.roomId, password: newPassword) { dic in
let cacheUDKey = FUSLiveUDKeys.fus_LiveRoomPasswordCacheUDKEY(FUSLiveHelper.shareInstance().roomInfoModel?.roomId ?? "")
UserDefaults.standard.setValue(newPassword, forKey: cacheUDKey)
self.clickWithSucceedHandler?(true, newPassword)
self.fus_dismissWithAnimation()
......
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