修复了黑名单管理中显示异常的问题

This commit is contained in:
fengshuo
2022-05-13 21:55:39 +08:00
parent 56417882e5
commit 4d9733da93
11 changed files with 125 additions and 22 deletions

View File

@@ -287,6 +287,7 @@
E800808527FD8FC20055A8AB /* ClanMemberDetailInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E800808427FD8FC20055A8AB /* ClanMemberDetailInfoModel.m */; };
E800808827FDA5100055A8AB /* XPClanSectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = E800808727FDA5100055A8AB /* XPClanSectionView.m */; };
E80487652717DDD9008595F2 /* XPRoomMenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = E80487642717DDD9008595F2 /* XPRoomMenuItem.m */; };
E8098CB4282E97550090B9F0 /* XPMineBlackListPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8098CB3282E97550090B9F0 /* XPMineBlackListPresenter.m */; };
E80B0712280D0A6700A79F63 /* FansInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E80B0711280D0A6700A79F63 /* FansInfoModel.m */; };
E80B0734280D740600A79F63 /* MessageContentGuildView.m in Sources */ = {isa = PBXBuildFile; fileRef = E80B0733280D740600A79F63 /* MessageContentGuildView.m */; };
E80B0737280D790400A79F63 /* GuildMessageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E80B0736280D790400A79F63 /* GuildMessageModel.m */; };
@@ -1364,6 +1365,9 @@
E800808727FDA5100055A8AB /* XPClanSectionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPClanSectionView.m; sourceTree = "<group>"; };
E80487632717DDD9008595F2 /* XPRoomMenuItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMenuItem.h; sourceTree = "<group>"; };
E80487642717DDD9008595F2 /* XPRoomMenuItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMenuItem.m; sourceTree = "<group>"; };
E8098CB2282E97550090B9F0 /* XPMineBlackListPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineBlackListPresenter.h; sourceTree = "<group>"; };
E8098CB3282E97550090B9F0 /* XPMineBlackListPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineBlackListPresenter.m; sourceTree = "<group>"; };
E8098CB6282E97AC0090B9F0 /* XPMineBlackListProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineBlackListProtocol.h; sourceTree = "<group>"; };
E80B0710280D0A6700A79F63 /* FansInfoModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FansInfoModel.h; sourceTree = "<group>"; };
E80B0711280D0A6700A79F63 /* FansInfoModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FansInfoModel.m; sourceTree = "<group>"; };
E80B0732280D740600A79F63 /* MessageContentGuildView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageContentGuildView.h; sourceTree = "<group>"; };
@@ -6135,6 +6139,8 @@
E8E70D7926F2F16600F03460 /* XPMinePresent.m */,
E8AC721A26F4720B007D6E91 /* XPMineSettingPresent.h */,
E8AC721B26F4720B007D6E91 /* XPMineSettingPresent.m */,
E8098CB2282E97550090B9F0 /* XPMineBlackListPresenter.h */,
E8098CB3282E97550090B9F0 /* XPMineBlackListPresenter.m */,
E8AC722526F482A4007D6E91 /* XPMineFeedbackPresenter.h */,
E8AC722626F482A4007D6E91 /* XPMineFeedbackPresenter.m */,
E8AC723326F49939007D6E91 /* XPMineNotificaPresenter.h */,
@@ -6184,6 +6190,7 @@
children = (
E8E70D7B26F2F18900F03460 /* XPMineProtocol.h */,
E8AC721D26F4723D007D6E91 /* XPMineSettingProtocol.h */,
E8098CB6282E97AC0090B9F0 /* XPMineBlackListProtocol.h */,
E8AC722826F48889007D6E91 /* XPMineFeedbackProtocol.h */,
E8AC723626F49957007D6E91 /* XPMineNotificaProtocol.h */,
E824544726F5940600BE8163 /* XPMinePayPwdProtocol.h */,
@@ -6954,6 +6961,7 @@
E8F1558D28124D5200EE8C06 /* MessageConentAudioView.m in Sources */,
E8E20BDB281645300033B688 /* SessionInfoViewController.m in Sources */,
E8E859CA28264C2300EE4857 /* WebSocket.m in Sources */,
E8098CB4282E97550090B9F0 /* XPMineBlackListPresenter.m in Sources */,
E8E859CC28264C2300EE4857 /* MultipartFormDataParser.m in Sources */,
E800807C27FD84980055A8AB /* GuildInfoModel.m in Sources */,
E8A03DF0276303D40098D9EA /* XPCandyTreeRankTableViewCell.m in Sources */,

View File

@@ -219,6 +219,11 @@ NS_ASSUME_NONNULL_BEGIN
/// @param uid 用户的uid
/// @param orderType 类型2
+ (void)getUserGiftWall:(HttpRequestHelperCompletion)comletion uid:(NSString *)uid orderType:(NSString *)orderType;
/// 批量获取用户信息
/// @param completion 完成
/// @param uids 用户的uid
+ (void)getUsersListInfo:(HttpRequestHelperCompletion)completion uids:(NSString *)uids;
@end
NS_ASSUME_NONNULL_END

View File

@@ -239,4 +239,11 @@
[self makeRequest:@"giftwall/get" method:HttpRequestHelperMethodGET completion:comletion, __FUNCTION__, uid, orderType, nil];
}
///
/// @param completion
/// @param uids uid
+ (void)getUsersListInfo:(HttpRequestHelperCompletion)completion uids:(NSString *)uids {
[self makeRequest:@"user/list" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, uids, nil];
}
@end

View File

@@ -0,0 +1,16 @@
//
// XPMineBlackListPresenter.h
// xplan-ios
//
// Created by 冯硕 on 2022/5/13.
//
#import "BaseMvpPresenter.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMineBlackListPresenter : BaseMvpPresenter
- (void)getUserListInfo:(NSArray *)array;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,25 @@
//
// XPMineBlackListPresenter.m
// xplan-ios
//
// Created by on 2022/5/13.
//
#import "XPMineBlackListPresenter.h"
#import "Api+Mine.h"
#import "UserInfoModel.h"
#import "XPMineBlackListProtocol.h"
@implementation XPMineBlackListPresenter
- (void)getUserListInfo:(NSArray *)array {
NSString * uids = @"";
if (array.count > 0) {
uids = [array componentsJoinedByString:@","];
}
[Api getUsersListInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray *users= [UserInfoModel modelsWithArray:data.data];
[[self getView] getUserListInfoSuccess:users];
}] uids:uids];
}
@end

View File

@@ -0,0 +1,18 @@
//
// XPMineBlackListProtocol.h
// xplan-ios
//
// Created by 冯硕 on 2022/5/13.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol XPMineBlackListProtocol <NSObject>
- (void)getUserListInfoSuccess:(NSArray *)array;
@end
NS_ASSUME_NONNULL_END

View File

@@ -8,9 +8,9 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class NIMUser;
@class UserInfoModel;
@interface XPMineBlackListTableViewCell : UITableViewCell
@property (nonatomic,strong) NIMUser *userInfo;
@property (nonatomic,strong) UserInfoModel *userInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -8,11 +8,11 @@
#import "XPMineBlackListTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
#import <NIMSDK/NIMSDK.h>
///Tool
#import "ThemeColor.h"
///Tool
#import "NetImageView.h"
///Model
#import "UserInfoModel.h"
@interface XPMineBlackListTableViewCell ()
///
@@ -52,11 +52,11 @@
}];
}
#pragma mark - Getters And Setters
- (void)setUserInfo:(NIMUser *)userInfo {
- (void)setUserInfo:(UserInfoModel *)userInfo {
_userInfo = userInfo;
if (_userInfo) {
self.avatarImageView.imageUrl = _userInfo.userInfo.avatarUrl;
self.nickLabel.text = _userInfo.userInfo.nickName;
self.avatarImageView.imageUrl = _userInfo.avatar;
self.nickLabel.text = _userInfo.nick;
}
}

View File

@@ -154,20 +154,16 @@
vc.url = urlstr;
[self.navigationController pushViewController:vc animated:YES];
}];
TTActionSheetConfig *removeBlack = [TTActionSheetConfig normalTitle:@"移除黑名单" clickAction:^{
[self addOrRemoveBlack:YES uid:uid];
}];
TTActionSheetConfig *black = [TTActionSheetConfig normalTitle:@"拉黑" clickAction:^{
[self addOrRemoveBlack:NO uid:uid];
}];
[array addObjectsFromArray:@[report]];
[array addObjectsFromArray:@[report, black]];
BOOL isInBlackList = [[NIMSDK sharedSDK].userManager isUserInBlackList:uid];
if (isInBlackList) {
[array addObject:removeBlack];
} else {
[array addObject:black];
[array removeObject:black];
}
[TTPopup actionSheetWithItems:array];
}

View File

@@ -5,11 +5,11 @@
// Created by 冯硕 on 2022/4/25.
//
#import "BaseViewController.h"
#import "MvpViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPMineBlackListViewController : BaseViewController
@interface XPMineBlackListViewController : MvpViewController
@end

View File

@@ -11,19 +11,34 @@
#import <NIMSDK/NIMSDK.h>
#import "XPMineBlackListTableViewCell.h"
#import "XPMineFriendEmptyTableViewCell.h"
///Model
#import "UserInfoModel.h"
///P
#import "XPMineBlackListPresenter.h"
#import "XPMineBlackListProtocol.h"
@interface XPMineBlackListViewController ()<UITableViewDelegate, UITableViewDataSource>
@interface XPMineBlackListViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineBlackListProtocol>
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSArray<NIMUser *> *datasource;
@property (nonatomic,strong) NSMutableArray<UserInfoModel *> *datasource;
@end
@implementation XPMineBlackListViewController
- (__kindof id)createPresenter {
return [[XPMineBlackListPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.datasource = [[NIMSDK sharedSDK].userManager myBlackList];
NSArray *array = [[NIMSDK sharedSDK].userManager myBlackList];
NSMutableArray * uids = [NSMutableArray array];
for (int i = 0; i< array.count; i++) {
NIMUser * user = [array objectAtIndex:i];
[uids addObject:user.userId];
}
[self.presenter getUserListInfo:uids];
[self initSubViews];
[self initSubViewConstraints];
}
@@ -72,10 +87,10 @@
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
if (editingStyle ==UITableViewCellEditingStyleDelete){
if (self.datasource.count > 0) {
NIMUser *userInfo = [self.datasource objectAtIndex:indexPath.row];
[[NIMSDK sharedSDK].userManager removeFromBlackBlackList:userInfo.userId completion:^(NSError * _Nullable error) {
UserInfoModel *userInfo = [self.datasource objectAtIndex:indexPath.row];
[[NIMSDK sharedSDK].userManager removeFromBlackBlackList:[NSString stringWithFormat:@"%ld", userInfo.uid] completion:^(NSError * _Nullable error) {
if (error == nil) {
self.datasource = [[NIMSDK sharedSDK].userManager myBlackList];
[self.datasource removeObject:userInfo];
[self.tableView reloadData];
}
}];
@@ -84,6 +99,12 @@
}
}
#pragma mark - XPMineBlackListPrototcol
- (void)getUserListInfoSuccess:(NSArray *)array {
[self.datasource addObjectsFromArray:array];
[self.tableView reloadData];
}
#pragma mark - Getters And Setters
- (UITableView *)tableView {
if (!_tableView) {
@@ -102,6 +123,13 @@
return _tableView;
}
- (NSMutableArray<UserInfoModel *> *)datasource {
if (!_datasource) {
_datasource = [NSMutableArray array];
}
return _datasource;
}
@end