修复了发现萌新筛选错误的问题
This commit is contained in:
@@ -20,21 +20,17 @@
|
||||
}
|
||||
|
||||
- (UIViewController *)getCurrentVC {
|
||||
UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
if ([rootViewController isKindOfClass:NSClassFromString(@"MMDrawerController")]) {
|
||||
rootViewController = (UIViewController *)[rootViewController valueForKey:@"centerViewController"];
|
||||
}
|
||||
|
||||
///兼容房间内私聊的
|
||||
UIWindow * currentWindow;
|
||||
for (int i = 0; i < [UIApplication sharedApplication].windows.count; i++) {
|
||||
UIWindow * window = [[UIApplication sharedApplication].windows objectAtIndex:i];
|
||||
if(window.tag == 1001) {
|
||||
if(window.tag == 1000) {
|
||||
currentWindow = window;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (currentWindow) {
|
||||
[currentWindow resignKeyWindow];
|
||||
[currentWindow.rootViewController.navigationController popViewControllerAnimated:YES];
|
||||
[currentWindow.superview removeFromSuperview];
|
||||
currentWindow.rootViewController = nil;
|
||||
@@ -42,6 +38,7 @@
|
||||
currentWindow = nil;
|
||||
}
|
||||
|
||||
UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
|
||||
UIViewController *currentVC = [self getCurrentVCFrom:rootViewController];
|
||||
return currentVC;
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns
|
||||
#define kNavigationHeight (kStatusBarHeight + 44)
|
||||
#define kTabBarHeight (iPhoneXSeries ? 49.0+34.0 : 49.0)
|
||||
#define kScreenScale ((CGFloat)KScreenWidth / (CGFloat)375)
|
||||
#define kHalfScreenHeight KScreenHeight * 0.65
|
||||
|
||||
#define kWeakify(o) try{}@finally{} __weak typeof(o) o##Weak = o;
|
||||
#define kStrongify(o) autoreleasepool{} __strong typeof(o) o = o##Weak;
|
||||
|
@@ -10,9 +10,10 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class FindNewUserInfoModel, XPSessionFindNewTableViewCell;
|
||||
@protocol XPSessionFindNewTableViewCellDelegate <NSObject>
|
||||
|
||||
///点击打招呼
|
||||
- (void)xPSessionFindNewTableViewCell:(XPSessionFindNewTableViewCell *)cell didSelectItem:(FindNewUserInfoModel *)userInfo;
|
||||
|
||||
///点击头像
|
||||
- (void)xPSessionFindNewTableViewCell:(XPSessionFindNewTableViewCell *)cell didClickAvatar:(FindNewUserInfoModel *)userInfo;
|
||||
@end
|
||||
|
||||
@interface XPSessionFindNewTableViewCell : UITableViewCell
|
||||
|
@@ -94,6 +94,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)avatarTapRecognizer {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPSessionFindNewTableViewCell:didClickAvatar:)]) {
|
||||
[self.delegate xPSessionFindNewTableViewCell:self didClickAvatar:self.userInfo];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setUserInfo:(FindNewUserInfoModel *)userInfo{
|
||||
_userInfo = userInfo;
|
||||
@@ -110,7 +116,7 @@
|
||||
}
|
||||
self.sexImageView.image = [UIImage imageNamed:sexStr];
|
||||
self.idLabel.text = [NSString stringWithFormat:@"大鹅号:%@", _userInfo.erbanNo];
|
||||
self.greetButton.enabled = _userInfo.hello;
|
||||
self.greetButton.selected = !_userInfo.hello;
|
||||
UIImage* image = self.experImageView.image;
|
||||
if (image) {
|
||||
CGFloat scale = image.size.width / image.size.height;
|
||||
@@ -155,6 +161,9 @@
|
||||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
_avatarImageView.layer.cornerRadius = 45/2;
|
||||
_avatarImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarTapRecognizer)];
|
||||
[_avatarImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _avatarImageView;
|
||||
}
|
||||
@@ -223,8 +232,8 @@
|
||||
_greetButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[_greetButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
[_greetButton setTitle:@"打招呼" forState:UIControlStateDisabled];
|
||||
[_greetButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateNormal];
|
||||
[_greetButton setBackgroundImage:[UIImage imageWithColor:[ThemeColor disableButtonColor]] forState:UIControlStateDisabled];
|
||||
[_greetButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateSelected];
|
||||
[_greetButton setBackgroundImage:[UIImage imageWithColor:[ThemeColor disableButtonColor]] forState:UIControlStateSelected];
|
||||
_greetButton.layer.masksToBounds = YES;
|
||||
_greetButton.layer.cornerRadius = 25 /2;
|
||||
[_greetButton addTarget:self action:@selector(attentionButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
@@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@class XPSessionFindNewFiltrateView;
|
||||
@protocol XPSessionFindNewFiltrateViewDelegate <NSObject>
|
||||
|
||||
- (void)xPSessionFindNewFiltrateView:(XPSessionFindNewFiltrateView *)view chooseSex:(NSString *)sex;
|
||||
- (void)xPSessionFindNewFiltrateView:(NSString *)chooseHello chooseSex:(NSString *)sex;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -29,8 +29,20 @@
|
||||
@property (nonatomic,strong) UIButton *femaleButton;
|
||||
///确认
|
||||
@property (nonatomic,strong) UIButton *sureButton;
|
||||
///打招呼
|
||||
@property (nonatomic,strong) UILabel *helloLabel;
|
||||
///招呼容器
|
||||
@property (nonatomic,strong) UIStackView *helloStackView;
|
||||
///全部
|
||||
@property (nonatomic,strong) UIButton *allHelloButton;
|
||||
///未达招呼
|
||||
@property (nonatomic,strong) UIButton *notHellowButton;
|
||||
///一打招呼
|
||||
@property (nonatomic,strong) UIButton *helloButton;
|
||||
///选择的性别
|
||||
@property (nonatomic,copy) NSString *sexChoose;
|
||||
///打招呼
|
||||
@property (nonatomic,copy) NSString *helloChoose;
|
||||
@end
|
||||
|
||||
|
||||
@@ -51,23 +63,31 @@
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.sexLabel];
|
||||
[self addSubview:self.sexStackView];
|
||||
[self addSubview:self.helloLabel];
|
||||
[self addSubview:self.helloStackView];
|
||||
[self addSubview:self.sureButton];
|
||||
|
||||
[self.sexStackView addArrangedSubview:self.allButton];
|
||||
[self.sexStackView addArrangedSubview:self.femaleButton];
|
||||
[self.sexStackView addArrangedSubview:self.maleButton];
|
||||
|
||||
[self.helloStackView addArrangedSubview:self.allHelloButton];
|
||||
[self.helloStackView addArrangedSubview:self.helloButton];
|
||||
[self.helloStackView addArrangedSubview:self.notHellowButton];
|
||||
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
CAShapeLayer * layer = [CAShapeLayer layer];
|
||||
layer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, 223) byRoundingCorners:UIRectCornerTopLeft| UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)].CGPath;
|
||||
layer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, 315) byRoundingCorners:UIRectCornerTopLeft| UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)].CGPath;
|
||||
self.layer.masksToBounds = YES;
|
||||
self.layer.mask = layer;
|
||||
[self sexButtonAction:self.allButton];
|
||||
[self helloButtonAction:self.allHelloButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(KScreenWidth);
|
||||
make.height.mas_equalTo(223);
|
||||
make.height.mas_equalTo(315);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -87,6 +107,18 @@
|
||||
make.width.mas_equalTo(72 * 3 + 20 * 2);
|
||||
}];
|
||||
|
||||
[self.helloLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self).offset(15);
|
||||
make.top.mas_equalTo(self.sexStackView.mas_bottom).offset(24);
|
||||
}];
|
||||
|
||||
[self.helloStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.sexLabel);
|
||||
make.top.mas_equalTo(self.helloLabel.mas_bottom).offset(12);
|
||||
make.height.mas_equalTo(26);
|
||||
make.width.mas_equalTo(72 * 3 + 20 * 2);
|
||||
}];
|
||||
|
||||
[self.sureButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self).inset(57);
|
||||
make.height.mas_equalTo(38);
|
||||
@@ -106,9 +138,21 @@
|
||||
self.sexChoose = [NSString stringWithFormat:@"%ld", sender.tag - 1000];
|
||||
}
|
||||
|
||||
- (void)helloButtonAction:(UIButton *)sender {
|
||||
self.helloButton.selected = NO;
|
||||
self.notHellowButton.selected = NO;
|
||||
self.allHelloButton.selected = NO;
|
||||
sender.selected = YES;
|
||||
self.allHelloButton.layer.borderWidth = 0;
|
||||
self.helloButton.layer.borderWidth = 0;
|
||||
self.notHellowButton.layer.borderWidth = 0;
|
||||
sender.layer.borderWidth = 0.5;
|
||||
self.helloChoose = [NSString stringWithFormat:@"%ld", sender.tag - 1000];
|
||||
}
|
||||
|
||||
- (void)sureButtonAction:(UIButton *)sener {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPSessionFindNewFiltrateView:chooseSex:)]) {
|
||||
[self.delegate xPSessionFindNewFiltrateView:self chooseSex:self.sexChoose];
|
||||
[self.delegate xPSessionFindNewFiltrateView:self.helloChoose chooseSex:self.sexChoose];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +251,87 @@
|
||||
return _allButton;
|
||||
}
|
||||
|
||||
- (UILabel *)helloLabel {
|
||||
if (!_helloLabel) {
|
||||
_helloLabel = [[UILabel alloc] init];
|
||||
_helloLabel.font = [UIFont systemFontOfSize:15];
|
||||
_helloLabel.textColor = [ThemeColor mainTextColor];
|
||||
_helloLabel.text = @"是否已打招呼";
|
||||
}
|
||||
return _helloLabel;
|
||||
}
|
||||
|
||||
- (UIStackView *)helloStackView {
|
||||
if (!_helloStackView) {
|
||||
_helloStackView = [[UIStackView alloc] init];
|
||||
_helloStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_helloStackView.distribution = UIStackViewDistributionFillEqually;
|
||||
_helloStackView.alignment = UIStackViewAlignmentFill;
|
||||
_helloStackView.spacing = 20;
|
||||
}
|
||||
return _helloStackView;
|
||||
}
|
||||
|
||||
- (UIButton *)helloButton {
|
||||
if (!_helloButton) {
|
||||
_helloButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_helloButton setTitle:@"已打招呼" forState:UIControlStateNormal];
|
||||
[_helloButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_helloButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[_helloButton setTitleColor:[ThemeColor secondTextColor] forState:UIControlStateNormal];
|
||||
[_helloButton setTitleColor:[ThemeColor appMainColor] forState:UIControlStateSelected];
|
||||
[_helloButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0xF1F1FA)] forState:UIControlStateNormal];
|
||||
[_helloButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0xFFF0C9)] forState:UIControlStateSelected];
|
||||
_helloButton.layer.borderWidth = 0.5;
|
||||
_helloButton.layer.masksToBounds = YES;
|
||||
_helloButton.layer.cornerRadius = 13;
|
||||
_helloButton.layer.borderColor = [ThemeColor appMainColor].CGColor;
|
||||
_helloButton.tag = 1001;
|
||||
[_helloButton addTarget:self action:@selector(helloButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _helloButton;
|
||||
}
|
||||
|
||||
- (UIButton *)notHellowButton {
|
||||
if (!_notHellowButton) {
|
||||
_notHellowButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_notHellowButton setTitle:@"未打招呼" forState:UIControlStateNormal];
|
||||
[_notHellowButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_notHellowButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[_notHellowButton setTitleColor:[ThemeColor secondTextColor] forState:UIControlStateNormal];
|
||||
[_notHellowButton setTitleColor:[ThemeColor appMainColor] forState:UIControlStateSelected];
|
||||
[_notHellowButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0xF1F1FA)] forState:UIControlStateNormal];
|
||||
[_notHellowButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0xFFF0C9)] forState:UIControlStateSelected];
|
||||
_notHellowButton.layer.borderWidth = 0.5;
|
||||
_notHellowButton.layer.masksToBounds = YES;
|
||||
_notHellowButton.layer.cornerRadius = 13;
|
||||
_notHellowButton.tag = 1002;
|
||||
_notHellowButton.layer.borderColor = [ThemeColor appMainColor].CGColor;
|
||||
[_notHellowButton addTarget:self action:@selector(helloButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _notHellowButton;
|
||||
}
|
||||
|
||||
- (UIButton *)allHelloButton {
|
||||
if (!_allHelloButton) {
|
||||
_allHelloButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_allHelloButton setTitle:@"全部" forState:UIControlStateNormal];
|
||||
[_allHelloButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_allHelloButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[_allHelloButton setTitleColor:[ThemeColor secondTextColor] forState:UIControlStateNormal];
|
||||
[_allHelloButton setTitleColor:[ThemeColor appMainColor] forState:UIControlStateSelected];
|
||||
[_allHelloButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0xF1F1FA)] forState:UIControlStateNormal];
|
||||
[_allHelloButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0xFFF0C9)] forState:UIControlStateSelected];
|
||||
_allHelloButton.layer.borderWidth = 0.5;
|
||||
_allHelloButton.layer.masksToBounds = YES;
|
||||
_allHelloButton.layer.cornerRadius = 13;
|
||||
_allHelloButton.layer.borderColor = [ThemeColor appMainColor].CGColor;
|
||||
_allHelloButton.tag = 1000;
|
||||
[_allHelloButton addTarget:self action:@selector(helloButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _allHelloButton;
|
||||
}
|
||||
|
||||
- (UIButton *)sureButton {
|
||||
if (!_sureButton) {
|
||||
_sureButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
|
@@ -83,13 +83,13 @@
|
||||
[self.refreshStackView addArrangedSubview:self.refreshLabel];
|
||||
|
||||
CAShapeLayer * layer = [CAShapeLayer layer];
|
||||
UIBezierPath * path= [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, KScreenHeight * 0.6) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)];
|
||||
UIBezierPath * path= [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, kHalfScreenHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)];
|
||||
layer.path = path.CGPath;
|
||||
self.layer.mask = layer;
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
self.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight * 0.6);
|
||||
self.frame = CGRectMake(0, 0, KScreenWidth, kHalfScreenHeight);
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self).offset(17);
|
||||
@@ -155,7 +155,7 @@
|
||||
[Api findNewUserGreet:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
[XCHUDTool showSuccessWithMessage:@"发送成功"];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPSessionFindNewGreetTableViewCell:didSelectItem:)]) {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPSessionFindNewGreetListView:greetUserId:)]) {
|
||||
[self.delegate xPSessionFindNewGreetListView:self greetUserId:self.userId];
|
||||
}
|
||||
[TTPopup dismiss];
|
||||
|
@@ -11,6 +11,7 @@
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "TTPopup.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
///Model
|
||||
#import "FindNewUserInfoModel.h"
|
||||
///View
|
||||
@@ -18,6 +19,7 @@
|
||||
#import "XPSessionFindNewEmptyTableViewCell.h"
|
||||
#import "XPSessionFindNewFiltrateView.h"
|
||||
#import "XPSessionFindNewGreetListView.h"
|
||||
#import "XPMineUserInfoViewController.h"
|
||||
///P
|
||||
#import "XPSessionFindNewProtocol.h"
|
||||
#import "XPSessionFindNewPresenter.h"
|
||||
@@ -104,7 +106,7 @@
|
||||
}
|
||||
|
||||
#pragma mark - XPSessionFindNewFiltrateViewDelegate
|
||||
- (void)xPSessionFindNewFiltrateView:(XPSessionFindNewFiltrateView *)view chooseSex:(NSString *)sex {
|
||||
- (void)xPSessionFindNewFiltrateView:(NSString *)chooseHello chooseSex:(NSString *)sex {
|
||||
[TTPopup dismiss];
|
||||
NSMutableArray<FindNewUserInfoModel *> * array = [NSMutableArray array];
|
||||
[self.originArray enumerateObjectsUsingBlock:^(FindNewUserInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
@@ -120,21 +122,70 @@
|
||||
[array addObject:obj];
|
||||
}
|
||||
}];
|
||||
self.datasource = array;
|
||||
|
||||
NSMutableArray * newArray = [NSMutableArray array];
|
||||
[array enumerateObjectsUsingBlock:^(FindNewUserInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if ([chooseHello isEqualToString:@"0"]) {
|
||||
[newArray addObject:obj];
|
||||
} else if([chooseHello isEqualToString:@"2"]) {
|
||||
if (obj.hello == YES) {
|
||||
[newArray addObject:obj];
|
||||
}
|
||||
} else if([chooseHello isEqualToString:@"1"]) {
|
||||
if (obj.hello == NO) {
|
||||
[newArray addObject:obj];
|
||||
}
|
||||
}
|
||||
}];
|
||||
self.datasource = newArray;
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - XPSessionFindNewTableViewCellDelegate
|
||||
- (void)xPSessionFindNewTableViewCell:(XPSessionFindNewTableViewCell *)cell didSelectItem:(FindNewUserInfoModel *)userInfo {
|
||||
XPSessionFindNewGreetListView * listView = [[XPSessionFindNewGreetListView alloc] init];
|
||||
listView.userId = userInfo.uid;
|
||||
listView.delegate = self;
|
||||
[TTPopup popupView:listView style:TTPopupStyleActionSheet];
|
||||
if (userInfo.hello) {
|
||||
///兼容房间内私聊的
|
||||
UIWindow * currentWindow;
|
||||
for (int i = 0; i < [UIApplication sharedApplication].windows.count; i++) {
|
||||
UIWindow * window = [[UIApplication sharedApplication].windows objectAtIndex:i];
|
||||
if(window.tag == 1000) {
|
||||
currentWindow = window;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (currentWindow) {
|
||||
currentWindow.windowLevel = -1;
|
||||
}
|
||||
XPSessionFindNewGreetListView * listView = [[XPSessionFindNewGreetListView alloc] init];
|
||||
listView.userId = userInfo.uid;
|
||||
listView.delegate = self;
|
||||
[TTPopup popupView:listView style:TTPopupStyleActionSheet];
|
||||
} else {
|
||||
[self showErrorToast:@"该用户被打招呼次数太多了,换一个吧~"];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)xPSessionFindNewTableViewCell:(XPSessionFindNewTableViewCell *)cell didClickAvatar:(FindNewUserInfoModel *)userInfo {
|
||||
if (userInfo.uid > 0) {
|
||||
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];
|
||||
userInfoVC.uid = userInfo.uid.integerValue;
|
||||
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:userInfoVC animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPSessionFindNewGreetListViewDelegate
|
||||
- (void)xPSessionFindNewGreetListView:(XPSessionFindNewGreetListView *)view greetUserId:(NSString *)userId {
|
||||
[self.presenter getFindNewUser];
|
||||
__block FindNewUserInfoModel * userInfo;
|
||||
[self.datasource enumerateObjectsUsingBlock:^(FindNewUserInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.uid.integerValue == userId.integerValue) {
|
||||
userInfo = obj;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
if (userInfo) {
|
||||
userInfo.hello = NO;
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark - XPSessionFindNewProtocol
|
||||
@@ -146,6 +197,19 @@
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)rightButtonAction:(UIButton *)sender {
|
||||
///兼容房间内私聊的
|
||||
UIWindow * currentWindow;
|
||||
for (int i = 0; i < [UIApplication sharedApplication].windows.count; i++) {
|
||||
UIWindow * window = [[UIApplication sharedApplication].windows objectAtIndex:i];
|
||||
if(window.tag == 1000) {
|
||||
currentWindow = window;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (currentWindow) {
|
||||
currentWindow.windowLevel = -1;
|
||||
}
|
||||
|
||||
XPSessionFindNewFiltrateView * flitrView = [[XPSessionFindNewFiltrateView alloc] init];
|
||||
flitrView.delegate = self;
|
||||
[TTPopup popupView:flitrView style:TTPopupStyleActionSheet];
|
||||
|
@@ -131,25 +131,8 @@
|
||||
}
|
||||
|
||||
- (UINavigationController *)getKeyWindowNav {
|
||||
UIWindow * currentWindow;
|
||||
for (int i = 0; i < [UIApplication sharedApplication].windows.count; i++) {
|
||||
UIWindow * window = [[UIApplication sharedApplication].windows objectAtIndex:i];
|
||||
if(window.tag == 1000) {
|
||||
currentWindow = window;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.openType == SessionListOpenTypeRoom) {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
[currentWindow.superview removeFromSuperview];
|
||||
currentWindow.rootViewController = nil;
|
||||
currentWindow.windowLevel = -1;
|
||||
currentWindow = nil;
|
||||
}
|
||||
|
||||
if ([XCCurrentVCStackManager shareManager].currentNavigationController) {
|
||||
return [XCCurrentVCStackManager shareManager].currentNavigationController;
|
||||
if ([XCCurrentVCStackManager shareManager].getCurrentVC) {
|
||||
return [XCCurrentVCStackManager shareManager].getCurrentVC.navigationController;
|
||||
}
|
||||
|
||||
return self.navigationController;
|
||||
|
@@ -11,6 +11,11 @@
|
||||
#import "SessionViewController.h"
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
#import "ClientConfig.h"
|
||||
#import "Api+Mine.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
///Model
|
||||
#import "UserInfoModel.h"
|
||||
///View
|
||||
#import "XPSessionFindNewViewController.h"
|
||||
|
||||
@@ -35,7 +40,8 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
@property (nonatomic, strong) NSMutableArray<NIMRecentSession *> *recentSessions;
|
||||
|
||||
@property (nonatomic, assign) SessionListOpenType openType;
|
||||
|
||||
///用户信息
|
||||
@property (nonatomic,strong) UserInfoModel *userInfo;
|
||||
@end
|
||||
|
||||
@implementation SessionListViewController
|
||||
@@ -72,10 +78,21 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self getUserInfo];
|
||||
[self initViews];
|
||||
[self initLayout];
|
||||
}
|
||||
|
||||
- (void)getUserInfo {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
[Api getUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
UserInfoModel * userInfo = [UserInfoModel modelWithDictionary:data.data];
|
||||
self.userInfo = userInfo;
|
||||
[self.sessionListView reloadData];
|
||||
}
|
||||
} uid:uid];
|
||||
}
|
||||
- (void)initViews {
|
||||
self.title = @"消息";
|
||||
if (self.openType == SessionListOpenTypeDefault) {
|
||||
@@ -171,7 +188,7 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
if (section == 0) {
|
||||
return 1;
|
||||
return [ClientConfig shareConfig].configInfo.findNewbieCharmLevel <= self.userInfo.userLevelVo.experLevelSeq ? 1 : 0;
|
||||
}
|
||||
return self.recentSessions.count;
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
|
||||
@implementation XPRoomHalfMessageView
|
||||
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
@@ -54,7 +55,7 @@
|
||||
|
||||
- (UIView *)dismissView {
|
||||
if (!_dismissView) {
|
||||
_dismissView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 300)];
|
||||
_dismissView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight - kHalfScreenHeight)];
|
||||
_dismissView.backgroundColor = [UIColor clearColor];
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissViewTap)];
|
||||
[_dismissView addGestureRecognizer:tap];
|
||||
@@ -69,9 +70,9 @@
|
||||
self.contactVC = vc;
|
||||
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:vc];
|
||||
//创建window,并将window的坐标设置在屏幕底部,设置windowLevel防止获取默认window失败
|
||||
UIWindow *testWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 300, KScreenWidth, KScreenHeight - 300)];
|
||||
UIWindow *testWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, KScreenHeight - kHalfScreenHeight, KScreenWidth, kHalfScreenHeight)];
|
||||
CAShapeLayer * layer = [CAShapeLayer layer];
|
||||
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, KScreenHeight-300) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)];
|
||||
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, kHalfScreenHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)];
|
||||
layer.path = path.CGPath;
|
||||
testWindow.layer.masksToBounds = YES;
|
||||
testWindow.layer.mask = layer;;
|
||||
|
@@ -80,7 +80,7 @@
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.mas_equalTo(self);
|
||||
make.height.mas_equalTo(KScreenHeight * 0.7);
|
||||
make.height.mas_equalTo(kHalfScreenHeight);
|
||||
}];
|
||||
|
||||
|
||||
|
@@ -18,6 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,assign) BOOL appStoreAuditNoticeVersion;
|
||||
//进入房间拉取N条聊天数据
|
||||
@property(nonatomic, assign) NSInteger roomMessageCount;
|
||||
///发现萌新展示等级
|
||||
@property (nonatomic,assign) NSInteger findNewbieCharmLevel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
Reference in New Issue
Block a user