|
|
@@ -14,13 +14,16 @@
|
|
|
#import "HJMessageBlankView.h"
|
|
|
#import "HJPageListView.h"
|
|
|
#import "HJMessageAPIManager.h"
|
|
|
+#import "HJClearMessageAPIManager.h"
|
|
|
#import "HJMessageDataBox.h"
|
|
|
+#import "UIView+FBProgressHUD.h"
|
|
|
|
|
|
@interface HJMessageViewController () <UITableViewDelegate, FBAPIManagerDelegate, FBAPIManagerInterceptor>
|
|
|
@property (nonatomic, strong) HJMessageBlankView *blankView;
|
|
|
@property (nonatomic, strong) HJPageListView *pageListView;
|
|
|
@property (nonatomic, strong) UIButton *delButton;
|
|
|
@property (nonatomic, strong) HJMessageAPIManager *msgAPIManager;
|
|
|
+@property (nonatomic, strong) HJClearMessageAPIManager *clearMsgAPIManager;
|
|
|
@property (nonatomic, strong) HJMessageDataBox *msgDataBox;
|
|
|
@end
|
|
|
|
|
|
@@ -54,19 +57,37 @@
|
|
|
#pragma mark - UITableViewDelegate
|
|
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
-
|
|
|
+ HJMessageModel *model = [self.msgDataBox messageModelAtIndexPath:indexPath];
|
|
|
+ if (model.type == HJMessageTypePositionChange) {
|
|
|
+ [self.tabBarController setSelectedIndex:0];
|
|
|
+ } else if (model.type == HJMessageTypeIdentityAuth) {
|
|
|
+ [self.tabBarController setSelectedIndex:3];
|
|
|
+ } else if (model.type == HJMessageTypeReturnMoney) {
|
|
|
+
|
|
|
+ } else if (model.type == HJMessageTypeJoin) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#pragma mark - FBAPIManagerInterceptor
|
|
|
|
|
|
- (BOOL)manager:(FBBaseAPIManager *)manager shouldStartCallAPIWithParams:(NSDictionary *)params {
|
|
|
- [self.view bringSubviewToFront:self.pageListView];
|
|
|
+ if (manager == self.msgAPIManager) {
|
|
|
+ [self.view bringSubviewToFront:self.pageListView];
|
|
|
+ }
|
|
|
+ if (manager == self.clearMsgAPIManager) {
|
|
|
+ [self.view bringSubviewToFront:self.blankView];
|
|
|
+ }
|
|
|
|
|
|
return [self.pageListView manager:manager shouldStartCallAPIWithParams:params];
|
|
|
}
|
|
|
|
|
|
- (void)managerShouldFinishCallAPI:(FBBaseAPIManager *)manager {
|
|
|
- [self.pageListView managerShouldFinishCallAPI:manager];
|
|
|
+ if (manager == self.msgAPIManager) {
|
|
|
+ [self.pageListView managerShouldFinishCallAPI:manager];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#pragma mark - FBAPIManagerDelegate
|
|
|
@@ -78,6 +99,11 @@
|
|
|
[self.view bringSubviewToFront:self.blankView];
|
|
|
}
|
|
|
}
|
|
|
+ if (manager == self.clearMsgAPIManager) {
|
|
|
+ NSString *successStr = [manager fetchDataWithBox:self.msgDataBox];
|
|
|
+ [self.view fb_showSuccessWithStatus:successStr];
|
|
|
+ [self.pageListView.tableView reloadData];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- (void)managerCallAPIDidFailed:(FBBaseAPIManager *)manager {
|
|
|
@@ -88,6 +114,13 @@
|
|
|
|
|
|
- (void)delButtonClicked:(UIButton *)sender {
|
|
|
HJConfirmPanelViewController *vc = [[HJConfirmPanelViewController alloc] init];
|
|
|
+ // 该效果属性不能放在HJConfirmPanelViewController内设置,不然设置透明度后不会显示底下视图的内容
|
|
|
+ vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
|
|
|
+ vc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
|
|
|
+ /** 如果把一个控制器的definesPresentationContext属性设置为YES,那么在进行跳转的时候,UIKit会使用视图层级内的这个控制器来进行跳转。
|
|
|
+ * 比如这里的tabBar就不被遮挡了,还可以在标签之间切换,在切换回本页面时不显示内容的情况。
|
|
|
+ */
|
|
|
+ self.navigationController.definesPresentationContext = NO;
|
|
|
vc.titleLabel.text = @"是否清除消息记录?";
|
|
|
[vc.confirmButton addTarget:self
|
|
|
action:@selector(confirmButtonClicked:)
|
|
|
@@ -98,7 +131,8 @@
|
|
|
}
|
|
|
|
|
|
- (void)confirmButtonClicked:(UIButton *)sender {
|
|
|
-
|
|
|
+ [self.clearMsgAPIManager call];
|
|
|
+ [self dismissViewControllerAnimated:YES completion:nil];
|
|
|
}
|
|
|
|
|
|
#pragma mark - private methods
|
|
|
@@ -112,6 +146,15 @@
|
|
|
return _msgDataBox;
|
|
|
}
|
|
|
|
|
|
+- (HJClearMessageAPIManager *)clearMsgAPIManager {
|
|
|
+ if (_clearMsgAPIManager == nil) {
|
|
|
+ _clearMsgAPIManager = [[HJClearMessageAPIManager alloc] init];
|
|
|
+ _clearMsgAPIManager.APIManagerDelegate = self;
|
|
|
+ _clearMsgAPIManager.APIManagerInterceptor = self;
|
|
|
+ }
|
|
|
+ return _clearMsgAPIManager;
|
|
|
+}
|
|
|
+
|
|
|
- (HJMessageAPIManager *)msgAPIManager {
|
|
|
if (_msgAPIManager == nil) {
|
|
|
_msgAPIManager = [[HJMessageAPIManager alloc] init];
|