Skip to content

Commit 4850905

Browse files
committed
常用项目
1 parent 9aa9ac0 commit 4850905

11 files changed

Lines changed: 294 additions & 168 deletions

File tree

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@
272272
4EE083DA1ADB72AA00CA342E /* topic-ios.html in Resources */ = {isa = PBXBuildFile; fileRef = 4EE083D81ADB72AA00CA342E /* topic-ios.html */; };
273273
4EE083DC1ADB736800CA342E /* service_terms.html in Resources */ = {isa = PBXBuildFile; fileRef = 4EE083DB1ADB736800CA342E /* service_terms.html */; };
274274
4EE5481E1AE7B7CA00A92306 /* UISearchBar+Common.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EE5481D1AE7B7CA00A92306 /* UISearchBar+Common.m */; };
275+
4EE548211AE8DB5600A92306 /* Project.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EE548201AE8DB5600A92306 /* Project.m */; };
275276
68D9A2AD062641F5BCA573C5 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B024F2227BD4152BC7C9A7A /* libPods.a */; };
276277
8E03D4A219F695FE0092F8C8 /* libMobClickLibrary.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E03D49F19F695FE0092F8C8 /* libMobClickLibrary.a */; };
277278
8E03D4A419F696970092F8C8 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E03D4A319F696970092F8C8 /* libz.dylib */; };
@@ -1027,6 +1028,8 @@
10271028
4EE083DB1ADB736800CA342E /* service_terms.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = service_terms.html; sourceTree = "<group>"; };
10281029
4EE5481C1AE7B7CA00A92306 /* UISearchBar+Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UISearchBar+Common.h"; sourceTree = "<group>"; };
10291030
4EE5481D1AE7B7CA00A92306 /* UISearchBar+Common.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UISearchBar+Common.m"; sourceTree = "<group>"; };
1031+
4EE5481F1AE8DB5600A92306 /* Project.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Project.h; sourceTree = "<group>"; };
1032+
4EE548201AE8DB5600A92306 /* Project.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Project.m; sourceTree = "<group>"; };
10301033
8B18B0211092D3903D031B13 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
10311034
8E03D49F19F695FE0092F8C8 /* libMobClickLibrary.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libMobClickLibrary.a; sourceTree = "<group>"; };
10321035
8E03D4A019F695FE0092F8C8 /* MobClick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MobClick.h; sourceTree = "<group>"; };
@@ -2712,6 +2715,8 @@
27122715
8EA6CFE319E240C40076D59C /* ProjectMember.m */,
27132716
8EA6CFE419E240C40076D59C /* Projects.h */,
27142717
8EA6CFE519E240C40076D59C /* Projects.m */,
2718+
4EE5481F1AE8DB5600A92306 /* Project.h */,
2719+
4EE548201AE8DB5600A92306 /* Project.m */,
27152720
4EACB4441A2C60110097ABB3 /* ProjectActivities.h */,
27162721
4EACB4451A2C60110097ABB3 /* ProjectActivities.m */,
27172722
8EA6CFE619E240C40076D59C /* ProjectTopic.h */,
@@ -3691,6 +3696,7 @@
36913696
8EA6D13619E240C40076D59C /* BaseViewController.m in Sources */,
36923697
4E5F39051ACA958C0010515D /* TopicCommentCCell.m in Sources */,
36933698
4E15C7D61A271A6300FB8DAD /* EaseToolBar.m in Sources */,
3699+
4EE548211AE8DB5600A92306 /* Project.m in Sources */,
36943700
4E6BA2D81A1EE6AF005FD721 /* AFHTTPRequestOperationManager.m in Sources */,
36953701
4ECE8AE21A3943E80021E29C /* UIColor+expanded.m in Sources */,
36963702
4EA7F15D1A6D192B00A046BD /* SDWebImageDownloader.m in Sources */,

Coding_iOS/Controllers/RootControllers/Project_RootViewController.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,9 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
254254

255255
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
256256
ProjectListCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_ProjectList forIndexPath:indexPath];
257-
cell.project = [self.searchResults objectAtIndex:indexPath.row];
257+
[cell setProject:[self.searchResults objectAtIndex:indexPath.row] withSWButtons:NO];
258258
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
259259
return cell;
260-
261260
}
262261

263262
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

Coding_iOS/Models/Project.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//
2+
// Project.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/4/23.
6+
// Copyright (c) 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface Project : NSObject
12+
@property (readwrite, nonatomic, strong) NSString *icon, *name, *owner_user_name, *backend_project_path, *full_name, *description_mine, *path, *parent_depot_path;
13+
@property (readwrite, nonatomic, strong) NSNumber *id, *owner_id, *is_public, *un_read_activities_count, *done, *processing, *star_count, *stared, *watch_count, *watched, *fork_count, *forked, *recommended, *pin;
14+
@property (assign, nonatomic) BOOL isStaring, isWatching, isLoadingMember, isLoadingDetail;
15+
16+
@property (strong, nonatomic) NSString *readMeHtml;
17+
@property (assign, nonatomic) CGFloat readMeHeight;
18+
19+
+ (Project *)project_All;
20+
+ (Project *)project_FeedBack;
21+
22+
- (NSString *)toProjectPath;
23+
- (NSDictionary *)toCreateParams;
24+
25+
- (NSString *)toUpdatePath;
26+
- (NSDictionary *)toUpdateParams;
27+
28+
- (NSString *)toUpdateIconPath;
29+
30+
- (NSString *)toDeletePath;
31+
- (NSDictionary *)toDeleteParamsWithPassword:(NSString *)password;
32+
33+
- (NSString *)toMembersPath;
34+
- (NSDictionary *)toMembersParams;
35+
36+
- (NSString *)toUpdateVisitPath;
37+
- (NSString *)toDetailPath;
38+
39+
- (NSString *)localMembersPath;
40+
41+
- (NSString *)toBranchOrTagPath:(NSString *)path;
42+
@end

Coding_iOS/Models/Project.m

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
//
2+
// Project.m
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/4/23.
6+
// Copyright (c) 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "Project.h"
10+
#import "Login.h"
11+
12+
@implementation Project
13+
- (instancetype)init
14+
{
15+
self = [super init];
16+
if (self) {
17+
_isStaring = _isWatching = _isLoadingMember = _isLoadingDetail = NO;
18+
_readMeHeight = 1;
19+
_recommended = [NSNumber numberWithInteger:0];
20+
}
21+
return self;
22+
}
23+
+(Project *)project_All{
24+
Project *pro = [[Project alloc] init];
25+
pro.id = [NSNumber numberWithInteger:-1];
26+
return pro;
27+
}
28+
29+
+ (Project *)project_FeedBack{
30+
Project *pro = [[Project alloc] init];
31+
pro.id = [NSNumber numberWithInteger:38894];//iOS公开项目
32+
pro.is_public = [NSNumber numberWithBool:YES];
33+
return pro;
34+
}
35+
36+
-(NSString *)toProjectPath{
37+
return @"api/project";
38+
}
39+
40+
-(NSDictionary *)toCreateParams{
41+
42+
NSString *type;
43+
if ([self.is_public isEqual:@YES]) {
44+
type = @"1";
45+
}else{
46+
type = @"2";
47+
}
48+
49+
return @{@"name":self.name,
50+
@"description":self.description_mine,
51+
@"type":type,
52+
@"gitEnabled":@"true",
53+
@"gitReadmeEnabled":@"true",
54+
@"gitIgnore":@"no",
55+
@"gitLicense":@"no",
56+
// @"importFrom":@"no",
57+
@"vcsType":@"git"};
58+
}
59+
60+
-(NSString *)toUpdatePath{
61+
return [self toProjectPath];
62+
}
63+
64+
-(NSDictionary *)toUpdateParams{
65+
return @{@"name":self.name,
66+
@"description":self.description_mine,
67+
@"id":self.id
68+
// @"default_branch":[NSNull null]
69+
};
70+
}
71+
72+
-(NSString *)toUpdateIconPath{
73+
return [NSString stringWithFormat:@"api/project/%@/project_icon",self.id];
74+
}
75+
76+
-(NSString *)toDeletePath{
77+
return [NSString stringWithFormat:@"api/project/%@",self.id];
78+
}
79+
80+
-(NSDictionary *)toDeleteParamsWithPassword:(NSString *)password{
81+
return @{@"user_name":[Login curLoginUser].name,
82+
@"name":self.name,
83+
@"porject_id":[self.id stringValue],
84+
@"password":[password sha1Str]};
85+
}
86+
87+
- (NSString *)toMembersPath{
88+
return [NSString stringWithFormat:@"api/project/%d/members", self.id.intValue];
89+
}
90+
- (NSDictionary *)toMembersParams{
91+
return @{@"page" : [NSNumber numberWithInteger:1],
92+
@"pageSize" : [NSNumber numberWithInteger:500]};
93+
}
94+
- (NSString *)toUpdateVisitPath{
95+
if (self.owner_user_name.length > 0 && self.name.length > 0) {
96+
return [NSString stringWithFormat:@"api/user/%@/project/%@/update_visit", self.owner_user_name, self.name];
97+
}else{
98+
return [NSString stringWithFormat:@"api/project/%d/update_visit", self.id.intValue];
99+
}
100+
}
101+
- (NSString *)toDetailPath{
102+
return [NSString stringWithFormat:@"api/user/%@/project/%@", self.owner_user_name, self.name];
103+
}
104+
- (NSString *)localMembersPath{
105+
return [NSString stringWithFormat:@"%@_MembersPath", self.id.stringValue];
106+
}
107+
108+
- (NSString *)toBranchOrTagPath:(NSString *)path{
109+
return [NSString stringWithFormat:@"api/user/%@/project/%@/git/%@", self.owner_user_name, self.name, path];
110+
}
111+
- (NSString *)description_mine{
112+
if (_description_mine && _description_mine.length > 0) {
113+
return _description_mine;
114+
}else{
115+
return @"未填写";
116+
}
117+
}
118+
@end

Coding_iOS/Models/Projects.h

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#import "ListGroupItem.h"
1919
#import "TaskComment.h"
2020
#import "ProjectActivities.h"
21+
#import "Project.h"
2122

2223

2324

@@ -40,6 +41,7 @@ typedef NS_ENUM(NSInteger, ProjectsType)
4041
//解析
4142
@property (readwrite, nonatomic, strong) NSNumber *totalPage, *totalRow;
4243
@property (readwrite, nonatomic, strong) NSMutableArray *list;
44+
@property (strong, nonatomic, readonly) NSArray *pinList, *noPinList;
4345
@property (readwrite, nonatomic, strong) NSDictionary *propertyArrayMap;
4446

4547
+ (Projects *)projectsWithType:(ProjectsType)type andUser:(User *)user;
@@ -49,38 +51,6 @@ typedef NS_ENUM(NSInteger, ProjectsType)
4951

5052
@end
5153

52-
@interface Project : NSObject
53-
@property (readwrite, nonatomic, strong) NSString *icon, *name, *owner_user_name, *backend_project_path, *full_name, *description_mine, *path, *parent_depot_path;
54-
@property (readwrite, nonatomic, strong) NSNumber *id, *owner_id, *is_public, *un_read_activities_count, *done, *processing, *star_count, *stared, *watch_count, *watched, *fork_count, *forked, *recommended;
55-
@property (assign, nonatomic) BOOL isStaring, isWatching, isLoadingMember, isLoadingDetail;
56-
57-
@property (strong, nonatomic) NSString *readMeHtml;
58-
@property (assign, nonatomic) CGFloat readMeHeight;
59-
60-
+ (Project *)project_All;
61-
+ (Project *)project_FeedBack;
62-
63-
- (NSString *)toProjectPath;
64-
- (NSDictionary *)toCreateParams;
65-
66-
- (NSString *)toUpdatePath;
67-
- (NSDictionary *)toUpdateParams;
68-
69-
- (NSString *)toUpdateIconPath;
70-
71-
- (NSString *)toDeletePath;
72-
- (NSDictionary *)toDeleteParamsWithPassword:(NSString *)password;
73-
74-
- (NSString *)toMembersPath;
75-
- (NSDictionary *)toMembersParams;
76-
77-
- (NSString *)toUpdateVisitPath;
78-
- (NSString *)toDetailPath;
79-
80-
- (NSString *)localMembersPath;
81-
82-
- (NSString *)toBranchOrTagPath:(NSString *)path;
83-
@end
8454

8555

8656

0 commit comments

Comments
 (0)