Skip to content

Commit 535b3d8

Browse files
committed
分支和版本管理
1 parent 7de88ad commit 535b3d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2394
-71
lines changed

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 122 additions & 0 deletions
Large diffs are not rendered by default.

Coding_iOS/.DS_Store

0 Bytes
Binary file not shown.

Coding_iOS/Controllers/CodeListViewController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
@interface CodeListViewController : BaseViewController
1414
@property (strong, nonatomic) Project *myProject;
1515
@property (strong, nonatomic) CodeTree *myCodeTree;
16+
17+
@property (assign, nonatomic) BOOL hideBranchTagButton;
18+
1619
@end

Coding_iOS/Controllers/CodeListViewController.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ - (void)viewDidLoad {
2525
[self configRightNavBtn];
2626

2727
_listView = [[ProjectCodeListView alloc] initWithFrame:self.view.bounds project:_myProject andCodeTree:_myCodeTree];
28+
_listView.hideBranchTagButton = _hideBranchTagButton;
2829
__weak typeof(self) weakSelf = self;
2930
_listView.codeTreeFileOfRefBlock = ^(CodeTree_File *curCodeTreeFile, NSString *ref){
3031
[weakSelf goToVCWith:curCodeTreeFile andRef:ref];
@@ -67,6 +68,7 @@ - (void)goToVCWith:(CodeTree_File *)codeTreeFile andRef:(NSString *)ref{
6768
CodeListViewController *vc = [[CodeListViewController alloc] init];
6869
vc.myProject = _myProject;
6970
vc.myCodeTree = nextCodeTree;
71+
vc.hideBranchTagButton = self.hideBranchTagButton;
7072
[self.navigationController pushViewController:vc animated:YES];
7173
}else if ([@[@"file", @"image", @"sym_link", @"executable"] containsObject:codeTreeFile.mode]){//文件
7274
CodeFile *nextCodeFile = [CodeFile codeFileWithRef:ref andPath:codeTreeFile.path];
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// EACodeBranchListViewController.h
3+
// Coding_iOS
4+
//
5+
// Created by Easeeeeeeeee on 2018/3/22.
6+
// Copyright © 2018年 Coding. All rights reserved.
7+
//
8+
9+
#import "BaseViewController.h"
10+
#import "Project.h"
11+
12+
@interface EACodeBranchListViewController : BaseViewController
13+
@property (nonatomic, strong) Project *myProject;
14+
15+
@end
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
//
2+
// EACodeBranchListViewController.m
3+
// Coding_iOS
4+
//
5+
// Created by Easeeeeeeeee on 2018/3/22.
6+
// Copyright © 2018年 Coding. All rights reserved.
7+
//
8+
9+
#import "EACodeBranchListViewController.h"
10+
#import "EACodeBranches.h"
11+
#import "ODRefreshControl.h"
12+
#import "SVPullToRefresh.h"
13+
#import "Coding_NetAPIManager.h"
14+
#import "EACodeBranchListCell.h"
15+
#import "ProjectViewController.h"
16+
17+
@interface EACodeBranchListViewController ()<UITableViewDataSource, UITableViewDelegate, SWTableViewCellDelegate>
18+
@property (strong, nonatomic) UITableView *myTableView;
19+
@property (nonatomic, strong) ODRefreshControl *myRefreshControl;
20+
21+
@property (strong, nonatomic) EACodeBranches *myCodeBranches;
22+
23+
@end
24+
25+
@implementation EACodeBranchListViewController
26+
27+
- (void)viewDidLoad {
28+
[super viewDidLoad];
29+
// Do any additional setup after loading the view.
30+
self.title = @"分支管理";
31+
self.view.backgroundColor = kColorTableSectionBg;
32+
_myTableView = ({
33+
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
34+
tableView.backgroundColor = [UIColor clearColor];
35+
tableView.dataSource = self;
36+
tableView.delegate = self;
37+
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
38+
// [tableView registerClass:[EACodeBranchListCell class] forCellReuseIdentifier:[EACodeBranchListCell nameOfClass]];
39+
[tableView registerNib:[UINib nibWithNibName:[EACodeBranchListCell nameOfClass] bundle:nil] forCellReuseIdentifier:[EACodeBranchListCell nameOfClass]];
40+
[self.view addSubview:tableView];
41+
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
42+
make.edges.equalTo(self.view);
43+
}];
44+
UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, 0, 0);
45+
tableView.contentInset = insets;
46+
tableView.scrollIndicatorInsets = insets;
47+
tableView.estimatedRowHeight = 0;
48+
tableView.estimatedSectionHeaderHeight = 0;
49+
tableView.estimatedSectionFooterHeight = 0;
50+
tableView;
51+
});
52+
_myRefreshControl = [[ODRefreshControl alloc] initInScrollView:self.myTableView];
53+
[_myRefreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged];
54+
55+
__weak typeof(self) weakSelf = self;
56+
[_myTableView addInfiniteScrollingWithActionHandler:^{
57+
[weakSelf refreshMore:YES];
58+
}];
59+
[self refresh];
60+
}
61+
62+
- (void)setMyProject:(Project *)myProject{
63+
_myProject = myProject;
64+
_myCodeBranches = [EACodeBranches new];
65+
_myCodeBranches.curPro = _myProject;
66+
}
67+
68+
#pragma Data
69+
- (void)refresh{
70+
[self refreshMore:NO];
71+
}
72+
- (void)refreshMore:(BOOL)willLoadMore{
73+
if (_myCodeBranches.isLoading) {
74+
return;
75+
}
76+
if (willLoadMore && !_myCodeBranches.canLoadMore) {
77+
[_myTableView.infiniteScrollingView stopAnimating];
78+
return;
79+
}
80+
_myCodeBranches.willLoadMore = willLoadMore;
81+
[self sendRequest];
82+
}
83+
84+
- (void)sendRequest{
85+
if (_myCodeBranches.list.count <= 0) {
86+
[self.view beginLoading];
87+
}
88+
__weak typeof(self) weakSelf = self;
89+
[[Coding_NetAPIManager sharedManager] request_CodeBranches_WithObj:_myCodeBranches andBlock:^(EACodeBranches *data, NSError *error) {
90+
[weakSelf.view endLoading];
91+
[weakSelf.myRefreshControl endRefreshing];
92+
[weakSelf.myTableView.infiniteScrollingView stopAnimating];
93+
if (data) {
94+
[weakSelf.myCodeBranches configWithObj:data];
95+
[weakSelf.myTableView reloadData];
96+
weakSelf.myTableView.showsInfiniteScrolling = weakSelf.myCodeBranches.canLoadMore;
97+
}
98+
[weakSelf.view configBlankPage:EaseBlankPageTypeView hasData:(weakSelf.myCodeBranches.list.count > 0) hasError:(error != nil) reloadButtonBlock:^(id sender) {
99+
[weakSelf refreshMore:NO];
100+
}];
101+
}];
102+
}
103+
104+
#pragma mark TableM
105+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
106+
return _myCodeBranches.list.count;
107+
}
108+
109+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
110+
EACodeBranchListCell *cell = [tableView dequeueReusableCellWithIdentifier:[EACodeBranchListCell nameOfClass] forIndexPath:indexPath];
111+
cell.curBranch = self.myCodeBranches.list[indexPath.row];
112+
cell.delegate = self;
113+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
114+
return cell;
115+
}
116+
117+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
118+
return 80;
119+
}
120+
121+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
122+
[tableView deselectRowAtIndexPath:indexPath animated:YES];
123+
CodeBranchOrTag *curB = self.myCodeBranches.list[indexPath.row];
124+
ProjectViewController *vc = [ProjectViewController codeVCWithCodeRef:curB.name andProject:self.myProject];
125+
vc.hideBranchTagButton = YES;
126+
[self.navigationController pushViewController:vc animated:YES];
127+
}
128+
129+
#pragma mark SWTableViewCellDelegate
130+
- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index{
131+
NSIndexPath *indexPath = [self.myTableView indexPathForCell:cell];
132+
CodeBranchOrTag *curB = self.myCodeBranches.list[indexPath.row];
133+
__weak typeof(self) weakSelf = self;
134+
[[UIActionSheet bk_actionSheetCustomWithTitle:[NSString stringWithFormat:@"请确认是否要删除分支 %@", curB.name] buttonTitles:nil destructiveTitle:@"确认删除" cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
135+
if (index == 0) {
136+
[weakSelf deleteBranch:curB];
137+
}
138+
}] showInView:self.view];
139+
}
140+
- (BOOL)swipeableTableViewCellShouldHideUtilityButtonsOnSwipe:(SWTableViewCell *)cell{
141+
return YES;
142+
}
143+
- (BOOL)swipeableTableViewCell:(SWTableViewCell *)cell canSwipeToState:(SWCellState)state{
144+
NSIndexPath *indexPath = [self.myTableView indexPathForCell:cell];
145+
return (indexPath.row != 0);
146+
}
147+
148+
- (void)deleteBranch:(CodeBranchOrTag *)curB{
149+
__weak typeof(self) weakSelf = self;
150+
[NSObject showHUDQueryStr:@"请稍等..."];
151+
[[Coding_NetAPIManager sharedManager] request_DeleteCodeBranch:curB inProject:_myProject andBlock:^(id data, NSError *error) {
152+
[NSObject hideHUDQuery];
153+
if (data) {
154+
[NSObject showHudTipStr:@"删除成功"];
155+
// [weakSelf.myCodeBranches.list removeObject:curB];
156+
// [weakSelf.myTableView reloadData];
157+
[weakSelf refresh];
158+
}
159+
}];
160+
}
161+
162+
@end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// EACodeReleaseListViewController.h
3+
// Coding_iOS
4+
//
5+
// Created by Easeeeeeeeee on 2018/3/22.
6+
// Copyright © 2018年 Coding. All rights reserved.
7+
//
8+
9+
#import "BaseViewController.h"
10+
#import "Project.h"
11+
12+
@interface EACodeReleaseListViewController : BaseViewController
13+
@property (nonatomic, strong) Project *myProject;
14+
15+
@end
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
//
2+
// EACodeReleaseListViewController.m
3+
// Coding_iOS
4+
//
5+
// Created by Easeeeeeeeee on 2018/3/22.
6+
// Copyright © 2018年 Coding. All rights reserved.
7+
//
8+
9+
#import "EACodeReleaseListViewController.h"
10+
#import "EACodeReleases.h"
11+
#import "ODRefreshControl.h"
12+
#import "SVPullToRefresh.h"
13+
#import "Coding_NetAPIManager.h"
14+
#import "EACodeReleaseListCell.h"
15+
#import "EACodeReleaseViewController.h"
16+
17+
@interface EACodeReleaseListViewController ()<UITableViewDataSource, UITableViewDelegate, SWTableViewCellDelegate>
18+
@property (strong, nonatomic) UITableView *myTableView;
19+
@property (nonatomic, strong) ODRefreshControl *myRefreshControl;
20+
21+
@property (strong, nonatomic) EACodeReleases *myCodeReleases;
22+
@property (strong, nonatomic) NSArray *dataList;
23+
@end
24+
25+
@implementation EACodeReleaseListViewController
26+
27+
- (void)viewDidLoad {
28+
[super viewDidLoad];
29+
// Do any additional setup after loading the view.
30+
self.title = @"发布管理";
31+
self.view.backgroundColor = kColorTableSectionBg;
32+
_myTableView = ({
33+
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
34+
tableView.backgroundColor = [UIColor clearColor];
35+
tableView.dataSource = self;
36+
tableView.delegate = self;
37+
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
38+
[tableView registerNib:[UINib nibWithNibName:[EACodeReleaseListCell nameOfClass] bundle:nil] forCellReuseIdentifier:[EACodeReleaseListCell nameOfClass]];
39+
[self.view addSubview:tableView];
40+
[tableView mas_makeConstraints:^(MASConstraintMaker *make) {
41+
make.edges.equalTo(self.view);
42+
}];
43+
UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, 0, 0);
44+
tableView.contentInset = insets;
45+
tableView.scrollIndicatorInsets = insets;
46+
tableView.estimatedRowHeight = 0;
47+
tableView.estimatedSectionHeaderHeight = 0;
48+
tableView.estimatedSectionFooterHeight = 0;
49+
tableView;
50+
});
51+
_myRefreshControl = [[ODRefreshControl alloc] initInScrollView:self.myTableView];
52+
[_myRefreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged];
53+
54+
__weak typeof(self) weakSelf = self;
55+
[_myTableView addInfiniteScrollingWithActionHandler:^{
56+
[weakSelf refreshMore:YES];
57+
}];
58+
[self refresh];
59+
}
60+
61+
- (void)setMyProject:(Project *)myProject{
62+
_myProject = myProject;
63+
_myCodeReleases = [EACodeReleases new];
64+
_myCodeReleases.curPro = _myProject;
65+
}
66+
67+
#pragma Data
68+
- (void)refresh{
69+
[self refreshMore:NO];
70+
}
71+
- (void)refreshMore:(BOOL)willLoadMore{
72+
if (_myCodeReleases.isLoading) {
73+
return;
74+
}
75+
if (willLoadMore && !_myCodeReleases.canLoadMore) {
76+
[_myTableView.infiniteScrollingView stopAnimating];
77+
return;
78+
}
79+
_myCodeReleases.willLoadMore = willLoadMore;
80+
[self sendRequest];
81+
}
82+
83+
- (void)sendRequest{
84+
if (_myCodeReleases.list.count <= 0) {
85+
[self.view beginLoading];
86+
}
87+
__weak typeof(self) weakSelf = self;
88+
[[Coding_NetAPIManager sharedManager] request_CodeReleases_WithObj:_myCodeReleases andBlock:^(EACodeReleases *data, NSError *error) {
89+
[weakSelf.view endLoading];
90+
[weakSelf.myRefreshControl endRefreshing];
91+
[weakSelf.myTableView.infiniteScrollingView stopAnimating];
92+
if (data) {
93+
[weakSelf.myCodeReleases configWithObj:data];
94+
[weakSelf.myTableView reloadData];
95+
weakSelf.myTableView.showsInfiniteScrolling = weakSelf.myCodeReleases.canLoadMore;
96+
}
97+
[weakSelf.view configBlankPage:EaseBlankPageTypeView hasData:(weakSelf.myCodeReleases.list.count > 0) hasError:(error != nil) reloadButtonBlock:^(id sender) {
98+
[weakSelf refreshMore:NO];
99+
}];
100+
}];
101+
}
102+
103+
#pragma mark TableM
104+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
105+
return _myCodeReleases.list.count;
106+
}
107+
108+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
109+
EACodeReleaseListCell *cell = [tableView dequeueReusableCellWithIdentifier:[EACodeReleaseListCell nameOfClass] forIndexPath:indexPath];
110+
cell.curCodeRelease = self.myCodeReleases.list[indexPath.row];
111+
cell.delegate = self;
112+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
113+
return cell;
114+
}
115+
116+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
117+
return 65;
118+
}
119+
120+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
121+
[tableView deselectRowAtIndexPath:indexPath animated:YES];
122+
EACodeReleaseViewController *vc = [EACodeReleaseViewController new];
123+
vc.curRelease = self.myCodeReleases.list[indexPath.row];
124+
[self.navigationController pushViewController:vc animated:YES];
125+
}
126+
127+
#pragma mark SWTableViewCellDelegate
128+
- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index{
129+
NSIndexPath *indexPath = [self.myTableView indexPathForCell:cell];
130+
EACodeRelease *curR = self.myCodeReleases.list[indexPath.row];
131+
__weak typeof(self) weakSelf = self;
132+
[[UIActionSheet bk_actionSheetCustomWithTitle:[NSString stringWithFormat:@"请确认是否删除版本 %@", curR.tag_name] buttonTitles:nil destructiveTitle:@"确认删除" cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
133+
if (index == 0) {
134+
[weakSelf deleteRelease:curR];
135+
}
136+
}] showInView:self.view];
137+
}
138+
- (BOOL)swipeableTableViewCellShouldHideUtilityButtonsOnSwipe:(SWTableViewCell *)cell{
139+
return YES;
140+
}
141+
- (BOOL)swipeableTableViewCell:(SWTableViewCell *)cell canSwipeToState:(SWCellState)state{
142+
return YES;
143+
}
144+
145+
- (void)deleteRelease:(EACodeRelease *)curR{
146+
__weak typeof(self) weakSelf = self;
147+
[NSObject showHUDQueryStr:@"请稍等..."];
148+
[[Coding_NetAPIManager sharedManager] request_DeleteCodeRelease:curR andBlock:^(id data, NSError *error) {
149+
[NSObject hideHUDQuery];
150+
if (data) {
151+
[NSObject showHudTipStr:@"删除成功"];
152+
// [weakSelf.myCodeReleases.list removeObject:curR];
153+
// [weakSelf.myTableView reloadData];
154+
[weakSelf refresh];
155+
}
156+
}];
157+
}
158+
159+
@end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// EACodeReleaseViewController.h
3+
// Coding_iOS
4+
//
5+
// Created by Easeeeeeeeee on 2018/3/23.
6+
// Copyright © 2018年 Coding. All rights reserved.
7+
//
8+
9+
#import "BaseViewController.h"
10+
#import "EACodeRelease.h"
11+
12+
@interface EACodeReleaseViewController : BaseViewController
13+
@property (strong, nonatomic) EACodeRelease *curRelease;
14+
@end

0 commit comments

Comments
 (0)