Skip to content

Commit c050fff

Browse files
committed
小改
1 parent b771079 commit c050fff

File tree

5 files changed

+100
-73
lines changed

5 files changed

+100
-73
lines changed

Coding_iOS/Controllers/FileActivitiesViewController.m

+96-69
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#import "ODRefreshControl.h"
1515
#import "FileCommentCell.h"
1616
#import "FileActivityCell.h"
17+
#import "AddCommentCell.h"
1718

1819
#import "UIView+PressMenu.h"
1920

@@ -25,7 +26,7 @@ @interface FileActivitiesViewController ()<UITableViewDataSource, UITableViewDel
2526
@property (strong, nonatomic) NSMutableArray *activityList;
2627

2728
@property (strong, nonatomic) UITableView *myTableView;
28-
@property (nonatomic, strong) EaseToolBar *myToolBar;
29+
//@property (nonatomic, strong) EaseToolBar *myToolBar;
2930
@property (nonatomic, strong) ODRefreshControl *myRefreshControl;
3031

3132
@property (assign, nonatomic) BOOL isLoading;
@@ -52,6 +53,7 @@ - (void)viewDidLoad
5253
[tableView registerClass:[FileCommentCell class] forCellReuseIdentifier:kCellIdentifier_FileCommentCell];
5354
[tableView registerClass:[FileCommentCell class] forCellReuseIdentifier:kCellIdentifier_FileCommentCell_Media];
5455
[tableView registerClass:[FileActivityCell class] forCellReuseIdentifier:kCellIdentifier_FileActivityCell];
56+
[tableView registerClass:[AddCommentCell class] forCellReuseIdentifier:kCellIdentifier_AddCommentCell];
5557
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
5658
[self.view addSubview:tableView];
5759
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -63,27 +65,25 @@ - (void)viewDidLoad
6365
_myRefreshControl = [[ODRefreshControl alloc] initInScrollView:self.myTableView];
6466
[_myRefreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged];
6567

66-
_myToolBar = ({
67-
EaseToolBarItem *item = [EaseToolBarItem easeToolBarItemWithTitle:@" 发表评论..." image:@"button_file_comment" disableImage:nil];
68-
69-
NSDictionary *attributes = @{NSFontAttributeName : [UIFont systemFontOfSize:15],
70-
NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0xB5B5B5"]};
71-
[item setAttributes:attributes forUIControlState:UIControlStateNormal];
72-
73-
EaseToolBar *toolBar = [EaseToolBar easeToolBarWithItems:@[item]];
74-
toolBar.delegate = self;
75-
[self.view addSubview:toolBar];
76-
[toolBar mas_makeConstraints:^(MASConstraintMaker *make) {
77-
make.bottom.equalTo(self.view.mas_bottom);
78-
make.size.mas_equalTo(toolBar.frame.size);
79-
}];
80-
toolBar;
81-
});
82-
83-
84-
UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0,CGRectGetHeight(self.myToolBar.frame), 0.0);
85-
self.myTableView.contentInset = contentInsets;
86-
self.myTableView.scrollIndicatorInsets = contentInsets;
68+
// _myToolBar = ({
69+
// EaseToolBarItem *item = [EaseToolBarItem easeToolBarItemWithTitle:@" 发表评论..." image:@"button_file_comment" disableImage:nil];
70+
//
71+
// NSDictionary *attributes = @{NSFontAttributeName : [UIFont systemFontOfSize:15],
72+
// NSForegroundColorAttributeName : [UIColor colorWithHexString:@"0xB5B5B5"]};
73+
// [item setAttributes:attributes forUIControlState:UIControlStateNormal];
74+
//
75+
// EaseToolBar *toolBar = [EaseToolBar easeToolBarWithItems:@[item]];
76+
// toolBar.delegate = self;
77+
// [self.view addSubview:toolBar];
78+
// [toolBar mas_makeConstraints:^(MASConstraintMaker *make) {
79+
// make.bottom.equalTo(self.view.mas_bottom);
80+
// make.size.mas_equalTo(toolBar.frame.size);
81+
// }];
82+
// toolBar;
83+
// });
84+
// UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0,CGRectGetHeight(self.myToolBar.frame), 0.0);
85+
// self.myTableView.contentInset = contentInsets;
86+
// self.myTableView.scrollIndicatorInsets = contentInsets;
8787

8888
[self refresh];
8989
}
@@ -117,77 +117,104 @@ - (void)sendRequest{
117117
}
118118

119119
#pragma mark Table M
120+
121+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
122+
return 2;
123+
}
124+
125+
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
126+
return 20.0;
127+
}
128+
129+
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
130+
UIView *view = [UIView new];
131+
view.backgroundColor = kColorTableSectionBg;
132+
return view;
133+
}
134+
120135
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
121-
return _activityList.count;
136+
return section == 0? _activityList.count: 1;
122137
}
123138

124139
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
125-
ProjectActivity *curActivity = [self.activityList objectAtIndex:indexPath.row];
126-
if ([curActivity.target_type isEqualToString:@"ProjectFileComment"]) {
127-
FileComment *curComment = curActivity.projectFileComment;
128-
curComment.created_at = curActivity.created_at;
129-
FileCommentCell *cell;
130-
if (curComment.htmlMedia.imageItems.count > 0) {
131-
cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_FileCommentCell_Media forIndexPath:indexPath];
140+
if (indexPath.section == 0) {
141+
ProjectActivity *curActivity = [self.activityList objectAtIndex:indexPath.row];
142+
if ([curActivity.target_type isEqualToString:@"ProjectFileComment"]) {
143+
FileComment *curComment = curActivity.projectFileComment;
144+
curComment.created_at = curActivity.created_at;
145+
FileCommentCell *cell;
146+
if (curComment.htmlMedia.imageItems.count > 0) {
147+
cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_FileCommentCell_Media forIndexPath:indexPath];
148+
}else{
149+
cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_FileCommentCell forIndexPath:indexPath];
150+
}
151+
cell.curComment = (TaskComment *)curComment;
152+
cell.contentLabel.delegate = self;
153+
cell.backgroundColor = kColorTableBG;
154+
[cell configTop:(indexPath.row == 0) andBottom:(indexPath.row == _activityList.count - 1)];
155+
return cell;
132156
}else{
133-
cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_FileCommentCell forIndexPath:indexPath];
157+
FileActivityCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_FileActivityCell forIndexPath:indexPath];
158+
cell.curActivity = curActivity;
159+
cell.backgroundColor = kColorTableBG;
160+
[cell configTop:(indexPath.row == 0) andBottom:(indexPath.row == _activityList.count - 1)];
161+
return cell;
134162
}
135-
cell.curComment = (TaskComment *)curComment;
136-
cell.contentLabel.delegate = self;
137-
cell.backgroundColor = kColorTableBG;
138-
[cell configTop:(indexPath.row == 0) andBottom:(indexPath.row == _activityList.count - 1)];
139-
return cell;
140163
}else{
141-
FileActivityCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_FileActivityCell forIndexPath:indexPath];
142-
cell.curActivity = curActivity;
143-
cell.backgroundColor = kColorTableBG;
144-
[cell configTop:(indexPath.row == 0) andBottom:(indexPath.row == _activityList.count - 1)];
164+
AddCommentCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_AddCommentCell forIndexPath:indexPath];
165+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:50];
145166
return cell;
146167
}
147168
}
148169

149170
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
150171
CGFloat cellHeight = 0;
151-
ProjectActivity *curActivity = [self.activityList objectAtIndex:indexPath.row];
152-
if ([curActivity.target_type isEqualToString:@"ProjectFileComment"]) {
153-
cellHeight = [FileCommentCell cellHeightWithObj:curActivity.projectFileComment];
172+
if (indexPath.section == 0) {
173+
ProjectActivity *curActivity = [self.activityList objectAtIndex:indexPath.row];
174+
if ([curActivity.target_type isEqualToString:@"ProjectFileComment"]) {
175+
cellHeight = [FileCommentCell cellHeightWithObj:curActivity.projectFileComment];
176+
}else{
177+
cellHeight = [FileActivityCell cellHeightWithObj:curActivity];
178+
}
154179
}else{
155-
cellHeight = [FileActivityCell cellHeightWithObj:curActivity];
180+
cellHeight = [AddCommentCell cellHeight];
156181
}
157182
return cellHeight;
158183
}
159184

160185
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
161186
[tableView deselectRowAtIndexPath:indexPath animated:YES];
162-
163-
ProjectActivity *curActivity = [self.activityList objectAtIndex:indexPath.row];
164-
if (![curActivity.target_type isEqualToString:@"ProjectFileComment"]) {
165-
return;
166-
}
167-
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
168-
if ([cell.contentView isMenuVCVisible]) {
169-
[cell.contentView removePressMenu];
170-
return;
171-
}
172-
NSArray *menuTitles;
173-
if ([curActivity.projectFileComment.owner.global_key isEqualToString:[Login curLoginUser].global_key]) {
174-
menuTitles = @[@"拷贝文字", @"删除"];
187+
if (indexPath.section == 0) {
188+
ProjectActivity *curActivity = [self.activityList objectAtIndex:indexPath.row];
189+
if (![curActivity.target_type isEqualToString:@"ProjectFileComment"]) {
190+
return;
191+
}
192+
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
193+
if ([cell.contentView isMenuVCVisible]) {
194+
[cell.contentView removePressMenu];
195+
return;
196+
}
197+
NSArray *menuTitles;
198+
if ([curActivity.projectFileComment.owner.global_key isEqualToString:[Login curLoginUser].global_key]) {
199+
menuTitles = @[@"拷贝文字", @"删除"];
200+
}else{
201+
menuTitles = @[@"拷贝文字", @"回复"];
202+
}
203+
__weak typeof(self) weakSelf = self;
204+
[cell.contentView showMenuTitles:menuTitles menuClickedBlock:^(NSInteger index, NSString *title) {
205+
if ([title hasPrefix:@"拷贝"]) {
206+
[[UIPasteboard generalPasteboard] setString:curActivity.projectFileComment.content];
207+
}else if ([title isEqualToString:@"删除"]){
208+
[weakSelf deleteCommentOfActivity:curActivity];
209+
}else if ([title isEqualToString:@"回复"]){
210+
[weakSelf goToAddCommentVCToActivity:curActivity];
211+
}
212+
}];
175213
}else{
176-
menuTitles = @[@"拷贝文字", @"回复"];
214+
[self goToAddCommentVCToActivity:nil];
177215
}
178-
__weak typeof(self) weakSelf = self;
179-
[cell.contentView showMenuTitles:menuTitles menuClickedBlock:^(NSInteger index, NSString *title) {
180-
if ([title hasPrefix:@"拷贝"]) {
181-
[[UIPasteboard generalPasteboard] setString:curActivity.projectFileComment.content];
182-
}else if ([title isEqualToString:@"删除"]){
183-
[weakSelf deleteCommentOfActivity:curActivity];
184-
}else if ([title isEqualToString:@"回复"]){
185-
[weakSelf goToAddCommentVCToActivity:curActivity];
186-
}
187-
}];
188216
}
189217

190-
191218
#pragma mark Comment
192219
- (void)goToAddCommentVCToActivity:(ProjectActivity *)curActivity{
193220
Project *curProject;

Coding_iOS/Models/ProjectFolder.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ - (NSDictionary *)toFilesParams{
8888
return @{@"height": @"90",
8989
@"width": @"90",
9090
@"page" : @"1",
91-
@"pageSize": @"9999"};
91+
@"pageSize": @(99999999)};
9292
}
9393
- (NSString *)toRenamePath{
9494
return [NSString stringWithFormat:@"api/project/%@/dir/%@/name/%@", _project_id.stringValue, _file_id.stringValue, _next_name];

Coding_iOS/Models/ProjectFolders.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ - (NSString *)toFoldersPathWithObj:(NSNumber *)project_id{
5656
}
5757
- (NSDictionary *)toFoldersParams{
5858
return @{@"page": @"1",
59-
@"pageSize": @"9999"};
59+
@"pageSize": @(99999999)};
6060
}
6161

6262
- (NSString *)toFoldersCountPathWithObj:(NSNumber *)project_id{

Coding_iOS/Models/Projects.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ + (Projects *)projectsWithType:(ProjectsType)type andUser:(User *)user{
3030
pros.curUser = user;
3131

3232
pros.page = [NSNumber numberWithInteger:1];
33-
pros.pageSize = [NSNumber numberWithInteger:9999];
33+
pros.pageSize = @(99999999);
3434
return pros;
3535
}
3636

Coding_iOS/Models/Users.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ - (instancetype)init
1818
_canLoadMore = YES;
1919
_isLoading = _willLoadMore = NO;
2020
_page = [NSNumber numberWithInteger:1];
21-
_pageSize = [NSNumber numberWithInteger:9999];
21+
_pageSize = @(99999999);
2222
}
2323
return self;
2424
}

0 commit comments

Comments
 (0)