Commit 3ace3508 by pidan

备份代码

parent 0fe6d701
Showing with 729 additions and 76 deletions
......@@ -82,7 +82,7 @@
#define ROOM_CID_LIKE 11003 // 点赞
#define ROOM_CID_LIVE_STATU 11004 // 直播状态改变
#define ROOM_CID_RECOMMEND_ANCHOR_LIVE_STATU 11005 // 推荐的主播直播状态
#define ROOM_CID_LIVE_SCOPE_DID_CHANGED 11008 // 切换直播范围
#define ROOM_CID_LIVE_SCOPE_DID_CHANGED 11017 // 切换直播范围
#define ROOM_CID_LIVE_ROOM_TYPE_CHANGED 11009 // 切换直播类型
#define ROOM_CID_BECOME_FANS_GROUP_MEMBER 11010 // 用户成为粉丝团成员
#define ROOM_CID_RoomPopularChanged 11019 // 人气值变化消息
......
......@@ -141,6 +141,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 上一次开播的标题
+ (NSString *)fus_lastLiveTitleUDKey;
/// 上一次设置的开播密码
+ (NSString *)fus_lastLivePasswordUDKEY;
@end
@interface FUSLiveNotificationKeys : NSObject
......
......@@ -230,6 +230,11 @@
return @"fus_lastLiveTitleUDKey";
}
/// 上一次设置的开播密码
+ (NSString *)fus_lastLivePasswordUDKEY {
return @"fus_lastLivePasswordUDKEY";
}
@end
......
......@@ -48,6 +48,8 @@ NS_ASSUME_NONNULL_BEGIN
/// 封面地址的icon
-(UIImage *)liveSmallCellAdressIcon;
- (NSString *)liveRoomPassword;
#pragma mark - Views
- (FUSPublicLiveGiftSendView *)fus_createLiveGiftSendViewWithFrame:(CGRect)frame;
- (FUSPublicVideoChatUserInfoView *)fus_createVideoChatUserInfoView;
......
......@@ -17,6 +17,21 @@
@end
@interface FUSRoomEncryptionData : FUSBaseModel
/// 初始密码
@property (nonatomic, copy) NSString *password;
/// 初始密码描述
@property (nonatomic, copy) NSString *passwordShow;
/// 开启公开房(-1:受限)
@property (nonatomic, copy) NSString *liveScopeOpen;
/// 受限提示文案
@property (nonatomic, copy) NSString *liveScopeOpenShow;
@end
@interface FUSRoomInfoModel : FUSBaseModel
@property (nonatomic, copy) NSString *bonds; // 主播的萤火
......@@ -91,6 +106,9 @@
/// 直播主题信息
@property (nonatomic, strong) FUSLiveThemeModel *theme;
/// 私享房信息
@property (nonatomic, strong) FUSRoomEncryptionData *encryptionData;
@property (nonatomic, copy) NSArray<NSString *> *reminderKeys;
- (void)fus_setModelWithMyRoomInfos;
......
......@@ -38,7 +38,7 @@
//嵌套的 model
+ (NSDictionary *)modelContainerPropertyGenericClass {
return @{@"stateSwitch":[FUSLiveRoomStateSwitchModel class], @"theme":[FUSLiveThemeModel class]};
return @{@"stateSwitch":[FUSLiveRoomStateSwitchModel class], @"theme":[FUSLiveThemeModel class], @"encryptionData":[FUSRoomEncryptionData class]};
}
......@@ -47,3 +47,7 @@
@implementation FUSLiveRoomStateSwitchModel
@end
@implementation FUSRoomEncryptionData
@end
......@@ -1414,6 +1414,7 @@
BEF678162C6B156600A670FB /* live_treasure_box_bg_img.png in Resources */ = {isa = PBXBuildFile; fileRef = BEF675EE2C6B156500A670FB /* live_treasure_box_bg_img.png */; };
BEF678172C6B156600A670FB /* live_userinfo_level_secrect.png in Resources */ = {isa = PBXBuildFile; fileRef = BEF675EF2C6B156500A670FB /* live_userinfo_level_secrect.png */; };
C50E4ED36D48026661F4283F /* Pods_FUSShowRoomModule.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B8B2CC1956F16144828BF43D /* Pods_FUSShowRoomModule.framework */; };
D2C6D57E2DFAB63200FB58E0 /* FUSLiveStartSetPasswordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2C6D57D2DFAB63200FB58E0 /* FUSLiveStartSetPasswordView.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
......@@ -2830,6 +2831,7 @@
BEF675ED2C6B156500A670FB /* live_pk_background_image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = live_pk_background_image.png; sourceTree = "<group>"; };
BEF675EE2C6B156500A670FB /* live_treasure_box_bg_img.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = live_treasure_box_bg_img.png; sourceTree = "<group>"; };
BEF675EF2C6B156500A670FB /* live_userinfo_level_secrect.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = live_userinfo_level_secrect.png; sourceTree = "<group>"; };
D2C6D57D2DFAB63200FB58E0 /* FUSLiveStartSetPasswordView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartSetPasswordView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -3368,6 +3370,7 @@
BEEAB25F2D34CC60008CD059 /* FUSLiveStartContentThemeEditView.swift */,
BEEAB2602D34CC60008CD059 /* FUSLiveStartContentWarningView.swift */,
BEEAB2612D34CC60008CD059 /* FUSLiveStartSetPrivacyView.swift */,
D2C6D57D2DFAB63200FB58E0 /* FUSLiveStartSetPasswordView.swift */,
BEEAB2622D34CC60008CD059 /* FUSLiveStartView.swift */,
BEB5043C2D2E53E300EA6E6F /* FUSVideoStartSetThemeItemCell.h */,
BEB5043D2D2E53E300EA6E6F /* FUSVideoStartSetThemeItemCell.m */,
......@@ -6899,6 +6902,7 @@
00A3AB712CB665EA007646E1 /* FUSLiveQuickChatSetCell.m in Sources */,
00B90AD22CA5072100BE935B /* FUSPatAudienceGiftCell.swift in Sources */,
BED6590D2C5B745E00668116 /* FUSLiveChatToolGiftTipView.m in Sources */,
D2C6D57E2DFAB63200FB58E0 /* FUSLiveStartSetPasswordView.swift in Sources */,
BE189DBE2C733B460008418B /* FSRShowRoomEffectRecommondModel.m in Sources */,
BED65A082C5B745F00668116 /* FUSPKEmptyView.m in Sources */,
BED659D32C5B745F00668116 /* FUSPKInfoModel.m in Sources */,
......
......@@ -290,6 +290,7 @@
BOOL isSelected = [naviView fus_isButtonSelected:FUSHomeNaviViewClickTypeFollow];
FUSHomeViewAnchorListType turnToType = isSelected ? FUSHomeViewAnchorListTypeNormal : FUSHomeViewAnchorListTypeFollow;
//如果跳转到的状态被判定为必须刷新的,那么就直接刷新,后续如果需要刷新普通列表的也在这里添加||判定就好
if (turnToType == FUSHomeViewAnchorListTypeFollow && self.followNeedUpdate) {
......@@ -399,6 +400,12 @@
}
}
} else if (type == FUSHomeViewAnchorListTypeFollow && isLastSelected == NO) {
//上一次是普通,然后点了追踪
[FUSDialogView fus_showDialog:[NSString fus_versionLocalString:@"您已切换至关注主播再次点击可恢复全部"]];
} else if (type == FUSHomeViewAnchorListTypeNormal && isLastSelected == YES) {
//上一次是追踪,然后点了普通
[FUSDialogView fus_showDialog:[NSString fus_versionLocalString:@"您已切换至全部主播再次点击可恢复关注"]];
}
}
......
......@@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
/// 直播预告状态 0:未设置 1:已设置
@property (nonatomic, assign) NSInteger previewLive;
@property (nonatomic, strong) FUSRoomEncryptionData *encryptionData;
@end
NS_ASSUME_NONNULL_END
......@@ -10,7 +10,7 @@
@implementation FUSLiveBeforeReadyModel
+ (NSDictionary *)modelContainerPropertyGenericClass {
return @{@"beforeLiveCond": [FUSBeforeLiveCondModel class]};
return @{@"beforeLiveCond": [FUSBeforeLiveCondModel class],@"encryptionData":[FUSRoomEncryptionData class]};
}
@end
......@@ -63,9 +63,10 @@ typedef NS_ENUM(NSInteger,FUSbarrageType) {
};
typedef NS_ENUM(NSInteger,FUSLiveRoomScopeType) {
FUSLiveRoomScopeTypeOpen = 0, // 全公开
FUSLiveRoomScopeTypeFollow, // 追踪圈
FUSLiveRoomScopeTypeIntimacy, // 亲密圈
FUSLiveRoomScopeTypeOpen = 0, // 公开屋
FUSLiveRoomScopeTypePassword = 4, // 私享屋
// FUSLiveRoomScopeTypeFollow, // 追踪圈
// FUSLiveRoomScopeTypeIntimacy, // 亲密圈
};
......
......@@ -132,9 +132,10 @@
NSString *roomId = dict[@"roomId"];
if (roomId.integerValue == self.roomInfoModel.roomId.integerValue) {
NSInteger liveScope = [dict[@"liveScope"] integerValue];
self.roomScopeType = liveScope;
NSInteger liveScope = [dict[@"mode"] integerValue];
self.roomScopeType = liveScope == 1 ? FUSLiveRoomScopeTypePassword : FUSLiveRoomScopeTypeOpen;
}
}
/**
......@@ -445,6 +446,10 @@
[[[FUSLiveHelper shareInstance] roomInfoModel] fus_setModelWithMyRoomInfos];
}
FUSRoomEncryptionData *data = model.encryptionData;
[FUSLiveHelper shareInstance].roomInfoModel.encryptionData = data;
[[FUSLiveHelper shareInstance] initLiveViewController];
[[[FUSLiveHelper shareInstance] liveVC] initPushPrepareView];
[self fus_showLiveMainVCAnimation:YES Completion:nil];
......
......@@ -169,13 +169,25 @@ NS_ASSUME_NONNULL_BEGIN
success:(void(^)(void))success
failure:(void(^)(NSString *, int))failure;
///// 切换直播范围
///// @param fid 当前主播的id
///// @param liveScope 直播范围 0:全公开、1:追踪圈、2:亲密圈
///// @param success 成功回调
///// @param failure 失败回调
//+ (void)fus_requestChangeLiveScope:(NSInteger)liveScope
// liveId:(NSInteger)liveId
// success:(void (^)(void))success
// failure:(void (^)(NSString *msg, int code))failure;
/// 切换直播范围
/// @param fid 当前主播的id
/// @param liveScope 直播范围 0:全公开、1:追踪圈、2:亲密圈
/// @param cancel 取消状态 0:否 1:是
/// @param password 密码(cancel=0必传)
/// @param success 成功回调
/// @param failure 失败回调
+ (void)fus_requestChangeLiveScope:(NSInteger)liveScope
liveId:(NSInteger)liveId
+ (void)fus_requestChangedPassword:(NSInteger)cancel
fid:(NSInteger)fid
password:(NSString *)password
success:(void (^)(void))success
failure:(void (^)(NSString *msg, int code))failure;
......
......@@ -577,10 +577,16 @@
return;
}
NSString *password = @"";
if (liveScope == 4) {
password = FUSRouter.liveRouter.liveRoomPassword;
}
NSDictionary *params = @{@"vdoid":vdoid,
@"livingType":@"0",
@"liveWay":livingWay,
@"liveScope":@(liveScope),
@"password":password,
@"roomid":roomId};
// params = [self addSocketParameterForDict:params];
......@@ -2141,19 +2147,45 @@
}
///// 切换直播范围
///// @param fid 当前主播的id
///// @param liveScope 直播范围 0:全公开、1:追踪圈、2:亲密圈
///// @param success 成功回调
///// @param failure 失败回调
//+ (void)fus_requestChangeLiveScope:(NSInteger)liveScope
// liveId:(NSInteger)liveId
// success:(void (^)(void))success
// failure:(void (^)(NSString *msg, int code))failure {
//
// NSDictionary *params = @{@"fid":@(liveId),@"liveScope":@(liveScope)};
//
// [FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_LIVE_CHANGE_LIVE_SCOPE params:params success:^(NSDictionary *dataDict, int code) {
// [[FUSLiveHelper shareInstance].currentFunctionView fus_startRecordLiveTimeWithTime:dataDict[@"livetime"]];
// if (success) {
// success();
// }
// } failure:^(NSDictionary *dataDict, int code) {
// if (failure) {
// failure(dataDict[@"msg"],code);
// }
// }];
//}
/// 切换直播范围
/// @param fid 当前主播的id
/// @param liveScope 直播范围 0:全公开、1:追踪圈、2:亲密圈
/// @param cancel 取消状态 0:否 1:是
/// @param password 密码(cancel=0必传)
/// @param success 成功回调
/// @param failure 失败回调
+ (void)fus_requestChangeLiveScope:(NSInteger)liveScope
liveId:(NSInteger)liveId
+ (void)fus_requestChangedPassword:(NSInteger)cancel
fid:(NSInteger)fid
password:(NSString *)password
success:(void (^)(void))success
failure:(void (^)(NSString *msg, int code))failure {
NSDictionary *params = @{@"fid":@(liveId),@"liveScope":@(liveScope)};
NSDictionary *params = @{@"fid":@(fid),@"cancel":@(cancel),@"password":password};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_LIVE_CHANGE_LIVE_SCOPE params:params success:^(NSDictionary *dataDict, int code) {
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_LIVE_CHANGE_Password params:params success:^(NSDictionary *dataDict, int code) {
[[FUSLiveHelper shareInstance].currentFunctionView fus_startRecordLiveTimeWithTime:dataDict[@"livetime"]];
if (success) {
success();
......
......@@ -34,6 +34,10 @@
return;
}
if (FUSLiveHelper.shareInstance.roomScopeType != FUSLiveRoomScopeTypeOpen) {
return;
}
[FUSLiveHttpHelper fus_getLiveBeforeInfosWithSucceed:^(NSDictionary * _Nonnull publicizeConfig, NSDictionary * _Nonnull gasStationConfig) {
if ([NSDictionary isNull:gasStationConfig]) {
......
......@@ -516,9 +516,13 @@
- (void)ffupdateToolView2TypesPKState:(FUSPKLiveState)pkState {
if (FUSLiveHelper.shareInstance.liveRoomType == FUSRoomTypeLinkMic) {
[self.toolView2 showItemWithTypesWithToolTypes:@[@(FUSLiveBottomToolTypeLiveSetting),@(FUSLiveBottomToolTypeRoomSetting),@(FUSLiveBottomToolTypeRoomScope)/*, @(FUSLiveBottomToolTypeNovaBuild)*/]];
[self.toolView2 showItemWithTypesWithToolTypes:@[@(FUSLiveBottomToolTypeLiveSetting),@(FUSLiveBottomToolTypeRoomSetting)/*,@(FUSLiveBottomToolTypeRoomScope), @(FUSLiveBottomToolTypeNovaBuild)*/]];
} else {
[self.toolView2 showItemWithTypesWithToolTypes:@[@(FUSLiveBottomToolTypeLiveSetting),@(FUSLiveBottomToolTypeRoomSetting), @(FUSLiveBottomToolTypeRoomScope),@(FUSLiveBottomToolTypePK)/*, @(FUSLiveBottomToolTypeNovaBuild)*/]];
if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) {
[self.toolView2 showItemWithTypesWithToolTypes:@[@(FUSLiveBottomToolTypeLiveSetting),@(FUSLiveBottomToolTypeRoomSetting), /*@(FUSLiveBottomToolTypeRoomScope),@(FUSLiveBottomToolTypePK), @(FUSLiveBottomToolTypeNovaBuild)*/]];
} else {
[self.toolView2 showItemWithTypesWithToolTypes:@[@(FUSLiveBottomToolTypeLiveSetting),@(FUSLiveBottomToolTypeRoomSetting), /*@(FUSLiveBottomToolTypeRoomScope),*/@(FUSLiveBottomToolTypePK)/*, @(FUSLiveBottomToolTypeNovaBuild)*/]];
}
}
}
......
......@@ -192,6 +192,8 @@ typedef NS_ENUM(NSUInteger, FUSLiveChatToolBeautyType) { //美颜工具按钮
- (void)fus_cleanBottomToolView;
- (void)fus_updateRoomScoreType;
@end
NS_ASSUME_NONNULL_END
......@@ -57,6 +57,8 @@
@property (nonatomic, strong) UIButton *inputChatBtn;
@property (nonatomic, strong) UIButton *roomScopeBtn;
@property (nonatomic, strong) UIButton *linkMicroBtn;
@property (nonatomic, strong) UIButton *msgBoxBtn;
......@@ -130,6 +132,7 @@
_allBtnTypes = [NSMutableArray arrayWithArray:@[@(FUSLiveBottomToolTypeMessage),
@(FUSLiveBottomToolTypeBeauty),
@(FUSLiveBottomToolTypeBeautySticker),
// @(FUSLiveBottomToolTypeRoomScope),
@(FUSLiveBottomToolTypeGift)]];
_divisionBtnType = FUSLiveBottomToolTypeBeautySticker;
}else{
......@@ -137,8 +140,9 @@
@(FUSLiveBottomToolTypeShare),
@(FUSLiveBottomToolTypeTool2),
@(FUSLiveBottomToolTypeBeautySticker),
@(FUSLiveBottomToolTypeRoomScope),
@(FUSLiveBottomToolTypeGift)]];
_divisionBtnType = FUSLiveBottomToolTypeBeautySticker;
_divisionBtnType = FUSLiveBottomToolTypeRoomScope;
}
......@@ -168,6 +172,7 @@
if (self.viewType == FUSLiveBottomViewTypeHost) {
[self fus_removeBtnWithType:FUSLiveBottomToolTypeBeautySticker];
[self fus_removeBtnWithType:FUSLiveBottomToolTypeRoomScope];
}
......@@ -512,12 +517,31 @@
btn = self.interactionGameBtn;
break;
case FUSLiveBottomToolTypeRoomScope:
[self fus_updateRoomScoreType];
btn = self.roomScopeBtn;
break;
default:
break;
}
return btn;
}
- (void)fus_updateRoomScoreType {
UIImage *image;
//TODO: 修改图片
if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) {
image = [FUSShowRoomCenterBunble imageNamed:@"live_RoomScope_intimate_normal"];
} else {
image = [FUSShowRoomCenterBunble imageNamed:@"live_RoomScope_normal"];
}
[self.roomScopeBtn setImage:image forState:UIControlStateNormal];
}
- (void)fus_updateBtnImageWithType:(FUSLiveBottomToolType)type image:(UIImage *)image state:(UIControlState *)state{
for (UIButton *btn in _allBtns) {
......@@ -649,7 +673,7 @@
if (FUSLiveHelper.shareInstance.liveRoomType == FUSRoomTypeLinkMic) {
lastIndex = FUSLiveBottomToolTypeTool2;
} else {
lastIndex = FUSLiveBottomToolTypeBeautySticker;
lastIndex = FUSLiveBottomToolTypeRoomScope;
}
} else {
lastIndex = FUSLiveBottomToolTypeShare;
......@@ -762,7 +786,7 @@
if (FUSLiveHelper.shareInstance.liveRoomType == FUSRoomTypeLinkMic) {
_divisionBtnType = FUSLiveBottomToolTypeTool2;
} else {
_divisionBtnType = FUSLiveBottomToolTypeBeautySticker;
_divisionBtnType = FUSLiveBottomToolTypeRoomScope;
}
}else{
_divisionBtnType = FUSLiveBottomToolTypeShare;
......@@ -934,8 +958,9 @@
@(FUSLiveBottomToolTypeShare),
@(FUSLiveBottomToolTypeTool2),
@(FUSLiveBottomToolTypeBeautySticker),
@(FUSLiveBottomToolTypeRoomScope),
@(FUSLiveBottomToolTypeGift)]];
_divisionBtnType = FUSLiveBottomToolTypeBeautySticker;
_divisionBtnType = FUSLiveBottomToolTypeRoomScope;
}
} else {
......@@ -1110,6 +1135,17 @@
}
- (UIButton *)roomScopeBtn {
if (!_roomScopeBtn) {
_roomScopeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_roomScopeBtn.tag = FUSLiveBottomToolTypeRoomScope;
}
return _roomScopeBtn;
}
- (UIButton *)taskBtn{
if (!_taskBtn) {
_taskBtn = [UIButton buttonWithType:UIButtonTypeCustom];
......
......@@ -121,7 +121,7 @@ public class FUSLiveChatInputToolView: UIView {
// 房间类型
roomTypeView = fus_createItemViewWithToolType(toolType: FUSLiveBottomToolTypeRoomScope, withSize: CGSize(width: itemWith, height: buttomViewHeight))
roomTypeView.x = liveSettingView.frame.maxX
toolViews.append(roomTypeView)
// toolViews.append(roomTypeView)
// pk
pkView = fus_createItemViewWithToolType(toolType: FUSLiveBottomToolTypePK, withSize: CGSize(width: itemWith, height: buttomViewHeight))
......@@ -196,9 +196,9 @@ public class FUSLiveChatInputToolView: UIView {
@objc public func fus_showToolViewWithClickHandler(handler:(@escaping (_ type: FUSLiveBottomToolType)->Void)) {
if toolViewType == FUSLiveBottomToolTypeTool2 {
fus_updateRoomTypeView()
}
// if toolViewType == FUSLiveBottomToolTypeTool2 {
// fus_updateRoomTypeView()
// }
UIView.animate(withDuration: 0.1) {
self.buttomView?.y = self.height - (self.buttomView?.height ?? buttomViewHeight)
......@@ -337,18 +337,18 @@ public class FUSLiveChatInputToolView: UIView {
case .open:
itemBtn.setImage(FUSShowRoomCenterBunble.imageNamed("live_RoomScope_normal"), for: UIControl.State.normal)
itemBtn.setImage(FUSShowRoomCenterBunble.imageNamed("live_RoomScope_preesed"), for: UIControl.State.highlighted)
titleLb.text = NSString.fus_localString("全公开")
titleLb.text = NSString.fus_localString("公开屋")
break
case .follow:
case .password:
itemBtn.setImage(FUSShowRoomCenterBunble.imageNamed("live_RoomScope_focus_normal"), for: UIControl.State.normal)
itemBtn.setImage(FUSShowRoomCenterBunble.imageNamed("live_RoomScope_focus_preesed"), for: UIControl.State.highlighted)
titleLb.text = NSString.fus_localString("追踪圈")
break
case .intimacy:
itemBtn.setImage(FUSShowRoomCenterBunble.imageNamed("live_RoomScope_intimate_normal"), for: UIControl.State.normal)
itemBtn.setImage(FUSShowRoomCenterBunble.imageNamed("live_RoomScope_intimate_preesed"), for: UIControl.State.highlighted)
titleLb.text = NSString.fus_localString("亲密圈")
titleLb.text = NSString.fus_localString("私享屋")
break
// case .intimacy:
// itemBtn.setImage(FUSShowRoomCenterBunble.imageNamed("live_RoomScope_intimate_normal"), for: UIControl.State.normal)
// itemBtn.setImage(FUSShowRoomCenterBunble.imageNamed("live_RoomScope_intimate_preesed"), for: UIControl.State.highlighted)
// titleLb.text = NSString.fus_localString("亲密圈")
// break
default:
break
}
......
......@@ -313,6 +313,8 @@ UIGestureRecognizerDelegate
@property (nonatomic, strong) FUSLiveEndChangeLinkMicModeView *changeView;
@property (nonatomic, weak) FusAnchorRewardView *anchorRewardView;
@property (nonatomic, assign) CGRect activityChangeFrame;
/// 半屏网页的管理,内部全是弱引用,放心添加网页
......@@ -1036,9 +1038,15 @@ UIGestureRecognizerDelegate
[self initPusherActivityView];
[self initPusherTableView];
[self fus_updateRewardViewIfNeeded];
}
- (void)fus_updateRewardViewIfNeeded {
__weak typeof(self) weakSelf = self;
[FusAnchorRewardView fus_showAnchorRewardViewIfNeeded:^(FusAnchorRewardView * _Nonnull view) {
view.y = weakSelf.pusherPopularView.bottom;
weakSelf.anchorRewardView = view;
}];
}
......@@ -5758,14 +5766,21 @@ UIGestureRecognizerDelegate
switch (FUSLiveHelper.shareInstance.roomScopeType) {
case FUSLiveRoomScopeTypeOpen:
[_liveTimeRecordView fus_updateRoomScopeTypeImage:[FUSShowRoomCenterBunble imageNamed:@"live_push_live_time_bg_open_scope"]];
[self fus_updateRewardViewIfNeeded];
break;
case FUSLiveRoomScopeTypeFollow:
case FUSLiveRoomScopeTypePassword:
[_liveTimeRecordView fus_updateRoomScopeTypeImage:[FUSShowRoomCenterBunble imageNamed:@"live_push_live_time_bg_follow_scope"]];
[self.anchorRewardView removeFromSuperview];
self.anchorRewardView = nil;
break;
case FUSLiveRoomScopeTypeIntimacy:
[_liveTimeRecordView fus_updateRoomScopeTypeImage:[FUSShowRoomCenterBunble imageNamed:@"live_push_live_time_bg_intimate_scope"]];
break;
// case FUSLiveRoomScopeTypeIntimacy:
// [_liveTimeRecordView fus_updateRoomScopeTypeImage:[FUSShowRoomCenterBunble imageNamed:@"live_push_live_time_bg_intimate_scope"]];
// break;
}
[self.bottomToolView fus_updateRoomScoreType];
}
- (void)fus_setAnchorAudioClose:(BOOL)closed {
......
......@@ -118,8 +118,8 @@
case FUSLiveRoomScopeTypeOpen:
[self fus_requestRecentlyChat];
break;
case FUSLiveRoomScopeTypeFollow:
case FUSLiveRoomScopeTypeIntimacy:
case FUSLiveRoomScopeTypePassword:
// case FUSLiveRoomScopeTypeIntimacy:
[self fus_refreshFriendDatas];
break;
}
......@@ -129,8 +129,8 @@
switch ([FUSLiveHelper shareInstance].roomScopeType) {
case FUSLiveRoomScopeTypeOpen:
break;
case FUSLiveRoomScopeTypeFollow:
case FUSLiveRoomScopeTypeIntimacy:
case FUSLiveRoomScopeTypePassword:
// case FUSLiveRoomScopeTypeIntimacy:
[self fus_loadMoreFriendDatas];
break;
}
......@@ -214,12 +214,12 @@
}
switch ([FUSLiveHelper shareInstance].roomScopeType) {
case FUSLiveRoomScopeTypeFollow:
[FUSLiveShareHttpHelper fus_requestShareUserLikeFollowListWithPage:self.page
success:success
failure:failure];
break;
case FUSLiveRoomScopeTypeIntimacy:
case FUSLiveRoomScopeTypePassword:
// [FUSLiveShareHttpHelper fus_requestShareUserLikeFollowListWithPage:self.page
// success:success
// failure:failure];
// break;
// case FUSLiveRoomScopeTypeIntimacy:
[FUSLiveShareHttpHelper fus_requestShareIntimateFriendListWithPage:self.page
success:success
failure:failure];
......
......@@ -42,15 +42,14 @@ import FUSCommon
switch type{
case .open:
self.privacyImageView.image = FUSShowRoomCenterBunble.imageNamed("live_start_openScope_img")
self.privacyLabel.text = .fus_localString("全公开")
case .follow:
self.privacyLabel.text = .fus_versionLocalString("公开屋")
case .password:
self.privacyImageView.image = FUSShowRoomCenterBunble.imageNamed("live_start_followScope_img")
self.privacyLabel.text = .fus_localString("追踪圈")
case .intimacy:
self.privacyImageView.image = FUSShowRoomCenterBunble.imageNamed("live_start_intimacyScope_img")
self.privacyLabel.text = .fus_localString("私密圈")
self.privacyLabel.text = .fus_versionLocalString("私享屋")
// case .intimacy:
//
// self.privacyImageView.image = FUSShowRoomCenterBunble.imageNamed("live_start_intimacyScope_img")
// self.privacyLabel.text = .fus_localString("私密圈")
@unknown default:
break
}
......
//
// FUSLiveStartSetPasswordView.swift
// FUSShowRoomModule
//
// Created by pppidan on 2025/6/12.
//
import UIKit
import RxSwift
class FUSLiveStartSetPasswordView: UIView {
///可以用这个快速创建,本身内部不请求改变房间类型,用于开播前
static public func fus_create(clickHandler: @escaping (_ password: String) -> Void){
guard let showVC = UINavigationController.fus_top() else { return }
let view = FUSLiveStartSetPasswordView(frame: showVC.view.bounds)
view.clickHandler = { password in
clickHandler(password)
}
showVC.view.addSubview(view)
view.fus_showWithAnimation()
}
let disposeBag = DisposeBag()
var clickHandler:((String)->Void)?
var password:String = ""
let contentViewHeight = 230 + UIView.fus_SafeBottom()
let contentView = FUSPanGestureAlertView(frame: CGRectMake(0, 0, UIView.fus_screenW(), 230))
let titleLabel = UILabel()
let passwordView = FUSPinCodeInputView(frame: .init(x: 0, y: 0, width: 250, height: 60))
let submitBtn = UIButton(type: .custom)
private var originalContentViewY: CGFloat = 0.0
public override init(frame: CGRect) {
super.init(frame: frame)
self.password = FUSRouter.live().liveRoomPassword()
let tapBgView = UIButton(type: .custom)
self.addSubview(tapBgView)
tapBgView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
contentView.frame = CGRectMake(0, UIView.fus_screenH(), UIView.fus_screenW(), contentViewHeight)
contentView.backgroundColor = .fus_appBG().withAlphaComponent(0.94)
contentView.addRoundedCorners(UIRectCorner(rawValue: UIRectCorner(rawValue: UIRectCorner.topRight.rawValue | UIRectCorner.topLeft.rawValue).rawValue), withRadii: CGSizeMake(14, 14))
tapBgView.addSubview(contentView)
titleLabel.font = .fus_themeFont(16)
titleLabel.textColor = .fus_textColorRich()
titleLabel.text = .fus_versionLocalString("设置私享屋密码")
contentView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(30)
make.centerX.equalToSuperview()
}
contentView.addSubview(self.passwordView)
self.passwordView.fus_setText(password)
self.passwordView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(self.titleLabel.snp.bottom).offset(10)
make.height.equalTo(60)
make.width.equalTo(300)
}
let tipLabel = UILabel()
tipLabel.font = .fus_themeFont(13)
tipLabel.textColor = .fus_textColorLight2()
tipLabel.text = FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData.passwordShow
contentView.addSubview(tipLabel)
tipLabel.snp.makeConstraints { make in
make.top.equalTo(self.passwordView.snp.bottom).offset(10)
make.centerX.equalToSuperview()
}
self.submitBtn.layer.cornerRadius = 38.0 / 2.0
self.submitBtn.backgroundColor = .fus_theme()
self.submitBtn.setTitle(.fus_localString("确定"), for: .normal)
self.submitBtn.titleLabel?.font = .fus_themeFont(14)
self.submitBtn.setTitleColor(.fus_textColorRich(), for: .normal)
self.contentView.addSubview(self.submitBtn)
self.submitBtn.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.width.equalToSuperview().multipliedBy(205.0 / 375.0)
make.height.equalTo(38)
make.top.equalTo(tipLabel.snp.bottom).offset(10)
}
tapBgView.rx.tap.subscribe(onNext: {[weak self] in
self?.fus_dismissWithAnimation()
}).disposed(by: disposeBag)
submitBtn.rx.tap.subscribe(onNext: {[weak self] in
guard let self = self else { return }
let newPassword = self.passwordView.fus_getText()
if newPassword.count < 4 {
FUSDialogView.fus_showDialog(.fus_versionLocalString("私享屋密码必须为4位"))
} else {
let uid = FUSCacheDataShare.shareStore().userDetailInfo.uid ?? ""
let userDefaults = UserDefaults.init(suiteName: uid)
userDefaults?.set(newPassword, forKey: FUSLiveUDKeys.fus_lastLivePasswordUDKEY())
self.passwordView.endEditing(true)
self.password = newPassword
self.fus_dismissWithAnimation()
}
}).disposed(by: disposeBag)
contentView.hasSlidedToCloseHandler = {[weak self] in
self?.fus_dismissWithAnimation()
}
NotificationCenter.default.addObserver(self, selector: #selector(fus_keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(fus_keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func fus_showWithAnimation(){
UIView.animate(withDuration: 0.3) {
self.contentView.frame = CGRectMake(0, UIView.fus_screenH() - self.contentViewHeight, UIView.fus_screenW(), self.contentViewHeight)
}
}
func fus_dismissWithAnimation(){
self.clickHandler?(self.password)
UIView.animate(withDuration: 0.3) {
self.contentView.y = UIView.fus_screenH()
} completion: { _ in
self.removeFromSuperview()
}
}
@objc private func fus_keyboardWillShow(_ notification: Notification) {
guard let userInfo = notification.userInfo,
let keyboardFrame = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect,
let duration = userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double,
let curve = userInfo[UIResponder.keyboardAnimationCurveUserInfoKey] as? UInt else {
return
}
// 记录原始位置
originalContentViewY = contentView.y
// 计算需要上移的距离
let keyboardHeight = keyboardFrame.height
let targetY = originalContentViewY - keyboardHeight + UIView.fus_SafeBottom()
// 动画移动 contentView
UIView.animate(withDuration: duration, delay: 0, options: .init(rawValue: curve), animations: {
self.contentView.y = targetY
}, completion: nil)
}
@objc private func fus_keyboardWillHide(_ notification: Notification) {
guard let userInfo = notification.userInfo,
let duration = userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double,
let curve = userInfo[UIResponder.keyboardAnimationCurveUserInfoKey] as? UInt else {
return
}
// 恢复原来的位置
UIView.animate(withDuration: duration, delay: 0, options: .init(rawValue: curve), animations: {
self.contentView.y = UIView.fus_screenH() - self.contentViewHeight
}, completion: nil)
}
deinit {
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)
}
}
@objc
class FUSPinCodeInputView: UIView, UITextFieldDelegate {
// MARK: - Constants
private let fus_boxCount = 4
// MARK: - UI Elements
private let fus_textField = UITextField()
private var fus_boxes: [UIView] = []
private var fus_labels: [UILabel] = []
// MARK: - Public Properties
@objc var fus_textDidChange: ((String) -> Void)? // 输入变化回调
// MARK: - Focus Tracking
private var fus_currentFocusedIndex: Int? {
didSet {
fus_updateFocusUI()
}
}
override init(frame: CGRect) {
super.init(frame: frame)
fus_commonInit()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
fus_commonInit()
}
private func fus_commonInit() {
fus_setupTextField()
fus_setupBoxes()
self.layoutSubviews()
}
private func fus_setupTextField() {
fus_textField.delegate = self
fus_textField.keyboardType = .numberPad
fus_textField.textAlignment = .center
fus_textField.textColor = .clear
fus_textField.tintColor = .clear
fus_textField.autocorrectionType = .no
fus_textField.autocapitalizationType = .none
fus_textField.addTarget(self, action: #selector(fus_textFieldEditingChanged), for: .editingChanged)
self.addSubview(fus_textField)
}
// 单独定义方法:
@objc private func fus_textFieldEditingChanged() {
if let currentText = self.fus_textField.text {
// 更新每个 box 的内容
for i in 0..<fus_boxCount {
if i < currentText.count {
let index = currentText.index(currentText.startIndex, offsetBy: i)
fus_labels[i].text = String(currentText[index])
} else {
fus_labels[i].text = ""
}
}
// 回调当前完整输入
fus_textDidChange?(currentText)
// 自动更新 focus index
fus_currentFocusedIndex = currentText.count - 1
fus_updateFocusIndex()
}
}
private func fus_setupBoxes() {
for _ in 0..<fus_boxCount {
let box = UIView()
box.layer.borderWidth = 1.5
box.layer.borderColor = UIColor.fus_textColorLight().cgColor
box.layer.cornerRadius = 8
addSubview(box)
fus_boxes.append(box)
let label = UILabel()
label.textAlignment = .center
label.font = UIFont.systemFont(ofSize: 24)
label.textColor = UIColor.fus_textColorRich()
box.addSubview(label)
fus_labels.append(label)
let tap = UITapGestureRecognizer(target: self, action: #selector(fus_handleBoxTapped(_:)))
box.addGestureRecognizer(tap)
box.isUserInteractionEnabled = true
}
}
@objc private func fus_handleBoxTapped(_ sender: UITapGestureRecognizer) {
// 显示键盘
fus_textField.becomeFirstResponder()
}
private func fus_updateFocusIndex() {
let textLength = fus_textField.text?.count ?? 0
fus_currentFocusedIndex = textLength < fus_boxCount ? textLength : nil
}
private func fus_updateFocusUI() {
for i in 0..<fus_boxCount {
if fus_currentFocusedIndex == i {
fus_boxes[i].layer.borderColor = UIColor.fus_theme().cgColor
fus_boxes[i].layer.borderWidth = 2.0
} else {
fus_boxes[i].layer.borderColor = UIColor.fus_textColorLight().cgColor
fus_boxes[i].layer.borderWidth = 1.5
}
}
}
override func layoutSubviews() {
super.layoutSubviews()
let boxHeight = bounds.height
let boxWidth = boxHeight
let space = (self.width - CGFloat(fus_boxCount) * boxWidth) / 3
for i in 0..<fus_boxCount {
let x: CGFloat = CGFloat(i) * (boxWidth + space)
let y: CGFloat = 0
fus_boxes[i].frame = CGRect(x: x, y: y, width: boxWidth, height: boxHeight)
fus_labels[i].frame = fus_boxes[i].bounds
}
fus_textField.frame = bounds
}
// MARK: - UITextFieldDelegate
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
guard let currentText = textField.text else { return true }
let newLength = currentText.count + string.count - range.length
if newLength <= fus_boxCount {
return true
}
return false
}
// MARK: - Public Methods
/// 获取当前输入的内容
@objc
func fus_getText() -> String {
return fus_textField.text ?? ""
}
@objc
func fus_setText(_ text:String) {
fus_textField.text = text
for i in 0..<fus_boxCount {
if i < text.count {
let index = text.index(text.startIndex, offsetBy: i)
fus_labels[i].text = String(text[index])
} else {
fus_labels[i].text = ""
}
}
// 回调当前完整输入
fus_textDidChange?(text)
}
/// 清空输入
@objc
func fus_clear() {
fus_textField.text = ""
fus_currentFocusedIndex = nil
for label in fus_labels {
label.text = ""
}
}
}
......@@ -106,18 +106,23 @@ import FUSCommon
}
//这里特殊用户有不一样的逻辑
let iconImagesList = ["live_start_openScope_cell","live_start_followScope_cell","live_start_intimacyScope_cell"]
let titlesList = [String.fus_localString("全公开"), .fus_localString("追踪圈"), .fus_localString("亲密圈")]
let subTitlesList = [String.fus_localString("所有人可进入房间"), .fus_localString("仅追踪主播超过24小的粉丝可进入房间"), .fus_localString("仅亲密好友可进入房间")]
let iconImagesList = ["live_start_openScope_cell","live_start_followScope_cell"/*,"live_start_intimacyScope_cell"*/]
let titlesList = [String.fus_versionLocalString("公开屋"), .fus_versionLocalString("私享屋")/*, .fus_localString("亲密圈")*/]
let subTitlesList = [String.fus_localString("所有人可进入房间"), .fus_versionLocalString("已关闭窗帘,玩家输入密码打开")/*, .fus_localString("仅亲密好友可进入房间")*/]
let selectIndex = fus_getIndexWithScopeType()
for (index, iconStr) in iconImagesList.enumerated() {
let itemView = FUSLiveStartSetPrivacyItemView.fus_create(icon: iconStr, title: titlesList[index], subTitle: subTitlesList[index])
var canSelect = true
if index == 0 {
if FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData.liveScopeOpen.intValue == -1 {
canSelect = false
}
}
let itemView = FUSLiveStartSetPrivacyItemView.fus_create(icon: iconStr, title: titlesList[index], subTitle: subTitlesList[index], canSelect: canSelect)
itemView.selected = selectIndex == index
self.privacyContentView.addArrangedSubview(itemView)
itemView.snp.makeConstraints { make in
make.size.equalTo(CGSizeMake(UIView.fus_screenW() - 18.0*2.0, 56))
make.size.equalTo(CGSizeMake(UIView.fus_screenW() - 18.0*2.0, 85))
}
itemView.bgTapBtn.rx.tap.subscribe(onNext: {[weak self] in
self?.fus_itemDidSelected(index: index)
......@@ -139,8 +144,22 @@ import FUSCommon
self.clickHandler?(self.scopeType)
self.fus_dismissWithAnimation()
}else if self.requestType == 1 {
if self.scopeType == .open {
self.fus_changeScopeRequest(scopeType: self.scopeType, password: "")
} else {
UIView.animate(withDuration: 0.3) {
self.contentView.y = UIView.fus_screenH()
} completion: { _ in
FUSLiveStartSetPasswordView.fus_create { [weak self] password in
guard let self = self else { return }
//在内部请求
self.fus_changeScopeRequest(scopeType: self.scopeType)
self.fus_changeScopeRequest(scopeType: self.scopeType, password: password)
}
}
}
}
}).disposed(by: disposeBag)
......@@ -158,11 +177,16 @@ import FUSCommon
switch index{
case 0:
if FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData.liveScopeOpen.intValue == -1 {
self.scopeType = .password
} else {
self.scopeType = .open
}
case 1:
self.scopeType = .follow
case 2:
self.scopeType = .intimacy
self.scopeType = .password
// case 2:
// self.scopeType = .intimacy
default:
break
}
......@@ -184,10 +208,10 @@ import FUSCommon
switch self.scopeType{
case .open:
return 0
case .follow:
case .password:
return 1
case .intimacy:
return 2
// case .intimacy:
// return 2
@unknown default:
return 0
}
......@@ -207,13 +231,14 @@ import FUSCommon
}
private func fus_changeScopeRequest(scopeType: FUSLiveRoomScopeType) {
private func fus_changeScopeRequest(scopeType: FUSLiveRoomScopeType, password:String) {
guard let roomID = FUSLiveHelper.shareInstance().roomInfoModel?.roomId else { return }
// FUSIndicator.showProgress(withMessage: "")
FUSLoadingIndicator.fus_show(canTouch: true)
FUSLiveHttpHelper.fus_requestChangeLiveScope(scopeType.rawValue, liveId: roomID.intValue, success: { [weak self] in
FUSLiveHttpHelper.fus_requestChangedPassword(scopeType == .password ? 1 : 0, fid: roomID.intValue, password: password, success: { [weak self] in
self?.fus_dismissWithAnimation()
......@@ -222,11 +247,13 @@ import FUSCommon
FUSLiveHelper.shareInstance().roomScopeType = scopeType
switch scopeType{
case .open:
//TODO: 文案:added by pidan
FUSDialogView.fus_showDialog(.fus_localString("房间已切换到全公开模式,所有人可进入房间"))
case .follow:
FUSDialogView.fus_showDialog(.fus_localString("房间已切换到追踪圈模式,仅追踪直播超过24小时的粉丝可进入房间,直播时长不计入直播奖励活动"))
case .intimacy:
FUSDialogView.fus_showDialog(.fus_localString("房间已切换到亲密圈模式,仅亲密好友的用户可进入房间,直播时长不计入直播奖励活动"))
case .password:
//TODO: 文案:added by pidan
FUSDialogView.fus_showDialog(.fus_versionLocalString("房间已切换到私享屋模式,仅追踪直播超过24小时的粉丝可进入房间,直播时长不计入直播奖励活动"))
// case .intimacy:
// FUSDialogView.fus_showDialog(.fus_localString("房间已切换到亲密圈模式,仅亲密好友的用户可进入房间,直播时长不计入直播奖励活动"))
@unknown default:
break
}
......@@ -254,6 +281,7 @@ class FUSLiveStartSetPrivacyItemView: UIView {
let titleLabel = UILabel()
let subTitleLabel = UILabel()
let selectedBtn = UIButton(type: .custom)
let cantSelectTipLabel = UILabel()
override init(frame: CGRect) {
super.init(frame: frame)
......@@ -311,6 +339,18 @@ class FUSLiveStartSetPrivacyItemView: UIView {
make.centerY.equalToSuperview()
}
cantSelectTipLabel.font = .fus_themeFont(11)
cantSelectTipLabel.textColor = .fus_textColorMedium()
cantSelectTipLabel.numberOfLines = 0
titleContentView.addSubview(cantSelectTipLabel)
cantSelectTipLabel.isHidden = true
cantSelectTipLabel.text = FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData.liveScopeOpenShow
cantSelectTipLabel.snp.makeConstraints { make in
make.right.equalToSuperview().inset(12)
make.centerY.equalToSuperview()
}
}
required init?(coder: NSCoder) {
......@@ -318,13 +358,16 @@ class FUSLiveStartSetPrivacyItemView: UIView {
}
///这个创建
static func fus_create(icon: String, title: String, subTitle: String) -> FUSLiveStartSetPrivacyItemView{
static func fus_create(icon: String, title: String, subTitle: String, canSelect:Bool = true) -> FUSLiveStartSetPrivacyItemView{
let subView = FUSLiveStartSetPrivacyItemView(frame: .zero)
subView.iconImageView.image = FUSShowRoomCenterBunble.imageNamed(icon)
subView.titleLabel.text = title
subView.subTitleLabel.text = subTitle
subView.cantSelectTipLabel.isHidden = canSelect
subView.selectedBtn.isHidden = canSelect == false
return subView
}
}
......@@ -26,10 +26,19 @@ import FUSCommon
//下面三个在私密哪一块获得,自动获取
///私密程度
public var scopeType = FUSLiveRoomScopeType.open
/// 私享房密码
public var password = ""
/// 清晰度
// var clarityOptionId = 0
public override init() {
super.init()
if FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData?.liveScopeOpen.intValue == -1 {
scopeType = .password
}
}
}
@objcMembers public class FUSLiveStartView: UIView {
......@@ -61,6 +70,7 @@ import FUSCommon
let contentView = UIView()
let closeBtn = UIButton(type: .custom)
let privacyView = FUSLiveStartContentPrivacyView()
let passwordBtn = FUSStyleButton(type: .custom)
let themeView = FUSLiveStartContentThemeEditView()
let shareView = FUSLiveStartContentShareView()
let bottomView = FUSLiveStartContentBottomView()
......@@ -99,6 +109,23 @@ import FUSCommon
}
privacyView.isHidden = FUSConfig.sharedInstanced().devConfigs.appStatus == true
self.passwordBtn.isHidden = true
headerView.addSubview(self.passwordBtn)
self.passwordBtn.setTitle(.fus_versionLocalString("密码"), for: .normal)
self.passwordBtn.titleLabel?.font = .fus_themeFont(14)
self.passwordBtn.style = .blue
self.passwordBtn.layer.cornerRadius = 14
self.passwordBtn.layer.masksToBounds = true
self.passwordBtn.snp.makeConstraints { make in
make.left.equalTo(self.privacyView.snp.right).offset(8)
make.centerY.equalTo(self.privacyView)
make.width.equalTo(60)
make.height.equalTo(28)
}
contentView.addSubview(themeView)
themeView.snp.makeConstraints { make in
make.top.equalTo(headerView.snp.bottom).offset(18)
......@@ -173,15 +200,34 @@ import FUSCommon
guard let model = self?.startLiveModel.value else { return }
FUSLiveStartSetPrivacyView.fus_create(defaultScopeType: model.scopeType) {[weak self] scopeType in
model.scopeType = scopeType
if scopeType == .password {
FUSLiveStartSetPasswordView.fus_create { password in
model.password = password
self?.startLiveModel.accept(model)
}
} else {
self?.startLiveModel.accept(model)
}
}
}
warningView.clickHandler = { model, index in
FUSRouter.userRouter().fus_handleTaskJumpAction(withJumpType: model.jumpurl, tid: 0, url: model.jumpval) {
}
}
//关闭按钮
passwordBtn.rx.tap.subscribe(onNext: {[weak self] in
guard let model = self?.startLiveModel.value else { return }
FUSLiveStartSetPasswordView.fus_create { password in
model.password = password
self?.startLiveModel.accept(model)
}
}).disposed(by: disposeBag)
//关闭按钮
closeBtn.rx.tap.subscribe(onNext: {[weak self] in
self?.clickCloseBtnActionHandler?(self?.closeBtn)
......@@ -274,6 +320,10 @@ import FUSCommon
self.startLiveModel.subscribe(onNext: {[weak self] model in
self?.privacyView.type = model.scopeType
self?.passwordBtn.isHidden = model.scopeType != .password
self?.liveActivityView.isHidden = model.scopeType == .password
}).disposed(by: disposeBag)
self.fus_updateWithLiveBeforeReadyInfo()
......
......@@ -270,6 +270,9 @@ NS_ASSUME_NONNULL_BEGIN
// 切换直播范围
+ (NSString *)fus_URL_LIVE_CHANGE_LIVE_SCOPE;
// 切换私享房
+ (NSString *)fus_URL_LIVE_CHANGE_Password;
// 贴纸列表
+ (NSString *)fus_URL_LIVE_STICKER_LIST;
......
......@@ -440,6 +440,11 @@
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/change/liveScope"];
}
// 切换私享房
+ (NSString *)fus_URL_LIVE_CHANGE_Password {
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/change/password"];
}
// 贴纸列表
+ (NSString *)fus_URL_LIVE_STICKER_LIST {
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/sticker/list"];
......
......@@ -86,6 +86,28 @@
return [FUSLiveHelper shareInstance].roomScopeType;
}
- (NSString *)liveRoomPassword {
if (FUSLiveHelper.shareInstance.roomInfoModel.encryptionData.password.length > 0) {
return FUSLiveHelper.shareInstance.roomInfoModel.encryptionData.password;
}
NSString *uid = [FUSCacheDataShare shareStore].userDetailInfo.uid ?: @"";
NSUserDefaults *userDefaults = [[NSUserDefaults alloc] initWithSuiteName:uid];
// 从 UserDefaults 中获取上次设置的密码
NSString *password = [userDefaults stringForKey:FUSLiveUDKeys.fus_lastLivePasswordUDKEY] ?: @"";
// 判断密码是否有效(假设 isValidString 是一个判断字符串是否非空且长度 >=4 的方法)
if (![NSString isNullWithString:password] && uid.length >= 4) {
// 取 uid 最后四个字符
NSUInteger startIndex = uid.length >= 4 ? uid.length - 4 : 0;
password = [uid substringFromIndex:startIndex];
}
return password;
}
- (FUSLiveRoomType)fus_liveRoomType {
return [FUSLiveHelper shareInstance].liveRoomType;
......
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