Skip to content

Commit 8bc4aad

Browse files
committed
MR +1
1 parent 3919472 commit 8bc4aad

File tree

8 files changed

+96
-47
lines changed

8 files changed

+96
-47
lines changed

Coding_iOS.xcodeproj/project.pbxproj

+8
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,8 @@
588588
4EAAD0831E55AC6E008AA957 /* icon_code_image@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EAAD0811E55AC6E008AA957 /* icon_code_image@3x.png */; };
589589
4EAAD09D1E5D8558008AA957 /* mrpr_icon_arrow@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EAAD09B1E5D8558008AA957 /* mrpr_icon_arrow@2x.png */; };
590590
4EAAD09E1E5D8558008AA957 /* mrpr_icon_arrow@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EAAD09C1E5D8558008AA957 /* mrpr_icon_arrow@3x.png */; };
591+
4EAAD0A51E5D8D90008AA957 /* PR_plus@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EAAD0A31E5D8D90008AA957 /* PR_plus@2x.png */; };
592+
4EAAD0A61E5D8D90008AA957 /* PR_plus@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EAAD0A41E5D8D90008AA957 /* PR_plus@3x.png */; };
591593
4EABD2541AD3CA7E005E515F /* UIMessageInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EABD2531AD3CA7E005E515F /* UIMessageInputView.m */; };
592594
4EABD2571AD3CAAC005E515F /* UIMessageInputView_Add.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EABD2561AD3CAAC005E515F /* UIMessageInputView_Add.m */; };
593595
4EABD25A1AD3CB4A005E515F /* UIMessageInputView_CCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EABD2591AD3CB4A005E515F /* UIMessageInputView_CCell.m */; };
@@ -2130,6 +2132,8 @@
21302132
4EAAD0811E55AC6E008AA957 /* icon_code_image@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_code_image@3x.png"; sourceTree = "<group>"; };
21312133
4EAAD09B1E5D8558008AA957 /* mrpr_icon_arrow@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mrpr_icon_arrow@2x.png"; sourceTree = "<group>"; };
21322134
4EAAD09C1E5D8558008AA957 /* mrpr_icon_arrow@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mrpr_icon_arrow@3x.png"; sourceTree = "<group>"; };
2135+
4EAAD0A31E5D8D90008AA957 /* PR_plus@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "PR_plus@2x.png"; sourceTree = "<group>"; };
2136+
4EAAD0A41E5D8D90008AA957 /* PR_plus@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "PR_plus@3x.png"; sourceTree = "<group>"; };
21332137
4EABD2521AD3CA7E005E515F /* UIMessageInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIMessageInputView.h; sourceTree = "<group>"; };
21342138
4EABD2531AD3CA7E005E515F /* UIMessageInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIMessageInputView.m; sourceTree = "<group>"; };
21352139
4EABD2551AD3CAAC005E515F /* UIMessageInputView_Add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIMessageInputView_Add.h; sourceTree = "<group>"; };
@@ -3213,6 +3217,8 @@
32133217
13FB5CD21CA17A0B00EE127C /* pullRequest */ = {
32143218
isa = PBXGroup;
32153219
children = (
3220+
4EAAD0A31E5D8D90008AA957 /* PR_plus@2x.png */,
3221+
4EAAD0A41E5D8D90008AA957 /* PR_plus@3x.png */,
32163222
133DAA621CC13A30004D8501 /* PR_update_title@2x.png */,
32173223
133DAA631CC13A30004D8501 /* PR_update_title@3x.png */,
32183224
134116F61CB55E69005E6550 /* PR_update@2x.png */,
@@ -6254,6 +6260,7 @@
62546260
8E97CEBA1A0C7E26006F9AD7 /* coding_emoji_35@2x.png in Resources */,
62556261
8E97CE681A0A3424006F9AD7 /* keyboard_keyboard@2x.png in Resources */,
62566262
8EA6D17919E240C40076D59C /* placeholder_monkey_round_48@2x.png in Resources */,
6263+
4EAAD0A51E5D8D90008AA957 /* PR_plus@2x.png in Resources */,
62576264
8EA6D1A819E240C40076D59C /* xtsegment_bordor_left@2x.png in Resources */,
62586265
4EB52F5C1C7C5C4F00B5EBEA /* task_resource_reference_MergeRequestBean@2x.png in Resources */,
62596266
8E525C8A19F7E3F800496B34 /* blankpage_image_loadFail@2x.png in Resources */,
@@ -6264,6 +6271,7 @@
62646271
4E095A6E1B69F920008DC439 /* banner__page_unselected@2x.png in Resources */,
62656272
4EAAD0211E540551008AA957 /* mrpr_icon_status_accepted@2x.png in Resources */,
62666273
4E96E7D81A1B537E0037C098 /* icon_file_ai@2x.png in Resources */,
6274+
4EAAD0A61E5D8D90008AA957 /* PR_plus@3x.png in Resources */,
62676275
4ED4B4931D82646100EED8C6 /* user_info_tweet@2x.png in Resources */,
62686276
8E525C8919F7E3F800496B34 /* blankpage_button_reload@2x.png in Resources */,
62696277
8E97CEAC1A0C7E26006F9AD7 /* coding_emoji_21@2x.png in Resources */,

Coding_iOS/Controllers/MRDetailViewController.m

+39-32
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
528528
if (self.curMRPRInfo.mrpr.status == MRPRStatusAccepted || self.curMRPRInfo.mrpr.status == MRPRStatusRefused || self.curMRPRInfo.mrpr.status == MRPRStatusRefused) {
529529
[cell cantReviewer];
530530
}
531+
cell.rightSideClickedBlock = ^(){
532+
[weakSelf jiaYi];
533+
};
531534
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:50];
532535
return cell;
533536
}else {
@@ -540,6 +543,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
540543
[tmpReviewers addObject:self.curReviewersInfo.volunteer_reviewers[i]];
541544
}
542545
[cell initCellWithReviewers:tmpReviewers];
546+
cell.lastItemClickedBlock = ^(){
547+
[weakSelf goToReviewerList];
548+
};
543549
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:50];
544550
return cell;
545551
}
@@ -567,6 +573,39 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
567573
}
568574
}
569575

576+
- (void)jiaYi{
577+
if (self.curMRPRInfo.mrpr.status == MRPRStatusAccepted || self.curMRPRInfo.mrpr.status == MRPRStatusRefused || self.curMRPRInfo.mrpr.status == MRPRStatusRefused) {
578+
return;
579+
}
580+
if([self CurrentUserIsOwer]) {
581+
NSArray *apparray= [[NSBundle mainBundle]loadNibNamed:@"AddReviewerViewController" owner:nil options:nil];
582+
AddReviewerViewController *appview=[apparray firstObject];
583+
appview.currentProject = self.curProject;
584+
appview.curMRPR = self.curMRPR;
585+
[self.navigationController pushViewController:appview animated:YES];
586+
} else {
587+
__weak typeof(self) weakSelf = self;
588+
if ([self.isLike isEqual:@0]) {
589+
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:self.reviewGoodPath withParams:nil withMethodType:Delete andBlock:^(id data, NSError *error) {
590+
weakSelf.isLike = @1;
591+
[weakSelf refresh];
592+
}];
593+
} else {
594+
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:self.reviewGoodPath withParams:nil withMethodType:Post andBlock:^(id data, NSError *error) {
595+
weakSelf.isLike = @0;
596+
[weakSelf refresh];
597+
}];
598+
}
599+
}
600+
}
601+
- (void)goToReviewerList{
602+
NSArray *apparray= [[NSBundle mainBundle]loadNibNamed:@"ReviewerListController" owner:nil options:nil];
603+
ReviewerListController *appview=[apparray firstObject];
604+
appview.currentProject = self.curProject;
605+
appview.curMRPR = self.curMRPR;
606+
appview.isPublisher = [self currentUserCanAddMember];
607+
[self.navigationController pushViewController:appview animated:YES];
608+
}
570609

571610
- (BOOL)CurrentUserIsOwer{
572611
User *currentUser = [Login curLoginUser];
@@ -657,38 +696,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
657696
[self.navigationController pushViewController:vc animated:YES];
658697
}
659698
} else if (indexPath.section == 2){//Disclosure
660-
if (indexPath.row == 0) {
661-
if (self.curMRPRInfo.mrpr.status == MRPRStatusAccepted || self.curMRPRInfo.mrpr.status == MRPRStatusRefused || self.curMRPRInfo.mrpr.status == MRPRStatusRefused) {
662-
return;
663-
}
664-
if([self CurrentUserIsOwer]) {
665-
NSArray *apparray= [[NSBundle mainBundle]loadNibNamed:@"AddReviewerViewController" owner:nil options:nil];
666-
AddReviewerViewController *appview=[apparray firstObject];
667-
appview.currentProject = self.curProject;
668-
appview.curMRPR = self.curMRPR;
669-
[self.navigationController pushViewController:appview animated:YES];
670-
} else {
671-
__weak typeof(self) weakSelf = self;
672-
if ([self.isLike isEqual:@0]) {
673-
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:self.reviewGoodPath withParams:nil withMethodType:Delete andBlock:^(id data, NSError *error) {
674-
weakSelf.isLike = @1;
675-
[weakSelf refresh];
676-
}];
677-
} else {
678-
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:self.reviewGoodPath withParams:nil withMethodType:Post andBlock:^(id data, NSError *error) {
679-
weakSelf.isLike = @0;
680-
[weakSelf refresh];
681-
}];
682-
}
683-
}
684-
} else {
685-
NSArray *apparray= [[NSBundle mainBundle]loadNibNamed:@"ReviewerListController" owner:nil options:nil];
686-
ReviewerListController *appview=[apparray firstObject];
687-
appview.currentProject = self.curProject;
688-
appview.curMRPR = self.curMRPR;
689-
appview.isPublisher = [self currentUserCanAddMember];
690-
[self.navigationController pushViewController:appview animated:YES];
691-
}
692699
} else if (self.activityList.count > 0 && indexPath.section == 3){//Comment
693700
ProjectLineNote *curCommentItem = self.activityList[indexPath.row];
694701
if ([curCommentItem.action isEqual:@"mergeChanges"]) {

Coding_iOS/Images/PR_plus@2x.png

1.29 KB
Loading

Coding_iOS/Images/PR_plus@3x.png

2.35 KB
Loading

Coding_iOS/Views/Cell/MRReviewerCell.h

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
@interface MRReviewerCell: UITableViewCell
1414

15+
@property (copy, nonatomic) void(^rightSideClickedBlock)();
16+
1517
- (void)setImageStr:(NSString *)imgStr
1618
isowner:(BOOL)ower
1719
hasLikeMr:(NSNumber *)hasLikeMr;

Coding_iOS/Views/Cell/MRReviewerCell.m

+13-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
2222
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
2323
if (self) {
2424
// Initialization code
25-
25+
self.selectionStyle = UITableViewCellSelectionStyleNone;
2626
self.backgroundColor = kColorTableBG;
2727
if (!_imgView) {
2828
_imgView = [UIImageView new];
@@ -65,6 +65,18 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
6565
make.centerY.equalTo(self.contentView);
6666
}];
6767
}
68+
UIView *rightSideV = [UIView new];
69+
[self.contentView addSubview:rightSideV];
70+
[rightSideV mas_makeConstraints:^(MASConstraintMaker *make) {
71+
make.top.right.bottom.equalTo(self.contentView);
72+
make.width.equalTo(self.contentView).multipliedBy(1.0/4);
73+
}];
74+
__weak typeof(self) weakSelf = self;
75+
[rightSideV bk_whenTapped:^{
76+
if (weakSelf.rightSideClickedBlock) {
77+
weakSelf.rightSideClickedBlock();
78+
}
79+
}];
6880
}
6981
return self;
7082
}
@@ -128,7 +140,6 @@ - (void)setImageStr:(NSString *)imgStr
128140
-(void) cantReviewer {
129141
self.rightLabel.hidden = YES;
130142
self.likeImgView.hidden = YES;
131-
self.selectionStyle = UITableViewCellSelectionStyleNone;
132143
self.accessoryType = UITableViewCellAccessoryNone;
133144
}
134145

Coding_iOS/Views/Cell/MRReviewerListCell.h

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
@interface MRReviewerListCell : UITableViewCell
1414
@property (readwrite, nonatomic, strong) NSMutableArray *reviewers;
15+
@property (copy, nonatomic) void(^lastItemClickedBlock)();
1516

1617
- (void)initCellWithReviewers:(NSArray *)reviewers;
1718

Coding_iOS/Views/Cell/MRReviewerListCell.m

+33-13
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
#define kDefaultImageSize 33
1212
#define kDefaultImageCount 8
1313
@interface MRReviewerListCell ()
14-
@property (strong, nonatomic) UIImageView *imgView;
14+
//@property (strong, nonatomic) UIImageView *imgView;
1515
@property (strong, nonatomic) NSMutableArray *imgViews;
1616
@property (strong, nonatomic) NSMutableArray *likeHeadImgViews;
1717
@property (strong, nonatomic) UILabel *titleLabel;
18+
@property (strong, nonatomic) NSArray *reviewerList;
1819
@end
1920

2021
@implementation MRReviewerListCell
@@ -24,9 +25,11 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
2425
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
2526
if (self) {
2627
// Initialization code
28+
self.selectionStyle = UITableViewCellSelectionStyleNone;
2729
self.imgViews = [[NSMutableArray alloc] init];
2830
self.likeHeadImgViews = [[NSMutableArray alloc] init];
2931
self.backgroundColor = kColorTableBG;
32+
__weak typeof(self) weakSelf = self;
3033
for(int i = 0; i < kDefaultImageCount; i ++)
3134
{
3235
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(40 * (i + 1) + 10, 15, kDefaultImageSize, kDefaultImageSize)];
@@ -39,14 +42,19 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
3942
[likeHeadView setHidden:true];
4043
[self.likeHeadImgViews addObject:likeHeadView];
4144
[self.contentView addSubview:likeHeadView];
45+
46+
imgView.userInteractionEnabled = YES;
47+
[imgView bk_whenTapped:^{
48+
[weakSelf imgViewClicked:weakSelf.imgViews[i]];
49+
}];
4250
}
4351

4452
}
4553
return self;
4654
}
4755

4856
- (void)prepareForReuse{
49-
57+
5058
[self removeTip];
5159
}
5260

@@ -89,20 +97,21 @@ - (void)initCellWithReviewers:(NSArray *)reviewerList{
8997
}
9098
return result;
9199
}];
100+
_reviewerList = reviewers.copy;
92101
int index = 0;
93102
for (int i = 0; i < imageCount; i++) {
94103
UIImageView *image = self.imgViews[index];
95-
if(i >= reviewers.count) {
104+
if(i > reviewers.count) {
96105
continue;
97106
}
98-
Reviewer* reviewer = (Reviewer*)reviewers[i];
99-
[image setHidden:false];
100-
if(index >= imageCount-1) {
101-
image.image = [UIImage imageNamed:@"PR_more"];
107+
if(index >= imageCount-1 || i == reviewers.count) {
108+
image.image = [UIImage imageNamed:i == reviewers.count? @"PR_plus": @"PR_more"];
109+
image.hidden = NO;
102110
index ++;
103111
continue;
104-
105112
}
113+
Reviewer* reviewer = (Reviewer*)reviewers[i];
114+
[image setHidden:false];
106115
[image mas_makeConstraints:^(MASConstraintMaker *make) {
107116
make.top.equalTo(self.contentView).offset(15);
108117
make.left.equalTo(self.contentView).offset(40 * (index + 1) + 10);
@@ -111,16 +120,26 @@ - (void)initCellWithReviewers:(NSArray *)reviewerList{
111120
}];
112121
[image sd_setImageWithURL:[reviewer.reviewer.avatar urlImageWithCodePathResizeToView:image] placeholderImage:kPlaceholderMonkeyRoundView(image)];
113122
if([reviewer.volunteer isEqualToString:@"invitee"]) {
114-
if([reviewer.value isEqual:@100]) {
123+
if([reviewer.value isEqual:@100]) {
115124
UIImageView *likeImage = self.likeHeadImgViews[index];
116125
[likeImage setHidden:false];
117-
likeImage.image = [UIImage imageNamed:@"PointLikeHead"];
118-
}
126+
likeImage.image = [UIImage imageNamed:@"PointLikeHead"];
127+
}
119128
}
120129
index ++;
121130
}
122-
123-
131+
}
132+
133+
- (void)imgViewClicked:(UIImageView *)imgView{
134+
NSUInteger index = [self.imgViews indexOfObject:imgView];
135+
if (index == NSNotFound) {
136+
return;
137+
}
138+
int imageCount = self.contentView.size.width / 40 - 2;
139+
BOOL isLastV = (index == _reviewerList.count -1) || (index == imageCount -1);
140+
if (isLastV && _lastItemClickedBlock) {
141+
_lastItemClickedBlock();
142+
}
124143
}
125144

126145
+ (CGFloat)cellHeight{
@@ -129,3 +148,4 @@ + (CGFloat)cellHeight{
129148

130149

131150
@end
151+

0 commit comments

Comments
 (0)