会话列表清除未读消息提醒
This commit is contained in:
22
xplan-ios/Assets.xcassets/SessionMessage/sessionList_clear.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/SessionMessage/sessionList_clear.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "sessionList_clear@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "sessionList_clear@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/SessionMessage/sessionList_clear.imageset/sessionList_clear@2x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/SessionMessage/sessionList_clear.imageset/sessionList_clear@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 509 B |
BIN
xplan-ios/Assets.xcassets/SessionMessage/sessionList_clear.imageset/sessionList_clear@3x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/SessionMessage/sessionList_clear.imageset/sessionList_clear@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 400 B |
@@ -18,6 +18,7 @@
|
||||
#import "UserInfoModel.h"
|
||||
///View
|
||||
#import "XPSessionFindNewViewController.h"
|
||||
#import "TTPopUp.h"
|
||||
|
||||
NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
|
||||
@@ -29,6 +30,7 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
|
||||
@property (nonatomic, strong) UIButton *allReadButton;
|
||||
/**
|
||||
* 会话列表
|
||||
*/
|
||||
@@ -98,6 +100,7 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
if (self.openType == SessionListOpenTypeDefault) {
|
||||
[self.customNavigationBar addSubview:self.titleLabel];
|
||||
[self.view addSubview:self.customNavigationBar];
|
||||
[self.customNavigationBar addSubview:self.allReadButton];
|
||||
}
|
||||
[self.view addSubview:self.sessionListView];
|
||||
}
|
||||
@@ -107,6 +110,11 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.customNavigationBar);
|
||||
}];
|
||||
[self.allReadButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-16);
|
||||
make.width.height.mas_equalTo(30);
|
||||
make.centerY.mas_equalTo(self.customNavigationBar);
|
||||
}];
|
||||
}
|
||||
|
||||
[self.sessionListView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -319,6 +327,26 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - action
|
||||
- (void)allReadButtonClick:(UIButton *)sender {
|
||||
NSInteger count = [NIMSDK sharedSDK].conversationManager.allUnreadCount;
|
||||
if (count<1) {
|
||||
[self showErrorToast:@"暂无未读消息需要清理"];
|
||||
return;
|
||||
}
|
||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||
config.confirmButtonConfig.title = @"清除";
|
||||
config.message =@"清除当前未读消息提醒?";
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
[[NIMSDK sharedSDK].conversationManager markAllMessagesRead];
|
||||
[self setTabBarItemBadge:0];
|
||||
[self.sessionListView reloadData];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
- (UIView *)customNavigationBar {
|
||||
if (!_customNavigationBar) {
|
||||
CGRect frame = CGRectMake(0, kStatusBarHeight, KScreenWidth, 44);
|
||||
@@ -357,4 +385,13 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
return _recentSessions;
|
||||
}
|
||||
|
||||
- (UIButton *)allReadButton {
|
||||
if (!_allReadButton) {
|
||||
_allReadButton = [[UIButton alloc] init];
|
||||
[_allReadButton setImage:[UIImage imageNamed:@"sessionList_clear"] forState:UIControlStateNormal];
|
||||
[_allReadButton addTarget:self action:@selector(allReadButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _allReadButton;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user