是否是查看自己的个人信息VC 展示不同的操作按钮
This commit is contained in:
@@ -7,11 +7,15 @@
|
|||||||
|
|
||||||
#import "XPMineUserInfoViewController.h"
|
#import "XPMineUserInfoViewController.h"
|
||||||
///Third
|
///Third
|
||||||
|
#import <NIMSDK/NIMSDK.h>
|
||||||
#import <Masonry/Masonry.h>
|
#import <Masonry/Masonry.h>
|
||||||
#import <SDCycleScrollView/SDCycleScrollView.h>
|
#import <SDCycleScrollView/SDCycleScrollView.h>
|
||||||
///Tool
|
///Tool
|
||||||
#import "ThemeColor.h"
|
#import "ThemeColor.h"
|
||||||
#import "XPMacro.h"
|
#import "XPMacro.h"
|
||||||
|
#import "AccountInfoStorage.h"
|
||||||
|
#import "TTPopup.h"
|
||||||
|
#import "XPHtmlUrl.h"
|
||||||
///View
|
///View
|
||||||
#import "XPMineUserInfoTableViewCell.h"
|
#import "XPMineUserInfoTableViewCell.h"
|
||||||
#import "XPMineUserInfoHeaderView.h"
|
#import "XPMineUserInfoHeaderView.h"
|
||||||
@@ -22,6 +26,7 @@
|
|||||||
#import "XPMineUserInfoProtocol.h"
|
#import "XPMineUserInfoProtocol.h"
|
||||||
///VC
|
///VC
|
||||||
#import "XPMineUserInfoEditViewController.h"
|
#import "XPMineUserInfoEditViewController.h"
|
||||||
|
#import "XPWebViewController.h"
|
||||||
|
|
||||||
@interface XPMineUserInfoViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, UIGestureRecognizerDelegate>
|
@interface XPMineUserInfoViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineCustomNavViewDelegate, XPMineUserInfoProtocol, UIGestureRecognizerDelegate>
|
||||||
///列别
|
///列别
|
||||||
@@ -55,7 +60,7 @@
|
|||||||
- (void)viewWillAppear:(BOOL)animated {
|
- (void)viewWillAppear:(BOOL)animated {
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
if (self.uid > 0) {
|
if (self.uid > 0) {
|
||||||
NSString * uidStr = [NSString stringWithFormat:@"%lld", self.uid];
|
NSString * uidStr = [NSString stringWithFormat:@"%ld", self.uid];
|
||||||
[self.presenter getUserInfoWithUid:uidStr];
|
[self.presenter getUserInfoWithUid:uidStr];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,6 +95,67 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - 拉黑 移除黑名单
|
||||||
|
- (void)showRightNavHandle {
|
||||||
|
NSMutableArray<TTActionSheetConfig *> *array = [NSMutableArray array];
|
||||||
|
NSString *uid = [NSString stringWithFormat:@"%ld",self.uid];
|
||||||
|
TTActionSheetConfig *report = [TTActionSheetConfig normalTitle:@"举报" clickAction:^{
|
||||||
|
XPWebViewController *vc = [[XPWebViewController alloc]init];
|
||||||
|
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%@&source=PERSONAL",URLWithType(kReportRoomURL),uid];
|
||||||
|
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, black]];
|
||||||
|
|
||||||
|
BOOL isInBlackList = [[NIMSDK sharedSDK].userManager isUserInBlackList:uid];
|
||||||
|
if (isInBlackList) {
|
||||||
|
[array addObject:removeBlack];
|
||||||
|
}
|
||||||
|
[TTPopup actionSheetWithItems:array];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//加入黑名单
|
||||||
|
- (void)addOrRemoveBlack:(BOOL)isRemove uid:(NSString *)uid {
|
||||||
|
NSString *title;
|
||||||
|
NSString *message;
|
||||||
|
if (isRemove) {
|
||||||
|
title = @"移除黑名单";
|
||||||
|
message = @"移除黑名单,你将正常收到对方的消息";
|
||||||
|
}else{
|
||||||
|
title = @"加入黑名单";
|
||||||
|
message = @"加入黑名单,你将不再收到对方的消息";
|
||||||
|
}
|
||||||
|
|
||||||
|
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||||
|
config.title = title;
|
||||||
|
config.message = message;
|
||||||
|
|
||||||
|
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||||
|
if (isRemove) {
|
||||||
|
[[NIMSDK sharedSDK].userManager removeFromBlackBlackList:uid completion:^(NSError * _Nullable error) {
|
||||||
|
if (error == nil) {
|
||||||
|
[self showSuccessToast:@"移出黑名单成功"];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
} else {
|
||||||
|
[[NIMSDK sharedSDK].userManager addToBlackList:uid completion:^(NSError * _Nullable error) {
|
||||||
|
if (error == nil) {
|
||||||
|
[self showSuccessToast:@"加入黑名单成功"];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
} cancelHandler:^{
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -114,8 +180,12 @@
|
|||||||
|
|
||||||
#pragma mark - XPMineCustomNavViewDelegate
|
#pragma mark - XPMineCustomNavViewDelegate
|
||||||
- (void)xPMineCustomNavView:(XPMineUserInfoCustomNavView *)view didClickEditButton:(UIButton *)sender {
|
- (void)xPMineCustomNavView:(XPMineUserInfoCustomNavView *)view didClickEditButton:(UIButton *)sender {
|
||||||
XPMineUserInfoEditViewController * editVC = [[XPMineUserInfoEditViewController alloc] init];
|
if (sender.isSelected) {///自己看自己的 去修改资料
|
||||||
[self.navigationController pushViewController:editVC animated:YES];
|
XPMineUserInfoEditViewController * editVC = [[XPMineUserInfoEditViewController alloc] init];
|
||||||
|
[self.navigationController pushViewController:editVC animated:YES];
|
||||||
|
} else {
|
||||||
|
[self showRightNavHandle];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)xPMineCustomNavView:(XPMineUserInfoCustomNavView *)view didClickBackButton:(UIButton *)sender {
|
- (void)xPMineCustomNavView:(XPMineUserInfoCustomNavView *)view didClickBackButton:(UIButton *)sender {
|
||||||
@@ -133,7 +203,15 @@
|
|||||||
- (void)setUid:(NSInteger)uid {
|
- (void)setUid:(NSInteger)uid {
|
||||||
_uid = uid;
|
_uid = uid;
|
||||||
if (_uid > 0) {
|
if (_uid > 0) {
|
||||||
NSString * uidStr = [NSString stringWithFormat:@"%d", uid];
|
if (_uid == [AccountInfoStorage instance].getUid.integerValue) {
|
||||||
|
[self.navView.editButton setTitle:@"编辑" forState:UIControlStateNormal];
|
||||||
|
[self.navView.editButton setImage:[UIImage new] forState:UIControlStateNormal];
|
||||||
|
} else {
|
||||||
|
[self.navView.editButton setTitle:@"" forState:UIControlStateNormal];
|
||||||
|
[self.navView.editButton setImage:[UIImage imageNamed:@"mine_user_info_edit"] forState:UIControlStateNormal];
|
||||||
|
}
|
||||||
|
self.navView.editButton.selected = _uid == [AccountInfoStorage instance].getUid.integerValue;
|
||||||
|
NSString * uidStr = [NSString stringWithFormat:@"%ld", uid];
|
||||||
[self.presenter getUserInfoWithUid:uidStr];
|
[self.presenter getUserInfoWithUid:uidStr];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -86,6 +86,8 @@
|
|||||||
if (!_editButton) {
|
if (!_editButton) {
|
||||||
_editButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
_editButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
[_editButton setImage:[UIImage imageNamed:@"mine_user_info_edit"] forState:UIControlStateNormal];
|
[_editButton setImage:[UIImage imageNamed:@"mine_user_info_edit"] forState:UIControlStateNormal];
|
||||||
|
_editButton.titleLabel.font = [UIFont systemFontOfSize:16];
|
||||||
|
[_editButton setTitleColor:[ThemeColor alertTitleColor] forState:UIControlStateNormal];
|
||||||
[_editButton addTarget:self action:@selector(editButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
[_editButton addTarget:self action:@selector(editButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
[_editButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
[_editButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user