Skip to content

Commit

Permalink
提交 1.10.0 版本
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhan committed Aug 30, 2022
1 parent 077ad8d commit 7bc598d
Show file tree
Hide file tree
Showing 119 changed files with 1,827 additions and 1,576 deletions.
10 changes: 5 additions & 5 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ target 'PolyvLiveScenesDemo' do
use_frameworks!

# 保利威 多场景 SDK
pod 'PLVLiveScenesSDK', '1.9.5'
pod 'PLVLiveScenesSDK', '1.10.0'

# 保利威 手机开播场景 需依赖的库
pod 'PLVBytedEffectSDK', '4.3.1'
pod 'PLVBusinessSDK', '1.9.5', :subspecs => ['Beauty']
pod 'PLVBusinessSDK', '1.10.0', :subspecs => ['Beauty']

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

end

target 'PLVScreenShareExtension' do
use_frameworks!
pod 'PLVBusinessSDK', '1.9.5', :subspecs => ['AbstractBSH','ReplayKitExt']
pod 'PLVFoundationSDK', '1.9.5'
pod 'PLVBusinessSDK', '1.10.0', :subspecs => ['AbstractBSH','ReplayKitExt']
pod 'PLVFoundationSDK', '1.10.0'
pod 'TXLiteAVSDK_TRTC', '9.3.10763'
end
84 changes: 44 additions & 40 deletions PolyvLiveScenesDemo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion PolyvLiveScenesDemo/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// 如需启用IPV6,解开注释,启用IPV6之后,将自动选择IP,取消HttpDNS
// [PLVLiveVideoConfig sharedInstance].enableIPV6 = YES;


// 接口sha256签名、接口防重放、接口响应加密开关
[PLVLiveVideoConfig sharedInstance].enableResponseEncrypt = [[NSUserDefaults standardUserDefaults] boolForKey:@"response_encrypt"];
[PLVLiveVideoConfig sharedInstance].enableSignatureNonce = [[NSUserDefaults standardUserDefaults] boolForKey:@"signature_nonce"];
[PLVLiveVideoConfig sharedInstance].enableSha256 = [[NSUserDefaults standardUserDefaults] boolForKey:@"sha256"];

PLVEnteranceViewController *vctrl = [[PLVEnteranceViewController alloc] init];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.rootViewController = vctrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "PLVLiveScenesPrivacyViewController.h"
#import "PLVLSStreamerViewController.h"
#import "PLVSAStreamerViewController.h"
#import "PLVAlertViewController.h"

#import "PLVLoginTextField.h"
#import "PLVRoomLoginClient.h"
Expand Down Expand Up @@ -407,27 +408,48 @@ - (void)tapAction:(UIGestureRecognizer *)gestureRecognizer {

- (void)loginButtonClickAction {
__weak typeof(self) weakSelf = self;
[self loginStreamerRoomWithCompletionHandler:^{
// 记住密码
if (self.rememberPasswordButton.selected) {
NSArray *userInfoArray = @[@(YES), self.tfChannelId.text, self.tfPassword.text, self.tfNickName.text];
[[NSUserDefaults standardUserDefaults] setObject:userInfoArray forKey:kUserDefaultUserInfo];
[self mediaAudioGrantedCompletion:^{
[weakSelf loginStreamerRoomWithCompletionHandler:^{
// 记住密码
if (weakSelf.rememberPasswordButton.selected) {
NSArray *userInfoArray = @[@(YES), weakSelf.tfChannelId.text, weakSelf.tfPassword.text, weakSelf.tfNickName.text];
[[NSUserDefaults standardUserDefaults] setObject:userInfoArray forKey:kUserDefaultUserInfo];
} else {
[[NSUserDefaults standardUserDefaults] removeObjectForKey:kUserDefaultUserInfo];
}
[[NSUserDefaults standardUserDefaults] synchronize];

PLVRoomData *roomData = [PLVRoomDataManager sharedManager].roomData;
[PLVBugReporter setUserIdentifier:roomData.roomUser.viewerId];

if (roomData.channelType == PLVChannelTypePPT) {
PLVLSStreamerViewController *vctrl = [[PLVLSStreamerViewController alloc] init];
vctrl.modalPresentationStyle = UIModalPresentationFullScreen;
[weakSelf presentViewController:vctrl animated:YES completion:nil];
} else if (roomData.channelType == PLVChannelTypeAlone) {
PLVSAStreamerViewController *vctrl = [[PLVSAStreamerViewController alloc] init];
vctrl.modalPresentationStyle = UIModalPresentationFullScreen;
[weakSelf presentViewController:vctrl animated:YES completion:nil];
}
}];
}];
}

- (void)mediaAudioGrantedCompletion:(void (^)(void))handler {
// 判断麦克风权限
__weak typeof(self) weakSelf = self;
PLVAuthorizationType type = PLVAuthorizationTypeMediaAudio;
[PLVAuthorizationManager requestAuthorizationWithType:type completion:^(BOOL granted) {
if (granted) {
handler ? handler() : nil;
} else {
[[NSUserDefaults standardUserDefaults] removeObjectForKey:kUserDefaultUserInfo];
}
[[NSUserDefaults standardUserDefaults] synchronize];

PLVRoomData *roomData = [PLVRoomDataManager sharedManager].roomData;
[PLVBugReporter setUserIdentifier:roomData.roomUser.viewerId];

if (roomData.channelType == PLVChannelTypePPT) {
PLVLSStreamerViewController *vctrl = [[PLVLSStreamerViewController alloc] init];
vctrl.modalPresentationStyle = UIModalPresentationFullScreen;
[weakSelf presentViewController:vctrl animated:YES completion:nil];
} else if (roomData.channelType == PLVChannelTypeAlone) {
PLVSAStreamerViewController *vctrl = [[PLVSAStreamerViewController alloc] init];
vctrl.modalPresentationStyle = UIModalPresentationFullScreen;
[weakSelf presentViewController:vctrl animated:YES completion:nil];
PLVAlertViewController *alert = [PLVAlertViewController alertControllerWithTitle:@"麦克风权限被禁止" message:@"请在“设置-隐私-麦克风”中允许POLYV开播访问您的麦克风" cancelActionTitle:@"取消" cancelHandler:nil confirmActionTitle:@"前往设置" confirmHandler:^{
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
}];
[weakSelf presentViewController:alert animated:NO completion:nil];
}
}];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,6 @@ - (void)loginCloudClassPlaybackRoomWithChannelType:(PLVChannelType)channelType
// roomUser.viewerAvatar = @"用户头像";
} completion:^(PLVViewLogCustomParam * _Nonnull customParam) {
[hud hideAnimated:YES];
if([PLVRoomDataManager sharedManager].roomData.channelType == PLVChannelTypePPT && weakSelf.vodListSwitch.isOn)
{
[weakSelf showHud:@"三分屏场景暂不支持使用点播列表播放" detail:nil];
return;
}
[weakSelf saveParamsToFile];

if (successHandler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface PLVLCChatLandscapeView : UIView

/// 主页创建/更新回放viewModel之后,通知横屏聊天室
- (void)updatePlaybackViewModel:(PLVLCChatroomPlaybackViewModel *)playbackViewModel;

- (void)updateChatTableView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ @interface PLVLCChatLandscapeView ()<
@property (nonatomic, strong) CAGradientLayer *gradientLayer;

@property (nonatomic, assign) BOOL observingTableView;

/// 聊天室是否处于聊天回放状态,默认为NO
@property (nonatomic, assign) BOOL playbackEnable;

/// 弱引用首页持有的聊天回放viewModel
@property (nonatomic, weak) PLVLCChatroomPlaybackViewModel *playbackViewModel;

@end
Expand Down Expand Up @@ -266,6 +266,28 @@ - (void)clearNewMessageCount {
[self.receiveNewMessageView hidden];
}

// 数据源数目
- (NSInteger)dataCount {
NSInteger count = 0;
if (self.playbackEnable) {
count = [self.playbackViewModel.chatArray count];
} else {
count = [[[PLVLCChatroomViewModel sharedViewModel] chatArray] count];
}
return count;
}

// 根据indexPath得到数据模型
- (PLVChatModel *)modelAtIndexPath:(NSIndexPath *)indexPath {
PLVChatModel *model = nil;
if (self.playbackEnable) {
model = self.playbackViewModel.chatArray[indexPath.row];
} else {
model = [[PLVLCChatroomViewModel sharedViewModel] chatArray][indexPath.row];
}
return model;
}

#pragma mark - PLVLCChatroomViewModelProtocol

- (void)chatroomManager_didSendMessage:(PLVChatModel *)model {
Expand Down Expand Up @@ -335,14 +357,12 @@ - (void)didReceiveNewMessagesForChatroomPlaybackViewModel:(PLVLCChatroomPlayback
}
}

/// 刷新聊天消息列表,列表应滚动到底部
- (void)didMessagesRefreshedForChatroomPlaybackViewModel:(PLVLCChatroomPlaybackViewModel *)viewModel {
[self.tableView reloadData];
[self clearNewMessageCount];
[self scrollsToBottom:YES];
}

/// 往上滚动,列表滚动到最顶部
- (void)didLoadMoreHistoryMessagesForChatroomPlaybackViewModel:(PLVLCChatroomPlaybackViewModel *)viewModel {
[self.refresher endRefreshing];
[self.tableView reloadData];
Expand All @@ -355,33 +375,16 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSInteger count = 0;
if (self.playbackEnable) {
count = [self.playbackViewModel.chatArray count];
} else {
count = [[[PLVLCChatroomViewModel sharedViewModel] chatArray] count];
}
return count;
return [self dataCount];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSInteger count = 0;
if (self.playbackEnable) {
count = [self.playbackViewModel.chatArray count];
} else {
count = [[[PLVLCChatroomViewModel sharedViewModel] chatArray] count];
}

if (indexPath.row >= count) {
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row >= [self dataCount]) {
return [UITableViewCell new];
}

PLVRoomUser *roomUser = [PLVRoomDataManager sharedManager].roomData.roomUser;
PLVChatModel *model = nil;
if (self.playbackEnable) {
model = self.playbackViewModel.chatArray[indexPath.row];
} else {
model = [[PLVLCChatroomViewModel sharedViewModel] chatArray][indexPath.row];
}
PLVChatModel *model = [self modelAtIndexPath:indexPath];

if ([PLVLCLandscapeSpeakCell isModelValid:model]) {
static NSString *speakMessageCellIdentify = @"PLVLCLandscapeSpeakCell";
Expand Down Expand Up @@ -436,26 +439,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
#pragma mark - UITableView Delegate

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger count = 0;
if (self.playbackEnable) {
count = [self.playbackViewModel.chatArray count];
} else {
count = [[[PLVLCChatroomViewModel sharedViewModel] chatArray] count];
}

if (indexPath.row >= count) {
if (indexPath.row >= [self dataCount]) {
return 0;
}

CGFloat cellHeight = 44.0;

PLVChatModel *model = nil;
if (self.playbackEnable) {
model = self.playbackViewModel.chatArray[indexPath.row];
} else {
model = [[PLVLCChatroomViewModel sharedViewModel] chatArray][indexPath.row];
}

PLVChatModel *model = [self modelAtIndexPath:indexPath];
PLVRoomUser *roomUser = [PLVRoomDataManager sharedManager].roomData.roomUser;
if ([PLVLCLandscapeSpeakCell isModelValid:model]) {
cellHeight = [PLVLCLandscapeSpeakCell cellHeightWithModel:model loginUserId:roomUser.viewerId cellWidth:self.tableView.frame.size.width];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ extern NSString *PLVLCChatroomOpenRewardViewNotification;

- (void)resumeCardPushButtonViewLayout;

/// 切换聊天室关闭状态
- (void)changeCloseRoomStatus:(BOOL)closeRoom;

/// 切换聊天室专注模式状态
- (void)changeFocusMode:(BOOL)focusMode;

/// 主页创建/更新回放viewModel之后,通过菜单视图,通知聊天室视图
- (void)updatePlaybackViewModel:(PLVLCChatroomPlaybackViewModel *)playbackViewModel;

- (void)leaveLiveRoom;
Expand Down
Loading

0 comments on commit 7bc598d

Please sign in to comment.