Skip to content

Commit 7bcef46

Browse files
committed
bugfix
1 parent 7464be3 commit 7bcef46

4 files changed

Lines changed: 30 additions & 12 deletions

File tree

Coding_iOS/Controllers/NProjectViewController/NProjectViewController.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ - (void)refresh{
9191
CGFloat readMeHeight = weakSelf.myProject.readMeHeight;
9292
weakSelf.myProject = data;
9393
weakSelf.myProject.readMeHeight = readMeHeight;
94-
94+
weakSelf.myProActs = [ProjectActivities proActivitiesWithPro:weakSelf.myProject type:ProjectActivityTypeAll];
95+
9596
weakSelf.myTableView.showsInfiniteScrolling = !weakSelf.myProject.is_public.boolValue;
9697

9798
if (weakSelf.myProject.is_public.boolValue) {
@@ -113,13 +114,13 @@ - (void)refreshReadMe{
113114
[weakSelf.view endLoading];
114115
if (data) {
115116
weakSelf.myProject.readMeHtml = data;
116-
[weakSelf.myTableView reloadData];
117117
}
118+
[weakSelf.myTableView reloadData];
118119
}];
119120
}
120121

121122
- (void)refreshActivityMore:(BOOL)loadMore{
122-
if (_myProActs.isLoading) {
123+
if (!_myProActs.user_id || _myProActs.isLoading) {
123124
return;
124125
}
125126
_myProActs.willLoadMore = loadMore;
@@ -131,9 +132,9 @@ - (void)refreshActivityMore:(BOOL)loadMore{
131132
[weakSelf.myTableView.infiniteScrollingView stopAnimating];
132133
if (data) {
133134
[weakSelf.myProActs configWithProActList:data];
134-
[weakSelf.myTableView reloadData];
135135
weakSelf.myTableView.showsInfiniteScrolling = weakSelf.myProActs.canLoadMore;
136136
}
137+
[weakSelf.myTableView reloadData];
137138
}];
138139
}
139140

Coding_iOS/Util/Manager/Coding_NetAPIManager.m

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,13 +1275,28 @@ - (void)request_ForkProject:(Project *)project andBlock:(void (^)(id data, NSErr
12751275
}
12761276
- (void)request_ReadMeOFProject:(Project *)project andBlock:(void (^)(id data, NSError *error))block{
12771277
[MobClick event:kUmeng_Event_Request label:@"项目_README"];
1278-
NSString *path = [NSString stringWithFormat:@"api/user/%@/project/%@/git/tree/master",project.owner_user_name, project.name];
1279-
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:path withParams:nil withMethodType:Get andBlock:^(id data, NSError *error) {
1280-
if (data) {
1281-
NSString *readMeHtml = [[[data valueForKey:@"data"] valueForKey:@"readme"] valueForKey:@"preview"];
1282-
block(readMeHtml? readMeHtml: @"我们推荐每个项目都新建一个README文件", nil);
1278+
1279+
[[Coding_NetAPIManager sharedManager] request_CodeBranchOrTagWithPath:@"list_branches" withPro:project andBlock:^(id dataTemp, NSError *errorTemp) {
1280+
if (dataTemp) {
1281+
__block NSString *defultBranch = @"master";
1282+
NSArray *branchList = (NSArray *)dataTemp;
1283+
[branchList enumerateObjectsUsingBlock:^(CodeBranchOrTag *obj, NSUInteger idx, BOOL *stop) {
1284+
if (obj.is_default_branch.boolValue) {
1285+
defultBranch = obj.name;
1286+
}
1287+
}];
1288+
1289+
NSString *path = [NSString stringWithFormat:@"api/user/%@/project/%@/git/tree/%@",project.owner_user_name, project.name, defultBranch];
1290+
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:path withParams:nil withMethodType:Get andBlock:^(id data, NSError *error) {
1291+
if (data) {
1292+
NSString *readMeHtml = [[[data valueForKey:@"data"] valueForKey:@"readme"] valueForKey:@"preview"];
1293+
block(readMeHtml? readMeHtml: @"我们推荐每个项目都新建一个README文件", nil);
1294+
}else{
1295+
block(nil, error);
1296+
}
1297+
}];
12831298
}else{
1284-
block(nil, error);
1299+
block(nil, errorTemp);
12851300
}
12861301
}];
12871302
}

Coding_iOS/Views/CCell/TweetLikeUserCCell.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ - (void)configWithUser:(User *)user likesNum:(NSNumber *)likes{
3434
_likesLabel.hidden = YES;
3535
}
3636
}else{
37+
[self.imgView sd_setImageWithURL:nil];
3738
[self.imgView setImage:[UIImage imageWithColor:[UIColor colorWithHexString:@"0xdadada"]]];
3839
if (!_likesLabel) {
3940
_likesLabel = [[UILabel alloc] initWithFrame:_imgView.frame];

Coding_iOS/Views/Cell/TweetDetailCell.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define kTweetDetailCell_PadingBottom 10.0
1717
#define kTweetDetailCell_LikeUserCCell_Height 25.0
1818
#define kTweetDetailCell_LikeUserCCell_Pading 10.0
19-
#define kTweetDetailCell_LikeNumMax 10
19+
#define kTweetDetailCell_LikeNumMax ((kDevice_Is_iPhone6 || kDevice_Is_iPhone6Plus)? 11: 9)
2020

2121

2222

@@ -44,6 +44,7 @@ @implementation TweetDetailCell
4444

4545
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
4646
{
47+
4748
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
4849
if (self) {
4950
// Initialization code
@@ -383,7 +384,7 @@ - (void)locationBtnClicked:(id)sender{
383384
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
384385
NSInteger row = 0;
385386
if (_tweet.like_users.count > 0) {
386-
row = MIN(_tweet.like_users.count, kTweetDetailCell_LikeNumMax);
387+
row = MIN(_tweet.like_users.count +1, kTweetDetailCell_LikeNumMax);
387388
}
388389
return row;
389390
}

0 commit comments

Comments
 (0)