Skip to content

Commit

Permalink
Fix bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
titman committed Jul 31, 2015
1 parent 7d220e4 commit 3126ac1
Show file tree
Hide file tree
Showing 20 changed files with 121 additions and 84 deletions.
4 changes: 4 additions & 0 deletions LIKE/LIKE.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
13892C3B1B1C31E40053303E /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 13892C3A1B1C31E30053303E /* [email protected] */; };
13892C3D1B1C44780053303E /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 13892C3C1B1C44780053303E /* [email protected] */; };
13892C671B1DD2B50053303E /* MMMaterialDesignSpinner.m in Sources */ = {isa = PBXBuildFile; fileRef = 13892C661B1DD2B50053303E /* MMMaterialDesignSpinner.m */; };
138C84771B6B650C00C2AC62 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 138C84761B6B650C00C2AC62 /* [email protected] */; };
138EDBF31AD7B08A0020957C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 138EDBF21AD7B08A0020957C /* main.m */; };
138EDBF61AD7B08A0020957C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 138EDBF51AD7B08A0020957C /* AppDelegate.m */; };
138EDBFC1AD7B08A0020957C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 138EDBFA1AD7B08A0020957C /* Main.storyboard */; };
Expand Down Expand Up @@ -943,6 +944,7 @@
13892C5C1B1DC4D40053303E /* MainInterface.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MainInterface.storyboard; sourceTree = "<group>"; };
13892C651B1DD2B50053303E /* MMMaterialDesignSpinner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMMaterialDesignSpinner.h; sourceTree = "<group>"; };
13892C661B1DD2B50053303E /* MMMaterialDesignSpinner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMMaterialDesignSpinner.m; sourceTree = "<group>"; };
138C84761B6B650C00C2AC62 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
138EDBED1AD7B08A0020957C /* LIKE.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LIKE.app; sourceTree = BUILT_PRODUCTS_DIR; };
138EDBF21AD7B08A0020957C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
138EDBF41AD7B08A0020957C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4502,6 +4504,7 @@
13478CB51B6636770012EDA2 /* [email protected] */,
13478CB61B6636770012EDA2 /* [email protected] */,
13D549E61B61114B00D3CA2C /* [email protected] */,
138C84761B6B650C00C2AC62 /* [email protected] */,
1377F0361B5E1240008E21BC /* [email protected] */,
1377F0371B5E1240008E21BC /* [email protected] */,
1377F0381B5E1240008E21BC /* [email protected] */,
Expand Down Expand Up @@ -4666,6 +4669,7 @@
13E3EE041B60996000A48E76 /* zh2HK.txt in Resources */,
1388B4FD1B01EFFB006F36AB /* [email protected] in Resources */,
13DEEC141AE789E6005E01A6 /* [email protected] in Resources */,
138C84771B6B650C00C2AC62 /* [email protected] in Resources */,
1387C34B1B31643D00B065A7 /* [email protected] in Resources */,
139C737F1B553EC20051B2C3 /* __LKFilterConsole.xib in Resources */,
13925A951B1477D2004D0656 /* [email protected] in Resources */,
Expand Down
4 changes: 2 additions & 2 deletions LIKE/LIKE/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ -(void) applicationWillEnterForeground:(UIApplication *)application
[LKNotificationCount startCheck];
}

if (self.enterBackgroundTimeInterval > 60 * 2) {
if (self.enterBackgroundTimeInterval > 60 * 5) {

//[self postNotification:LKHomeViewControllerReloadingData];
[self postNotification:LKHomeViewControllerReloadingData];
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,5 @@
"RecommentReason1" = "Based on tag";
"RecommentReason2" = "Editor pick";
"RecommentReason3" = "Mybe you like";
"RecommentReason4" = "Following";

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
134 changes: 66 additions & 68 deletions LIKE/LIKE/LKApplication/Application/Home/LKHomeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ -(void) buildUI

self.header.backgroundAction = ^(id value){

/*
// upload cover.
@normally(self);
Expand All @@ -300,6 +301,7 @@ -(void) buildUI
}
}];
}
*/

};

Expand Down Expand Up @@ -624,10 +626,10 @@ -(void) handleNotification:(NSNotification *)notification
}
else if ([notification is:LKHomeViewControllerReloadingData]){

if (self.feedType == LKHomepageFeedTypeFocus) {

[self handleNavigationBarButton:LCUINavigationBarButtonTypeLeft];
}
// if (self.feedType == LKHomepageFeedTypeFocus) {
//
// [self handleNavigationBarButton:LCUINavigationBarButtonTypeLeft];
// }

[self loadData:LCUIPullLoaderDiretionTop];
}
Expand All @@ -649,8 +651,66 @@ -(void) addTag:(NSString *)tag onPost:(LKPost *)post onCell:(LKHomeTableViewCell
{
@weakly(self);


LKTag * tagValue = [[LKTag alloc] init];
tagValue.tag = tag;
tagValue.likes = @1;
tagValue.createTime = @([[NSDate date] timeIntervalSince1970]);
tagValue.isLiked = YES;
tagValue.user = LKLocalUser.singleton.user;
tagValue.id = @99999999;

[post.tags insertObject:tagValue atIndex:0];


// reload tags...
[cell reloadTags];

NSIndexPath * indexPath = nil;

if (self.feedType == LKHomepageFeedTypeFocus) {

indexPath = [self.attentionViewController.tableView indexPathForCell:cell];
}
else{

indexPath = [self.tableView indexPathForCell:cell];
}


// reload row...
if (indexPath) {

post.user.likes = @(post.user.likes.integerValue + 1);


if (self.feedType == LKHomepageFeedTypeFocus) {

[self.attentionViewController.tableView beginUpdates];
cell.post = post;
[self.attentionViewController.tableView endUpdates];

}
else{

[self.tableView beginUpdates];
cell.post = post;
[self.tableView endUpdates];
}

[cell newTagAnimation:^(BOOL finished) {

}];

}

// input view...
[self.inputView resignFirstResponder];

//
self.inputView.textField.text = @"";


[LKTagAddModel addTagString:tag onPost:post requestFinished:^(LKHttpRequestResult *result, NSString *error) {

@normally(self);
Expand All @@ -664,72 +724,10 @@ -(void) addTag:(NSString *)tag onPost:(LKPost *)post onCell:(LKHomeTableViewCell
// insert...
LKTag * tag = [LKTag objectFromDictionary:result.json[@"data"]];

if (!tag) {

[self.inputView resignFirstResponder];
self.inputView.textField.text = @"";
if (tag) {
tagValue.id = tag.id;
return;
}

[post.tags insertObject:tag atIndex:0];


// reload tags...
[cell reloadTags];

NSIndexPath * indexPath = nil;

if (self.feedType == LKHomepageFeedTypeFocus) {

indexPath = [self.attentionViewController.tableView indexPathForCell:cell];
}
else{

indexPath = [self.tableView indexPathForCell:cell];
}


// reload row...
if (indexPath) {

post.user.likes = @(post.user.likes.integerValue + 1);


if (self.feedType == LKHomepageFeedTypeFocus) {

[self.attentionViewController.tableView beginUpdates];
cell.post = post;
[self.attentionViewController.tableView endUpdates];

}
else{

[self.tableView beginUpdates];
cell.post = post;
[self.tableView endUpdates];
}

[cell newTagAnimation:^(BOOL finished) {

// if (self.feedType == LKHomepageFeedTypeFocus) {
//
// [self.attentionViewController.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
//
// }
// else{
//
// [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
// }

}];

}

// input view...
[self.inputView resignFirstResponder];

//
self.inputView.textField.text = @"";
}

}];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#import "LKTagCommentsViewController.h"
#import "LKTime.h"
#import "LKPresentAnimation.h"
#import "ADTickerLabel.h"

@interface LKPostDetailViewController ()<UITableViewDataSource,UITableViewDelegate,JTSImageViewControllerDismissalDelegate,UINavigationControllerDelegate,UIViewControllerTransitioningDelegate>

Expand All @@ -41,6 +42,8 @@ @interface LKPostDetailViewController ()<UITableViewDataSource,UITableViewDelega

LC_PROPERTY(strong) LCUIImageView * userHead;
LC_PROPERTY(strong) LCUILabel * userName;
LC_PROPERTY(strong) ADTickerLabel * userLikes;
LC_PROPERTY(strong) LCUILabel * likesTip;
LC_PROPERTY(strong) LCUILabel * postTime;


Expand Down Expand Up @@ -758,12 +761,35 @@ - (UITableViewCell *)tableView:(LCUITableView *)tableView cellForRowAtIndexPath:
self.userName.viewFrameWidth = LC_DEVICE_WIDTH - self.userName.viewFrameX - 75;
self.userName.viewFrameHeight = 15;
self.userName.textAlignment = UITextAlignmentLeft;
self.userName.font = LK_FONT(13);
self.userName.lineBreakMode = NSLineBreakByTruncatingMiddle;
self.userName.font = LK_FONT_B(13);
self.userName.lineBreakMode = NSLineBreakByTruncatingTail;
self.userName.textColor = LC_RGB(51, 51, 51);
configurationCell.ADD(self.userName);


self.userLikes = ADTickerLabel.view;
self.userLikes.viewFrameWidth = LC_DEVICE_WIDTH / 2 - 10 - 5;
self.userLikes.viewFrameHeight = LK_FONT(13).lineHeight;
self.userLikes.viewFrameY = self.userName.viewFrameY;
self.userLikes.font = LK_FONT(13);
self.userLikes.textAlignment = UITextAlignmentLeft;
self.userLikes.textColor = LC_RGB(51, 51, 51);
self.userLikes.changeTextAnimationDuration = 0.25;
configurationCell.ADD(self.userLikes);


self.likesTip = LCUILabel.view;
self.likesTip.font = LK_FONT(13);
self.likesTip.textAlignment = UITextAlignmentLeft;
self.likesTip.textColor = LC_RGB(51, 51, 51);
self.likesTip.text = @"likes";
self.likesTip.FIT();
self.likesTip.viewFrameY = self.userName.viewFrameY;
self.likesTip.viewFrameHeight = LK_FONT(13).lineHeight;
configurationCell.ADD(self.likesTip);



self.postTime = LCUILabel.view;
self.postTime.viewFrameY = self.userName.viewBottomY + 5;
self.postTime.viewFrameX = self.userHead.viewRightX + 10;
Expand Down Expand Up @@ -822,14 +848,23 @@ - (UITableViewCell *)tableView:(LCUITableView *)tableView cellForRowAtIndexPath:


self.userHead.url = self.post.user.avatar;
self.userName.text = LC_NSSTRING_FORMAT(@"%@ %@ likes", self.post.user.name, self.post.user.likes);
self.userName.text = self.post.user.name;
[self.userLikes setText:self.post.user.likes.description animated:NO];

NSMutableAttributedString * attString = [[NSMutableAttributedString alloc] initWithString:self.userName.text];
[attString addAttribute:NSFontAttributeName value:LK_FONT_B(13) range:[self.userName.text rangeOfString:self.post.user.name]];
CGSize likeSize = [self.userLikes.text sizeWithFont:LK_FONT(13) byWidth:200];

self.userLikes.viewFrameWidth = likeSize.width;
self.likesTip.FIT();

CGFloat maxWidth = LC_DEVICE_WIDTH - self.userName.viewFrameX - 75 - self.likesTip.viewFrameWidth - self.userLikes.viewFrameWidth - 15;

self.userName.attributedText = attString;
self.userName.viewFrameWidth = 1000;
self.userName.FIT();
self.userName.viewFrameWidth = self.userName.viewFrameWidth > maxWidth ? maxWidth : self.userName.viewFrameWidth;
self.userLikes.viewFrameX = self.userName.viewRightX + 5;
self.likesTip.viewFrameX = self.userLikes. viewRightX + 5;

self.postTime.text = [NSString stringWithFormat:@"%@ %@ %@", [LKTime dateNearByTimestamp:self.post.timestamp], self.post.place ? LC_LO(@"来自") : @"", self.post.place ? self.post.place : @""];
self.postTime.text = [NSString stringWithFormat:@"%@ %@ %@", [LKTime dateNearByTimestamp:self.post.timestamp], self.post.place.length ? LC_LO(@"来自") : @"", self.post.place.length ? self.post.place : @""];

return cell;
}
Expand Down Expand Up @@ -867,12 +902,7 @@ - (UITableViewCell *)tableView:(LCUITableView *)tableView cellForRowAtIndexPath:
self.post.user.likes = @(self.post.user.likes.integerValue - 1);
}

self.userName.text = LC_NSSTRING_FORMAT(@"%@ %@ likes", self.post.user.name, self.post.user.likes);

NSMutableAttributedString * attString = [[NSMutableAttributedString alloc] initWithString:self.userName.text];
[attString addAttribute:NSFontAttributeName value:LK_FONT_B(13) range:[self.userName.text rangeOfString:self.post.user.name]];

self.userName.attributedText = attString;
self.userLikes.text = self.post.user.likes.description;
};

cell.willRequest = ^(LKTagItem * item){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@ -(UIImage *) getIconImage:(NSInteger)type

return [UIImage imageNamed:@"LittleYouLike.png" useCache:YES];
}
else if(type == 4){

return [UIImage imageNamed:@"LittleFollowing.png" useCache:YES];
}

return nil;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ -(void) setComment:(LKComment *)comment
self.contentLabel.FIT();

self.timeLabel.viewFrameY = self.contentLabel.viewBottomY + 3;
self.timeLabel.text = [NSString stringWithFormat:@"%@ %@ %@", [LKTime dateNearByTimestamp:comment.timestamp], comment.place ? LC_LO(@"来自") : @"", comment.place ? comment.place : @""];
self.timeLabel.text = [NSString stringWithFormat:@"%@ %@ %@", [LKTime dateNearByTimestamp:comment.timestamp], comment.place.length ? LC_LO(@"来自") : @"", comment.place.length ? comment.place : @""];
self.timeLabel.FIT();


Expand Down
Binary file added LIKE/LIKE/LKResource/Home/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3126ac1

Please sign in to comment.