增加换肤功能
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
|
||||
// Created by Tencent on 2023/06/09.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@class TUIGroupInfoController_Minimalist;
|
||||
@class TUIGroupMemberCellData;
|
||||
@class V2TIMGroupInfo;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TUIGroupInfoController
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@interface TUIGroupInfoController_Minimalist : UIViewController
|
||||
|
||||
@property(nonatomic, strong) UITableView *tableView;
|
||||
@property(nonatomic, strong) NSString *groupId;
|
||||
|
||||
- (void)updateData;
|
||||
- (void)updateGroupInfo;
|
||||
@end
|
||||
@@ -0,0 +1,830 @@
|
||||
|
||||
// Created by Tencent on 2023/06/09.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
#import "TUIGroupInfoController_Minimalist.h"
|
||||
#import <TIMCommon/TIMCommonModel.h>
|
||||
#import <TIMCommon/TIMDefine.h>
|
||||
#import <TUICore/TUICore.h>
|
||||
#import <TUICore/TUILogin.h>
|
||||
#import <TUICore/TUIThemeManager.h>
|
||||
#import "TIMGroupInfo+TUIDataProvider.h"
|
||||
#import "TUIGroupButtonCell_Minimalist.h"
|
||||
#import "TUIGroupInfoDataProvider_Minimalist.h"
|
||||
#import "TUIGroupManageController_Minimalist.h"
|
||||
#import "TUIGroupMemberCell.h"
|
||||
#import "TUIGroupMemberController_Minimalist.h"
|
||||
#import "TUIGroupMemberTableViewCell_Minimalist.h"
|
||||
#import "TUIGroupMembersCell.h"
|
||||
#import "TUIGroupNoticeCell.h"
|
||||
#import "TUIGroupNoticeController_Minimalist.h"
|
||||
#import "TUIGroupProfileCardViewCell_Minimalist.h"
|
||||
#import "TUISelectGroupMemberViewController_Minimalist.h"
|
||||
|
||||
#define ADD_TAG @"-1"
|
||||
#define DEL_TAG @"-2"
|
||||
|
||||
@interface TUIGroupInfoController_Minimalist () <TUIModifyViewDelegate,
|
||||
TUIGroupMembersCellDelegate,
|
||||
TUIProfileCardDelegate,
|
||||
TUIGroupInfoDataProviderDelegate_Minimalist,
|
||||
UITableViewDelegate,
|
||||
UITableViewDataSource>
|
||||
@property(nonatomic, strong) TUIGroupInfoDataProvider_Minimalist *dataProvider;
|
||||
@property(nonatomic, strong) TUINaviBarIndicatorView *titleView;
|
||||
@property(nonatomic, assign) NSInteger tag;
|
||||
@end
|
||||
|
||||
@implementation TUIGroupInfoController_Minimalist
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.dataProvider = [[TUIGroupInfoDataProvider_Minimalist alloc] initWithGroupID:self.groupId];
|
||||
self.dataProvider.delegate = self;
|
||||
|
||||
[self setupViews];
|
||||
[self.dataProvider loadData];
|
||||
|
||||
@weakify(self);
|
||||
[RACObserve(self.dataProvider, dataList) subscribeNext:^(id _Nullable x) {
|
||||
@strongify(self);
|
||||
[self.tableView reloadData];
|
||||
}];
|
||||
|
||||
_titleView = [[TUINaviBarIndicatorView alloc] init];
|
||||
self.navigationItem.titleView = _titleView;
|
||||
self.navigationItem.title = @"";
|
||||
[_titleView setTitle:TIMCommonLocalizableString(ProfileDetails)];
|
||||
}
|
||||
|
||||
- (void)setupViews {
|
||||
self.tableView = [[UITableView alloc] init];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.backgroundColor = TIMCommonDynamicColor(@"", @"#FFFFFF");
|
||||
self.tableView.delaysContentTouches = NO;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
|
||||
self.tableView.separatorColor = [UIColor whiteColor];
|
||||
self.tableView.separatorInset = UIEdgeInsetsMake(0, -58, 0, 0);
|
||||
if (@available(iOS 15.0, *)) {
|
||||
self.tableView.sectionHeaderTopPadding = 0;
|
||||
}
|
||||
self.tableView.frame = self.view.bounds;
|
||||
[self.view addSubview:self.tableView];
|
||||
|
||||
self.tableView.tableFooterView = [[UIView alloc] init];
|
||||
TUIGroupProfileHeaderView_Minimalist *headerView = [[TUIGroupProfileHeaderView_Minimalist alloc] init];
|
||||
self.tableView.tableHeaderView = headerView;
|
||||
[self updateGroupInfo];
|
||||
|
||||
@weakify(self);
|
||||
headerView.headImgClickBlock = ^{
|
||||
@strongify(self);
|
||||
[self didSelectAvatar];
|
||||
};
|
||||
headerView.editBtnClickBlock = ^{
|
||||
@strongify(self);
|
||||
[self didSelectEditGroupName];
|
||||
};
|
||||
|
||||
// Extension
|
||||
NSMutableArray<TUIGroupProfileHeaderItemView_Minimalist *> *itemViewList = [NSMutableArray array];
|
||||
NSMutableDictionary *param = [NSMutableDictionary dictionary];
|
||||
if (self.groupId.length > 0) {
|
||||
param[TUICore_TUIGroupExtension_GroupInfoCardActionMenu_GroupID] = self.groupId;
|
||||
}
|
||||
param[TUICore_TUIGroupExtension_GroupInfoCardActionMenu_FilterVideoCall] = @(NO);
|
||||
param[TUICore_TUIGroupExtension_GroupInfoCardActionMenu_FilterAudioCall] = @(NO);
|
||||
if (self.navigationController) {
|
||||
param[TUICore_TUIGroupExtension_GroupInfoCardActionMenu_PushVC] = self.navigationController;
|
||||
}
|
||||
NSArray<TUIExtensionInfo *> *extensionList = [TUICore getExtensionList:TUICore_TUIGroupExtension_GroupInfoCardActionMenu_MinimalistExtensionID param:param];
|
||||
for (TUIExtensionInfo *info in extensionList) {
|
||||
if (info.icon && info.text && info.onClicked) {
|
||||
TUIGroupProfileHeaderItemView_Minimalist *itemView = [[TUIGroupProfileHeaderItemView_Minimalist alloc] init];
|
||||
itemView.iconView.image = info.icon;
|
||||
itemView.textLabel.text = info.text;
|
||||
itemView.messageBtnClickBlock = ^{
|
||||
info.onClicked(param);
|
||||
};
|
||||
[itemViewList addObject:itemView];
|
||||
}
|
||||
}
|
||||
headerView.itemViewList = itemViewList;
|
||||
|
||||
if (itemViewList.count > 0) {
|
||||
headerView.frame = CGRectMake(0, 0, self.tableView.bounds.size.width, 355);
|
||||
} else {
|
||||
headerView.frame = CGRectMake(0, 0, self.tableView.bounds.size.width, 257);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateData {
|
||||
[self.dataProvider loadData];
|
||||
}
|
||||
|
||||
- (void)updateGroupInfo {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[self.dataProvider updateGroupInfo:^{
|
||||
TUIGroupProfileHeaderView_Minimalist *headerView = (TUIGroupProfileHeaderView_Minimalist *)self.tableView.tableHeaderView;
|
||||
headerView.groupInfo = weakSelf.dataProvider.groupInfo;
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Table view data source
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return self.dataProvider.dataList.count;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||
UIView *view = [[UIView alloc] init];
|
||||
view.backgroundColor = [UIColor clearColor];
|
||||
return view;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
||||
return 10;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
NSMutableArray *array = self.dataProvider.dataList[section];
|
||||
return array.count;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
NSMutableArray *array = self.dataProvider.dataList[indexPath.section];
|
||||
NSObject *data = array[indexPath.row];
|
||||
if ([data isKindOfClass:[TUIGroupMemberCellData_Minimalist class]]) {
|
||||
return [(TUIGroupMemberCellData_Minimalist *)data heightOfWidth:Screen_Width];
|
||||
} else if ([data isKindOfClass:[TUIGroupButtonCellData_Minimalist class]]) {
|
||||
return [(TUIGroupButtonCellData_Minimalist *)data heightOfWidth:Screen_Width];
|
||||
;
|
||||
} else if ([data isKindOfClass:[TUICommonSwitchCellData class]]) {
|
||||
return [(TUICommonSwitchCellData *)data heightOfWidth:Screen_Width];
|
||||
;
|
||||
} else if ([data isKindOfClass:TUIGroupNoticeCellData.class]) {
|
||||
return 72.0;
|
||||
}
|
||||
return kScale390(55);
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
NSMutableArray *array = self.dataProvider.dataList[indexPath.section];
|
||||
NSObject *data = array[indexPath.row];
|
||||
@weakify(self);
|
||||
|
||||
if ([data isKindOfClass:[TUICommonTextCellData class]]) {
|
||||
TUICommonTextCell *cell = [tableView dequeueReusableCellWithIdentifier:TKeyValueCell_ReuseId];
|
||||
if (!cell) {
|
||||
cell = [[TUICommonTextCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TKeyValueCell_ReuseId];
|
||||
}
|
||||
[cell fillWithData:(TUICommonTextCellData *)data];
|
||||
cell.backgroundColor = TIMCommonDynamicColor(@"", @"#f9f9f9");
|
||||
cell.contentView.backgroundColor = TIMCommonDynamicColor(@"", @"#f9f9f9");
|
||||
|
||||
return cell;
|
||||
} else if ([data isKindOfClass:[TUIGroupMemberCellData_Minimalist class]]) {
|
||||
TUIGroupMemberTableViewCell_Minimalist *cell = [tableView dequeueReusableCellWithIdentifier:TGroupMembersCell_ReuseId];
|
||||
if (!cell) {
|
||||
cell = [[TUIGroupMemberTableViewCell_Minimalist alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TGroupMembersCell_ReuseId];
|
||||
}
|
||||
[cell fillWithData:(TUIGroupMemberCellData_Minimalist *)data];
|
||||
cell.backgroundColor = TIMCommonDynamicColor(@"", @"#f9f9f9");
|
||||
cell.contentView.backgroundColor = TIMCommonDynamicColor(@"", @"#f9f9f9");
|
||||
|
||||
return cell;
|
||||
} else if ([data isKindOfClass:[TUICommonSwitchCellData class]]) {
|
||||
TUICommonSwitchCell *cell = [tableView dequeueReusableCellWithIdentifier:TSwitchCell_ReuseId];
|
||||
if (!cell) {
|
||||
cell = [[TUICommonSwitchCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TSwitchCell_ReuseId];
|
||||
}
|
||||
[cell fillWithData:(TUICommonSwitchCellData *)data];
|
||||
cell.backgroundColor = TIMCommonDynamicColor(@"", @"#f9f9f9");
|
||||
cell.contentView.backgroundColor = TIMCommonDynamicColor(@"", @"#f9f9f9");
|
||||
return cell;
|
||||
} else if ([data isKindOfClass:[TUIGroupButtonCellData_Minimalist class]]) {
|
||||
TUIGroupButtonCell_Minimalist *cell = [tableView dequeueReusableCellWithIdentifier:TButtonCell_ReuseId];
|
||||
if (!cell) {
|
||||
cell = [[TUIGroupButtonCell_Minimalist alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TButtonCell_ReuseId];
|
||||
}
|
||||
[cell fillWithData:(TUIGroupButtonCellData_Minimalist *)data];
|
||||
return cell;
|
||||
} else if ([data isKindOfClass:TUIGroupNoticeCellData.class]) {
|
||||
TUIGroupNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TUIGroupNoticeCell"];
|
||||
if (cell == nil) {
|
||||
cell = [[TUIGroupNoticeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TUIGroupNoticeCell"];
|
||||
}
|
||||
cell.backgroundColor = TIMCommonDynamicColor(@"", @"#f9f9f9");
|
||||
cell.contentView.backgroundColor = TIMCommonDynamicColor(@"", @"#f9f9f9");
|
||||
cell.cellData = data;
|
||||
return cell;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
}
|
||||
|
||||
- (void)leftBarButtonClick:(UIButton *)sender {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
#pragma mark TUIGroupInfoDataProviderDelegate
|
||||
|
||||
- (void)onSendMessage:(TUIGroupProfileCardViewCell_Minimalist *)cell {
|
||||
TUIGroupProfileCardCellData_Minimalist *cellData = cell.cardData;
|
||||
|
||||
UIImage *avataImage = [UIImage new];
|
||||
if (cell.headerView.headImg.image) {
|
||||
avataImage = cell.headerView.headImg.image;
|
||||
}
|
||||
|
||||
NSDictionary *param = @{
|
||||
TUICore_TUIChatObjectFactory_ChatViewController_Title : cellData.name ?: @"",
|
||||
TUICore_TUIChatObjectFactory_ChatViewController_GroupID : cellData.identifier ?: @"",
|
||||
TUICore_TUIChatObjectFactory_ChatViewController_AvatarImage : avataImage ?: [UIImage new]
|
||||
};
|
||||
[self.navigationController pushViewController:TUICore_TUIChatObjectFactory_ChatViewController_Minimalist param:param forResult:nil];
|
||||
}
|
||||
|
||||
- (void)didSelectMembers {
|
||||
TUIGroupMemberController_Minimalist *membersController = [[TUIGroupMemberController_Minimalist alloc] init];
|
||||
membersController.groupId = _groupId;
|
||||
membersController.groupInfo = self.dataProvider.groupInfo;
|
||||
[self.navigationController pushViewController:membersController animated:YES];
|
||||
}
|
||||
|
||||
- (void)didSelectAddOption:(TUICommonTextCell *)cell {
|
||||
TUICommonTextCellData *data = cell.textData;
|
||||
BOOL isApprove = [data.key isEqualToString:TIMCommonLocalizableString(TUIKitGroupProfileInviteType)];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
UIAlertController *ac = [UIAlertController
|
||||
alertControllerWithTitle:nil
|
||||
message:isApprove ? TIMCommonLocalizableString(TUIKitGroupProfileInviteType) : TIMCommonLocalizableString(TUIKitGroupProfileJoinType)
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
|
||||
NSArray *actionList = @[
|
||||
@{
|
||||
@(V2TIM_GROUP_ADD_FORBID) : isApprove ? TIMCommonLocalizableString(TUIKitGroupProfileInviteDisable)
|
||||
: TIMCommonLocalizableString(TUIKitGroupProfileJoinDisable)
|
||||
},
|
||||
@{@(V2TIM_GROUP_ADD_AUTH) : TIMCommonLocalizableString(TUIKitGroupProfileAdminApprove)},
|
||||
@{@(V2TIM_GROUP_ADD_ANY) : TIMCommonLocalizableString(TUIKitGroupProfileAutoApproval)}
|
||||
];
|
||||
for (NSDictionary *map in actionList) {
|
||||
[ac tuitheme_addAction:[UIAlertAction actionWithTitle:map.allValues.firstObject
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
V2TIMGroupAddOpt opt = (V2TIMGroupAddOpt)[map.allKeys.firstObject intValue];
|
||||
if (isApprove) {
|
||||
[weakSelf.dataProvider setGroupApproveOpt:opt];
|
||||
} else {
|
||||
[weakSelf.dataProvider setGroupAddOpt:opt];
|
||||
}
|
||||
}]];
|
||||
}
|
||||
[ac tuitheme_addAction:[UIAlertAction actionWithTitle:TIMCommonLocalizableString(Cancel) style:UIAlertActionStyleCancel handler:nil]];
|
||||
|
||||
[self presentViewController:ac animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)didSelectGroupNick:(TUICommonTextCell *)cell {
|
||||
TUIModifyViewData *data = [[TUIModifyViewData alloc] init];
|
||||
data.title = TIMCommonLocalizableString(TUIKitGroupProfileEditAlias);
|
||||
data.content = self.dataProvider.selfInfo.nameCard;
|
||||
data.desc = TIMCommonLocalizableString(TUIKitGroupProfileEditAliasDesc);
|
||||
TUIModifyView *modify = [[TUIModifyView alloc] init];
|
||||
modify.tag = 2;
|
||||
modify.delegate = self;
|
||||
[modify setData:data];
|
||||
[modify showInWindow:self.view.window];
|
||||
}
|
||||
|
||||
- (void)didSelectCommon {
|
||||
UIAlertController *ac = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
|
||||
if ([self.dataProvider.groupInfo isPrivate] || [TUIGroupInfoDataProvider_Minimalist isMeOwner:self.dataProvider.groupInfo]) {
|
||||
@weakify(self);
|
||||
[ac tuitheme_addAction:[UIAlertAction actionWithTitle:TIMCommonLocalizableString(TUIKitGroupProfileEditGroupName)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
@strongify(self);
|
||||
[self didSelectEditGroupName];
|
||||
}]];
|
||||
}
|
||||
if ([TUIGroupInfoDataProvider_Minimalist isMeOwner:self.dataProvider.groupInfo]) {
|
||||
@weakify(self);
|
||||
[ac tuitheme_addAction:[UIAlertAction actionWithTitle:TIMCommonLocalizableString(TUIKitGroupProfileEditAnnouncement)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
@strongify(self);
|
||||
[self didSelectEditAnnouncement];
|
||||
}]];
|
||||
}
|
||||
|
||||
if ([TUIGroupInfoDataProvider_Minimalist isMeOwner:self.dataProvider.groupInfo]) {
|
||||
@weakify(self);
|
||||
[ac tuitheme_addAction:[UIAlertAction actionWithTitle:TIMCommonLocalizableString(TUIKitGroupProfileEditAvatar)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
@strongify(self);
|
||||
[self didSelectAvatar];
|
||||
}]];
|
||||
}
|
||||
|
||||
[ac tuitheme_addAction:[UIAlertAction actionWithTitle:TIMCommonLocalizableString(Cancel) style:UIAlertActionStyleCancel handler:nil]];
|
||||
|
||||
[self presentViewController:ac animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)didSelectEditGroupName {
|
||||
TUIModifyViewData *data = [[TUIModifyViewData alloc] init];
|
||||
data.title = TIMCommonLocalizableString(TUIKitGroupProfileEditGroupName);
|
||||
data.content = self.dataProvider.groupInfo.groupName;
|
||||
data.desc = TIMCommonLocalizableString(TUIKitGroupProfileEditGroupName);
|
||||
TUIModifyView *modify = [[TUIModifyView alloc] init];
|
||||
modify.tag = 0;
|
||||
modify.delegate = self;
|
||||
[modify setData:data];
|
||||
[modify showInWindow:self.view.window];
|
||||
}
|
||||
- (void)didSelectEditAnnouncement {
|
||||
TUIModifyViewData *data = [[TUIModifyViewData alloc] init];
|
||||
data.title = TIMCommonLocalizableString(TUIKitGroupProfileEditAnnouncement);
|
||||
TUIModifyView *modify = [[TUIModifyView alloc] init];
|
||||
modify.tag = 1;
|
||||
modify.delegate = self;
|
||||
[modify setData:data];
|
||||
[modify showInWindow:self.view.window];
|
||||
}
|
||||
- (void)didSelectAvatar {
|
||||
TUISelectAvatarController *vc = [[TUISelectAvatarController alloc] init];
|
||||
vc.selectAvatarType = TUISelectAvatarTypeGroupAvatar;
|
||||
vc.profilFaceURL = self.dataProvider.groupInfo.faceURL;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
@weakify(self);
|
||||
vc.selectCallBack = ^(NSString *_Nonnull urlStr) {
|
||||
@strongify(self);
|
||||
if (urlStr.length > 0) {
|
||||
V2TIMGroupInfo *info = [[V2TIMGroupInfo alloc] init];
|
||||
info.groupID = self.groupId;
|
||||
info.faceURL = urlStr;
|
||||
@weakify(self);
|
||||
[[V2TIMManager sharedInstance] setGroupInfo:info
|
||||
succ:^{
|
||||
@strongify(self);
|
||||
[self updateGroupInfo];
|
||||
}
|
||||
fail:^(int code, NSString *msg) {
|
||||
[TUITool makeToastError:code msg:msg];
|
||||
}];
|
||||
}
|
||||
};
|
||||
}
|
||||
- (void)didSelectOnNotDisturb:(TUICommonSwitchCell *)cell {
|
||||
V2TIMReceiveMessageOpt opt;
|
||||
if (cell.switcher.on) {
|
||||
opt = V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE;
|
||||
} else {
|
||||
opt = V2TIM_RECEIVE_MESSAGE;
|
||||
}
|
||||
@weakify(self);
|
||||
[V2TIMManager.sharedInstance markConversation:@[ [NSString stringWithFormat:@"group_%@", self.groupId] ]
|
||||
markType:@(V2TIM_CONVERSATION_MARK_TYPE_FOLD)
|
||||
enableMark:NO
|
||||
succ:nil
|
||||
fail:nil];
|
||||
|
||||
[self.dataProvider setGroupReceiveMessageOpt:opt
|
||||
Succ:^{
|
||||
@strongify(self);
|
||||
[self updateGroupInfo];
|
||||
}
|
||||
fail:^(int code, NSString *desc){
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)didSelectOnTop:(TUICommonSwitchCell *)cell {
|
||||
if (cell.switcher.on) {
|
||||
[[TUIConversationPin sharedInstance] addTopConversation:[NSString stringWithFormat:@"group_%@", _groupId]
|
||||
callback:^(BOOL success, NSString *_Nonnull errorMessage) {
|
||||
if (success) {
|
||||
return;
|
||||
}
|
||||
cell.switcher.on = !cell.switcher.isOn;
|
||||
[TUITool makeToast:errorMessage];
|
||||
}];
|
||||
} else {
|
||||
[[TUIConversationPin sharedInstance] removeTopConversation:[NSString stringWithFormat:@"group_%@", _groupId]
|
||||
callback:^(BOOL success, NSString *_Nonnull errorMessage) {
|
||||
if (success) {
|
||||
return;
|
||||
}
|
||||
cell.switcher.on = !cell.switcher.isOn;
|
||||
[TUITool makeToast:errorMessage];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didDeleteGroup:(TUIButtonCell *)cell {
|
||||
UIAlertController *ac = [UIAlertController alertControllerWithTitle:nil
|
||||
message:TIMCommonLocalizableString(TUIKitGroupProfileDeleteGroupTips)
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
|
||||
@weakify(self);
|
||||
[ac tuitheme_addAction:[UIAlertAction
|
||||
actionWithTitle:TIMCommonLocalizableString(Confirm)
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
@strongify(self);
|
||||
@weakify(self);
|
||||
if ([self.dataProvider.groupInfo canDismissGroup]) {
|
||||
[self.dataProvider
|
||||
dismissGroup:^{
|
||||
@strongify(self);
|
||||
@weakify(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@strongify(self);
|
||||
UIViewController *vc = [self findConversationListViewController];
|
||||
[[TUIConversationPin sharedInstance]
|
||||
removeTopConversation:[NSString stringWithFormat:@"group_%@", self.groupId]
|
||||
callback:nil];
|
||||
[V2TIMManager.sharedInstance markConversation:@[ [NSString stringWithFormat:@"group_%@", self.groupId] ]
|
||||
markType:@(V2TIM_CONVERSATION_MARK_TYPE_FOLD)
|
||||
enableMark:NO
|
||||
succ:^(NSArray<V2TIMConversationOperationResult *> *result) {
|
||||
[self.navigationController popToViewController:vc animated:YES];
|
||||
}
|
||||
fail:^(int code, NSString *desc) {
|
||||
[self.navigationController popToViewController:vc animated:YES];
|
||||
}];
|
||||
});
|
||||
}
|
||||
fail:^(int code, NSString *msg) {
|
||||
[TUITool makeToastError:code msg:msg];
|
||||
}];
|
||||
} else {
|
||||
[self.dataProvider
|
||||
quitGroup:^{
|
||||
@strongify(self);
|
||||
@weakify(self);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@strongify(self);
|
||||
UIViewController *vc = [self findConversationListViewController];
|
||||
[[TUIConversationPin sharedInstance]
|
||||
removeTopConversation:[NSString stringWithFormat:@"group_%@", self.groupId]
|
||||
callback:nil];
|
||||
[V2TIMManager.sharedInstance markConversation:@[ [NSString stringWithFormat:@"group_%@", self.groupId] ]
|
||||
markType:@(V2TIM_CONVERSATION_MARK_TYPE_FOLD)
|
||||
enableMark:NO
|
||||
succ:^(NSArray<V2TIMConversationOperationResult *> *result) {
|
||||
[self.navigationController popToViewController:vc animated:YES];
|
||||
}
|
||||
fail:^(int code, NSString *desc) {
|
||||
[self.navigationController popToViewController:vc animated:YES];
|
||||
}];
|
||||
});
|
||||
}
|
||||
fail:^(int code, NSString *msg) {
|
||||
[TUITool makeToastError:code msg:msg];
|
||||
}];
|
||||
}
|
||||
}]];
|
||||
|
||||
[ac tuitheme_addAction:[UIAlertAction actionWithTitle:TIMCommonLocalizableString(Cancel) style:UIAlertActionStyleCancel handler:nil]];
|
||||
[self presentViewController:ac animated:YES completion:nil];
|
||||
}
|
||||
- (void)didReportGroup:(TUIButtonCell *)cell {
|
||||
NSURL *url = [NSURL URLWithString:@"https://cloud.tencent.com/act/event/report-platform"];
|
||||
[TUITool openLinkWithURL:url];
|
||||
}
|
||||
- (UIViewController *)findConversationListViewController {
|
||||
UIViewController *vc = self.navigationController.viewControllers[0];
|
||||
for (UIViewController *vc in self.navigationController.viewControllers) {
|
||||
if ([vc isKindOfClass:NSClassFromString(@"TUIFoldListViewController")]) {
|
||||
return vc;
|
||||
}
|
||||
}
|
||||
return vc;
|
||||
}
|
||||
|
||||
- (void)didSelectOnFoldConversation:(TUICommonSwitchCell *)cell {
|
||||
BOOL enableMark = NO;
|
||||
if (cell.switcher.on) {
|
||||
enableMark = YES;
|
||||
}
|
||||
|
||||
@weakify(self);
|
||||
|
||||
[V2TIMManager.sharedInstance markConversation:@[ [NSString stringWithFormat:@"group_%@", self.groupId] ]
|
||||
markType:@(V2TIM_CONVERSATION_MARK_TYPE_FOLD)
|
||||
enableMark:enableMark
|
||||
succ:^(NSArray<V2TIMConversationOperationResult *> *result) {
|
||||
cell.switchData.on = enableMark;
|
||||
[[TUIConversationPin sharedInstance] removeTopConversation:[NSString stringWithFormat:@"group_%@", self.groupId]
|
||||
callback:^(BOOL success, NSString *_Nonnull errorMessage) {
|
||||
@strongify(self);
|
||||
[self updateGroupInfo];
|
||||
}];
|
||||
}
|
||||
fail:nil];
|
||||
|
||||
}
|
||||
|
||||
- (void)didSelectOnChangeBackgroundImage:(TUICommonTextCell *)cell {
|
||||
@weakify(self);
|
||||
NSString *conversationID = [NSString stringWithFormat:@"group_%@", self.groupId];
|
||||
TUISelectAvatarController *vc = [[TUISelectAvatarController alloc] init];
|
||||
vc.selectAvatarType = TUISelectAvatarTypeConversationBackGroundCover;
|
||||
vc.profilFaceURL = [self getBackgroundImageUrlByConversationID:conversationID];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
vc.selectCallBack = ^(NSString *_Nonnull urlStr) {
|
||||
@strongify(self);
|
||||
[self appendBackgroundImage:urlStr conversationID:conversationID];
|
||||
if (IS_NOT_EMPTY_NSSTRING(conversationID)) {
|
||||
[TUICore notifyEvent:TUICore_TUIGroupNotify
|
||||
subKey:TUICore_TUIGroupNotify_UpdateConversationBackgroundImageSubKey
|
||||
object:self
|
||||
param:@{TUICore_TUIGroupNotify_UpdateConversationBackgroundImageSubKey_ConversationID : conversationID}];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
- (NSString *)getBackgroundImageUrlByConversationID:(NSString *)targerConversationID {
|
||||
if (targerConversationID.length == 0) {
|
||||
return nil;
|
||||
}
|
||||
NSDictionary *dict = [NSUserDefaults.standardUserDefaults objectForKey:@"conversation_backgroundImage_map"];
|
||||
if (dict == nil) {
|
||||
dict = @{};
|
||||
}
|
||||
NSString *conversationID_UserID = [NSString stringWithFormat:@"%@_%@", targerConversationID, [TUILogin getUserID]];
|
||||
if (![dict isKindOfClass:NSDictionary.class] || ![dict.allKeys containsObject:conversationID_UserID]) {
|
||||
return nil;
|
||||
}
|
||||
return [dict objectForKey:conversationID_UserID];
|
||||
}
|
||||
|
||||
- (void)appendBackgroundImage:(NSString *)imgUrl conversationID:(NSString *)conversationID {
|
||||
if (conversationID.length == 0) {
|
||||
return;
|
||||
}
|
||||
NSDictionary *dict = [NSUserDefaults.standardUserDefaults objectForKey:@"conversation_backgroundImage_map"];
|
||||
if (dict == nil) {
|
||||
dict = @{};
|
||||
}
|
||||
if (![dict isKindOfClass:NSDictionary.class]) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *conversationID_UserID = [NSString stringWithFormat:@"%@_%@", conversationID, [TUILogin getUserID]];
|
||||
NSMutableDictionary *originDataDict = [NSMutableDictionary dictionaryWithDictionary:dict];
|
||||
if (imgUrl.length == 0) {
|
||||
[originDataDict removeObjectForKey:conversationID_UserID];
|
||||
} else {
|
||||
[originDataDict setObject:imgUrl forKey:conversationID_UserID];
|
||||
}
|
||||
|
||||
[NSUserDefaults.standardUserDefaults setObject:originDataDict forKey:@"conversation_backgroundImage_map"];
|
||||
[NSUserDefaults.standardUserDefaults synchronize];
|
||||
}
|
||||
|
||||
- (void)didTransferGroup:(TUIButtonCell *)cell {
|
||||
TUISelectGroupMemberViewController_Minimalist *vc = [[TUISelectGroupMemberViewController_Minimalist alloc] init];
|
||||
vc.optionalStyle = TUISelectMemberOptionalStyleTransferOwner;
|
||||
vc.groupId = self.groupId;
|
||||
vc.name = TIMCommonLocalizableString(TUIKitGroupTransferOwner);
|
||||
@weakify(self);
|
||||
vc.selectedFinished = ^(NSMutableArray<TUIUserModel *> *_Nonnull modelList) {
|
||||
@strongify(self);
|
||||
TUIUserModel *userModel = modelList[0];
|
||||
NSString *groupId = self.groupId;
|
||||
NSString *member = userModel.userId;
|
||||
if (userModel && [userModel isKindOfClass:[TUIUserModel class]]) {
|
||||
@weakify(self);
|
||||
[self.dataProvider transferGroupOwner:groupId
|
||||
member:member
|
||||
succ:^{
|
||||
@strongify(self);
|
||||
[self updateGroupInfo];
|
||||
[TUITool makeToast:TIMCommonLocalizableString(TUIKitGroupTransferOwnerSuccess)];
|
||||
}
|
||||
fail:^(int code, NSString *desc) {
|
||||
[TUITool makeToastError:code msg:desc];
|
||||
}];
|
||||
}
|
||||
};
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
- (void)didClearAllHistory:(TUIButtonCell *)cell {
|
||||
@weakify(self);
|
||||
UIAlertController *ac = [UIAlertController alertControllerWithTitle:nil
|
||||
message:TIMCommonLocalizableString(TUIKitClearAllChatHistoryTips)
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[ac tuitheme_addAction:[UIAlertAction actionWithTitle:TIMCommonLocalizableString(Confirm)
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
@strongify(self);
|
||||
[self.dataProvider
|
||||
clearAllHistory:^{
|
||||
[TUICore notifyEvent:TUICore_TUIConversationNotify
|
||||
subKey:TUICore_TUIConversationNotify_ClearConversationUIHistorySubKey
|
||||
object:self
|
||||
param:nil];
|
||||
[TUITool makeToast:@"success"];
|
||||
}
|
||||
fail:^(int code, NSString *desc) {
|
||||
[TUITool makeToastError:code msg:desc];
|
||||
}];
|
||||
}]];
|
||||
[ac tuitheme_addAction:[UIAlertAction actionWithTitle:TIMCommonLocalizableString(Cancel) style:UIAlertActionStyleCancel handler:nil]];
|
||||
[self presentViewController:ac animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)didSelectGroupManage {
|
||||
TUIGroupManageController_Minimalist *vc = [[TUIGroupManageController_Minimalist alloc] init];
|
||||
vc.groupID = self.groupId;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
- (void)didSelectGroupNotice {
|
||||
TUIGroupNoticeController_Minimalist *vc = [[TUIGroupNoticeController_Minimalist alloc] init];
|
||||
vc.groupID = self.groupId;
|
||||
__weak typeof(self) weakSelf = self;
|
||||
vc.onNoticeChanged = ^{
|
||||
[weakSelf updateGroupInfo];
|
||||
};
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark TUIProfileCardDelegate
|
||||
|
||||
- (void)didTapOnAvatar:(TUIProfileCardCell *)cell {
|
||||
TUISelectAvatarController *vc = [[TUISelectAvatarController alloc] init];
|
||||
vc.selectAvatarType = TUISelectAvatarTypeGroupAvatar;
|
||||
vc.profilFaceURL = self.dataProvider.groupInfo.faceURL;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
@weakify(self);
|
||||
vc.selectCallBack = ^(NSString *_Nonnull urlStr) {
|
||||
@strongify(self);
|
||||
if (urlStr.length > 0) {
|
||||
V2TIMGroupInfo *info = [[V2TIMGroupInfo alloc] init];
|
||||
info.groupID = self.groupId;
|
||||
info.faceURL = urlStr;
|
||||
[[V2TIMManager sharedInstance] setGroupInfo:info
|
||||
succ:^{
|
||||
[self updateGroupInfo];
|
||||
}
|
||||
fail:^(int code, NSString *msg) {
|
||||
[TUITool makeToastError:code msg:msg];
|
||||
}];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#pragma mark TUIGroupMembersCellDelegate
|
||||
|
||||
- (void)didAddMemebers {
|
||||
NSMutableArray *ids = [NSMutableArray array];
|
||||
NSMutableDictionary *displayNames = [NSMutableDictionary dictionary];
|
||||
for (TUIGroupMemberCellData *cd in self.dataProvider.membersData) {
|
||||
if (![cd.identifier isEqualToString:[[V2TIMManager sharedInstance] getLoginUser]]) {
|
||||
[ids addObject:cd.identifier];
|
||||
[displayNames setObject:cd.name ?: @"" forKey:cd.identifier ?: @""];
|
||||
}
|
||||
}
|
||||
|
||||
@weakify(self);
|
||||
void (^selectContactCompletion)(NSArray<TUICommonContactSelectCellData *> *) = ^(NSArray<TUICommonContactSelectCellData *> *array) {
|
||||
@strongify(self);
|
||||
if (self.tag == 1) {
|
||||
// add
|
||||
NSMutableArray *list = @[].mutableCopy;
|
||||
for (TUICommonContactSelectCellData *data in array) {
|
||||
[list addObject:data.identifier];
|
||||
}
|
||||
[self.navigationController popToViewController:self animated:YES];
|
||||
[self addGroupId:self.groupId memebers:list];
|
||||
} else if (self.tag == 2) {
|
||||
// delete
|
||||
NSMutableArray *list = @[].mutableCopy;
|
||||
for (TUICommonContactSelectCellData *data in array) {
|
||||
[list addObject:data.identifier];
|
||||
}
|
||||
[self.navigationController popToViewController:self animated:YES];
|
||||
[self deleteGroupId:self.groupId memebers:list];
|
||||
}
|
||||
};
|
||||
|
||||
NSMutableDictionary *param = [NSMutableDictionary dictionary];
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_TitleKey] = TIMCommonLocalizableString(GroupAddFirend);
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_DisableIdsKey] = ids;
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_DisplayNamesKey] = displayNames;
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_CompletionKey] = selectContactCompletion;
|
||||
UIViewController *vc = [TUICore createObject:TUICore_TUIContactObjectFactory_Minimalist
|
||||
key:TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod
|
||||
param:param];
|
||||
if (vc && [vc isKindOfClass:UIViewController.class]) {
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
self.tag = 1;
|
||||
}
|
||||
|
||||
- (void)didCurrentMemberAtCell:(TUIGroupMemberTableViewCell_Minimalist *)cell {
|
||||
TUIGroupMemberCellData_Minimalist *mem = (TUIGroupMemberCellData_Minimalist *)cell.data;
|
||||
NSMutableArray *ids = [NSMutableArray array];
|
||||
NSMutableDictionary *displayNames = [NSMutableDictionary dictionary];
|
||||
for (TUIGroupMemberCellData *cd in self.dataProvider.membersData) {
|
||||
if (![cd.identifier isEqualToString:[[V2TIMManager sharedInstance] getLoginUser]]) {
|
||||
[ids addObject:cd.identifier];
|
||||
[displayNames setObject:cd.name ?: @"" forKey:cd.identifier ?: @""];
|
||||
}
|
||||
}
|
||||
|
||||
NSString *userID = mem.identifier;
|
||||
@weakify(self);
|
||||
[self getUserOrFriendProfileVCWithUserID:userID
|
||||
SuccBlock:^(UIViewController *vc) {
|
||||
@strongify(self);
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
failBlock:^(int code, NSString *desc){
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)getUserOrFriendProfileVCWithUserID:(NSString *)userID SuccBlock:(void (^)(UIViewController *vc))succ failBlock:(nullable V2TIMFail)fail {
|
||||
NSDictionary *param = @{
|
||||
TUICore_TUIContactObjectFactory_GetUserOrFriendProfileVCMethod_UserIDKey: userID ? : @"",
|
||||
TUICore_TUIContactObjectFactory_GetUserOrFriendProfileVCMethod_SuccKey: succ ? : ^(UIViewController *vc){},
|
||||
TUICore_TUIContactObjectFactory_GetUserOrFriendProfileVCMethod_FailKey: fail ? : ^(int code, NSString * desc){}
|
||||
};
|
||||
[TUICore createObject:TUICore_TUIContactObjectFactory_Minimalist key:TUICore_TUIContactObjectFactory_GetUserOrFriendProfileVCMethod param:param];
|
||||
}
|
||||
|
||||
- (void)addGroupId:(NSString *)groupId memebers:(NSArray *)members {
|
||||
@weakify(self);
|
||||
[[V2TIMManager sharedInstance] inviteUserToGroup:_groupId
|
||||
userList:members
|
||||
succ:^(NSArray<V2TIMGroupMemberOperationResult *> *resultList) {
|
||||
@strongify(self);
|
||||
[self updateData];
|
||||
[TUITool makeToast:TIMCommonLocalizableString(add_success)];
|
||||
}
|
||||
fail:^(int code, NSString *desc) {
|
||||
[TUITool makeToastError:code msg:desc];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)deleteGroupId:(NSString *)groupId memebers:(NSArray *)members {
|
||||
@weakify(self);
|
||||
[[V2TIMManager sharedInstance] kickGroupMember:groupId
|
||||
memberList:members
|
||||
reason:@""
|
||||
succ:^(NSArray<V2TIMGroupMemberOperationResult *> *resultList) {
|
||||
@strongify(self);
|
||||
[self updateData];
|
||||
[TUITool makeToast:TIMCommonLocalizableString(delete_success)];
|
||||
}
|
||||
fail:^(int code, NSString *desc) {
|
||||
[TUITool makeToastError:code msg:desc];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark TUIModifyViewDelegate
|
||||
|
||||
- (void)modifyView:(TUIModifyView *)modifyView didModiyContent:(NSString *)content {
|
||||
@weakify(self);
|
||||
if (modifyView.tag == 0) {
|
||||
[self.dataProvider setGroupName:content
|
||||
succ:^{
|
||||
@strongify(self);
|
||||
[self updateGroupInfo];
|
||||
}
|
||||
fail:^(int code, NSString *desc){
|
||||
}];
|
||||
} else if (modifyView.tag == 1) {
|
||||
[self.dataProvider setGroupNotification:content];
|
||||
} else if (modifyView.tag == 2) {
|
||||
[self.dataProvider setGroupMemberNameCard:content];
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
@interface IUGroupView_Minimalist : UIView
|
||||
@property(nonatomic, strong) UIView *view;
|
||||
@end
|
||||
|
||||
@implementation IUGroupView_Minimalist
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
|
||||
[self addSubview:self.view];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// TUIGroupManageController.h
|
||||
// TUIGroup
|
||||
//
|
||||
// Created by harvy on 2021/12/24.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TUIGroupManageController_Minimalist : UIViewController
|
||||
|
||||
@property(nonatomic, copy) NSString *groupID;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,266 @@
|
||||
//
|
||||
// TUIGroupManageController.m
|
||||
// TUIGroup
|
||||
//
|
||||
// Created by harvy on 2021/12/24.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TUIGroupManageController_Minimalist.h"
|
||||
#import <TIMCommon/TIMCommonModel.h>
|
||||
#import <TUICore/TUIGlobalization.h>
|
||||
#import <TUICore/TUIThemeManager.h>
|
||||
#import "TUIGroupManageDataProvider_Minimalist.h"
|
||||
#import "TUIMemberInfoCellData_Minimalist.h"
|
||||
#import "TUIMemberInfoCell_Minimalist.h"
|
||||
#import "TUISelectGroupMemberViewController_Minimalist.h"
|
||||
#import "TUISettingAdminController_Minimalist.h"
|
||||
|
||||
@interface TUIGroupManageController_Minimalist () <UITableViewDelegate, UITableViewDataSource, TUIGroupManageDataProviderDelegate_Minimalist>
|
||||
|
||||
@property(nonatomic, strong) UITableView *tableView;
|
||||
@property(nonatomic, strong) TUIGroupManageDataProvider_Minimalist *dataProvider;
|
||||
@property(nonatomic, strong) UIView *coverView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TUIGroupManageController_Minimalist
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
[self setupViews];
|
||||
self.dataProvider.groupID = self.groupID;
|
||||
[self showCoverViewWhenMuteAll:YES];
|
||||
[self.dataProvider loadData];
|
||||
}
|
||||
|
||||
- (void)setupViews {
|
||||
UILabel *titleLabel = [[UILabel alloc] init];
|
||||
titleLabel.text = TIMCommonLocalizableString(TUIKitGroupProfileManage);
|
||||
titleLabel.font = [UIFont boldSystemFontOfSize:17.0];
|
||||
titleLabel.textColor = TIMCommonDynamicColor(@"nav_title_text_color", @"#000000");
|
||||
[titleLabel sizeToFit];
|
||||
self.navigationItem.titleView = titleLabel;
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
|
||||
- (void)viewWillLayoutSubviews {
|
||||
[super viewWillLayoutSubviews];
|
||||
self.tableView.frame = self.view.bounds;
|
||||
}
|
||||
|
||||
- (void)onSettingAdmin:(TUICommonTextCellData *)textData {
|
||||
if (!self.dataProvider.currentGroupTypeSupportSettingAdmin) {
|
||||
[TUITool makeToast:TIMCommonLocalizableString(TUIKitGroupSetAdminsForbidden)];
|
||||
return;
|
||||
}
|
||||
TUISettingAdminController_Minimalist *vc = [[TUISettingAdminController_Minimalist alloc] init];
|
||||
vc.groupID = self.groupID;
|
||||
__weak typeof(self) weakSelf = self;
|
||||
vc.settingAdminDissmissCallBack = ^{
|
||||
[weakSelf.dataProvider updateMuteMembersFilterAdmins];
|
||||
[weakSelf.tableView reloadData];
|
||||
};
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
- (void)onMutedAll:(TUICommonSwitchCell *)switchCell {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[self.dataProvider mutedAll:switchCell.switcher.isOn
|
||||
completion:^(int code, NSString *error) {
|
||||
if (code != 0) {
|
||||
switchCell.switcher.on = !switchCell.switcher.isOn;
|
||||
[weakSelf.view makeToast:error];
|
||||
return;
|
||||
}
|
||||
[weakSelf showCoverViewWhenMuteAll:switchCell.switcher.isOn];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - TUIGroupManageDataProviderDelegate
|
||||
- (void)onError:(int)code desc:(NSString *)desc operate:(NSString *)operate {
|
||||
if (code != 0) {
|
||||
[TUITool makeToast:[NSString stringWithFormat:@"%d, %@", code, desc]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showCoverViewWhenMuteAll:(BOOL)show {
|
||||
[self.coverView removeFromSuperview];
|
||||
if (show) {
|
||||
CGFloat y = 0;
|
||||
if (self.dataProvider.datas.count == 0) {
|
||||
y = 100;
|
||||
} else {
|
||||
CGRect rect = [self.tableView rectForSection:0];
|
||||
y = CGRectGetMaxY(rect);
|
||||
}
|
||||
self.coverView.frame = CGRectMake(0, y, self.tableView.mm_w, self.tableView.mm_h);
|
||||
[self.tableView addSubview:self.coverView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)reloadData {
|
||||
[self.tableView reloadData];
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[weakSelf showCoverViewWhenMuteAll:weakSelf.dataProvider.muteAll];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation {
|
||||
[self.tableView insertSections:sections withRowAnimation:animation];
|
||||
}
|
||||
|
||||
- (void)reloadRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation {
|
||||
[self.tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:animation];
|
||||
}
|
||||
|
||||
- (void)insertRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation {
|
||||
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:animation];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate, UITableViewDataSource
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return self.dataProvider.datas.count;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
NSArray *subArray = self.dataProvider.datas[section];
|
||||
return subArray.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UITableViewCell *cell = nil;
|
||||
NSArray *subArray = self.dataProvider.datas[indexPath.section];
|
||||
TUICommonCellData *data = subArray[indexPath.row];
|
||||
|
||||
if ([data isKindOfClass:TUICommonTextCellData.class]) {
|
||||
cell = [[TUICommonTextCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass(TUICommonTextCell.class)];
|
||||
[(TUICommonTextCell *)cell fillWithData:(TUICommonTextCellData *)data];
|
||||
} else if ([data isKindOfClass:TUICommonSwitchCellData.class]) {
|
||||
cell = [[TUICommonSwitchCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass(TUICommonSwitchCell.class)];
|
||||
[(TUICommonSwitchCell *)cell fillWithData:(TUICommonSwitchCellData *)data];
|
||||
} else if ([data isKindOfClass:TUIMemberInfoCellData_Minimalist.class]) {
|
||||
cell = [[TUIMemberInfoCell_Minimalist alloc] initWithStyle:UITableViewCellStyleValue1
|
||||
reuseIdentifier:NSStringFromClass(TUIMemberInfoCell_Minimalist.class)];
|
||||
[(TUIMemberInfoCell_Minimalist *)cell setData:(TUIMemberInfoCellData_Minimalist *)data];
|
||||
} else {
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
|
||||
cell.textLabel.text = @"";
|
||||
}
|
||||
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return 48.0;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
|
||||
return section == 0 ? kScale390(53) : 0;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
||||
UIView *view = [[UIView alloc] init];
|
||||
view.backgroundColor = [UIColor tui_colorWithHex:@"#f9f9f9"];
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.text = TIMCommonLocalizableString(TUIKitGroupManageShutupAllTips);
|
||||
label.textColor = [UIColor colorWithRed:136 / 255.0 green:136 / 255.0 blue:136 / 255.0 alpha:1 / 1.0];
|
||||
label.font = [UIFont systemFontOfSize:14.0];
|
||||
label.numberOfLines = 0;
|
||||
label.lineBreakMode = NSLineBreakByWordWrapping;
|
||||
label.textAlignment = NSTextAlignmentJustified;
|
||||
|
||||
[view addSubview:label];
|
||||
[label sizeToFit];
|
||||
label.frame = CGRectMake(kScale390(20), kScale390(3), Screen_Width - 2 * kScale390(20), kScale390(53));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:NO];
|
||||
|
||||
if (indexPath.section == 1 && indexPath.row == 0) {
|
||||
if (!self.dataProvider.currentGroupTypeSupportAddMemberOfBlocked) {
|
||||
[TUITool makeToast:TIMCommonLocalizableString(TUIKitGroupAddMemberOfBlockedForbidden)];
|
||||
return;
|
||||
}
|
||||
|
||||
TUISelectGroupMemberViewController_Minimalist *vc = [[TUISelectGroupMemberViewController_Minimalist alloc] init];
|
||||
vc.optionalStyle = TUISelectMemberOptionalStylePublicMan;
|
||||
vc.groupId = self.groupID;
|
||||
vc.name = TIMCommonLocalizableString(TUIKitGroupProfileMember);
|
||||
__weak typeof(self) weakSelf = self;
|
||||
vc.selectedFinished = ^(NSMutableArray<TUIUserModel *> *_Nonnull modelList) {
|
||||
for (TUIUserModel *userModel in modelList) {
|
||||
[weakSelf.dataProvider mute:YES user:userModel];
|
||||
}
|
||||
};
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return TIMCommonLocalizableString(Delete);
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (indexPath.section == 1 && indexPath.row > 0) {
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
||||
TUIMemberInfoCellData_Minimalist *cellData = self.dataProvider.datas[indexPath.section][indexPath.row];
|
||||
if (![cellData isKindOfClass:TUIMemberInfoCellData_Minimalist.class]) {
|
||||
return;
|
||||
}
|
||||
|
||||
TUIUserModel *userModel = [[TUIUserModel alloc] init];
|
||||
userModel.userId = cellData.identifier;
|
||||
[self.dataProvider mute:NO user:userModel];
|
||||
}
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||
return [[UIView alloc] init];
|
||||
}
|
||||
|
||||
- (UITableView *)tableView {
|
||||
if (_tableView == nil) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
|
||||
_tableView.backgroundColor = [UIColor tui_colorWithHex:@"#f9f9f9"];
|
||||
_tableView.delaysContentTouches = NO;
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
- (TUIGroupManageDataProvider_Minimalist *)dataProvider {
|
||||
if (_dataProvider == nil) {
|
||||
_dataProvider = [[TUIGroupManageDataProvider_Minimalist alloc] init];
|
||||
_dataProvider.delegate = self;
|
||||
}
|
||||
return _dataProvider;
|
||||
}
|
||||
|
||||
- (UIView *)coverView {
|
||||
if (_coverView == nil) {
|
||||
_coverView = [[UIView alloc] init];
|
||||
_coverView.backgroundColor = self.tableView.backgroundColor;
|
||||
}
|
||||
return _coverView;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
// Created by Tencent on 2023/06/09.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TUIGroupMembersView.h"
|
||||
|
||||
@class TUIGroupMemberController_Minimalist;
|
||||
@class V2TIMGroupInfo;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TUIGroupMemberController_Minimalist
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@interface TUIGroupMemberController_Minimalist : UIViewController
|
||||
|
||||
@property(nonatomic, strong) UITableView *tableView;
|
||||
|
||||
@property(nonatomic, strong) NSString *groupId;
|
||||
|
||||
@property(nonatomic, strong) V2TIMGroupInfo *groupInfo;
|
||||
|
||||
- (void)refreshData;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,381 @@
|
||||
//
|
||||
// GroupMemberController.m
|
||||
// UIKit
|
||||
//
|
||||
// Created by kennethmiao on 2018/9/27.
|
||||
// Copyright © 2018 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TUIGroupMemberController_Minimalist.h"
|
||||
#import <TIMCommon/TIMDefine.h>
|
||||
#import <TUICore/TUICore.h>
|
||||
#import "TIMGroupInfo+TUIDataProvider.h"
|
||||
#import "TUIGroupMemberCell.h"
|
||||
#import "TUIGroupMemberDataProvider.h"
|
||||
|
||||
#import <TUICore/TUILogin.h>
|
||||
#import <TUICore/TUIThemeManager.h>
|
||||
#import "TUIMemberInfoCell.h"
|
||||
#import "TUIMemberInfoCellData.h"
|
||||
#import "TUISettingAdminDataProvider.h"
|
||||
|
||||
@interface TUIGroupMemberController_Minimalist () <UITableViewDelegate, UITableViewDataSource>
|
||||
@property(nonatomic, strong) UIActivityIndicatorView *indicatorView;
|
||||
@property(nonatomic, strong) TUINaviBarIndicatorView *titleView;
|
||||
@property(nonatomic, strong) UIViewController *showContactSelectVC;
|
||||
@property(nonatomic, strong) TUIGroupMemberDataProvider *dataProvider;
|
||||
@property(nonatomic, strong) NSMutableArray<TUIMemberInfoCellData *> *members;
|
||||
@property NSInteger tag;
|
||||
@property(nonatomic, strong) TUISettingAdminDataProvider *adminDataprovier;
|
||||
@end
|
||||
|
||||
@implementation TUIGroupMemberController_Minimalist
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self setupViews];
|
||||
|
||||
self.dataProvider = [[TUIGroupMemberDataProvider alloc] initWithGroupID:self.groupId];
|
||||
self.dataProvider.groupInfo = self.groupInfo;
|
||||
|
||||
self.adminDataprovier = [[TUISettingAdminDataProvider alloc] init];
|
||||
self.adminDataprovier.groupID = self.groupId;
|
||||
|
||||
[self.adminDataprovier loadData:^(int code, NSString *error) {
|
||||
[self refreshData];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)refreshData {
|
||||
@weakify(self);
|
||||
[self.dataProvider loadDatas:^(BOOL success, NSString *_Nonnull err, NSArray *_Nonnull datas) {
|
||||
@strongify(self);
|
||||
NSString *title = [NSString stringWithFormat:TIMCommonLocalizableString(TUIKitGroupProfileGroupCountFormat), (long)datas.count];
|
||||
self.title = title;
|
||||
self.members = [NSMutableArray arrayWithArray:datas];
|
||||
[self.tableView reloadData];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setupViews {
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
// left
|
||||
UIImage *image = TUIGroupDynamicImage(@"group_nav_back_img", [UIImage imageNamed:TUIGroupImagePath(@"back")]);
|
||||
image = [image rtl_imageFlippedForRightToLeftLayoutDirection];
|
||||
UIButton *leftButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
|
||||
[leftButton addTarget:self action:@selector(leftBarButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[leftButton setImage:image forState:UIControlStateNormal];
|
||||
UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
|
||||
UIBarButtonItem *spaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
|
||||
spaceItem.width = 10.0f;
|
||||
self.navigationItem.leftBarButtonItems = @[ leftItem ];
|
||||
self.parentViewController.navigationItem.leftBarButtonItems = @[ leftItem ];
|
||||
|
||||
// right
|
||||
UIButton *rightButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
|
||||
[rightButton addTarget:self action:@selector(rightBarButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[rightButton setTitle:TIMCommonLocalizableString(TUIKitGroupProfileManage) forState:UIControlStateNormal];
|
||||
[rightButton setTitleColor:TIMCommonDynamicColor(@"nav_title_text_color", @"#000000") forState:UIControlStateNormal];
|
||||
rightButton.titleLabel.font = [UIFont systemFontOfSize:16];
|
||||
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton];
|
||||
|
||||
self.indicatorView.frame = CGRectMake(0, 0, self.view.bounds.size.width, TMessageController_Header_Height);
|
||||
|
||||
self.tableView.frame = self.view.bounds;
|
||||
self.tableView.tableFooterView = self.indicatorView;
|
||||
[self.view addSubview:self.tableView];
|
||||
|
||||
_titleView = [[TUINaviBarIndicatorView alloc] init];
|
||||
self.navigationItem.titleView = _titleView;
|
||||
self.navigationItem.title = @"";
|
||||
[_titleView setTitle:TIMCommonLocalizableString(GroupMember)];
|
||||
}
|
||||
|
||||
- (void)leftBarButtonClick {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
- (void)rightBarButtonClick {
|
||||
UIAlertController *ac = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
|
||||
NSMutableArray *ids = [NSMutableArray array];
|
||||
NSMutableDictionary *displayNames = [NSMutableDictionary dictionary];
|
||||
for (TUIGroupMemberCellData *cd in self.members) {
|
||||
if (![cd.identifier isEqualToString:[[V2TIMManager sharedInstance] getLoginUser]]) {
|
||||
[ids addObject:cd.identifier];
|
||||
[displayNames setObject:cd.name ?: @"" forKey:cd.identifier ?: @""];
|
||||
}
|
||||
}
|
||||
|
||||
@weakify(self);
|
||||
void (^selectContactCompletion)(NSArray<TUICommonContactSelectCellData *> *) = ^(NSArray<TUICommonContactSelectCellData *> *array) {
|
||||
@strongify(self);
|
||||
if (self.tag == 1) {
|
||||
// add
|
||||
NSMutableArray *list = @[].mutableCopy;
|
||||
for (TUICommonContactSelectCellData *data in array) {
|
||||
[list addObject:data.identifier];
|
||||
}
|
||||
[self.navigationController popToViewController:self animated:YES];
|
||||
[self addGroupId:self.groupId memebers:list];
|
||||
} else if (self.tag == 2) {
|
||||
// delete
|
||||
NSMutableArray *list = @[].mutableCopy;
|
||||
for (TUICommonContactSelectCellData *data in array) {
|
||||
[list addObject:data.identifier];
|
||||
}
|
||||
[self.navigationController popToViewController:self animated:YES];
|
||||
[self deleteGroupId:self.groupId memebers:list];
|
||||
}
|
||||
};
|
||||
if ([self.dataProvider.groupInfo canInviteMember]) {
|
||||
[ac tuitheme_addAction:[UIAlertAction
|
||||
actionWithTitle:TIMCommonLocalizableString(TUIKitGroupProfileManageAdd)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
// add
|
||||
self.tag = 1;
|
||||
NSMutableDictionary *param = [NSMutableDictionary dictionary];
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_TitleKey] =
|
||||
TIMCommonLocalizableString(GroupAddFirend);
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_DisableIdsKey] = ids;
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_DisplayNamesKey] = displayNames;
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_CompletionKey] = selectContactCompletion;
|
||||
self.showContactSelectVC = [TUICore createObject:TUICore_TUIContactObjectFactory_Minimalist
|
||||
key:TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod
|
||||
param:param];
|
||||
[self.navigationController pushViewController:self.showContactSelectVC animated:YES];
|
||||
}]];
|
||||
}
|
||||
if ([self.dataProvider.groupInfo canRemoveMember]) {
|
||||
[ac tuitheme_addAction:[UIAlertAction
|
||||
actionWithTitle:TIMCommonLocalizableString(TUIKitGroupProfileManageDelete)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
// delete
|
||||
self.tag = 2;
|
||||
NSMutableDictionary *param = [NSMutableDictionary dictionary];
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_TitleKey] =
|
||||
TIMCommonLocalizableString(GroupDeleteFriend);
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_SourceIdsKey] = ids;
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_DisplayNamesKey] = displayNames;
|
||||
param[TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod_CompletionKey] = selectContactCompletion;
|
||||
self.showContactSelectVC = [TUICore createObject:TUICore_TUIContactObjectFactory_Minimalist
|
||||
key:TUICore_TUIContactObjectFactory_GetContactSelectControllerMethod
|
||||
param:param];
|
||||
[self.navigationController pushViewController:self.showContactSelectVC animated:YES];
|
||||
}]];
|
||||
}
|
||||
[ac tuitheme_addAction:[UIAlertAction actionWithTitle:TIMCommonLocalizableString(Cancel) style:UIAlertActionStyleCancel handler:nil]];
|
||||
|
||||
[self presentViewController:ac animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)addGroupId:(NSString *)groupId memebers:(NSArray *)members {
|
||||
@weakify(self);
|
||||
[[V2TIMManager sharedInstance] inviteUserToGroup:_groupId
|
||||
userList:members
|
||||
succ:^(NSArray<V2TIMGroupMemberOperationResult *> *resultList) {
|
||||
@strongify(self);
|
||||
[self refreshData];
|
||||
[TUITool makeToast:TIMCommonLocalizableString(add_success)];
|
||||
}
|
||||
fail:^(int code, NSString *desc) {
|
||||
[TUITool makeToastError:code msg:desc];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)deleteGroupId:(NSString *)groupId memebers:(NSArray *)members {
|
||||
@weakify(self);
|
||||
[[V2TIMManager sharedInstance] kickGroupMember:groupId
|
||||
memberList:members
|
||||
reason:@""
|
||||
succ:^(NSArray<V2TIMGroupMemberOperationResult *> *resultList) {
|
||||
@strongify(self);
|
||||
[self refreshData];
|
||||
[TUITool makeToast:TIMCommonLocalizableString(delete_success)];
|
||||
}
|
||||
fail:^(int code, NSString *desc) {
|
||||
[TUITool makeToastError:code msg:desc];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)getUserOrFriendProfileVCWithUserID:(NSString *)userID SuccBlock:(void (^)(UIViewController *vc))succ failBlock:(nullable V2TIMFail)fail {
|
||||
NSDictionary *param = @{
|
||||
TUICore_TUIContactObjectFactory_GetUserOrFriendProfileVCMethod_UserIDKey: userID ? : @"",
|
||||
TUICore_TUIContactObjectFactory_GetUserOrFriendProfileVCMethod_SuccKey: succ ? : ^(UIViewController *vc){},
|
||||
TUICore_TUIContactObjectFactory_GetUserOrFriendProfileVCMethod_FailKey: fail ? : ^(int code, NSString * desc){}
|
||||
};
|
||||
[TUICore createObject:TUICore_TUIContactObjectFactory_Minimalist key:TUICore_TUIContactObjectFactory_GetUserOrFriendProfileVCMethod param:param];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate, UITableViewDataSource
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.members.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
TUIMemberInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TUIMemberInfoCell"];
|
||||
TUIMemberInfoCellData *data = self.members[indexPath.row];
|
||||
data.showAccessory = YES;
|
||||
cell.data = data;
|
||||
cell.avatarImageView.layer.cornerRadius = cell.avatarImageView.mm_h / 2;
|
||||
cell.avatarImageView.layer.masksToBounds = YES;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:NO];
|
||||
TUIMemberInfoCellData *data = self.members[indexPath.row];
|
||||
|
||||
if ([data.identifier isEqualToString:TUILogin.getUserID]) {
|
||||
// Can't manage yourself
|
||||
return;
|
||||
}
|
||||
|
||||
UIAlertController *ac = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
UIAlertAction *actionInfo = [UIAlertAction actionWithTitle:TIMCommonLocalizableString(Info)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
__strong typeof(weakSelf) strongSelf = weakSelf;
|
||||
[self getUserOrFriendProfileVCWithUserID:data.identifier
|
||||
SuccBlock:^(UIViewController *vc) {
|
||||
[strongSelf.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
failBlock:^(int code, NSString *desc){
|
||||
|
||||
}];
|
||||
}];
|
||||
|
||||
UIAlertAction *actionDelete = [UIAlertAction actionWithTitle:TIMCommonLocalizableString(TUIKitGroupProfileManageDelete)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
// delete
|
||||
NSMutableArray *list = @[].mutableCopy;
|
||||
[list addObject:data.identifier];
|
||||
[weakSelf deleteGroupId:weakSelf.groupId memebers:list];
|
||||
}];
|
||||
|
||||
UIAlertAction *actionAddAdmin = [UIAlertAction actionWithTitle:TIMCommonLocalizableString(TUIKitGroupProfileAdmainAdd)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
TUIUserModel *user = [[TUIUserModel alloc] init];
|
||||
user.userId = data.identifier;
|
||||
[self.adminDataprovier settingAdmins:@[ user ]
|
||||
callback:^(int code, NSString *errorMsg) {
|
||||
if (code != 0) {
|
||||
[weakSelf.view makeToast:errorMsg];
|
||||
} else {
|
||||
data.role = V2TIM_GROUP_MEMBER_ROLE_ADMIN;
|
||||
}
|
||||
[weakSelf.tableView reloadData];
|
||||
}];
|
||||
}];
|
||||
UIAlertAction *actionRemoveAdmin = [UIAlertAction actionWithTitle:TIMCommonLocalizableString(TUIKitGroupProfileAdmainDelete)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
TUIUserModel *user = [[TUIUserModel alloc] init];
|
||||
user.userId = data.identifier;
|
||||
[self.adminDataprovier removeAdmin:data.identifier
|
||||
callback:^(int code, NSString *errorMsg) {
|
||||
if (code != 0) {
|
||||
[weakSelf.view makeToast:errorMsg];
|
||||
} else {
|
||||
data.role = V2TIM_GROUP_MEMBER_ROLE_MEMBER;
|
||||
}
|
||||
[weakSelf.tableView reloadData];
|
||||
}];
|
||||
;
|
||||
}];
|
||||
|
||||
[ac tuitheme_addAction:actionInfo];
|
||||
|
||||
if (([self.dataProvider.groupInfo canSupportSetAdmain])) {
|
||||
if (data.role == V2TIM_GROUP_MEMBER_ROLE_MEMBER || data.role == V2TIM_GROUP_MEMBER_UNDEFINED) {
|
||||
[ac tuitheme_addAction:actionAddAdmin];
|
||||
} else {
|
||||
[ac tuitheme_addAction:actionRemoveAdmin];
|
||||
}
|
||||
}
|
||||
|
||||
if ([self.dataProvider.groupInfo canRemoveMember]) {
|
||||
if ((data.role < self.dataProvider.groupInfo.role)) {
|
||||
[ac tuitheme_addAction:actionDelete];
|
||||
}
|
||||
}
|
||||
|
||||
[ac tuitheme_addAction:[UIAlertAction actionWithTitle:TIMCommonLocalizableString(Cancel) style:UIAlertActionStyleCancel handler:nil]];
|
||||
|
||||
[self presentViewController:ac animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
||||
return [UIView new];
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||
return [UIView new];
|
||||
}
|
||||
|
||||
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
|
||||
if (scrollView.contentOffset.y > 0 && (scrollView.contentOffset.y >= scrollView.bounds.origin.y)) {
|
||||
if (self.indicatorView.isAnimating) {
|
||||
return;
|
||||
}
|
||||
[self.indicatorView startAnimating];
|
||||
|
||||
// There's no more data, stop loading.
|
||||
if (self.dataProvider.isNoMoreData) {
|
||||
[self.indicatorView stopAnimating];
|
||||
[TUITool makeToast:TIMCommonLocalizableString(TUIKitMessageReadNoMoreData)];
|
||||
return;
|
||||
}
|
||||
|
||||
@weakify(self);
|
||||
[self.dataProvider loadDatas:^(BOOL success, NSString *_Nonnull err, NSArray *_Nonnull datas) {
|
||||
@strongify(self);
|
||||
[self.indicatorView stopAnimating];
|
||||
if (!success) {
|
||||
return;
|
||||
}
|
||||
[self.members addObjectsFromArray:datas];
|
||||
[self.tableView reloadData];
|
||||
[self.tableView layoutIfNeeded];
|
||||
if (datas.count == 0) {
|
||||
[self.tableView setContentOffset:CGPointMake(0, scrollView.contentOffset.y - TMessageController_Header_Height) animated:YES];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (UIActivityIndicatorView *)indicatorView {
|
||||
if (_indicatorView == nil) {
|
||||
_indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
|
||||
_indicatorView.hidesWhenStopped = YES;
|
||||
}
|
||||
return _indicatorView;
|
||||
}
|
||||
|
||||
- (UITableView *)tableView {
|
||||
if (_tableView == nil) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
|
||||
_tableView.backgroundColor = [UIColor whiteColor];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
[_tableView registerClass:TUIMemberInfoCell.class forCellReuseIdentifier:@"TUIMemberInfoCell"];
|
||||
_tableView.rowHeight = kScale390(52);
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// TUIGroupNoticeController.h
|
||||
// TUIGroup
|
||||
//
|
||||
// Created by harvy on 2022/1/11.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TUIGroupNoticeController_Minimalist : UIViewController
|
||||
|
||||
@property(nonatomic, copy) dispatch_block_t onNoticeChanged;
|
||||
@property(nonatomic, copy) NSString *groupID;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// TUIGroupNoticeController.m
|
||||
// TUIGroup
|
||||
//
|
||||
// Created by harvy on 2022/1/11.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TUIGroupNoticeController_Minimalist.h"
|
||||
#import <TUICore/TUIThemeManager.h>
|
||||
#import "TUIGroupNoticeDataProvider.h"
|
||||
|
||||
@interface TUIGroupNoticeController_Minimalist ()
|
||||
|
||||
@property(nonatomic, strong) UITextView *textView;
|
||||
@property(nonatomic, weak) UIButton *rightButton;
|
||||
@property(nonatomic, strong) TUIGroupNoticeDataProvider *dataProvider;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TUIGroupNoticeController_Minimalist
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.view.backgroundColor = [UIColor tui_colorWithHex:@"#f9f9f9"];
|
||||
[self.view addSubview:self.textView];
|
||||
|
||||
UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[rightBtn setTitleColor:TIMCommonDynamicColor(@"nav_title_text_color", @"#000000") forState:UIControlStateNormal];
|
||||
[rightBtn setTitleColor:TIMCommonDynamicColor(@"nav_title_text_color", @"#000000") forState:UIControlStateSelected];
|
||||
[rightBtn setTitle:TIMCommonLocalizableString(Edit) forState:UIControlStateNormal];
|
||||
[rightBtn setTitle:TIMCommonLocalizableString(Done) forState:UIControlStateSelected];
|
||||
[rightBtn sizeToFit];
|
||||
[rightBtn addTarget:self action:@selector(onClickRight:) forControlEvents:UIControlEventTouchUpInside];
|
||||
self.rightButton = rightBtn;
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
|
||||
self.rightButton.hidden = YES;
|
||||
|
||||
UILabel *titleLabel = [[UILabel alloc] init];
|
||||
titleLabel.text = TIMCommonLocalizableString(TUIKitGroupNotice);
|
||||
titleLabel.font = [UIFont boldSystemFontOfSize:17.0];
|
||||
titleLabel.textColor = TIMCommonDynamicColor(@"nav_title_text_color", @"#000000");
|
||||
[titleLabel sizeToFit];
|
||||
self.navigationItem.titleView = titleLabel;
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
self.dataProvider.groupID = self.groupID;
|
||||
[self.dataProvider getGroupInfo:^{
|
||||
weakSelf.textView.text = weakSelf.dataProvider.groupInfo.notification;
|
||||
weakSelf.textView.editable = NO;
|
||||
weakSelf.rightButton.hidden = !weakSelf.dataProvider.canEditNotice;
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)viewWillLayoutSubviews {
|
||||
[super viewWillLayoutSubviews];
|
||||
|
||||
self.textView.frame = self.view.bounds;
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
if (self.dataProvider.canEditNotice && self.textView.text.length == 0) {
|
||||
[self onClickRight:self.rightButton];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onClickRight:(UIButton *)button {
|
||||
if (button.isSelected) {
|
||||
self.textView.editable = NO;
|
||||
[self.textView resignFirstResponder];
|
||||
[self updateNotice];
|
||||
} else {
|
||||
self.textView.editable = YES;
|
||||
[self.textView becomeFirstResponder];
|
||||
}
|
||||
button.selected = !button.isSelected;
|
||||
}
|
||||
|
||||
- (void)updateNotice {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[self.dataProvider updateNotice:self.textView.text
|
||||
callback:^(int code, NSString *desc) {
|
||||
if (code != 0) {
|
||||
[TUITool makeToastError:code msg:desc];
|
||||
return;
|
||||
}
|
||||
if (weakSelf.onNoticeChanged) {
|
||||
weakSelf.onNoticeChanged();
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (UITextView *)textView {
|
||||
if (_textView == nil) {
|
||||
_textView = [[UITextView alloc] init];
|
||||
_textView.textAlignment = isRTL()?NSTextAlignmentRight:NSTextAlignmentLeft;
|
||||
_textView.backgroundColor = TIMCommonDynamicColor(@"controller_bg_color", @"#F2F3F5");
|
||||
_textView.textColor = TIMCommonDynamicColor(@"form_title_color", @"#000000");
|
||||
_textView.font = [UIFont systemFontOfSize:17];
|
||||
}
|
||||
return _textView;
|
||||
}
|
||||
|
||||
- (TUIGroupNoticeDataProvider *)dataProvider {
|
||||
if (_dataProvider == nil) {
|
||||
_dataProvider = [[TUIGroupNoticeDataProvider alloc] init];
|
||||
}
|
||||
return _dataProvider;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// TUIGroupRequestViewController.h
|
||||
// TUIKitDemo
|
||||
//
|
||||
// Created by annidyfeng on 2019/5/20.
|
||||
// Copyright © 2019 Tencent. All rights reserved.
|
||||
//
|
||||
#import <TIMCommon/TIMDefine.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TUIGroupRequestViewController_Minimalist : UIViewController
|
||||
@property V2TIMGroupInfo *groupInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,224 @@
|
||||
//
|
||||
// TUIGroupRequestViewController.m
|
||||
// TUIKitDemo
|
||||
//
|
||||
// Created by annidyfeng on 2019/5/20.
|
||||
// Copyright © 2019 Tencent. All rights reserved.
|
||||
//
|
||||
#import "TUIGroupRequestViewController_Minimalist.h"
|
||||
#import <TIMCommon/TIMCommonModel.h>
|
||||
#import <TIMCommon/TIMDefine.h>
|
||||
#import "TUIGroupButtonCell_Minimalist.h"
|
||||
#import "TUIProfileCardCell_Minimalist.h"
|
||||
|
||||
@interface TUIGroupRequestViewController_Minimalist () <UITableViewDataSource, UITableViewDelegate, TUIProfileCardDelegate>
|
||||
@property UITableView *tableView;
|
||||
@property UITextView *addMsgTextView;
|
||||
@property TUIProfileCardCellData_Minimalist *cardCellData;
|
||||
@end
|
||||
|
||||
@implementation TUIGroupRequestViewController_Minimalist
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
||||
[self.view addSubview:self.tableView];
|
||||
self.tableView.mm_fill();
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.backgroundColor = [UIColor whiteColor];
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
|
||||
self.addMsgTextView = [[UITextView alloc] initWithFrame:CGRectZero];
|
||||
self.addMsgTextView.font = [UIFont systemFontOfSize:14];
|
||||
self.addMsgTextView.textAlignment = isRTL()?NSTextAlignmentRight:NSTextAlignmentLeft;
|
||||
self.addMsgTextView.backgroundColor = [UIColor tui_colorWithHex:@"f9f9f9"];
|
||||
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
||||
paragraphStyle.lineSpacing = 5;
|
||||
paragraphStyle.firstLineHeadIndent = kScale390(12.5);
|
||||
paragraphStyle.alignment = NSTextAlignmentLeft;
|
||||
NSDictionary *attributes = @{NSFontAttributeName : [UIFont systemFontOfSize:kScale390(16)], NSParagraphStyleAttributeName : paragraphStyle};
|
||||
NSString *loginUser = [[V2TIMManager sharedInstance] getLoginUser];
|
||||
[[V2TIMManager sharedInstance]
|
||||
getUsersInfo:@[ loginUser ]
|
||||
succ:^(NSArray<V2TIMUserFullInfo *> *infoList) {
|
||||
NSString *text = [NSString stringWithFormat:TIMCommonLocalizableString(GroupRequestJoinGroupFormat), [[infoList firstObject] showName]];
|
||||
self.addMsgTextView.attributedText = [[NSAttributedString alloc] initWithString:text attributes:attributes];
|
||||
}
|
||||
fail:^(int code, NSString *msg){
|
||||
}];
|
||||
|
||||
TUIProfileCardCellData_Minimalist *data = [TUIProfileCardCellData_Minimalist new];
|
||||
data.name = self.groupInfo.groupName;
|
||||
data.identifier = self.groupInfo.groupID;
|
||||
data.signature = [NSString stringWithFormat:@"%@: %@", TIMCommonLocalizableString(TUIKitCreatGroupType), self.groupInfo.groupType];
|
||||
data.showSignature = YES;
|
||||
data.avatarImage = DefaultGroupAvatarImageByGroupType(self.groupInfo.groupType);
|
||||
data.avatarUrl = [NSURL URLWithString:self.groupInfo.faceURL];
|
||||
self.cardCellData = data;
|
||||
|
||||
self.title = TIMCommonLocalizableString(GroupJoin);
|
||||
|
||||
[TUITool addUnsupportNotificationInVC:self];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
NSLog(@"%s dealloc", __FUNCTION__);
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
|
||||
{
|
||||
if (indexPath.section == 0) {
|
||||
return [self.cardCellData heightOfWidth:Screen_Width];
|
||||
}
|
||||
if (indexPath.section == 1) {
|
||||
return kScale390(123);
|
||||
}
|
||||
if (indexPath.section == 2) {
|
||||
return kScale390(42);
|
||||
}
|
||||
return 0.;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
||||
UIView *view = [[UIView alloc] init];
|
||||
return view;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||
UIView *view = [[UIView alloc] init];
|
||||
view.backgroundColor = [UIColor clearColor];
|
||||
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.text = TIMCommonLocalizableString(please_fill_in_verification_information);
|
||||
label.textColor = [UIColor tui_colorWithHex:@"000000"];
|
||||
label.font = [UIFont systemFontOfSize:14.0];
|
||||
|
||||
label.frame = CGRectMake(kScale390(16), kScale390(12), self.tableView.bounds.size.width - 20, kScale390(28));
|
||||
[view addSubview:label];
|
||||
|
||||
return section == 1 ? view : nil;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
||||
if (section == 0) {
|
||||
return kScale390(10);
|
||||
}
|
||||
if (section == 1) {
|
||||
return kScale390(40);
|
||||
}
|
||||
if (section == 2) {
|
||||
return kScale390(20);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
|
||||
{ return 3; }
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return 1;
|
||||
}
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (indexPath.section == 0) {
|
||||
TUIProfileCardCell_Minimalist *cell = [[TUIProfileCardCell_Minimalist alloc] initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:@"TPersonalCommonCell_ReuseId"];
|
||||
cell.delegate = self;
|
||||
[cell fillWithData:self.cardCellData];
|
||||
return cell;
|
||||
}
|
||||
if (indexPath.section == 1) {
|
||||
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"AddWord"];
|
||||
[cell.contentView addSubview:self.addMsgTextView];
|
||||
self.addMsgTextView.mm_width(Screen_Width).mm_height(kScale390(123));
|
||||
return cell;
|
||||
}
|
||||
if (indexPath.section == 2) {
|
||||
TUIGroupButtonCell_Minimalist *cell = [[TUIGroupButtonCell_Minimalist alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"send"];
|
||||
TUIGroupButtonCellData_Minimalist *cellData = [[TUIGroupButtonCellData_Minimalist alloc] init];
|
||||
cellData.title = TIMCommonLocalizableString(Send);
|
||||
cellData.style = ButtonBule;
|
||||
cellData.cselector = @selector(onSend);
|
||||
cellData.textColor = [UIColor tui_colorWithHex:@"#147AFF"];
|
||||
[cell fillWithData:cellData];
|
||||
return cell;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||
[self.addMsgTextView endEditing:YES];
|
||||
}
|
||||
- (void)onSend {
|
||||
// display toast with an activity spinner
|
||||
[TUITool makeToastActivity];
|
||||
[[V2TIMManager sharedInstance] joinGroup:self.groupInfo.groupID
|
||||
msg:self.addMsgTextView.text
|
||||
succ:^{
|
||||
[TUITool hideToastActivity];
|
||||
[self showHud:YES msgText:TIMCommonLocalizableString(send_success)];
|
||||
}
|
||||
fail:^(int code, NSString *desc) {
|
||||
[TUITool hideToastActivity];
|
||||
NSString *msg = [TUITool convertIMError:code msg:desc];
|
||||
[self showHud:NO msgText:msg];
|
||||
if (code == ERR_SDK_INTERFACE_NOT_SUPPORT) {
|
||||
[TUITool postUnsupportNotificationOfService:TIMCommonLocalizableString(TUIKitErrorUnsupportIntefaceCommunity)
|
||||
serviceDesc:TIMCommonLocalizableString(TUIKitErrorUnsupportIntefaceCommunityDesc)
|
||||
debugOnly:YES];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)didTapOnAvatar:(TUIProfileCardCell_Minimalist *)cell {
|
||||
TUIAvatarViewController *image = [[TUIAvatarViewController alloc] init];
|
||||
image.avatarData = cell.cardData;
|
||||
[self.navigationController pushViewController:image animated:YES];
|
||||
}
|
||||
- (void)showHud:(BOOL)isSuccess msgText:(NSString *)msgText {
|
||||
UIView *hudView = [[UIView alloc] init];
|
||||
hudView.frame = CGRectMake(0, 0, Screen_Width, Screen_Height);
|
||||
hudView.backgroundColor = [UIColor tui_colorWithHex:@"#000000" alpha:0.6];
|
||||
|
||||
UIView *msgView = [[UIView alloc] init];
|
||||
[hudView addSubview:msgView];
|
||||
msgView.layer.masksToBounds = YES;
|
||||
msgView.layer.cornerRadius = kScale390(10);
|
||||
msgView.backgroundColor = [UIColor tui_colorWithHex:@"FFFFFF"];
|
||||
|
||||
UIImageView *icon = [[UIImageView alloc] init];
|
||||
[msgView addSubview:icon];
|
||||
icon.image = isSuccess ? [UIImage imageNamed:TUIContactImagePath_Minimalist(@"contact_add_success")]
|
||||
: [UIImage imageNamed:TUIContactImagePath_Minimalist(@"contact_add_failed")];
|
||||
|
||||
UILabel *descLabel = [[UILabel alloc] init];
|
||||
[msgView addSubview:descLabel];
|
||||
descLabel.font = [UIFont systemFontOfSize:kScale390(14)];
|
||||
descLabel.text = msgText;
|
||||
[descLabel sizeToFit];
|
||||
|
||||
icon.frame = CGRectMake(kScale390(12), kScale390(10), kScale390(16), kScale390(16));
|
||||
descLabel.frame = CGRectMake(icon.frame.origin.x + icon.frame.size.width + kScale390(8), kScale390(8), descLabel.frame.size.width, kScale390(20));
|
||||
msgView.frame = CGRectMake(0, 0, descLabel.frame.origin.x + descLabel.frame.size.width + kScale390(12), kScale390(36));
|
||||
msgView.mm__centerX(hudView.mm_centerX);
|
||||
msgView.mm__centerY(hudView.mm_centerY);
|
||||
|
||||
[[UIApplication sharedApplication].keyWindow showToast:hudView
|
||||
duration:3.0
|
||||
position:TUICSToastPositionCenter
|
||||
completion:^(BOOL didTap){
|
||||
|
||||
}];
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// TUISearchGroupViewController.h
|
||||
// TUIKitDemo
|
||||
//
|
||||
// Created by annidyfeng on 2019/5/20.
|
||||
// Copyright © 2019 Tencent. All rights reserved.
|
||||
//
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TUISearchGroupViewController_Minimalist : UIViewController
|
||||
|
||||
@property(nonatomic, retain) UISearchController *searchController;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,186 @@
|
||||
//
|
||||
// TUISearchGroupViewController.m
|
||||
// TUIKitDemo
|
||||
//
|
||||
// Created by annidyfeng on 2019/5/20.
|
||||
// Copyright © 2019 Tencent. All rights reserved.
|
||||
//
|
||||
#import "TUISearchGroupViewController_Minimalist.h"
|
||||
#import <TIMCommon/TIMDefine.h>
|
||||
#import <TUICore/TUIThemeManager.h>
|
||||
#import "TUIGroupRequestViewController_Minimalist.h"
|
||||
|
||||
@implementation UISearchController (Leak)
|
||||
|
||||
- (BOOL)willDealloc {
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface AddGroupItemView_Minimalist : UIView
|
||||
@property(nonatomic) V2TIMGroupInfo *groupInfo;
|
||||
@end
|
||||
|
||||
@implementation AddGroupItemView_Minimalist {
|
||||
UILabel *_idLabel;
|
||||
UIView *_line;
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
|
||||
_idLabel = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||
[self addSubview:_idLabel];
|
||||
|
||||
_line = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
_line.backgroundColor = [UIColor grayColor];
|
||||
[self addSubview:_line];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setGroupInfo:(V2TIMGroupInfo *)groupInfo {
|
||||
if (groupInfo) {
|
||||
if (groupInfo.groupName.length > 0) {
|
||||
_idLabel.text = [NSString stringWithFormat:@"%@ (group id: %@)", groupInfo.groupName, groupInfo.groupID];
|
||||
} else {
|
||||
_idLabel.text = groupInfo.groupID;
|
||||
}
|
||||
_idLabel.mm_sizeToFit().tui_mm_center().mm_left(8);
|
||||
_line.mm_height(1).mm_width(self.mm_w).mm_bottom(0);
|
||||
_line.hidden = NO;
|
||||
} else {
|
||||
_idLabel.text = @"";
|
||||
_line.hidden = YES;
|
||||
}
|
||||
|
||||
_groupInfo = groupInfo;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface TUISearchGroupViewController_Minimalist () <UISearchBarDelegate>
|
||||
|
||||
@property(nonatomic, strong) AddGroupItemView_Minimalist *userView;
|
||||
;
|
||||
|
||||
@end
|
||||
|
||||
@interface TUISearchGroupViewController_Minimalist () <UISearchControllerDelegate, UISearchBarDelegate>
|
||||
|
||||
@end
|
||||
|
||||
@implementation TUISearchGroupViewController_Minimalist
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.title = TIMCommonLocalizableString(ContactsJoinGroup);
|
||||
|
||||
self.view.backgroundColor = TIMCommonDynamicColor(@"controller_bg_color", @"#F2F3F5");
|
||||
|
||||
self.edgesForExtendedLayout = UIRectEdgeNone;
|
||||
self.automaticallyAdjustsScrollViewInsets = NO;
|
||||
self.definesPresentationContext = YES;
|
||||
|
||||
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
|
||||
self.searchController.delegate = self;
|
||||
self.searchController.dimsBackgroundDuringPresentation = NO;
|
||||
_searchController.searchBar.placeholder = @"group ID";
|
||||
_searchController.searchBar.delegate = self;
|
||||
[self.view addSubview:_searchController.searchBar];
|
||||
[self setSearchIconCenter:YES];
|
||||
|
||||
self.userView = [[AddGroupItemView_Minimalist alloc] initWithFrame:CGRectZero];
|
||||
[self.view addSubview:self.userView];
|
||||
|
||||
UITapGestureRecognizer *singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleUserTap:)];
|
||||
[self.userView addGestureRecognizer:singleFingerTap];
|
||||
}
|
||||
|
||||
- (void)setSearchIconCenter:(BOOL)center {
|
||||
if (center) {
|
||||
CGSize size = [self.searchController.searchBar.placeholder sizeWithAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14.0]}];
|
||||
CGFloat width = size.width + 60;
|
||||
[self.searchController.searchBar setPositionAdjustment:UIOffsetMake(0.5 * (self.searchController.searchBar.bounds.size.width - width), 0)
|
||||
forSearchBarIcon:UISearchBarIconSearch];
|
||||
} else {
|
||||
[self.searchController.searchBar setPositionAdjustment:UIOffsetZero forSearchBarIcon:UISearchBarIconSearch];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UISearchControllerDelegate
|
||||
- (void)didPresentSearchController:(UISearchController *)searchController {
|
||||
NSLog(@"didPresentSearchController");
|
||||
[self.view addSubview:self.searchController.searchBar];
|
||||
|
||||
self.searchController.searchBar.mm_top([self safeAreaTopGap]);
|
||||
self.userView.mm_top(self.searchController.searchBar.mm_maxY).mm_height(44).mm_width(Screen_Width);
|
||||
}
|
||||
|
||||
- (void)willPresentSearchController:(UISearchController *)searchController {
|
||||
[self setSearchIconCenter:NO];
|
||||
}
|
||||
|
||||
- (void)willDismissSearchController:(UISearchController *)searchController {
|
||||
[self setSearchIconCenter:YES];
|
||||
}
|
||||
|
||||
- (CGFloat)safeAreaTopGap {
|
||||
NSNumber *gap;
|
||||
if (gap == nil) {
|
||||
if (@available(iOS 11, *)) {
|
||||
gap = @(self.view.safeAreaLayoutGuide.layoutFrame.origin.y);
|
||||
} else {
|
||||
gap = @(0);
|
||||
}
|
||||
}
|
||||
return gap.floatValue;
|
||||
}
|
||||
|
||||
- (void)didDismissSearchController:(UISearchController *)searchController {
|
||||
NSLog(@"didDismissSearchController");
|
||||
self.searchController.searchBar.mm_top(0);
|
||||
self.userView.groupInfo = nil;
|
||||
}
|
||||
|
||||
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {
|
||||
self.searchController.active = YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
|
||||
self.searchController.active = NO;
|
||||
}
|
||||
|
||||
- (void)handleUserTap:(id)sender {
|
||||
if (self.userView.groupInfo) {
|
||||
TUIGroupRequestViewController_Minimalist *frc = [[TUIGroupRequestViewController_Minimalist alloc] init];
|
||||
frc.groupInfo = self.userView.groupInfo;
|
||||
[self.navigationController pushViewController:frc animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UISearchBarDelegate
|
||||
|
||||
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
|
||||
NSString *inputStr = searchBar.text;
|
||||
[[V2TIMManager sharedInstance] getGroupsInfo:@[ inputStr ]
|
||||
succ:^(NSArray<V2TIMGroupInfoResult *> *groupResultList) {
|
||||
if (groupResultList.count > 0) {
|
||||
V2TIMGroupInfoResult *result = groupResultList.firstObject;
|
||||
if (0 == result.resultCode) {
|
||||
self.userView.groupInfo = result.info;
|
||||
} else {
|
||||
self.userView.groupInfo = nil;
|
||||
}
|
||||
} else {
|
||||
self.userView.groupInfo = nil;
|
||||
}
|
||||
}
|
||||
fail:^(int code, NSString *desc) {
|
||||
self.userView.groupInfo = nil;
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// TUISelectGroupMemberViewController.h
|
||||
// TXIMSDK_TUIKit_iOS
|
||||
//
|
||||
// Created by xiangzhang on 2020/7/6.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <TIMCommon/TIMDefine.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TUIGroupDefine.h"
|
||||
#import "TUISelectGroupMemberCell.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TUISelectGroupMemberViewController_Minimalist : UIViewController
|
||||
@property(nonatomic, copy) NSString *groupId;
|
||||
@property(nonatomic, copy) NSString *name;
|
||||
@property(nonatomic, strong) SelectedFinished selectedFinished;
|
||||
@property(nonatomic, assign) TUISelectMemberOptionalStyle optionalStyle;
|
||||
@property(nonatomic, strong) NSArray *selectedUserIDList;
|
||||
@property(nonatomic, copy) NSString *userData;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,481 @@
|
||||
//
|
||||
// TUISelectGroupMemberViewController.m
|
||||
// TXIMSDK_TUIKit_iOS
|
||||
//
|
||||
// Created by xiangzhang on 2020/7/6.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TUISelectGroupMemberViewController_Minimalist.h"
|
||||
#import <TUICore/TUICore.h>
|
||||
#import <TUICore/TUIDarkModel.h>
|
||||
#import <TUICore/TUIGlobalization.h>
|
||||
#import <TUICore/TUIThemeManager.h>
|
||||
#import "ReactiveObjC/ReactiveObjC.h"
|
||||
#import "TUIMemberPanelCell.h"
|
||||
#import "TUISelectGroupMemberCell.h"
|
||||
|
||||
#define kUserBorder 44.0
|
||||
#define kUserSpacing 2
|
||||
#define kUserPanelLeftSpacing 15
|
||||
|
||||
@interface TUISelectGroupMemberViewController_Minimalist () <UICollectionViewDelegate,
|
||||
UICollectionViewDataSource,
|
||||
UICollectionViewDelegateFlowLayout,
|
||||
UITableViewDelegate,
|
||||
UITableViewDataSource>
|
||||
@property(nonatomic, strong) UIButton *cancelBtn;
|
||||
@property(nonatomic, strong) UIButton *doneBtn;
|
||||
@property(nonatomic, strong) UICollectionView *userPanel;
|
||||
@property(nonatomic, strong) UITableView *selectTable;
|
||||
@property(nonatomic, strong) UIActivityIndicatorView *indicatorView;
|
||||
@property(nonatomic, strong) NSMutableArray<TUIUserModel *> *selectedUsers;
|
||||
|
||||
@property(nonatomic, assign) CGFloat topStartPosition;
|
||||
@property(nonatomic, assign) CGFloat userPanelWidth;
|
||||
@property(nonatomic, assign) CGFloat userPanelHeight;
|
||||
@property(nonatomic, assign) CGFloat realSpacing;
|
||||
@property(nonatomic, assign) NSInteger userPanelColumnCount;
|
||||
@property(nonatomic, assign) NSInteger userPanelRowCount;
|
||||
|
||||
@property(nonatomic, strong) NSMutableArray *memberList;
|
||||
@property(nonatomic, assign) NSInteger pageIndex;
|
||||
@property(nonatomic, assign) BOOL isNoData;
|
||||
@end
|
||||
|
||||
@implementation TUISelectGroupMemberViewController_Minimalist {
|
||||
UICollectionView *_userPanel;
|
||||
UITableView *_selectTable;
|
||||
UIButton *_cancelBtn;
|
||||
UIButton *_doneBtn;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
UILabel *titleLabel = [[UILabel alloc] init];
|
||||
titleLabel.text = self.name ?: TIMCommonLocalizableString(Make_a_call);
|
||||
titleLabel.font = [UIFont boldSystemFontOfSize:17.0];
|
||||
titleLabel.textColor = TIMCommonDynamicColor(@"nav_title_text_color", @"#000000");
|
||||
[titleLabel sizeToFit];
|
||||
self.navigationItem.titleView = titleLabel;
|
||||
|
||||
self.view.backgroundColor = TIMCommonDynamicColor(@"controller_bg_color", @"#F2F3F5");
|
||||
|
||||
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:self.cancelBtn];
|
||||
self.navigationItem.leftBarButtonItem = item;
|
||||
|
||||
UIBarButtonItem *item2 = [[UIBarButtonItem alloc] initWithCustomView:self.doneBtn];
|
||||
self.navigationItem.rightBarButtonItem = item2;
|
||||
|
||||
CGFloat topPadding = 44.f;
|
||||
|
||||
if (@available(iOS 11.0, *)) {
|
||||
UIWindow *window = [UIApplication sharedApplication].keyWindow;
|
||||
topPadding = window.safeAreaInsets.top;
|
||||
}
|
||||
|
||||
topPadding = MAX(26, topPadding);
|
||||
CGFloat navBarHeight = self.navigationController.navigationBar.bounds.size.height;
|
||||
self.topStartPosition = topPadding + (navBarHeight > 0 ? navBarHeight : 44);
|
||||
CGRect rect = self.view.bounds;
|
||||
self.memberList = [NSMutableArray array];
|
||||
self.selectedUsers = [NSMutableArray array];
|
||||
self.indicatorView.frame = CGRectMake(0, 0, self.view.bounds.size.width, TMessageController_Header_Height);
|
||||
self.selectTable.tableFooterView = self.indicatorView;
|
||||
[self getMembers];
|
||||
}
|
||||
|
||||
#pragma mark UI
|
||||
|
||||
- (UIButton *)cancelBtn {
|
||||
if (!_cancelBtn.superview) {
|
||||
_cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
|
||||
[_cancelBtn setTitle:TIMCommonLocalizableString(Cancel) forState:UIControlStateNormal];
|
||||
[_cancelBtn setTitleColor:TIMCommonDynamicColor(@"nav_title_text_color", @"#000000") forState:UIControlStateNormal];
|
||||
[_cancelBtn addTarget:self action:@selector(cancel) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _cancelBtn;
|
||||
}
|
||||
|
||||
- (UIButton *)doneBtn {
|
||||
if (!_doneBtn.superview) {
|
||||
_doneBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
|
||||
[_doneBtn setTitle:TIMCommonLocalizableString(Done) forState:UIControlStateNormal];
|
||||
[_doneBtn setAlpha:0.5];
|
||||
[_doneBtn setTitleColor:TIMCommonDynamicColor(@"nav_title_text_color", @"#000000") forState:UIControlStateNormal];
|
||||
[_doneBtn addTarget:self action:@selector(onNext) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _doneBtn;
|
||||
}
|
||||
|
||||
- (UICollectionView *)userPanel {
|
||||
if (!_userPanel.superview) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
|
||||
_userPanel = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_userPanel.backgroundColor = [UIColor clearColor];
|
||||
[_userPanel registerClass:[TUIMemberPanelCell class] forCellWithReuseIdentifier:@"TUIMemberPanelCell"];
|
||||
if (@available(iOS 10.0, *)) {
|
||||
_userPanel.prefetchingEnabled = YES;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
_userPanel.showsVerticalScrollIndicator = NO;
|
||||
_userPanel.showsHorizontalScrollIndicator = NO;
|
||||
_userPanel.contentMode = UIViewContentModeScaleAspectFit;
|
||||
_userPanel.scrollEnabled = NO;
|
||||
_userPanel.delegate = self;
|
||||
_userPanel.dataSource = self;
|
||||
[self.view addSubview:_userPanel];
|
||||
}
|
||||
return _userPanel;
|
||||
}
|
||||
|
||||
- (UITableView *)selectTable {
|
||||
if (!_selectTable.superview) {
|
||||
_selectTable = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_selectTable.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
[_selectTable registerClass:[TUISelectGroupMemberCell class] forCellReuseIdentifier:@"TUISelectGroupMemberCell"];
|
||||
if (@available(iOS 15.0, *)) {
|
||||
_selectTable.sectionHeaderTopPadding = 0;
|
||||
}
|
||||
_selectTable.delegate = self;
|
||||
_selectTable.dataSource = self;
|
||||
[self.view addSubview:_selectTable];
|
||||
_selectTable.mm_width(self.view.mm_w).mm_top(self.topStartPosition + 10).mm_flexToBottom(0);
|
||||
}
|
||||
return _selectTable;
|
||||
}
|
||||
|
||||
- (UIActivityIndicatorView *)indicatorView {
|
||||
if (_indicatorView == nil) {
|
||||
_indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
|
||||
_indicatorView.hidesWhenStopped = YES;
|
||||
}
|
||||
return _indicatorView;
|
||||
}
|
||||
|
||||
- (void)updateUserPanel {
|
||||
self.userPanel.mm_height(self.userPanelHeight).mm_left(kUserPanelLeftSpacing).mm_flexToRight(0).mm_top(self.topStartPosition);
|
||||
self.selectTable.mm_width(self.view.mm_w).mm_top(self.userPanel.mm_maxY).mm_flexToBottom(0);
|
||||
@weakify(self);
|
||||
[self.userPanel
|
||||
performBatchUpdates:^{
|
||||
@strongify(self);
|
||||
[self.userPanel reloadSections:[NSIndexSet indexSetWithIndex:0]];
|
||||
}
|
||||
completion:nil];
|
||||
[self.selectTable reloadData];
|
||||
self.doneBtn.alpha = (self.selectedUsers.count == 0 ? 0.5 : 1);
|
||||
}
|
||||
|
||||
#pragma mark action
|
||||
|
||||
- (void)onNext {
|
||||
if (self.selectedUsers.count == 0) {
|
||||
return;
|
||||
}
|
||||
NSMutableArray *users = [NSMutableArray array];
|
||||
for (TUIUserModel *model in self.selectedUsers) {
|
||||
[users addObject:[model copy]];
|
||||
}
|
||||
if (self.selectedFinished) {
|
||||
[self cancel];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
self.selectedFinished(users);
|
||||
});
|
||||
}
|
||||
if (self.optionalStyle == TUISelectMemberOptionalStyleTransferOwner) {
|
||||
[self cancel];
|
||||
return;
|
||||
}
|
||||
[self cancel];
|
||||
|
||||
NSDictionary *result = @{TUICore_TUIGroupObjectFactory_SelectGroupMemberVC_ResultUserList : users};
|
||||
if (self.navigateValueCallback) {
|
||||
self.navigateValueCallback(result);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)cancel {
|
||||
if (self.isModal) {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
} else {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)isModal {
|
||||
NSArray *viewControllers = self.navigationController.viewControllers;
|
||||
if (viewControllers.count > 1 && [viewControllers.lastObject isEqual:self]) {
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark UITableViewDelegate
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.memberList.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
static NSString *cellIdentifier = @"TUISelectGroupMemberCell";
|
||||
TUISelectGroupMemberCell *cell = (TUISelectGroupMemberCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
|
||||
if (!cell) {
|
||||
cell = [[TUISelectGroupMemberCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
|
||||
}
|
||||
if (indexPath.row < self.memberList.count) {
|
||||
TUIUserModel *model = self.memberList[indexPath.row];
|
||||
BOOL isSelect = [self isUserSelected:model];
|
||||
[cell fillWithData:model isSelect:isSelect];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section {
|
||||
UITableViewHeaderFooterView *footer = (UITableViewHeaderFooterView *)view;
|
||||
footer.textLabel.textColor = [UIColor d_systemGrayColor];
|
||||
footer.textLabel.font = [UIFont systemFontOfSize:14];
|
||||
}
|
||||
|
||||
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
|
||||
return TIMCommonLocalizableString(TUIKitGroupProfileMember);
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
|
||||
return 44;
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
BOOL isSelected = NO;
|
||||
TUIUserModel *userSelected = [[TUIUserModel alloc] init];
|
||||
if (indexPath.row < self.memberList.count) {
|
||||
TUIUserModel *user = self.memberList[indexPath.row];
|
||||
isSelected = [self isUserSelected:user];
|
||||
userSelected = [user copy];
|
||||
}
|
||||
|
||||
if (userSelected.userId.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ([userSelected.userId isEqualToString:kImSDK_MesssageAtALL]) {
|
||||
[self.selectedUsers removeAllObjects];
|
||||
[self.selectedUsers addObject:userSelected];
|
||||
[self onNext];
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.optionalStyle == TUISelectMemberOptionalStyleTransferOwner) {
|
||||
[self.selectedUsers removeAllObjects];
|
||||
}
|
||||
if (isSelected) {
|
||||
for (TUIUserModel *user in self.selectedUsers) {
|
||||
if ([user.userId isEqualToString:userSelected.userId]) {
|
||||
[self.selectedUsers removeObject:user];
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
[self.selectedUsers addObject:userSelected];
|
||||
}
|
||||
[self updateUserPanel];
|
||||
}
|
||||
|
||||
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
|
||||
if (scrollView.contentOffset.y > 0 && (scrollView.contentOffset.y >= scrollView.bounds.origin.y)) {
|
||||
if (self.indicatorView.isAnimating) {
|
||||
return;
|
||||
}
|
||||
[self.indicatorView startAnimating];
|
||||
@weakify(self);
|
||||
[self loadData:^(BOOL success, NSString *desc, NSArray<TUIUserModel *> *datas) {
|
||||
@strongify(self);
|
||||
[self.indicatorView stopAnimating];
|
||||
if (!success) {
|
||||
return;
|
||||
}
|
||||
[self.memberList addObjectsFromArray:datas];
|
||||
[self.selectTable reloadData];
|
||||
[self.selectTable layoutIfNeeded];
|
||||
if (datas.count == 0) {
|
||||
[self.selectTable setContentOffset:CGPointMake(0, scrollView.contentOffset.y - TMessageController_Header_Height) animated:YES];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark UICollectionViewDelegate
|
||||
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
return self.selectedUsers.count;
|
||||
}
|
||||
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
static NSString *cellIdentifier = @"TUIMemberPanelCell";
|
||||
TUIMemberPanelCell *cell = (TUIMemberPanelCell *)[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
|
||||
if (indexPath.row < self.selectedUsers.count) {
|
||||
[cell fillWithData:self.selectedUsers[indexPath.row]];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView
|
||||
layout:(UICollectionViewLayout *)collectionViewLayout
|
||||
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return CGSizeMake(kUserBorder, kUserBorder);
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[collectionView deselectItemAtIndexPath:indexPath animated:NO];
|
||||
if (indexPath.row < self.selectedUsers.count) {
|
||||
// to do
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark data
|
||||
- (NSInteger)userPanelColumnCount {
|
||||
if (self.selectedUsers.count == 0) {
|
||||
return 0;
|
||||
}
|
||||
CGFloat totalWidth = self.view.mm_w - kUserPanelLeftSpacing;
|
||||
int columnCount = (int)(totalWidth / (kUserBorder + kUserSpacing));
|
||||
return columnCount;
|
||||
}
|
||||
|
||||
- (CGFloat)realSpacing {
|
||||
CGFloat totalWidth = self.view.mm_w - kUserPanelLeftSpacing;
|
||||
if (self.userPanelColumnCount == 0 || self.userPanelColumnCount == 1) {
|
||||
return 0;
|
||||
}
|
||||
return (totalWidth - (CGFloat)self.userPanelColumnCount * kUserBorder) / ((CGFloat)self.userPanelColumnCount - 1);
|
||||
}
|
||||
|
||||
- (NSInteger)userPanelRowCount {
|
||||
NSInteger userCount = self.selectedUsers.count;
|
||||
NSInteger columnCount = MAX(self.userPanelColumnCount, 1);
|
||||
NSInteger rowCount = userCount / columnCount;
|
||||
if (userCount % columnCount != 0) {
|
||||
rowCount += 1;
|
||||
}
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
- (CGFloat)userPanelWidth {
|
||||
return (CGFloat)self.userPanelColumnCount * kUserBorder + ((CGFloat)self.userPanelColumnCount - 1) * self.realSpacing;
|
||||
}
|
||||
|
||||
- (CGFloat)userPanelHeight {
|
||||
return (CGFloat)self.userPanelRowCount * kUserBorder + ((CGFloat)self.userPanelRowCount - 1) * self.realSpacing;
|
||||
}
|
||||
|
||||
- (void)getMembers {
|
||||
@weakify(self);
|
||||
[self getMembersWithOptionalStyle];
|
||||
[self loadData:^(BOOL success, NSString *desc, NSArray<TUIUserModel *> *datas) {
|
||||
@strongify(self);
|
||||
if (!success) {
|
||||
return;
|
||||
}
|
||||
[self.memberList addObjectsFromArray:datas];
|
||||
[self.selectTable reloadData];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)loadData:(void (^)(BOOL, NSString *, NSArray<TUIUserModel *> *))completion {
|
||||
if (self.isNoData) {
|
||||
if (completion) {
|
||||
completion(YES, @"there is no more data", @[]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[[V2TIMManager sharedInstance] getGroupMemberList:self.groupId
|
||||
filter:V2TIM_GROUP_MEMBER_FILTER_ALL
|
||||
nextSeq:self.pageIndex
|
||||
succ:^(uint64_t nextSeq, NSArray<V2TIMGroupMemberFullInfo *> *memberList) {
|
||||
weakSelf.pageIndex = nextSeq;
|
||||
weakSelf.isNoData = (nextSeq == 0);
|
||||
NSMutableArray *arrayM = [NSMutableArray array];
|
||||
for (V2TIMGroupMemberFullInfo *info in memberList) {
|
||||
if ([info.userID isEqualToString:[[V2TIMManager sharedInstance] getLoginUser]]) {
|
||||
continue;
|
||||
}
|
||||
if (weakSelf.optionalStyle & TUISelectMemberOptionalStylePublicMan) {
|
||||
BOOL isSuper = (info.role == V2TIM_GROUP_MEMBER_ROLE_SUPER);
|
||||
BOOL isAdMin = (info.role == V2TIM_GROUP_MEMBER_ROLE_ADMIN);
|
||||
if (isSuper || isAdMin) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.selectedUserIDList && [self.selectedUserIDList containsObject:info.userID]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TUIUserModel *model = [[TUIUserModel alloc] init];
|
||||
model.userId = info.userID;
|
||||
if (info.nameCard.length > 0) {
|
||||
model.name = info.nameCard;
|
||||
} else if (info.friendRemark.length > 0) {
|
||||
model.name = info.friendRemark;
|
||||
} else if (info.nickName.length > 0) {
|
||||
model.name = info.nickName;
|
||||
} else {
|
||||
model.name = info.userID;
|
||||
}
|
||||
if (info.faceURL != nil) {
|
||||
model.avatar = info.faceURL;
|
||||
}
|
||||
[arrayM addObject:model];
|
||||
}
|
||||
if (completion) {
|
||||
completion(YES, nil, [NSArray arrayWithArray:arrayM]);
|
||||
}
|
||||
}
|
||||
fail:^(int code, NSString *desc) {
|
||||
if (completion) {
|
||||
completion(NO, desc, @[]);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)getMembersWithOptionalStyle {
|
||||
if (!NSThread.isMainThread) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[weakSelf getMembersWithOptionalStyle];
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.optionalStyle == TUISelectMemberOptionalStyleNone) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.optionalStyle & TUISelectMemberOptionalStyleAtAll) {
|
||||
TUIUserModel *model = [[TUIUserModel alloc] init];
|
||||
model.userId = kImSDK_MesssageAtALL;
|
||||
model.name = TIMCommonLocalizableString(All);
|
||||
[self.memberList addObject:model];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)isUserSelected:(TUIUserModel *)user {
|
||||
BOOL isSelected = NO;
|
||||
for (TUIUserModel *selectUser in self.selectedUsers) {
|
||||
if ([selectUser.userId isEqualToString:user.userId] && ![selectUser.userId isEqualToString:[[V2TIMManager sharedInstance] getLoginUser]]) {
|
||||
isSelected = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isSelected;
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// TUISettingAdminController.h
|
||||
// TUIGroup
|
||||
//
|
||||
// Created by harvy on 2021/12/28.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TUISettingAdminController_Minimalist : UIViewController
|
||||
|
||||
@property(nonatomic, copy) NSString *groupID;
|
||||
|
||||
@property(nonatomic, copy) void (^settingAdminDissmissCallBack)(void);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,171 @@
|
||||
//
|
||||
// TUISettingAdminController.m
|
||||
// TUIGroup
|
||||
//
|
||||
// Created by harvy on 2021/12/28.
|
||||
// Copyright © 2023 Tencent. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TUISettingAdminController_Minimalist.h"
|
||||
#import <TUICore/TUIGlobalization.h>
|
||||
#import <TUICore/TUIThemeManager.h>
|
||||
#import "TUIMemberInfoCell.h"
|
||||
#import "TUIMemberInfoCellData.h"
|
||||
#import "TUISelectGroupMemberViewController_Minimalist.h"
|
||||
#import "TUISettingAdminDataProvider.h"
|
||||
|
||||
@interface TUISettingAdminController_Minimalist () <UITableViewDataSource, UITableViewDelegate>
|
||||
|
||||
@property(nonatomic, strong) UITableView *tableView;
|
||||
@property(nonatomic, strong) TUISettingAdminDataProvider *dataProvider;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TUISettingAdminController_Minimalist
|
||||
|
||||
- (void)dealloc {
|
||||
if (self.settingAdminDissmissCallBack) {
|
||||
self.settingAdminDissmissCallBack();
|
||||
}
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
[self setupViews];
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
self.dataProvider.groupID = self.groupID;
|
||||
[self.dataProvider loadData:^(int code, NSString *error) {
|
||||
[weakSelf.tableView reloadData];
|
||||
if (code != 0) {
|
||||
[weakSelf.view makeToast:error];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setupViews {
|
||||
UILabel *titleLabel = [[UILabel alloc] init];
|
||||
titleLabel.text = TIMCommonLocalizableString(TUIKitGroupManageAdminSetting);
|
||||
titleLabel.font = [UIFont boldSystemFontOfSize:17.0];
|
||||
titleLabel.textColor = TIMCommonDynamicColor(@"nav_title_text_color", @"#000000");
|
||||
[titleLabel sizeToFit];
|
||||
self.navigationItem.titleView = titleLabel;
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDataSource, UITableViewDelegate
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return self.dataProvider.datas.count;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
NSArray *subArray = self.dataProvider.datas[section];
|
||||
return subArray.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
TUIMemberInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
NSArray *subArray = self.dataProvider.datas[indexPath.section];
|
||||
TUIMemberInfoCellData *cellData = subArray[indexPath.row];
|
||||
cell.data = cellData;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:NO];
|
||||
|
||||
if (indexPath.section == 1 && indexPath.row == 0) {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
TUISelectGroupMemberViewController_Minimalist *vc = [[TUISelectGroupMemberViewController_Minimalist alloc] init];
|
||||
vc.groupId = self.groupID;
|
||||
vc.name = TIMCommonLocalizableString(TUIKitGroupManageAdminSetting);
|
||||
vc.selectedFinished = ^(NSMutableArray<TUIUserModel *> *_Nonnull modelList) {
|
||||
[weakSelf.dataProvider settingAdmins:modelList
|
||||
callback:^(int code, NSString *errorMsg) {
|
||||
if (code != 0) {
|
||||
[weakSelf.view makeToast:errorMsg];
|
||||
}
|
||||
[weakSelf.tableView reloadData];
|
||||
}];
|
||||
};
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return indexPath.section == 1 && indexPath.row > 0;
|
||||
}
|
||||
|
||||
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return TIMCommonLocalizableString(Delete);
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
||||
NSArray *subArray = self.dataProvider.datas[indexPath.section];
|
||||
TUIMemberInfoCellData *cellData = subArray[indexPath.row];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[self.dataProvider removeAdmin:cellData.identifier
|
||||
callback:^(int code, NSString *err) {
|
||||
if (code != 0) {
|
||||
[weakSelf.view makeToast:err];
|
||||
}
|
||||
[weakSelf.tableView reloadData];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||
NSArray *subArray = self.dataProvider.datas[section];
|
||||
NSString *title = TIMCommonLocalizableString(TUIKitGroupOwner);
|
||||
if (section == 1) {
|
||||
title = [NSString stringWithFormat:TIMCommonLocalizableString(TUIKitGroupManagerFormat), subArray.count - 1, 10];
|
||||
}
|
||||
|
||||
UIView *view = [[UIView alloc] init];
|
||||
view.backgroundColor = [UIColor groupTableViewBackgroundColor];
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.text = title;
|
||||
label.textColor = [UIColor colorWithRed:136 / 255.0 green:136 / 255.0 blue:136 / 255.0 alpha:1 / 1.0];
|
||||
label.font = [UIFont systemFontOfSize:14.0];
|
||||
[view addSubview:label];
|
||||
[label sizeToFit];
|
||||
label.mm_x = 20;
|
||||
label.mm_y = 10;
|
||||
return view;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
||||
return [UIView new];
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
||||
return 30;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (UITableView *)tableView {
|
||||
if (_tableView == nil) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
|
||||
_tableView.backgroundColor = TIMCommonDynamicColor(@"controller_bg_color", @"#F2F3F5");
|
||||
_tableView.delaysContentTouches = NO;
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
[_tableView registerClass:TUIMemberInfoCell.class forCellReuseIdentifier:@"cell"];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
- (TUISettingAdminDataProvider *)dataProvider {
|
||||
if (_dataProvider == nil) {
|
||||
_dataProvider = [[TUISettingAdminDataProvider alloc] init];
|
||||
}
|
||||
return _dataProvider;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user