FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Coding-iOS/Coding_iOS/Controllers/ProjectViewController.m at master · CodeY2J/Coding-iOS · GitHub
CodeY2J
/
Coding-iOS
Public
forked from
coding/Coding-iOS
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Coding-iOS
/
Coding_iOS
/
Controllers
/
ProjectViewController.m
Copy path
More file actions
More file actions
Latest commit
History
History
History
579 lines (542 loc) · 25.6 KB
Breadcrumbs
Coding-iOS
/
Coding_iOS
/
Controllers
/
ProjectViewController.m
Copy path
File metadata and controls
579 lines (542 loc) · 25.6 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
//
//
ProjectViewController.m
//
Coding_iOS
//
//
Created by 王 原闯 on 14-8-13.
//
Copyright (c) 2014年 Coding. All rights reserved.
//
#
import
"
ProjectViewController.h
"
#
import
"
UIViewController+DownMenu.h
"
#
import
"
ProjectActivitiesView.h
"
#
import
"
ProjectTasksView.h
"
#
import
"
EditTaskViewController.h
"
#
import
"
ProjectTopicsView.h
"
#
import
"
ProjectMemberListViewController.h
"
#
import
"
EditTopicViewController.h
"
#
import
"
TopicDetailViewController.h
"
#
import
"
ConversationViewController.h
"
#
import
"
Coding_NetAPIManager.h
"
#
import
"
UserInfoViewController.h
"
#
import
"
AddUserViewController.h
"
#
import
"
ProjectFolderListView.h
"
#
import
"
ProjectCodeListView.h
"
#
import
"
CodeListViewController.h
"
#
import
"
CodeViewController.h
"
#
import
"
ProjectMemberActivityListViewController.h
"
#
import
"
FileListViewController.h
"
#
import
"
SettingTextViewController.h
"
#
import
"
FolderToMoveViewController.h
"
#
import
"
FileViewController.h
"
#
import
"
ProjectCommitsViewController.h
"
#
import
"
ProjectCommitsViewController.h
"
#
import
"
MRPRDetailViewController.h
"
#
import
"
NProjectViewController.h
"
#
import
"
CommitFilesViewController.h
"
#
import
"
FunctionTipsManager.h
"
@interface
ProjectViewController
()
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*projectContentDict;
//
项目成员
@property
(
strong
,
nonatomic
) ProjectMemberListViewController *proMemberVC;
@end
@implementation
ProjectViewController
+ (ProjectViewController *)
codeVCWithCodeRef
:
(
NSString
*)
codeRef
andProject
:
(Project *)
project
{
ProjectViewController *vc = [
self
new
];
vc.
codeRef
= codeRef;
vc.
myProject
= project;
if
(vc.
myProject
.
is_public
.
boolValue
) {
vc.
curIndex
=
2
;
}
else
{
vc.
curIndex
=
4
;
}
return
vc;
}
- (
instancetype
)
init
{
self = [
super
init
];
if
(self) {
_curIndex =
0
;
}
return
self;
}
- (UIView *)
getCurContentView
{
return
[_projectContentDict
objectForKey:
[
NSNumber
numberWithInteger:
_curIndex]];
}
- (
void
)
saveCurContentView
:
(UIView *)
curContentView
{
if
(curContentView) {
[_projectContentDict
setObject:
curContentView
forKey:
[
NSNumber
numberWithInteger:
_curIndex]];
}
}
- (
void
)
viewDidLoad
{
[
super
viewDidLoad
];
//
Do any additional setup after loading the view.
_projectContentDict = [[
NSMutableDictionary
alloc
]
initWithCapacity:
5
];
if
(_myProject) {
if
(!_myProject.
is_public
) {
[
self
requestForMyProject
];
}
else
{
[
self
configNavBtnWithMyProject
];
[
self
refreshWithNewIndex:
_curIndex];
}
}
}
- (
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
//
Dispose of any resources that can be recreated.
}
- (
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
super
viewWillAppear:
animated];
[
self
refreshToQueryData
];
}
- (
void
)
refreshToQueryData
{
UIView *curView = [
self
getCurContentView
];
if
(curView && [curView
respondsToSelector:
@selector
(
refreshToQueryData
)]) {
[curView
performSelector:
@selector
(
refreshToQueryData
)];
}
if
([curView
isKindOfClass:
[ProjectTasksView
class
]]) {
ProjectTasksView *tasksView = (ProjectTasksView *)curView;
[tasksView
refreshToQueryData
];
}
else
{
if
(curView && [curView
respondsToSelector:
@selector
(
reloadData
)]) {
[curView
performSelector:
@selector
(
reloadData
)];
}
}
}
- (
void
)
requestForMyProject
{
[
self
.view
beginLoading
];
__weak
typeof
(self) weakSelf = self;
[[Coding_NetAPIManager
sharedManager
]
request_ProjectDetail_WithObj:
_myProject
andBlock:
^(
id
data,
NSError
*error) {
[weakSelf.view
endLoading
];
if
(data) {
weakSelf.
myProject
= data;
[weakSelf
configNavBtnWithMyProject
];
[weakSelf
refreshWithNewIndex:
_curIndex];
}
}];
}
- (
void
)
configNavBtnWithMyProject
{
self.
title
= _myProject.
name
;
}
- (
void
)
configRightBarButtonItemWithViewType
:
(ProjectViewType)
viewType
{
UIBarButtonItem *navRightBtn =
nil
;
if
((viewType == ProjectViewTypeMembers && [[Login
curLoginUser
].global_key
isEqualToString:
_myProject.owner_user_name])
|| viewType == ProjectViewTypeTasks
|| viewType == ProjectViewTypeTopics
|| viewType == ProjectViewTypeFiles) {
navRightBtn = [[UIBarButtonItem
alloc
]
initWithImage:
[UIImage
imageNamed:
(viewType == ProjectViewTypeCodes ?
@"
timeBtn_Nav
"
:
@"
addBtn_Nav
"
)]
style:
UIBarButtonItemStylePlain
target:
self
action:
@selector
(
navRightBtnClicked
)];
}
else
if
(viewType == ProjectViewTypeCodes){
UIButton *button = [[UIButton
alloc
]
initWithFrame:
CGRectMake
(
0
,
0
,
20
,
20
)];
[button
setImage:
[UIImage
imageNamed:
@"
timeBtn_Nav
"
]
forState:
UIControlStateNormal];
[button
addTarget:
self
action:
@selector
(
navRightBtnClicked
)
forControlEvents:
UIControlEventTouchUpInside];
if
([[FunctionTipsManager
shareManager
]
needToTip:
kFunctionTipStr_CommitList
]) {
[button
addBadgeTip:
kBadgeTipStr
withCenterPosition:
CGPointMake
(
20
,
0
)];
}
navRightBtn = [[UIBarButtonItem
alloc
]
initWithCustomView:
button];
}
[
self
.navigationItem
setRightBarButtonItem:
navRightBtn
animated:
YES
];
}
- (ProjectViewType)
viewTypeFromIndex
:
(
NSInteger
)
index
{
ProjectViewType type =
0
;
if
(_myProject.
is_public
) {
if
(_myProject.
is_public
.
boolValue
) {
switch
(index) {
case
0
:
type = ProjectViewTypeActivities;
break
;
case
1
:
type = ProjectViewTypeTopics;
break
;
case
2
:
type = ProjectViewTypeCodes;
break
;
case
3
:
type = ProjectViewTypeMembers;
break
;
default
:
type = ProjectViewTypeActivities;
break
;
}
}
else
{
type = index;
}
}
return
type;
}
- (ProjectViewType)
curType
{
return
[
self
viewTypeFromIndex:
_curIndex];
}
- (
void
)
refreshWithNewIndex
:
(
NSInteger
)
newIndex
{
ProjectViewType curViewType = [
self
viewTypeFromIndex:
_curIndex];
ProjectViewType newViewType = [
self
viewTypeFromIndex:
newIndex];
//
配置navBtn
[
self
configRightBarButtonItemWithViewType:
newViewType];
//
隐藏上一个视图
UIView *curView = [
self
getCurContentView
];
if
(curViewType != newViewType && curView) {
curView.
hidden
=
YES
;
}
//
配置将要显示的视图
_curIndex = newIndex;
curView = [
self
getCurContentView
];
__weak
typeof
(self) weakSelf = self;
if
(curView ==
nil
) {
switch
(newViewType) {
case
ProjectViewTypeActivities:{
curView = ({
ProjectActivitiesView *activitiesView = [[ProjectActivitiesView
alloc
]
initWithFrame:
self
.view.bounds
project:
_myProject
block:
^(ProjectActivity *proActivity) {
[weakSelf
goToVCWithItem:
nil
activity:
proActivity
isContent:
YES
inProject:
weakSelf.myProject];
}
defaultIndex:
0
];
activitiesView.
htmlItemClickedBlock
= ^(HtmlMediaItem *clickedItem, ProjectActivity *proAct,
BOOL
isContent){
[weakSelf
goToVCWithItem:
clickedItem
activity:
proAct
isContent:
isContent
inProject:
weakSelf.myProject];
};
activitiesView.
userIconClickedBlock
= ^(User *curUser){
[weakSelf
goToUserInfo:
curUser];
};
activitiesView;
});
}
break
;
case
ProjectViewTypeTasks:{
curView = ({
[[ProjectTasksView
alloc
]
initWithFrame:
self
.view.bounds
project:
_myProject
block:
^(ProjectTaskListView *taskListView, Task *task) {
EditTaskViewController *vc = [[EditTaskViewController
alloc
]
init
];
vc.
myTask
= task;
vc.
taskChangedBlock
= ^(){
[taskListView
refreshToQueryData
];
};
[weakSelf.navigationController
pushViewController:
vc
animated:
YES
];
}
defaultIndex:
0
];
});
}
break
;
case
ProjectViewTypeTopics:{
curView = [[ProjectTopicsView
alloc
]
initWithFrame:
self
.view.bounds
project:
_myProject
block:
^(ProjectTopicListView *projectTopicListView, ProjectTopic *projectTopic) {
TopicDetailViewController *vc = [[TopicDetailViewController
alloc
]
init
];
vc.
curTopic
= projectTopic;
[weakSelf.navigationController
pushViewController:
vc
animated:
YES
];
}
defaultIndex:
0
];
}
break
;
case
ProjectViewTypeFiles:{
curView = ({
ProjectFolderListView *folderListView = [[ProjectFolderListView
alloc
]
initWithFrame:
self
.view.bounds
project:
_myProject];
folderListView.
folderInProjectBlock
= ^(ProjectFolders *rootFolders, ProjectFolder *clickedFolder, Project *inProject){
DebugLog
(
@"
folderInProjectBlock-----:
%@
-
%@
"
, clickedFolder.
name
, inProject.
name
);
[weakSelf
goToVCWithRootFolder:
rootFolders
folder:
clickedFolder
inProject:
inProject];
};
folderListView;
});
}
break
;
case
ProjectViewTypeCodes:{
curView = ({
ProjectCodeListView *codeListView = [[ProjectCodeListView
alloc
]
initWithFrame:
self
.view.bounds
project:
_myProject
andCodeTree:
[CodeTree
codeTreeWithRef:
_codeRef
andPath:
@"
"
]];
codeListView.
codeTreeFileOfRefBlock
= ^(CodeTree_File *curCodeTreeFile,
NSString
*ref){
[weakSelf
goToVCWith:
curCodeTreeFile
andRef:
ref];
};
codeListView.
refChangedBlock
= ^(
NSString
*ref){
weakSelf.
codeRef
= ref;
};
[codeListView
addBranchTagButton
];
codeListView;
});
}
break
;
case
ProjectViewTypeMembers:{
_proMemberVC = [[ProjectMemberListViewController
alloc
]
init
];
[_proMemberVC
setFrame:
self
.view.bounds
project:
_myProject
type:
ProMemTypeProject
refreshBlock:
^(
NSArray
*memberArray) {
}
selectBlock:
^(ProjectMember *member) {
[weakSelf
goToActivityListOfUser:
member.user];
}
cellBtnBlock:
^(ProjectMember *member) {
if
(member.
user_id
.
intValue
== [Login
curLoginUser
].
id
.
intValue
) {
//
自己,退出了项目
[weakSelf.navigationController
popToRootViewControllerAnimated:
YES
];
}
else
{
//
别人,发起私信
ConversationViewController *vc = [[ConversationViewController
alloc
]
init
];
vc.
myPriMsgs
= [PrivateMessages
priMsgsWithUser:
member.user];
[weakSelf.navigationController
pushViewController:
vc
animated:
YES
];
}
}];
curView = _proMemberVC.
view
;
}
break
;
default
:
break
;
}
[
self
saveCurContentView:
curView];
[
self
.view
addSubview:
curView];
[curView
mas_makeConstraints:
^(MASConstraintMaker *make) {
make.
edges
.
equalTo
(self.
view
);
}];
}
if
(newViewType != ProjectViewTypeMembers && _proMemberVC) {
[_proMemberVC
willHiden
];
}
curView.
hidden
=
NO
;
}
#
pragma mark
toVC
- (
void
)
goToUserInfo
:
(User *)
user
{
UserInfoViewController *vc = [[UserInfoViewController
alloc
]
init
];
vc.
curUser
= user;
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
- (
void
)
goToActivityListOfUser
:
(User *)
user
{
ProjectMemberActivityListViewController *vc = [[ProjectMemberActivityListViewController
alloc
]
init
];
vc.
curProject
= self.
myProject
;
vc.
curUser
= user;
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
- (
void
)
goToVCWith
:
(CodeTree_File *)
codeTreeFile
andRef
:
(
NSString
*)
ref
{
DebugLog
(
@"
%@
"
, codeTreeFile.
path
);
if
([codeTreeFile.mode
isEqualToString:
@"
tree
"
]) {
//
文件夹
CodeTree *nextCodeTree = [CodeTree
codeTreeWithRef:
ref
andPath:
codeTreeFile.path];
CodeListViewController *vc = [[CodeListViewController
alloc
]
init
];
vc.
myProject
= _myProject;
vc.
myCodeTree
= nextCodeTree;
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
else
if
([@[
@"
file
"
,
@"
image
"
,
@"
sym_link
"
]
containsObject:
codeTreeFile.mode]){
//
文件
CodeFile *nextCodeFile = [CodeFile
codeFileWithRef:
ref
andPath:
codeTreeFile.path];
CodeViewController *vc = [CodeViewController
codeVCWithProject:
_myProject
andCodeFile:
nextCodeFile];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
else
{
[
NSObject
showHudTipStr:
@"
有些文件还不支持查看呢_(:з」∠)_
"
];
}
}
- (
void
)
goToVCWithRootFolder
:
(ProjectFolders *)
rootFolders
folder
:
(ProjectFolder *)
folder
inProject
:
(Project *)
project
{
FileListViewController *vc = [[FileListViewController
alloc
]
init
];
vc.
rootFolders
= rootFolders;
vc.
curFolder
= folder;
vc.
curProject
= project;
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
- (
void
)
goToVCWithItem
:
(HtmlMediaItem *)
clickedItem
activity
:
(ProjectActivity *)
proAct
isContent
:
(
BOOL
)
isContent
inProject
:
(Project *)
project
{
if
(isContent) {
//
cell上面第二个Label
NSString
*target_type = proAct.
target_type
;
if
([target_type
isEqualToString:
@"
Task
"
]) {
Task *task = proAct.
task
;
NSArray
*pathArray = [task.path
componentsSeparatedByString:
@"
/
"
];
if
(pathArray.
count
>=
7
) {
EditTaskViewController *vc = [[EditTaskViewController
alloc
]
init
];
vc.
myTask
= [Task
taskWithBackend_project_path:
[
NSString
stringWithFormat:
@"
/user/
%@
/project/
%@
"
, pathArray[
2
], pathArray[
4
]]
andId:
pathArray[
6
]];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
else
{
[
NSObject
showHudTipStr:
@"
任务不存在
"
];
}
}
else
if
([target_type
isEqualToString:
@"
TaskComment
"
]){
Task *task = proAct.
task
;
NSArray
*pathArray = [proAct.project.full_name
componentsSeparatedByString:
@"
/
"
];
if
(pathArray.
count
>=
2
) {
EditTaskViewController *vc = [[EditTaskViewController
alloc
]
init
];
vc.
myTask
= [Task
taskWithBackend_project_path:
[
NSString
stringWithFormat:
@"
/user/
%@
/project/
%@
"
, pathArray[
0
], pathArray[
1
]]
andId:
task.
id
.stringValue];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
else
{
[
NSObject
showHudTipStr:
@"
任务不存在
"
];
}
}
else
if
([target_type
isEqualToString:
@"
ProjectTopic
"
]){
ProjectTopicActivity *topic = proAct.
project_topic
;
NSArray
*pathArray;
if
([proAct.action
isEqualToString:
@"
comment
"
]) {
pathArray = [topic.parent.path
componentsSeparatedByString:
@"
/
"
];
}
else
{
pathArray = [topic.path
componentsSeparatedByString:
@"
/
"
];
}
if
(pathArray.
count
>=
7
) {
TopicDetailViewController *vc = [[TopicDetailViewController
alloc
]
init
];
vc.
curTopic
= [ProjectTopic
topicWithId:
[
NSNumber
numberWithInteger:
[pathArray[
6
]
integerValue
]]];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
else
{
[
NSObject
showHudTipStr:
@"
讨论不存在
"
];
}
}
else
if
([target_type
isEqualToString:
@"
ProjectFile
"
]){
File *file = proAct.
file
;
NSArray
*pathArray = [file.path
componentsSeparatedByString:
@"
/
"
];
BOOL
isFile = [proAct.type
isEqualToString:
@"
file
"
];
if
(isFile && pathArray.
count
>=
9
) {
//
文件
NSString
*fileIdStr = pathArray[
8
];
ProjectFile *curFile = [ProjectFile
fileWithFileId:
@(fileIdStr.integerValue)
andProjectId:
@(project.
id
.integerValue)];
curFile.
name
= file.
name
;
FileViewController *vc = [FileViewController
vcWithFile:
curFile
andVersion:
nil
];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
else
if
(!isFile && pathArray.
count
>=
7
){
//
文件夹
ProjectFolder *folder;
NSString
*folderIdStr = pathArray[
6
];
if
(![folderIdStr
isEqualToString:
@"
default
"
] && [folderIdStr
isPureInt
]) {
NSNumber
*folderId = [
NSNumber
numberWithInteger:
folderIdStr.integerValue];
folder = [ProjectFolder
folderWithId:
folderId];
folder.
name
= file.
name
;
}
else
{
folder = [ProjectFolder
defaultFolder
];
folder.
name
=
@"
默认文件夹
"
;
}
FileListViewController *vc = [[FileListViewController
alloc
]
init
];
vc.
curProject
= project;
vc.
curFolder
= folder;
vc.
rootFolders
=
nil
;
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
else
{
[
NSObject
showHudTipStr:
(isFile?
@"
文件不存在
"
:
@"
文件夹不存在
"
)];
}
}
else
if
([target_type
isEqualToString:
@"
ProjectMember
"
]) {
if
([proAct.action
isEqualToString:
@"
quit
"
]) {
//
退出项目
}
else
{
//
添加了某成员
User *user = proAct.
target_user
;
UserInfoViewController *vc = [[UserInfoViewController
alloc
]
init
];
vc.
curUser
= [User
userWithGlobalKey:
user.global_key];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
}
else
if
([target_type
isEqualToString:
@"
Depot
"
]) {
if
([proAct.action_msg
isEqualToString:
@"
删除了
"
]) {
[
NSObject
showHudTipStr:
@"
删除了,不能看了~
"
];
}
else
if
([proAct.action
isEqualToString:
@"
fork
"
]) {
NSArray
*nameComponents = [proAct.depot.name
componentsSeparatedByString:
@"
/
"
];
if
(nameComponents.
count
==
2
) {
NProjectViewController *vc = [NProjectViewController
new
];
vc.
myProject
= [Project
new
];
vc.
myProject
.
owner_user_name
= nameComponents[
0
];
vc.
myProject
.
name
= nameComponents[
1
];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
else
{
[
NSObject
showHudTipStr:
@"
没找到 Fork 到哪里去了~
"
];
}
}
else
if
([proAct.action
isEqualToString:
@"
push
"
]){
if
(proAct.
commits
.
count
==
1
) {
Commit *firstCommit = [proAct.commits
firstObject
];
NSString
*request_path = [
NSString
stringWithFormat:
@"
%@
/commit/
%@
"
, proAct.depot.path, firstCommit.sha];
CommitFilesViewController *vc = [CommitFilesViewController
vcWithPath:
request_path];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
else
{
NSString
*ref = proAct.
ref
? proAct.
ref
:
@"
master
"
;
ProjectCommitsViewController *vc = [ProjectCommitsViewController
new
];
vc.
curProject
= project;
vc.
curCommits
= [Commits
commitsWithRef:
ref
Path:
@"
"
];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
}
else
{
ProjectViewController *vc = [ProjectViewController
codeVCWithCodeRef:
proAct.ref
andProject:
project];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
}
else
if
([target_type
isEqualToString:
@"
PullRequestBean
"
] ||
[target_type
isEqualToString:
@"
MergeRequestBean
"
] ||
[target_type
isEqualToString:
@"
CommitLineNote
"
]){
NSString
*request_path;
if
([target_type
isEqualToString:
@"
PullRequestBean
"
]){
request_path = proAct.
pull_request_path
;
}
else
if
([target_type
isEqualToString:
@"
MergeRequestBean
"
]){
request_path = proAct.
merge_request_path
;
}
else
if
([target_type
isEqualToString:
@"
CommitLineNote
"
]){
request_path = proAct.
line_note
.
noteable_url
;
}
UIViewController *vc;
if
([proAct.line_note.noteable_type
isEqualToString:
@"
Commit
"
]) {
vc = [CommitFilesViewController
vcWithPath:
request_path];
}
else
{
vc = [MRPRDetailViewController
vcWithPath:
request_path];
}
if
(vc) {
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
else
{
[
NSObject
showHudTipStr:
@"
不知道这是个什么东西o(╯□╰)o~
"
];
}
}
else
{
if
([target_type
isEqualToString:
@"
Project
"
]){
//
这是什么鬼。。遗留的 type 吧
[
NSObject
showHudTipStr:
@"
还不能查看详细信息呢~
"
];
//
}else if ([target_type isEqualToString:@"MergeRequestComment"]){//过期类型,已用CommitLineNote替代
//
}else if ([target_type isEqualToString:@"PullRequestComment"]){//过期类型,已用CommitLineNote替代
//
}else if ([target_type isEqualToString:@"ProjectStar"]){//不用解析
//
}else if ([target_type isEqualToString:@"ProjectWatcher"]){//不用解析
}
else
if
([target_type
isEqualToString:
@"
QcTask
"
]){
//
还不能解析
[
NSObject
showHudTipStr:
@"
还不能查看详细信息呢~
"
];
}
}
}
else
{
//
cell上面第一个Label
[
self
goToUserInfo:
[User
userWithGlobalKey:
[clickedItem.href
substringFromIndex:
3
]]];
}
}
#
pragma mark
Mine M
- (
void
)
navRightBtnClicked
{
ProjectViewType curViewType = [
self
viewTypeFromIndex:
_curIndex];
switch
(curViewType) {
case
ProjectViewTypeTasks:
{
UIView *curView = [
self
getCurContentView
];
if
(![curView
isKindOfClass:
[ProjectTasksView
class
]]) {
return
;
}
ProjectTasksView *tasksView = (ProjectTasksView *)curView;
EditTaskViewController *vc = [[EditTaskViewController
alloc
]
init
];
User *user = tasksView.
selectedMember
.
user
? tasksView.
selectedMember
.
user
: [Login
curLoginUser
];
vc.
myTask
= [Task
taskWithProject:
self
.myProject
andUser:
user];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
break
;
case
ProjectViewTypeTopics:
{
EditTopicViewController *vc = [[EditTopicViewController
alloc
]
init
];
vc.
curProTopic
= [ProjectTopic
topicWithPro:
self
.myProject];
vc.
type
= TopicEditTypeAdd;
vc.
topicChangedBlock
=
nil
;
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
break
;
case
ProjectViewTypeMembers:
{
__weak
typeof
(self) weakSelf = self;
AddUserViewController *vc = [[AddUserViewController
alloc
]
init
];
vc.
curProject
= self.
myProject
;
vc.
type
= AddUserTypeProject;
if
(_proMemberVC && _proMemberVC.
myMemberArray
) {
[vc
configAddedArrayWithMembers:
_proMemberVC.myMemberArray];
}
vc.
popSelfBlock
= ^(){
if
(weakSelf.
proMemberVC
) {
[weakSelf.proMemberVC
refreshMembersData
];
}
};
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
break
;
case
ProjectViewTypeFiles:
{
//
新建文件夹
__weak
typeof
(self) weakSelf = self;
[SettingTextViewController
showSettingFolderNameVCFromVC:
self
withTitle:
@"
新建文件夹
"
textValue:
nil
type:
SettingTypeNewFolderName
doneBlock:
^(
NSString
*textValue) {
DebugLog
(
@"
%@
"
, textValue);
[[Coding_NetAPIManager
sharedManager
]
request_CreatFolder:
textValue
inFolder:
nil
inProject:
weakSelf.myProject
andBlock:
^(
id
data,
NSError
*error) {
if
(data) {
[
NSObject
showHudTipStr:
@"
创建文件夹成功
"
];
ProjectFolderListView *folderListView = (ProjectFolderListView *)[weakSelf
getCurContentView
];
if
(folderListView && [folderListView
isKindOfClass:
[ProjectFolderListView
class
]]) {
[folderListView
refreshToQueryData
];
}
}
}];
}];
}
break
;
case
ProjectViewTypeCodes:
{
if
([[FunctionTipsManager
shareManager
]
needToTip:
kFunctionTipStr_CommitList
]) {
[[FunctionTipsManager
shareManager
]
markTiped:
kFunctionTipStr_CommitList
];
[
self
configRightBarButtonItemWithViewType:
ProjectViewTypeCodes];
}
//
代码提交记录
ProjectCommitsViewController *vc = [ProjectCommitsViewController
new
];
vc.
curProject
= self.
myProject
;
vc.
curCommits
= [Commits
commitsWithRef:
self
.codeRef?
self
.
codeRef:
@"
master
"
Path:
@"
"
];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
break
;
default
:
break
;
}
}
@end
Back
|
FazBrowse Home
|
New Git URL