Skip to content

Commit b8d2c62

Browse files
committed
curProject 的问题
1 parent 82c56d3 commit b8d2c62

21 files changed

Lines changed: 113 additions & 34 deletions

Coding_iOS/Controllers/AddMDCommentViewController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
//
88

99
#import "BaseViewController.h"
10+
#import "Project.h"
1011

1112
@interface AddMDCommentViewController : BaseViewController
1213
@property (strong, nonatomic) void (^completeBlock)(id data);
1314
@property (strong, nonatomic) NSString *requestPath;
1415
@property (strong, nonatomic) NSMutableDictionary *requestParams;
1516
@property (strong, nonatomic) NSString *contentStr;
17+
@property (strong, nonatomic) Project *curProject;
18+
1619
@end

Coding_iOS/Controllers/AddMDCommentViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ - (void)setCurIndex:(NSInteger)curIndex{
100100
- (void)loadEditView{
101101
if (!_editView) {
102102
_editView = [[EaseMarkdownTextView alloc] initWithFrame:self.view.bounds];
103-
// _editView.curProject = self.curTask.project;
103+
_editView.curProject = self.curProject;
104104
_editView.backgroundColor = [UIColor clearColor];
105105
_editView.textColor = [UIColor colorWithHexString:@"0x666666"];
106106
_editView.font = [UIFont systemFontOfSize:16];

Coding_iOS/Controllers/CommitFilesViewController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
//
88

99
#import "BaseViewController.h"
10+
#import "Project.h"
1011

1112
@interface CommitFilesViewController : BaseViewController
1213
@property (strong, nonatomic) NSString *ownerGK, *projectName, *commitId;
14+
@property (strong, nonatomic) Project *curProject;
1315
@end

Coding_iOS/Controllers/CommitFilesViewController.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ - (void)refresh{
8585
[weakSelf refresh];
8686
}];
8787
}];
88+
//推送过来的页面,可能 curProject 对象为空
89+
if (!_curProject) {
90+
_curProject = [Project new];
91+
_curProject.owner_user_name = _ownerGK;
92+
_curProject.name = _projectName;
93+
[[Coding_NetAPIManager sharedManager] request_ProjectDetail_WithObj:_curProject andBlock:^(id data, NSError *error) {
94+
if (data) {
95+
weakSelf.curProject = data;
96+
}
97+
}];
98+
}
8899
}
89100

90101
- (void)configListGroups{
@@ -228,6 +239,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
228239
FileChange *curFileChange = [curList objectAtIndex:indexPath.row];
229240

230241
FileChangeDetailViewController *vc = [FileChangeDetailViewController new];
242+
vc.curProject = _curProject;
231243
vc.requestPath = [NSString stringWithFormat:@"api/user/%@/project/%@/git/commitDiffContent/%@/%@", _ownerGK, _projectName, _commitId, curFileChange.path];
232244
vc.filePath = nil;
233245
[self.navigationController pushViewController:vc animated:YES];
@@ -244,6 +256,7 @@ - (void)goToAddCommentVCToUser:(NSString *)userName{
244256
DebugLog(@"%@", userName);
245257
AddMDCommentViewController *vc = [AddMDCommentViewController new];
246258

259+
vc.curProject = _curProject;
247260
vc.requestPath = [NSString stringWithFormat:@"api/user/%@/project/%@/git/line_notes", _ownerGK, _projectName];
248261
vc.requestParams = [@{
249262
@"noteable_type" : @"Commit",

Coding_iOS/Controllers/FileChangeDetailViewController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
#import "BaseViewController.h"
1010
#import "MRPR.h"
11+
#import "Project.h"
1112

1213
@interface FileChangeDetailViewController : BaseViewController
1314
@property (strong, nonatomic) NSString *requestPath, *filePath;
15+
@property (strong, nonatomic) Project *curProject;
1416
@end

Coding_iOS/Controllers/MRPRAcceptViewController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
//
88

99
#import "BaseViewController.h"
10+
#import "Project.h"
1011

1112
@interface MRPRAcceptViewController : BaseViewController
13+
@property (strong, nonatomic) Project *curProject;
1214

1315
@end

Coding_iOS/Controllers/MRPRCommitsViewController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
#import "BaseViewController.h"
1010
#import "MRPR.h"
1111
#import "Commit.h"
12+
#import "Project.h"
1213

1314
@interface MRPRCommitsViewController : BaseViewController
1415
@property (strong, nonatomic) MRPR *curMRPR;
16+
@property (strong, nonatomic) Project *curProject;
1517

1618
@end

Coding_iOS/Controllers/MRPRCommitsViewController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
129129
DebugLog(@"%@", curCommit.fullMessage);
130130

131131
CommitFilesViewController *vc = [CommitFilesViewController new];
132+
vc.curProject = _curProject;
132133
vc.ownerGK = _curMRPR.des_owner_name;
133134
vc.projectName = _curMRPR.des_project_name;
134135
vc.commitId = curCommit.commitId;

Coding_iOS/Controllers/MRPRDetailViewController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88

99
#import "BaseViewController.h"
1010
#import "MRPRBaseInfo.h"
11+
#import "Project.h"
1112

1213
@interface MRPRDetailViewController : BaseViewController
1314
@property (strong, nonatomic) MRPR *curMRPR;
15+
@property (strong, nonatomic) Project *curProject;
16+
1417
@end

Coding_iOS/Controllers/MRPRDetailViewController.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ - (void)refresh{
108108
[weakSelf refresh];
109109
}];
110110
}];
111+
112+
//推送过来的页面,可能 curProject 对象为空
113+
if (!_curProject) {
114+
_curProject = [Project new];
115+
_curProject.owner_user_name = _curMRPR.des_owner_name;
116+
_curProject.name = _curMRPR.des_project_name;
117+
[[Coding_NetAPIManager sharedManager] request_ProjectDetail_WithObj:_curProject andBlock:^(id data, NSError *error) {
118+
if (data) {
119+
weakSelf.curProject = data;
120+
}
121+
}];
122+
}
111123
}
112124

113125
#pragma mark TableM Footer Header
@@ -206,10 +218,12 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
206218
if (indexPath.row == 0) {
207219
MRPRCommitsViewController *vc = [MRPRCommitsViewController new];
208220
vc.curMRPR = _curMRPR;
221+
vc.curProject = _curProject;
209222
[self.navigationController pushViewController:vc animated:YES];
210223
}else{
211224
MRPRFilesViewController *vc = [MRPRFilesViewController new];
212225
vc.curMRPR = _curMRPR;
226+
vc.curProject = _curProject;
213227
[self.navigationController pushViewController:vc animated:YES];
214228
}
215229
}else if (_curMRPRInfo.discussions.count > 0 && indexPath.section == 2){//Comment
@@ -225,6 +239,7 @@ - (void)goToAddCommentVCToUser:(NSString *)userName{
225239
DebugLog(@"%@", userName);
226240
AddMDCommentViewController *vc = [AddMDCommentViewController new];
227241

242+
vc.curProject = _curProject;
228243
vc.requestPath = [NSString stringWithFormat:@"api/user/%@/project/%@/git/line_notes", _curMRPR.des_owner_name, _curMRPR.des_project_name];
229244
vc.requestParams = [@{
230245
@"noteable_type" : @"MergeRequestBean",

0 commit comments

Comments
 (0)