| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- //
- // MOChatViewController+MoreMenu.m
- // MiMoLive
- //
- // Created by SuperC on 2025/6/5.
- //
- #import "MOChatViewController+MoreMenu.h"
- #import "MOChooseTimeAlertView.h"
- #import "MONormalRightAlertView.h"
- #import "MOAddBlackAlertView.h"
- @implementation MOChatViewController (MoreMenu)
- - (void)updateRightBarItem{
- WEAKSELF
- if(!(self.isHalfShow || self.isLiveRoom)){
- [self setNavRightItemWithImage:[UIImage imageNamed:@"v_2_chat_more"]];
- }
- }
- - (void)RightBarItemClick:(UIButton *)sender{
- //更多按钮
- [self moreBtnClick];
- }
- - (void)moreBtnClick{
- NSMutableArray *dataArr = [NSMutableArray array];
-
- NSDictionary *setDict = [self addItemWithTitle:NSLocalString(@"mimo_2_chat_right_user_info") andSel:@selector(toPushUserHomePageh)];
- [dataArr addObject:setDict];
-
- NSDictionary *reportDict = [self addItemWithTitle:NSLocalString(@"mimo_report_title") andSel:@selector(reportBtnClick)];
- [dataArr addObject:reportDict];
-
- if(self.userData.blacklist){
- //移除黑名单
- NSDictionary *ruleDict = [self addItemWithTitle:NSLocalString(@"mimo_blacklist_remove") andSel:@selector(toDeleteBlackList)];
- [dataArr addObject:ruleDict];
- }
- else{
- //增加黑名单
- NSDictionary *ruleDict = [self addItemWithTitle:NSLocalString(@"mimo_blacklist_add") andSel:@selector(showBlackConfirmAlertView)];
- [dataArr addObject:ruleDict];
- }
-
- MONormalRightAlertView *view = [MONormalRightAlertView moNormalRightAlertView];
- UIWindow *keyWindow = [[UIApplication sharedApplication] delegate].window;
- [keyWindow addSubview:view];
- [view showVipMenuView];
- view.target = self;
- view.dataArr = dataArr;
-
- CGFloat statusBarHeight = STATUS_BAR_HEIGHT;
- view.menuVIewTop.constant = statusBarHeight + 12.0 + 30.0 + 5.0;
- view.menuViewRight.constant = 12.0;
- }
- - (NSDictionary *)addItemWithTitle:(NSString *)title andSel:(SEL)sel{
- NSDictionary *itemDic = @{@"name":title,@"sel":NSStringFromSelector(sel)};
- return itemDic;
- }
- - (void)toPushUserHomePageh{
- //查看资料
- [self toPushUserHomePageWith:self.userData.userProfile.id];
- }
- - (void)reportBtnClick{
- //举报
- [self showReportView];
- }
- - (void)toDeleteBlackList{
- NSString *userId = self.otherUserId;
- if(userId.length == 0){
- return;
- }
-
- WEAKSELF
- NSDictionary *dict = @{@"duration":@(5),
- @"target":userId};
- [kHttpManager toRemoveBlockWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
- if(kCode_Success){
- MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
- [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")];
-
- //移除黑名单
- [weakSelf toGetUserSetData];
- }
- else{
- MOLogV(@"toDeleteBlackList 接口报错了");
- kShowNetError(data)
- }
- }];
-
- }
- - (void)showBlackConfirmAlertView{
-
- // NSArray *dataArr = @[@"30Min",@"24H",@"3Day",@"7Day",@"forever"];
- //
- // WEAKSELF
- // MOChooseTimeAlertView *view = [MOChooseTimeAlertView moChooseTimeAlertView];
- // view.topTipText = [NSString stringWithFormat:NSLocalString(@"mimo_blacklist_set_time"),self.userData.userProfile.nickname];
- // view.bottomTipText = NSLocalString(@"mimo_blacklist_set_black_result");
- // view.dataArr = dataArr;
- // [view showChooseTimeAlertView];
- // view.confirmBtnBlock = ^(NSInteger index) {
- // [weakSelf toAddBlackListWith:index];
- // };
-
- MOAddBlackAlertView *alertView = [[MOAddBlackAlertView alloc] init];
- WEAKSELF
- alertView.addBlackConfirmBlock = ^(NSInteger timeIndex) {
- [weakSelf toAddBlackListWith:timeIndex];
- };
- [alertView show];
- }
- - (void)toAddBlackListWith:(NSInteger)index{
-
- NSString *userId = self.otherUserId;
- if(userId.length == 0){
- return;
- }
-
- WEAKSELF
- //时长(1=30分钟,2=24小时,3=3天,4=7天,5=永久) ps:新增黑名单时,字段非空
- NSDictionary *dict = @{@"duration":@(index),
- @"target":userId};
- [kHttpManager toAddSomeOneForBlockWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
- if(kCode_Success){
-
- [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")];
- [weakSelf toGetUserSetData];
- }
- else{
- kShowNetError(data)
- }
- }];
- }
- @end
|