608 lines
23 KiB
Objective-C
608 lines
23 KiB
Objective-C
//
|
|
// MewRoomViewController.m
|
|
// mew-ios
|
|
//
|
|
// Created by 触海 on 2023/11/7.
|
|
//
|
|
|
|
|
|
///View
|
|
#import "MewRoomViewController.h"
|
|
#import "BaseNavigationController.h"
|
|
#import "MewRoomHeaderView.h"
|
|
#import "MewRoomRightView.h"
|
|
#import "MewSocialStageView.h"
|
|
#import "MewRoomMessageContainerView.h"
|
|
#import "MewRoomSendTextView.h"
|
|
#import "MewRoomAnimationView.h"
|
|
///Model
|
|
#import "UserInfoModel.h"
|
|
#import "MewRoomInfoModel.h"
|
|
#import "MewMessageInfoModel.h"
|
|
#import "MewAttachmentModel.h"
|
|
#import "MicroQueueModel.h"
|
|
#import "MewGiftInfoModel.h"
|
|
#import "MewGiftReceiveInfoModel.h"
|
|
#import "MewMessageRemoteExtModel.h"
|
|
///Tool
|
|
#import "AccountInfoStorage.h"
|
|
#import "MEWHUDTool.h"
|
|
#import "YMMacro.h"
|
|
#import "NSArray+MEWSafe.h"
|
|
#import "MewRtcManager.h"
|
|
///P
|
|
#import "MewRoomPresenter.h"
|
|
#import "MewRoomProtocol.h"
|
|
#import "MewRoomHostDelegate.h"
|
|
/// Third
|
|
#import <Masonry/Masonry.h>
|
|
#import <NIMSDK/NIMSDK.h>
|
|
|
|
|
|
@interface MewRoomViewController ()<MewRoomProtocol,
|
|
NIMChatroomManagerDelegate, NIMChatManagerDelegate, NIMConversationManagerDelegate, NIMLoginManagerDelegate,
|
|
MewRoomHostDelegate, MewRoomRightViewDelegate, MewRoomHeaderViewDelegate>
|
|
|
|
// 背景
|
|
@property (nonatomic, strong) UIImageView *roomBgImageView;
|
|
@property (nonatomic, strong) MewRoomHeaderView *roomHeaderView;
|
|
@property (nonatomic, strong) MewRoomRightView *roomRightView;
|
|
@property (nonatomic, strong) CHStageView *roomStageView;
|
|
@property (nonatomic, strong) MewRoomMessageContainerView *roomMessageView;
|
|
///动画的view
|
|
@property (nonatomic,strong) MewRoomAnimationView *roomAnimationView;
|
|
@property (nonatomic, strong) UIImageView *emojiImageView;
|
|
/// 房间的Uid
|
|
@property (nonatomic, strong) NSString *roomUid;
|
|
/// 用户信息
|
|
@property (nonatomic, strong) UserInfoModel *userInfo;
|
|
///房间信息
|
|
@property (nonatomic, strong) MewRoomInfoModel *roomInfo;
|
|
/// emoji
|
|
@property (nonatomic, assign) BOOL isPlayEmojiAnimation;
|
|
@property (nonatomic, copy) NSArray<NSString *> *emojiArrays;
|
|
@property (nonatomic, strong) NSMutableArray<NSString *> *playEmojiArrays;
|
|
|
|
@end
|
|
|
|
@implementation MewRoomViewController
|
|
#pragma mark - Super
|
|
- (MewRoomPresenter *)createPresenter {
|
|
return [[MewRoomPresenter alloc] init];
|
|
}
|
|
|
|
- (BOOL)mew_isHiddenNavBar {
|
|
return YES;
|
|
}
|
|
|
|
|
|
#pragma mark - Life Cycle
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
[self mew_initView];
|
|
self.emojiArrays = @[@"mew_room_emoji_deyi",@"mew_room_emoji_happy",@"mew_room_emoji_sex",@"mew_room_emoji_suprise"];
|
|
self.playEmojiArrays = [NSMutableArray array];
|
|
self.isPlayEmojiAnimation = NO;
|
|
[self.presenter mew_initEnterCurrentRoom:self.roomUid user:[AccountInfoStorage instance].getUid];
|
|
|
|
//监听云信消息
|
|
[[NIMSDK sharedSDK].chatroomManager addDelegate:self];
|
|
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
|
[[NIMSDK sharedSDK].loginManager addDelegate:self];
|
|
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
|
|
}
|
|
|
|
#pragma mark - dealloc
|
|
- (void)dealloc {
|
|
#warning to dox - 时刻注意这个方法 功能做完的时候删除此方法
|
|
NSLog(@"房间销毁了");
|
|
[[NIMSDK sharedSDK].chatroomManager removeDelegate:self];
|
|
[[NIMSDK sharedSDK].chatManager removeDelegate:self];
|
|
[[NIMSDK sharedSDK].loginManager removeDelegate:self];
|
|
[[NIMSDK sharedSDK].conversationManager removeDelegate:self];
|
|
// [[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
}
|
|
|
|
#pragma mark - NIMChatManagerDelegate
|
|
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
|
|
for (NIMMessage * message in messages) {
|
|
///房间内收到p2p的消息 比如升级消息
|
|
// 非房间内消息不处理
|
|
if (message.session.sessionType != NIMSessionTypeChatroom) {
|
|
continue;
|
|
}
|
|
|
|
// 非本房间不处理
|
|
if (![message.session.sessionId isEqualToString:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]) {
|
|
continue;
|
|
}
|
|
|
|
if (message.messageType == NIMMessageTypeNotification) {
|
|
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
|
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
|
NSInteger onLineNumber = self.roomInfo.onlineNum;
|
|
switch (content.eventType) {
|
|
case NIMChatroomEventTypeInfoUpdated: // 麦序状态更新
|
|
{
|
|
NSDictionary *data = [content.notifyExt mewToJSONObject];
|
|
int type = [data[@"type"] intValue];
|
|
switch (type) {
|
|
case 1:
|
|
case 3:
|
|
{
|
|
NSMutableDictionary *lastRoomInfoDic = [NSMutableDictionary dictionaryWithDictionary:[self.roomInfo mewModel2dictionary]];
|
|
[lastRoomInfoDic addEntriesFromDictionary: ((NSString *)data[@"roomInfo"]).mewToJSONObject];
|
|
[self.roomStageView mew_onRoomInfoUpdate];
|
|
// [self.roomMessageView onRoomUpdate];
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case NIMChatroomEventTypeEnter:
|
|
if (content.source.userId.integerValue != [AccountInfoStorage instance].getUid.integerValue && self.userInfo.platformRole != 1) {
|
|
// onLineNumber += 1;
|
|
}
|
|
break;
|
|
case NIMChatroomEventTypeAddBlack:
|
|
case NIMChatroomEventTypeKicked:
|
|
case NIMChatroomEventTypeExit:
|
|
onLineNumber -= 1;
|
|
break;
|
|
case NIMChatroomEventTypeQueueChange: // 麦序上下麦
|
|
{
|
|
NSDictionary* data = (NSDictionary *)content.ext;
|
|
UserInfoModel* userInfo = [UserInfoModel mewModelWithJSON:[data objectForKey:NIMChatroomEventInfoQueueChangeItemValueKey]];
|
|
NSInteger changeType = [data[NIMChatroomEventInfoQueueChangeTypeKey] integerValue];
|
|
if (changeType == 1 && userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
|
// [self cancelRoomArrangeMic];
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
self.roomInfo.onlineNum = onLineNumber;
|
|
// [self.roomHeaderView onRoomUpdate];
|
|
[self.roomStageView mew_handleNIMNotificationMessage:message];
|
|
[self.roomAnimationView mew_handleNIMNotificationMessage:message];
|
|
[self.roomMessageView mew_handleNIMNotificationMessage:message];
|
|
} else if (message.messageType == NIMMessageTypeCustom) {
|
|
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
|
if (obj.attachment != nil && [obj.attachment isKindOfClass:[MewAttachmentModel class]]) {
|
|
[self.roomStageView mew_handleNIMCustomMessage:message];
|
|
[self.roomAnimationView mew_handleNIMCustomMessage:message];
|
|
|
|
[self.roomMessageView mew_handleNIMCustomMessage:message];
|
|
}
|
|
} else if(message.messageType == NIMMessageTypeText) {
|
|
[self.roomMessageView mew_handleNIMTextMessage:message];
|
|
} else if(message.messageType == NIMMessageTypeTip) {
|
|
[self.roomMessageView mew_handleNIMTextMessage:message];
|
|
}
|
|
}
|
|
}
|
|
|
|
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
|
|
if (![message.session.sessionId isEqualToString:[NSString stringWithFormat:@"%ld",self.roomInfo.roomId]]) {
|
|
return;
|
|
}
|
|
|
|
if (message.yidunAntiSpamRes) {
|
|
NSDictionary * spamRes = message.yidunAntiSpamRes.mewToJSONObject;
|
|
NSDictionary * spamResExt = ((NSString *)spamRes[@"ext"]).mewToJSONObject;
|
|
if ([spamResExt[@"antispam"][@"suggestion"] intValue] == 2) {
|
|
[self showErrorToast:@"消息中可能含有违规信息,请停止发送类似信息!"];
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (error) return;
|
|
|
|
if (message.messageType == NIMMessageTypeCustom) {
|
|
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
|
if (obj.attachment != nil && [obj.attachment isKindOfClass:[MewAttachmentModel class]]) {
|
|
[self.roomStageView mew_handleNIMCustomMessage:message];
|
|
[self.roomAnimationView mew_handleNIMCustomMessage:message];
|
|
[self.roomMessageView mew_handleNIMCustomMessage:message];
|
|
}
|
|
|
|
|
|
} else if(message.messageType == NIMMessageTypeText) {
|
|
[self.roomMessageView mew_handleNIMTextMessage:message];
|
|
}
|
|
}
|
|
|
|
|
|
#pragma mark - Public Method
|
|
/// 进入房间
|
|
+ (BOOL)openRoom:(NSString *)roomUid viewController:(UIViewController *)viewController {
|
|
MewRoomViewController *roomVC = [[self alloc] init];
|
|
roomVC.roomUid = roomUid;
|
|
BaseNavigationController *baseNav = [[BaseNavigationController alloc] initWithRootViewController:roomVC];
|
|
baseNav.modalPresentationStyle = UIModalPresentationFullScreen;
|
|
[viewController presentViewController:baseNav animated:YES completion:nil];
|
|
return YES;
|
|
}
|
|
|
|
#pragma mark - MewRoomHostDelegate
|
|
- (MewRoomInfoModel *)mew_getRoomInformation {
|
|
return self.roomInfo;
|
|
}
|
|
|
|
- (UserInfoModel *)mew_getUserInformation {
|
|
return self.userInfo;
|
|
}
|
|
|
|
/// 退出房间
|
|
- (void)mew_exitCurrentRoom {
|
|
//其他模式下
|
|
[self.roomAnimationView mew_resumeAnimationTimer];
|
|
// 默认模式下
|
|
[self.presenter mew_exitNIMCurrentRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]];
|
|
[[MewRtcManager instance] mew_exitRoom];
|
|
[self.presenter mew_reportUserOutRoom:[NSString stringWithFormat:@"%ld",self.roomInfo.uid]];
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
}
|
|
|
|
- (UINavigationController *)mew_getCurrentNavigationController {
|
|
return self.navigationController;
|
|
}
|
|
|
|
- (void)mew_microQueueUpdate:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
|
|
BOOL isOnMic = false;
|
|
for (MicroQueueModel * info in queue.allValues) {
|
|
if (info.userInfo.uid > 0 && [AccountInfoStorage instance].getUid.integerValue == info.userInfo.uid) {
|
|
isOnMic = YES;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
- (CGPoint)mew_animationPointAtStageViewByUid:(NSString *)uid {
|
|
return [self.roomStageView mew_animationPointAtStageViewByUid:uid];
|
|
}
|
|
#pragma mark - MewRoomProtocol
|
|
/// 进入房间成功
|
|
- (void)mew_initEnterCurrentRoomSuccess:(MewRoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo {
|
|
[MewHUDTool hideHUDInView:self.navigationController.view];
|
|
self.userInfo = userInfo;
|
|
self.roomInfo = roomInfo;
|
|
if (roomInfo.valid) {
|
|
[self.roomHeaderView mew_onRoomEntered];
|
|
[self.presenter mew_enterNIMCurrentRoom:[NSString stringWithFormat:@"%ld",self.roomInfo.roomId] user:self.userInfo];
|
|
} else {
|
|
if ([self.roomUid isEqualToString:[NSString stringWithFormat:@"%ld", userInfo.uid]]) {
|
|
//用户进入自己的房间
|
|
if (roomInfo.roomId > 0) {
|
|
[self.presenter mew_openUserRoom:roomInfo.title type:roomInfo.type roomPwd:@"" roomDesc:roomInfo.roomDesc backPic:@"" mgId:@""];
|
|
|
|
} else {
|
|
NSString *title = [NSString stringWithFormat:@"%@的房间",userInfo.nick];
|
|
RoomType type = RoomType_Game;
|
|
|
|
[self.presenter mew_openUserRoom:title type:type roomPwd:@"" roomDesc:@"" backPic:@"" mgId:@""];
|
|
}
|
|
} else {
|
|
[self showSuccessToast:@"房主已下线"];
|
|
[self enterCurrentRoomFail:-1];
|
|
}
|
|
}
|
|
}
|
|
|
|
// 开房成功
|
|
- (void)openCurrentRoomSuccess:(MewRoomInfoModel *)roomInfo {
|
|
self.roomInfo = roomInfo;
|
|
[self.roomHeaderView mew_onRoomEntered];
|
|
[self.presenter mew_enterNIMCurrentRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId] user:self.userInfo];
|
|
|
|
}
|
|
|
|
// IM进房成功
|
|
- (void)enterCurrentRoomSuccess:(NIMChatroom *)chatRoom {
|
|
[MewHUDTool hideHUDInView:self.navigationController.view];
|
|
[self.roomStageView mew_onRoomEntered];
|
|
if (self.roomInfo != nil) {
|
|
[self.presenter mew_reportUserInterRoom:[NSString stringWithFormat:@"%zd", self.roomInfo.uid]];
|
|
|
|
}
|
|
self.roomInfo.onlineNum = chatRoom.onlineUserCount;
|
|
|
|
}
|
|
|
|
// 进房失败
|
|
- (void)enterCurrentRoomFail:(NSInteger)code {
|
|
[MewHUDTool hideHUDInView:self.navigationController.view];
|
|
[self hideHUD];
|
|
if (code == 13003) {
|
|
[self showErrorToast:@"您已被管理员拉黑"];
|
|
}
|
|
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
}
|
|
|
|
/// 送礼物成功
|
|
- (void)mew_sendRoomGiftSuccess:(MewGiftReceiveInfoModel *)receiveInfo originDic:(NSDictionary *)originDic uidCount:(NSInteger)uidCount {
|
|
[MewHUDTool hideHUD];
|
|
|
|
[self sendCustomMessage:receiveInfo oringinDic:originDic];
|
|
|
|
}
|
|
|
|
/// 送礼物失败
|
|
- (void)mew_sendRoomGiftFailWithCode:(NSInteger)code msg:(NSString *)msg {
|
|
[MewHUDTool hideHUD];
|
|
|
|
if (code == 31005) {// 余额不足
|
|
[self showErrorToast:msg];
|
|
} else {
|
|
[self showErrorToast:msg];
|
|
}
|
|
}
|
|
|
|
|
|
/// 发送云信IM
|
|
- (void)sendCustomMessage:(MewGiftReceiveInfoModel *)eceiveModel oringinDic:(NSDictionary *)originDic {
|
|
///单人
|
|
NSMutableDictionary *data = [NSMutableDictionary dictionary];
|
|
[data addEntriesFromDictionary:originDic];
|
|
MewAttachmentModel *attchment = [[MewAttachmentModel alloc] init];
|
|
attchment.first = Mew_CustomMessageType_Gift;
|
|
attchment.second = Custom_Message_Sub_Gift_Send;
|
|
NSDictionary *targetUsers = ((NSArray *)[data objectForKey:@"targetUsers"]).firstObject;
|
|
[data setObject:[targetUsers valueForKeyPath:@"uid"] forKey:@"targetUid"];
|
|
[data setObject:[targetUsers valueForKeyPath:@"nick"] forKey:@"targetNick"];
|
|
[data setObject:[targetUsers valueForKeyPath:@"avatar"] forKey:@"targetAvatar"];
|
|
attchment.data = data;
|
|
[self sendCustomMessage:attchment];
|
|
}
|
|
|
|
- (void)sendCustomMessage:(MewAttachmentModel *)attachment {
|
|
NSString *sessionID = [NSString stringWithFormat:@"%ld", [self mew_getRoomInformation].roomId];
|
|
NIMMessage *message = [[NIMMessage alloc] init];
|
|
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
|
object.attachment = attachment;
|
|
message.messageObject = object;
|
|
|
|
UserInfoModel *userInfo = [self mew_getUserInformation];
|
|
MewMessageRemoteExtModel *extModel = [[MewMessageRemoteExtModel alloc] init];
|
|
NSMutableDictionary *remoteExt = [NSMutableDictionary dictionaryWithObject:extModel.mewModel2dictionary forKey:[NSString stringWithFormat:@"%ld",userInfo.uid]];
|
|
message.remoteExt = remoteExt;
|
|
/// 构造会话
|
|
NIMSessionType sessionType = NIMSessionTypeChatroom;
|
|
NIMSession *session = [NIMSession session:sessionID type:sessionType];
|
|
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
|
|
|
}
|
|
|
|
#pragma mark - MewRoomHeaderViewDelegate (header事件回调)
|
|
- (void)didSelectMewRoomHeaderViewTarget:(NSInteger)target {
|
|
if (target == 0) {
|
|
// 收藏
|
|
|
|
} else if (target == 1) {
|
|
// 退出房间
|
|
[self mew_exitCurrentRoom];
|
|
} else {
|
|
// 举报房间
|
|
[self reportButton];
|
|
|
|
}
|
|
}
|
|
|
|
|
|
#pragma mark - MewRoomRightViewDelegate(右边事件回调)
|
|
- (void)didSelectMewRoomRightViewWithTarget:(NSInteger)target {
|
|
if (target == 0) {
|
|
// 聊天
|
|
[MewRoomSendTextView Mew_ShowTextView:self.view.superview.superview delegate:self];
|
|
} else if (target == 1) {
|
|
// 表情
|
|
[self randomEmoji];
|
|
} else {
|
|
// 礼物
|
|
[self sendRoomGift];
|
|
}
|
|
}
|
|
|
|
|
|
#pragma mark - Private Method
|
|
/// 表情
|
|
- (void)randomEmoji {
|
|
int t = arc4random() % self.emojiArrays.count;
|
|
[self.playEmojiArrays addObject:self.emojiArrays[t]];
|
|
[self startPlayEmojiAnimation:self.playEmojiArrays[0]];
|
|
|
|
}
|
|
|
|
- (void)startPlayEmojiAnimation:(NSString *)emoji {
|
|
if (self.playEmojiArrays.count == 0) {
|
|
return;
|
|
};
|
|
|
|
if (self.isPlayEmojiAnimation) return;
|
|
|
|
self.isPlayEmojiAnimation = YES;
|
|
self.emojiImageView.hidden = NO;
|
|
if (self.playEmojiArrays.count > 0) {
|
|
self.emojiImageView.image = [UIImage imageNamed:self.playEmojiArrays[0]];
|
|
}
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
self.isPlayEmojiAnimation = NO;
|
|
self.emojiImageView.hidden = YES;
|
|
|
|
if (self.playEmojiArrays.count > 0) {
|
|
[self.playEmojiArrays removeObjectAtIndex:0];
|
|
}
|
|
|
|
if (self.playEmojiArrays.count > 0) {
|
|
[self startPlayEmojiAnimation:self.playEmojiArrays[0]];
|
|
}
|
|
});
|
|
}
|
|
|
|
/// 礼物
|
|
- (void)sendRoomGift {
|
|
MewSocialStageView *mewStageView = (MewSocialStageView *)self.roomStageView;
|
|
NSString *selectId = mewStageView.selectUid;
|
|
if (selectId == [AccountInfoStorage instance].getUid) {
|
|
[self showErrorToast:@"不能赠送礼物给自己"];
|
|
return;
|
|
}
|
|
if (mewStageView.selectUid.length == 0 || [mewStageView.selectUid isEqualToString:@""]) {
|
|
[self showErrorToast:@"请点击麦位头像,选择送礼的人"];
|
|
return;
|
|
}
|
|
|
|
[MewHUDTool showLoadingWithMessage:@"赠送中..."];
|
|
[self.presenter mew_sendRoomGift:mewStageView.selectUid roomUid:self.roomUid];
|
|
}
|
|
|
|
|
|
- (void)reportButton {
|
|
|
|
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"举报内容" message:@""
|
|
preferredStyle:UIAlertControllerStyleActionSheet];
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"色情低俗,以任何形式传播淫秽、色情、低俗擦边的内" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
|
|
[self showSuccessToast:@"举报成功"];
|
|
}]];
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"政治敏感,进行反党反政府或带有侮辱诋毁党和国家的内容" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
|
|
[self showSuccessToast:@"举报成功"];
|
|
}]];
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"垃圾广告,传播垃圾广告或违法违规广告信息" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
|
|
[self showSuccessToast:@"举报成功"];
|
|
}]];
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"言语攻击,恶意抹黑、诋毁或辱骂他人" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
|
|
[self showSuccessToast:@"举报成功"];
|
|
}]];
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"违规交易,发布线下交易或可能涉及诈骗的内容" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
|
|
[self showSuccessToast:@"举报成功"];
|
|
}]];
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"泄露隐私,以任何形式泄露他人隐私" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
|
|
[self showSuccessToast:@"举报成功"];
|
|
}]];
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"暴力恐怖,传播暴力、血腥、威胁生命健康的内容或展示枪支、刀具" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
|
|
[self showSuccessToast:@"举报成功"];
|
|
}]];
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"侵权盗版,侵犯他人合法版权" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
|
|
[self showSuccessToast:@"举报成功"];
|
|
}]];
|
|
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"其它" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
|
|
[self showSuccessToast:@"举报成功"];
|
|
}]];
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action){
|
|
// [self showSuccessToast:@"举报成功"];
|
|
}]];
|
|
[self presentViewController:alert animated:YES completion:nil];
|
|
|
|
|
|
}
|
|
#pragma mark - Init
|
|
- (void)mew_initView {
|
|
[self.view addSubview:self.roomBgImageView];
|
|
[self.view addSubview:self.roomHeaderView];
|
|
[self.view addSubview:self.roomStageView];
|
|
[self.view insertSubview:self.roomRightView aboveSubview:self.roomStageView];
|
|
[self.view addSubview:self.roomMessageView];
|
|
[self.view insertSubview:self.emojiImageView aboveSubview:self.roomRightView];
|
|
[self.view addSubview:self.roomAnimationView];
|
|
[self mew_initLayout];
|
|
}
|
|
|
|
- (void)mew_initLayout {
|
|
[self.roomBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.equalTo(self.view);
|
|
}];
|
|
[self.roomHeaderView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.equalTo(self.view);
|
|
make.top.mas_equalTo(kStatusBarHeight+20);
|
|
make.height.mas_equalTo(28);
|
|
}];
|
|
|
|
[self.roomRightView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self.roomHeaderView.mas_bottom).offset(35);
|
|
make.right.equalTo(self.view).offset(-32);
|
|
}];
|
|
|
|
[self.roomStageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self.roomRightView);
|
|
make.left.right.equalTo(self.view);
|
|
make.height.mas_equalTo(self.roomStageView.heightForStageView);
|
|
}];
|
|
|
|
[self.roomMessageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self.roomStageView.mas_bottom);
|
|
make.left.right.equalTo(self.view);
|
|
make.bottom.mas_equalTo(-kSafeAreaBottomHeight);
|
|
}];
|
|
|
|
[self.emojiImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerX.equalTo(self.roomStageView);
|
|
make.bottom.equalTo(self.roomStageView).offset(-60);
|
|
}];
|
|
|
|
[self.roomAnimationView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.mas_equalTo(self.view);
|
|
}];
|
|
}
|
|
|
|
|
|
#pragma mark - Get
|
|
- (UIImageView *)roomBgImageView {
|
|
if (!_roomBgImageView) {
|
|
_roomBgImageView = [[UIImageView alloc] init];
|
|
_roomBgImageView.image = [UIImage imageNamed:@"mew_home_bg"];
|
|
}
|
|
return _roomBgImageView;
|
|
}
|
|
|
|
- (MewRoomHeaderView *)roomHeaderView {
|
|
if (!_roomHeaderView) {
|
|
_roomHeaderView = [[MewRoomHeaderView alloc] initWithDelegate:self];
|
|
_roomHeaderView.delegate = self;
|
|
}
|
|
return _roomHeaderView;
|
|
}
|
|
|
|
- (MewRoomRightView *)roomRightView {
|
|
if (!_roomRightView) {
|
|
_roomRightView = [[MewRoomRightView alloc] init];
|
|
_roomRightView.delegate = self;
|
|
|
|
}
|
|
return _roomRightView;
|
|
}
|
|
|
|
- (CHStageView *)roomStageView {
|
|
if (!_roomStageView) {
|
|
_roomStageView = [[MewSocialStageView alloc] initWithDelegate:self];
|
|
}
|
|
return _roomStageView;
|
|
}
|
|
|
|
- (MewRoomMessageContainerView *)roomMessageView {
|
|
if (!_roomMessageView) {
|
|
_roomMessageView = [[MewRoomMessageContainerView alloc] initWithDelegate:self];
|
|
}
|
|
return _roomMessageView;
|
|
}
|
|
|
|
- (UIImageView *)emojiImageView {
|
|
if (!_emojiImageView) {
|
|
_emojiImageView = [[UIImageView alloc] init];
|
|
}
|
|
return _emojiImageView;
|
|
}
|
|
|
|
- (MewRoomAnimationView *)roomAnimationView {
|
|
if (!_roomAnimationView) {
|
|
_roomAnimationView = [[MewRoomAnimationView alloc] initWithDelegate:self];
|
|
}
|
|
return _roomAnimationView;
|
|
}
|
|
|
|
@end
|