Files
featherVoice/QXLive/Message(音信)/Controller/群聊/QXIMGroupSettingVC.m
2026-01-04 14:01:30 +08:00

81 lines
2.6 KiB
Objective-C

//
// QXIMGroupSettingVC.m
// QXLive
//
// Created by 启星 on 2026/1/2.
//
#import "QXIMGroupSettingVC.h"
#import "QXIMGroupSettingView.h"
#import "QXMessageServices.h"
#import "QXGroupMemberViewController.h"
#import "ImSDK_Plus/V2TIMManager+Group.h"
@interface QXIMGroupSettingVC ()<QXIMGroupSettingViewDelegate>
@property (nonatomic,strong)UIScrollView *scrollView;
@property (nonatomic,strong)QXIMGroupSettingView *settingView;
@property (nonatomic,strong)QXGroupSettingInfoModel *model;
@end
@implementation QXIMGroupSettingVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
-(void)setNavgationItems{
[super setNavgationItems];
self.navigationItem.title = @"群聊设置";
}
-(void)initSubViews{
self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight)];
self.settingView = [[QXIMGroupSettingView alloc] initWithFrame:self.scrollView.bounds];
self.settingView.delegate = self;
[self.scrollView addSubview:self.settingView];
[self.view addSubview:self.scrollView];
[self getGroupInfo];
}
-(void)previewMemberList{
QXGroupMemberViewController *vc = [[QXGroupMemberViewController alloc] init];
vc.groupId = self.groupId;
vc.isOwner = self.model.is_deacon;
[self.navigationController pushViewController:vc animated:YES];
}
-(void)saveGroupInfoWithGroupId:(NSString *)groupId notice:(NSString *)notice name:(NSString *)name{
MJWeakSelf
[QXMessageServices setGroupInfoWithGuildId:groupId name:name avatar:@"" notice:notice successBlock:^(NSDictionary * _Nonnull dict) {
showToast(@"修改成功");
[weakSelf getGroupInfo];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(void)groupSetMute:(BOOL)isMute muteSwitch:(UISwitch *)muteSwitch{
[[V2TIMManager sharedInstance] muteAllGroupMembers:self.groupId isMute:isMute succ:^{
} fail:^(int code, NSString * _Nullable desc) {
if (isMute) {
muteSwitch.on = NO;
}else{
muteSwitch.on = YES;
}
}];
}
-(void)getGroupInfo{
MJWeakSelf
[QXMessageServices getGroupSettingWithGuildId:self.groupId successBlock:^(QXGroupSettingInfoModel * _Nonnull model) {
weakSelf.model = model;
weakSelf.settingView.model = model;
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
@end