Skip to content

Commit

Permalink
提交 1.9.1 版本
Browse files Browse the repository at this point in the history
  • Loading branch information
pyfer committed May 13, 2022
1 parent c0c1e2f commit 8bdc44f
Show file tree
Hide file tree
Showing 172 changed files with 6,286 additions and 1,119 deletions.
8 changes: 7 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ target 'PolyvLiveScenesDemo' do
use_frameworks!

# 保利威 多场景 SDK
pod 'PLVLiveScenesSDK', '1.8.3'
pod 'PLVLiveScenesSDK', '1.9.1'

# 保利威 UI源码 需依赖的库
pod 'SDWebImage', '4.4.0'
pod 'MJRefresh', '~> 3.5.0'
pod 'PLVImagePickerController', '~> 0.1.0' # 仅手机开播场景需要
pod 'SVGAPlayer', '~> 2.3'

target 'PLVScreenShareExtension' do
use_frameworks!
inherit! :search_paths
pod 'PLVBusinessSDK', '1.9.1', :subspecs => ['ReplayKitExt']
end

end
388 changes: 341 additions & 47 deletions PolyvLiveScenesDemo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ NS_ASSUME_NONNULL_BEGIN

extern NSString *PLVLCChatroomOpenBulletinNotification;

extern NSString *PLVLCChatroomOpenLotteryRecordNotification;

extern NSString *PLVLCChatroomOpenRewardViewNotification;

@interface PLVLCChatViewController : UIViewController

@property (nonatomic, weak) UIViewController *liveRoom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@

NSString *PLVLCChatroomOpenBulletinNotification = @"PLVLCChatroomOpenBulletinNotification";

NSString *PLVLCChatroomOpenLotteryRecordNotification = @"PLVLCChatroomOpenLotteryRecordNotification";

NSString *PLVLCChatroomOpenRewardViewNotification = @"PLVLCChatroomOpenRewardViewNotification";

NSString *PLVInteractLotteryWinRecordMessageNewCallbackNotification = @"PLVInteractLotteryWinRecordMessageNewCallbackNotification";

@interface PLVLCChatViewController ()<
PLVLCKeyboardToolViewDelegate,
PLVLCLikeButtonViewDelegate,
Expand Down Expand Up @@ -221,6 +227,9 @@ - (void)addObserver {
selector:@selector(gotChatroomFunction:)
name:PLVLCChatroomFunctionGotNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(lotteryWinRecordCallback:) name:PLVInteractLotteryWinRecordMessageNewCallbackNotification
object:nil];
}

- (void)removeObserver {
Expand All @@ -230,6 +239,9 @@ - (void)removeObserver {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:PLVLCChatroomFunctionGotNotification
object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:PLVInteractLotteryWinRecordMessageNewCallbackNotification
object:nil];
}

- (void)interfaceOrientationDidChange:(NSNotification *)notification {
Expand All @@ -243,6 +255,12 @@ - (void)gotChatroomFunction:(NSNotification *)notification {
self.likeButtonView.hidden = [PLVRoomDataManager sharedManager].roomData.sendLikeDisable;
}

- (void)lotteryWinRecordCallback:(NSNotification *)notification {
NSDictionary *dict = notification.userInfo;
self.keyboardToolView.hideLotteryWinRecord = ![dict[@"isShow"] boolValue];
self.keyboardToolView.isNewLotteryMessage = [dict[@"hasNew"] boolValue];
}

#pragma mark - Public Method

- (instancetype)initWithLiveRoom:(UIViewController *)liveRoom {
Expand Down Expand Up @@ -648,6 +666,15 @@ - (void)keyboardToolView_readBulletin:(PLVLCKeyboardToolView *)toolView {
[[NSNotificationCenter defaultCenter] postNotificationName:PLVLCChatroomOpenBulletinNotification object:nil];
}


- (void)keyboardToolView_openLotteryRecord:(PLVLCKeyboardToolView *)toolView {
[[NSNotificationCenter defaultCenter] postNotificationName:PLVLCChatroomOpenLotteryRecordNotification object:nil];
}

- (void)keyboardToolView_openReward:(PLVLCKeyboardToolView *)toolView {
[[NSNotificationCenter defaultCenter] postNotificationName:PLVLCChatroomOpenRewardViewNotification object:nil];
}

#pragma mark - PLVLCLikeButtonView Delegate

- (void)didTapLikeButton:(PLVLCLikeButtonView *)likeButtonView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
/// 打开公告
- (void)keyboardMoreView_openBulletin:(PLVLCKeyboardMoreView *)moreView;

/// 打开中奖记录
- (void)keyboardMoreView_openLotteryRecord:(PLVLCKeyboardMoreView *)moreView;

/// 点击【查看全部】或【只看讲师】按钮
/// @param on YES - 只看教师;NO - 查看全部
- (void)keyboardMoreView_onlyTeacher:(PLVLCKeyboardMoreView *)moreView on:(BOOL)on;
Expand All @@ -37,5 +40,10 @@
/// 是否隐藏公告按钮,默认 NO;YES - 隐藏,NO - 显示
@property (nonatomic, assign) BOOL hiddenBulletin;

/// 是否隐藏消息按钮,默认 YES;YES - 隐藏,NO - 显示
@property (nonatomic, assign) BOOL hideLotteryWinRecord;

/// 消息按钮红点是否显示,默认 NO;YES - 显示,NO - 隐藏
@property (nonatomic, assign) BOOL isNewLotteryMessage;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ typedef NS_ENUM(NSInteger, PLVLCKeyboardMoreButtonType) {
PLVLCKeyboardMoreButtonTypeOpenCamera,
PLVLCKeyboardMoreButtonTypeOpenAlbum,
PLVLCKeyboardMoreButtonTypeOpenBulletin,
PLVLCKeyboardMoreButtonTypeOpenLotteryWinRecord
};

@interface PLVLCMoreCollectionViewCell : UICollectionViewCell
Expand All @@ -46,7 +47,7 @@ - (instancetype)initWithFrame:(CGRect)frame {

self.moreBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;

[self addSubview:self.moreBtn];
[self.contentView addSubview:self.moreBtn];
}
return self;
}
Expand All @@ -64,35 +65,39 @@ - (void)setType:(PLVLCKeyboardMoreButtonType)type {
break;
case PLVLCKeyboardMoreButtonTypeOpenAlbum:
[self.moreBtn setImage:[PLVLCUtils imageForChatroomResource:@"plvlc_keyboard_album"] forState:UIControlStateNormal];
[self.moreBtn setImage:[PLVLCUtils imageForChatroomResource:@"plvlc_keyboard_album"] forState:UIControlStateSelected];
[self.moreBtn setTitle:@"发送图片" forState:UIControlStateNormal];
[self.moreBtn setTitle:@"发送图片" forState:UIControlStateSelected];
break;
case PLVLCKeyboardMoreButtonTypeOpenCamera:
[self.moreBtn setImage:[PLVLCUtils imageForChatroomResource:@"plvlc_keyboard_camera"] forState:UIControlStateNormal];
[self.moreBtn setImage:[PLVLCUtils imageForChatroomResource:@"plvlc_keyboard_camera"] forState:UIControlStateSelected];
[self.moreBtn setTitle:@"拍照" forState:UIControlStateNormal];
[self.moreBtn setTitle:@"拍照" forState:UIControlStateSelected];
break;
case PLVLCKeyboardMoreButtonTypeOpenBulletin:
[self.moreBtn setImage:[PLVLCUtils imageForChatroomResource:@"plvlc_keyboard_notice"] forState:UIControlStateNormal];
[self.moreBtn setImage:[PLVLCUtils imageForChatroomResource:@"plvlc_keyboard_notice"] forState:UIControlStateSelected];
[self.moreBtn setTitle:@"公告" forState:UIControlStateNormal];
[self.moreBtn setTitle:@"公告" forState:UIControlStateSelected];
break;
case PLVLCKeyboardMoreButtonTypeOpenLotteryWinRecord:
[self.moreBtn setImage:[PLVLCUtils imageForChatroomResource:@"plvlc_keyboard_lottery_normal"] forState:UIControlStateNormal];
[self.moreBtn setImage:[PLVLCUtils imageForChatroomResource:@"plvlc_keyboard_lottery_newMessage"] forState:UIControlStateSelected];
[self.moreBtn setTitle:@"消息" forState:UIControlStateNormal];
[self.moreBtn setTitle:@"消息" forState:UIControlStateSelected];
break;
default:
break;
}

CGSize ivSize = self.moreBtn.imageView.frame.size;
CGSize lbSize = self.moreBtn.titleLabel.frame.size;
[self.moreBtn setTitleEdgeInsets:UIEdgeInsetsMake(ivSize.height + kCellImageLabelMargin / 2.0f,
-ivSize.width - 2,
0.0,
0.0)];
[self.moreBtn setImageEdgeInsets:UIEdgeInsetsMake(0.0,
(kCellButtonWidth - ivSize.width) / 2.0f,
lbSize.height + 5.0,
0.0)];
[self.moreBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, - self.moreBtn.imageView.frame.size.width, - self.moreBtn.imageView.frame.size.height - kCellImageLabelMargin / 2.0f, 0)];
[self.moreBtn setImageEdgeInsets:UIEdgeInsetsMake(- self.moreBtn.titleLabel.intrinsicContentSize.height - kCellImageLabelMargin / 2.0f, 0, 0, - self.moreBtn.titleLabel.intrinsicContentSize.width)];
}

@end

@interface PLVLCKeyboardMoreView () <UICollectionViewDataSource, UICollectionViewDelegate>
@interface PLVLCKeyboardMoreView () <UICollectionViewDataSource>

@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) UICollectionViewFlowLayout *flowLayout;
Expand All @@ -107,11 +112,13 @@ - (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
_sendImageEnable = YES;
_hideLotteryWinRecord = YES;
_isNewLotteryMessage = NO;

self.backgroundColor = [UIColor colorWithRed:0x2b/255.0 green:0x2c/255.0 blue:0x35/255.0 alpha:1.0];

self.flowLayout = [[UICollectionViewFlowLayout alloc] init];
self.flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
self.flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
self.flowLayout.itemSize = CGSizeMake(kCellButtonWidth, kCellButtonHeight);

float totalPadding = [UIScreen mainScreen].bounds.size.width - kCellButtonWidth * 4;
Expand All @@ -125,7 +132,6 @@ - (instancetype)initWithFrame:(CGRect)frame {
self.collectionView.backgroundColor = [UIColor clearColor];
[self.collectionView registerClass:[PLVLCMoreCollectionViewCell class] forCellWithReuseIdentifier:kMoreViewCellIdentifier];
self.collectionView.dataSource = self;
self.collectionView.delegate = self;
self.collectionView.showsHorizontalScrollIndicator = NO;
self.collectionView.showsVerticalScrollIndicator = NO;
[self addSubview:self.collectionView];
Expand Down Expand Up @@ -157,83 +163,82 @@ - (void)setHiddenBulletin:(BOOL)hiddenBulletin {
[self.collectionView reloadData];
}

- (void)setHideLotteryWinRecord:(BOOL)hideLotteryWinRecord {
if (_hideLotteryWinRecord == hideLotteryWinRecord) {
return;
}
_hideLotteryWinRecord = hideLotteryWinRecord;
[self.collectionView reloadData];
}

- (void)setIsNewLotteryMessage:(BOOL)isNewLotteryMessage {
if (_isNewLotteryMessage == isNewLotteryMessage) {
return;
}
_isNewLotteryMessage = isNewLotteryMessage;
[self.collectionView reloadData];
}

#pragma mark - UICollectionView DataSource

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView*)collectionView {
NSUInteger count = 4;
return kItemCountPerSection;
}

- (NSInteger)collectionView:(UICollectionView*)collectionView numberOfItemsInSection:(NSInteger)section {
NSUInteger count = 5;
if (!self.sendImageEnable) {
count -= 2;
}
if (self.hiddenBulletin) {
count--;
}
if (self.hideLotteryWinRecord) {
count--;
}
return count;
}

- (NSInteger)collectionView:(UICollectionView*)collectionView numberOfItemsInSection:(NSInteger)section {
return kItemCountPerSection;
}

- (UICollectionViewCell *)collectionView:(UICollectionView*)collectionView cellForItemAtIndexPath:(NSIndexPath*)indexPath {
PLVLCMoreCollectionViewCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:kMoreViewCellIdentifier
forIndexPath:indexPath];
NSInteger index = indexPath.row + indexPath.section * kItemCountPerSection;
PLVLCKeyboardMoreButtonType type = [self typeOfIndex:index];
if (type == PLVLCKeyboardMoreButtonTypeOnlyTeacher) {
[cell.moreBtn addTarget:self action:@selector(onlyTeacher:) forControlEvents:UIControlEventTouchUpInside];
} else if (type == PLVLCKeyboardMoreButtonTypeOpenAlbum) {
[cell.moreBtn addTarget:self action:@selector(openAlbum:) forControlEvents:UIControlEventTouchUpInside];
} else if (type == PLVLCKeyboardMoreButtonTypeOpenCamera) {
[cell.moreBtn addTarget:self action:@selector(openCamera:) forControlEvents:UIControlEventTouchUpInside];
} else if (type == PLVLCKeyboardMoreButtonTypeOpenBulletin) {
[cell.moreBtn addTarget:self action:@selector(openBulletin:) forControlEvents:UIControlEventTouchUpInside];

PLVLCKeyboardMoreButtonType type = [self typeOfIndex:indexPath.item];
if (type == PLVLCKeyboardMoreButtonTypeOpenLotteryWinRecord) {
cell.moreBtn.selected = self.isNewLotteryMessage;
}

[cell.moreBtn addTarget:self action:@selector(moreBtnAction:) forControlEvents:UIControlEventTouchUpInside];
cell.type = type;
cell.moreBtn.tag = (NSInteger)cell.type;

return cell;
}

#pragma mark - Action

- (void)openCamera:(id)sender
{
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardMoreView_openCamera:)]) {
[self.delegate keyboardMoreView_openCamera:self];
}
}

- (IBAction)openAlbum:(id)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardMoreView_openAlbum:)]) {
[self.delegate keyboardMoreView_openAlbum:self];
}
}

- (IBAction)openBulletin:(id)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardMoreView_openBulletin:)]) {
[self.delegate keyboardMoreView_openBulletin:self];
}
}

- (IBAction)onlyTeacher:(id)sender {
UIButton *button = (UIButton *)sender;
button.selected = !button.selected;
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardMoreView_onlyTeacher:on:)]) {
[self.delegate keyboardMoreView_onlyTeacher:self on:button.selected];
}
}

#pragma mark - UICollectionViewDelegate FlowLayout

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
CGSize size = CGSizeMake(0.0, self.collectionView.bounds.size.height);
if (section == 0) {
size = CGSizeMake(self.flowLayout.sectionInset.left, self.collectionView.bounds.size.height);
- (void)moreBtnAction:(UIButton *)button {
if (button.tag == 0) {
button.selected = !button.selected;
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardMoreView_onlyTeacher:on:)]) {
[self.delegate keyboardMoreView_onlyTeacher:self on:button.selected];
}
} else if (button.tag == 1) {
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardMoreView_openAlbum:)]) {
[self.delegate keyboardMoreView_openCamera:self];
}
} else if (button.tag == 2) {
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardMoreView_openCamera:)]) {
[self.delegate keyboardMoreView_openAlbum:self];
}
} else if (button.tag == 3) {
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardMoreView_openBulletin:)]) {
[self.delegate keyboardMoreView_openBulletin:self];
}
} else if (button.tag == 4) {
if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardMoreView_openLotteryRecord:)]) {
[self.delegate keyboardMoreView_openLotteryRecord:self];
}
}
return size;
}

- (CGSize)collectionView:(UICollectionView*)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section {
CGSize size = CGSizeMake(0.0, self.collectionView.bounds.size.height);
return size;
}

#pragma mark - Private Method
Expand All @@ -249,10 +254,14 @@ - (PLVLCKeyboardMoreButtonType)typeOfIndex:(NSInteger)index {
return PLVLCKeyboardMoreButtonTypeOpenCamera;
} else if (index == 3 && !self.hiddenBulletin) {
return PLVLCKeyboardMoreButtonTypeOpenBulletin;
} else if (index == 4 && !self.hideLotteryWinRecord) {
return PLVLCKeyboardMoreButtonTypeOpenLotteryWinRecord;
}
} else {
if (index == 1 && !self.hiddenBulletin) {
return PLVLCKeyboardMoreButtonTypeOpenBulletin;
} else if (index == 2 && !self.hideLotteryWinRecord) {
return PLVLCKeyboardMoreButtonTypeOpenLotteryWinRecord;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ NS_ASSUME_NONNULL_BEGIN
- (void)keyboardToolView_openCamera:(PLVLCKeyboardToolView *)toolView;
/// 打开公告
- (void)keyboardToolView_readBulletin:(PLVLCKeyboardToolView *)toolView;
/// 打开中奖列表
- (void)keyboardToolView_openLotteryRecord:(PLVLCKeyboardToolView *)toolView;
/// 打开积分打赏面板
- (void)keyboardToolView_openReward:(PLVLCKeyboardToolView *)toolView;

@end

Expand All @@ -61,6 +65,12 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL enableSendImage;
/// 是否隐藏公告按钮,默认 NO;YES - 隐藏,NO - 显示
@property (nonatomic, assign) BOOL hiddenBulletin;
/// 是否隐藏消息按钮,默认 YES;YES - 隐藏,NO - 显示
@property (nonatomic, assign) BOOL hideLotteryWinRecord;
/// 是否有新中奖消息
@property (nonatomic, assign) BOOL isNewLotteryMessage;
/// 是否隐藏积分打赏按钮,默认NO;YES - 显示,NO - 隐藏
@property (nonatomic, assign) BOOL enablePointReward;
///键盘的图片表情
@property (nonatomic, strong) NSArray *imageEmotions;

Expand Down
Loading

0 comments on commit 8bdc44f

Please sign in to comment.