FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Coding-iOS/Coding_iOS/Controllers/CodeListViewController.m at master · YUCoderSW/Coding-iOS · GitHub
YUCoderSW
/
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
/
CodeListViewController.m
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
118 lines (103 loc) · 4.5 KB
Breadcrumbs
Coding-iOS
/
Coding_iOS
/
Controllers
/
CodeListViewController.m
Copy path
File metadata and controls
executable file
·
118 lines (103 loc) · 4.5 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
//
//
CodeListViewController.m
//
Coding_iOS
//
//
Created by 王 原闯 on 14/10/30.
//
Copyright (c) 2014年 Coding. All rights reserved.
//
#
import
"
CodeListViewController.h
"
#
import
"
CodeViewController.h
"
#
import
"
ProjectViewController.h
"
#
import
"
ProjectCommitsViewController.h
"
@interface
CodeListViewController
()
@end
@implementation
CodeListViewController
- (
void
)
viewDidLoad
{
[
super
viewDidLoad
];
//
Do any additional setup after loading the view.
self.
title
= [[_myCodeTree.path
componentsSeparatedByString:
@"
/
"
]
lastObject
];
[
self
configRightNavBtn
];
ProjectCodeListView *listView = [[ProjectCodeListView
alloc
]
initWithFrame:
self
.view.bounds
project:
_myProject
andCodeTree:
_myCodeTree];
__weak
typeof
(self) weakSelf = self;
listView.
codeTreeFileOfRefBlock
= ^(CodeTree_File *curCodeTreeFile,
NSString
*ref){
[weakSelf
goToVCWith:
curCodeTreeFile
andRef:
ref];
};
listView.
refChangedBlock
= ^(
NSString
*ref){
weakSelf.
myCodeTree
.
ref
= ref;
};
[
self
.view
addSubview:
listView];
[listView
mas_makeConstraints:
^(MASConstraintMaker *make) {
make.
edges
.
equalTo
(self.
view
);
}];
[listView
addBranchTagButton
];
}
- (
void
)
configRightNavBtn
{
if
(!self.
navigationItem
.
rightBarButtonItem
) {
[
self
.navigationItem
setRightBarButtonItem:
[[UIBarButtonItem
alloc
]
initWithImage:
[UIImage
imageNamed:
@"
moreBtn_Nav
"
]
style:
UIBarButtonItemStylePlain
target:
self
action:
@selector
(
rightNavBtnClicked
)]
animated:
NO
];
}
}
- (
void
)
rightNavBtnClicked
{
__weak
typeof
(self) weakSelf = self;
[[UIActionSheet
bk_actionSheetCustomWithTitle:
nil
buttonTitles:
@[
@"
查看提交记录
"
,
@"
退出代码查看
"
]
destructiveTitle:
nil
cancelTitle:
@"
取消
"
andDidDismissBlock:
^(UIActionSheet *sheet,
NSInteger
index) {
switch
(index) {
case
0
:{
[weakSelf
goToCommitsVC
];
}
break
;
case
1
:{
[weakSelf.navigationController.viewControllers
enumerateObjectsWithOptions:
NSEnumerationReverse
usingBlock:
^(UIViewController *obj,
NSUInteger
idx,
BOOL
*stop) {
if
(![obj
isKindOfClass:
[weakSelf
class
]]) {
if
([obj
isKindOfClass:
[ProjectViewController
class
]]) {
if
([(ProjectViewController *)obj
curType
] != ProjectViewTypeCodes) {
*stop =
YES
;
}
}
else
{
*stop =
YES
;
}
}
if
(*stop) {
[weakSelf.navigationController
popToViewController:
obj
animated:
YES
];
}
}];
}
break
;
default
:
break
;
}
}]
showInView:
self
.view];
}
- (
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
//
Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
- (
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
)
goToCommitsVC
{
ProjectCommitsViewController *vc = [ProjectCommitsViewController
new
];
vc.
curProject
= self.
myProject
;
vc.
curCommits
= [Commits
commitsWithRef:
self
.myCodeTree.ref
Path:
self
.myCodeTree.path];
[
self
.navigationController
pushViewController:
vc
animated:
YES
];
}
@end
Back
|
FazBrowse Home
|
New Git URL