summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2013-12-07 14:54:04 +0400
committerGravatar Vitaly Takmazov2013-12-07 14:54:04 +0400
commit78d6e25f674d083466e32051c26e8ee5ea840afe (patch)
tree9efdae36561f5555cc36231f30ddf2adc3c4e58e
parent1b1c8ed0549432071d85952f767b8b72e35f8e0a (diff)
fix constraints
-rw-r--r--Juick.xcodeproj/project.pbxproj16
-rw-r--r--Juick/AppDelegate.m2
-rw-r--r--Juick/AttachPlaceholder@2x.png (renamed from Juick/AttachPlaceholder.png)bin15565 -> 15565 bytes
-rw-r--r--Juick/MessageCell.m34
-rw-r--r--Juick/MessagesViewController.m30
-rw-r--r--Podfile2
-rw-r--r--Podfile.lock8
7 files changed, 40 insertions, 52 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj
index c53013f..f5ba7d9 100644
--- a/Juick.xcodeproj/project.pbxproj
+++ b/Juick.xcodeproj/project.pbxproj
@@ -21,7 +21,7 @@
77317BD0181BBE8500D60005 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77317BAF181BBE8500D60005 /* UIKit.framework */; };
77317BD8181BBE8500D60005 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 77317BD6181BBE8500D60005 /* InfoPlist.strings */; };
77317BDA181BBE8500D60005 /* JuickTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 77317BD9181BBE8500D60005 /* JuickTests.m */; };
- 77418CBB182F9A78004111B7 /* AttachPlaceholder.png in Resources */ = {isa = PBXBuildFile; fileRef = 77418CBA182F9A78004111B7 /* AttachPlaceholder.png */; };
+ 77418CBB182F9A78004111B7 /* AttachPlaceholder@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 77418CBA182F9A78004111B7 /* AttachPlaceholder@2x.png */; };
77418CBD182FB9B6004111B7 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77418CBC182FB9B6004111B7 /* ImageIO.framework */; };
77418CBF182FBAB5004111B7 /* iTunesArtwork in Resources */ = {isa = PBXBuildFile; fileRef = 77418CBE182FBAB5004111B7 /* iTunesArtwork */; };
77418CC1182FBABB004111B7 /* iTunesArtwork@2x in Resources */ = {isa = PBXBuildFile; fileRef = 77418CC0182FBABB004111B7 /* iTunesArtwork@2x */; };
@@ -69,7 +69,7 @@
77317BD5181BBE8500D60005 /* JuickTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "JuickTests-Info.plist"; sourceTree = "<group>"; };
77317BD7181BBE8500D60005 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
77317BD9181BBE8500D60005 /* JuickTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JuickTests.m; sourceTree = "<group>"; };
- 77418CBA182F9A78004111B7 /* AttachPlaceholder.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AttachPlaceholder.png; sourceTree = "<group>"; };
+ 77418CBA182F9A78004111B7 /* AttachPlaceholder@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "AttachPlaceholder@2x.png"; sourceTree = "<group>"; };
77418CBC182FB9B6004111B7 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
77418CBE182FBAB5004111B7 /* iTunesArtwork */ = {isa = PBXFileReference; lastKnownFileType = file; path = iTunesArtwork; sourceTree = "<group>"; };
77418CC0182FBABB004111B7 /* iTunesArtwork@2x */ = {isa = PBXFileReference; lastKnownFileType = file; path = "iTunesArtwork@2x"; sourceTree = "<group>"; };
@@ -166,7 +166,7 @@
isa = PBXGroup;
children = (
77418CC0182FBABB004111B7 /* iTunesArtwork@2x */,
- 77418CBA182F9A78004111B7 /* AttachPlaceholder.png */,
+ 77418CBA182F9A78004111B7 /* AttachPlaceholder@2x.png */,
77418CBE182FBAB5004111B7 /* iTunesArtwork */,
77C67EE918283C8D00427098 /* buttons.png */,
77C67EE31828342000427098 /* NSURL+PathParameters.h */,
@@ -308,7 +308,7 @@
77418CC1182FBABB004111B7 /* iTunesArtwork@2x in Resources */,
77418CBF182FBAB5004111B7 /* iTunesArtwork in Resources */,
77317BB6181BBE8500D60005 /* InfoPlist.strings in Resources */,
- 77418CBB182F9A78004111B7 /* AttachPlaceholder.png in Resources */,
+ 77418CBB182F9A78004111B7 /* AttachPlaceholder@2x.png in Resources */,
77C67EDE182827DB00427098 /* reveal-icon.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -444,7 +444,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.1;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
@@ -476,7 +476,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.1;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
@@ -495,7 +495,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Juick/Juick-Prefix.pch";
INFOPLIST_FILE = "Juick/Juick-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.1;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
@@ -515,7 +515,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Juick/Juick-Prefix.pch";
INFOPLIST_FILE = "Juick/Juick-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 6.1;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m
index 874ea94..a776b43 100644
--- a/Juick/AppDelegate.m
+++ b/Juick/AppDelegate.m
@@ -28,6 +28,8 @@
// make the status bar white
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
+ AFNetworkActivityIndicatorManager.sharedManager.enabled = YES;
+
MessagesViewController *messages = [[MessagesViewController alloc] init];
RevealPanelViewController *rear = [[RevealPanelViewController alloc] init];
diff --git a/Juick/AttachPlaceholder.png b/Juick/AttachPlaceholder@2x.png
index 94e8c32..94e8c32 100644
--- a/Juick/AttachPlaceholder.png
+++ b/Juick/AttachPlaceholder@2x.png
Binary files differ
diff --git a/Juick/MessageCell.m b/Juick/MessageCell.m
index 0777dfd..3f06436 100644
--- a/Juick/MessageCell.m
+++ b/Juick/MessageCell.m
@@ -9,6 +9,7 @@
#import "MessageCell.h"
#import "ColorsAndButtons.h"
#import "Masonry.h"
+#import "JMImageCache.h"
@interface MessageCell ()
@@ -23,12 +24,10 @@
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setBackgroundColor:[UIColor whiteColor]];
-
self.avatar = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
[self.avatar setBackgroundColor:[UIColor clearColor]];
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
- [self.titleLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.titleLabel setLineBreakMode:NSLineBreakByTruncatingTail];
[self.titleLabel setNumberOfLines:1];
[self.titleLabel setTextAlignment:NSTextAlignmentLeft];
@@ -36,7 +35,6 @@
[self.titleLabel setBackgroundColor:[UIColor clearColor]];
self.timestampLabel = [[UILabel alloc] initWithFrame:CGRectZero];
- [self.timestampLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.timestampLabel setLineBreakMode:NSLineBreakByTruncatingTail];
[self.timestampLabel setNumberOfLines:1];
[self.timestampLabel setTextAlignment:NSTextAlignmentLeft];
@@ -46,7 +44,6 @@
self.bodyLabel = [[TTTAttributedLabel alloc] initWithFrame:CGRectZero];
self.bodyLabel.dataDetectorTypes = NSTextCheckingTypeLink;
self.bodyLabel.delegate = self;
- [self.bodyLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.bodyLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
[self.bodyLabel setLineBreakMode:NSLineBreakByTruncatingTail];
[self.bodyLabel setNumberOfLines:0];
@@ -94,41 +91,42 @@
[self.avatar makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contentView.top).with.offset(padding.top);
- make.leading.equalTo(self.contentView.leading).with.offset(padding.left);
+ make.left.equalTo(self.contentView.left).with.offset(padding.left);
make.width.equalTo(@32);
make.height.equalTo(@32);
}];
[self.titleLabel makeConstraints:^(MASConstraintMaker *make) {
- make.leading.equalTo(self.avatar.trailing).with.offset(padding.right);
+ make.left.equalTo(self.avatar.right).with.offset(padding.right);
make.top.equalTo(self.contentView.top).with.offset(padding.top);
- make.trailing.equalTo(self.contentView.trailing).with.offset(-padding.right);
+ make.right.equalTo(self.contentView.right).with.offset(-padding.right);
}];
[self.timestampLabel makeConstraints:^(MASConstraintMaker *make) {
- make.leading.equalTo(self.avatar.trailing).with.offset(padding.left);
+ make.left.equalTo(self.avatar.right).with.offset(padding.left);
make.top.equalTo(self.titleLabel.bottom).with.offset(padding.top /2);
- make.trailing.equalTo(self.contentView.trailing).with.offset(-padding.right);
+ make.right.equalTo(self.contentView.right).with.offset(-padding.right);
+ make.bottom.equalTo(self.bodyLabel.top).with.offset(-padding.bottom);
}];
-
[self.bodyLabel makeConstraints:^(MASConstraintMaker *make) {
- make.leading.equalTo(self.contentView.leading).with.offset(padding.left);
+ make.left.equalTo(self.contentView.left).with.offset(padding.left);
make.top.equalTo(self.timestampLabel.bottom).with.offset(padding.top);
- make.trailing.equalTo(self.contentView.trailing).with.offset(-padding.right);
+ make.right.equalTo(self.contentView.right).with.offset(-padding.right);
make.bottom.equalTo(self.attach.top).with.offset(-padding.bottom);
}];
[self.attach makeConstraints:^(MASConstraintMaker *make) {
- make.leading.equalTo(self.contentView.leading).with.offset(padding.left);
+ make.left.equalTo(self.contentView.left).with.offset(padding.left);
make.bottom.equalTo(self.summaryLabel.top).with.offset(-padding.bottom);
- make.trailing.equalTo(self.contentView.trailing).with.offset(-padding.right);
+ make.right.equalTo(self.contentView.right).with.offset(-padding.right);
make.top.equalTo(self.bodyLabel.bottom).with.offset(padding.top);
}];
[self.summaryLabel makeConstraints:^(MASConstraintMaker *make) {
- make.leading.equalTo(self.contentView.leading).with.offset(padding.left);
+ make.left.equalTo(self.contentView.left).with.offset(padding.left);
make.bottom.equalTo(self.contentView.bottom).with.offset(-padding.bottom);
- make.trailing.equalTo(self.contentView.trailing).with.offset(-padding.right);
+ make.right.equalTo(self.contentView.right).with.offset(-padding.right);
+ make.top.equalTo(self.attach.bottom).with.offset(padding.top);
}];
@@ -148,7 +146,7 @@
}
- (void) bind:(Message *)msg {
- [self.avatar setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://i.juick.com/as/%@.png", msg.userID]]];
+ [self.avatar setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://i.juick.com/as/%d.png", [msg.userID intValue]]]];
self.titleLabel.text = msg.user;
self.timestampLabel.text = msg.timestamp;
@@ -167,7 +165,7 @@
[msg.text stringByDecodingHTMLEntities]];
}
if ([msg.attach length] > 0) {
- [self.attach setImageWithURL:[NSURL URLWithString:msg.attach]];
+ [self.attach setImageWithURL:[NSURL URLWithString:msg.attach] key:[NSString stringWithFormat:@"%d", [msg.MID intValue]] placeholder:[UIImage imageNamed:@"AttachPlaceholder.png"]];
} else {
self.attach.image = nil;
}
diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m
index 7369bd9..4beeb1c 100644
--- a/Juick/MessagesViewController.m
+++ b/Juick/MessagesViewController.m
@@ -18,7 +18,6 @@
#import "NSURL+PathParameters.h"
-#import <SDWebImage/UIImageView+WebCache.h>
static NSString *CellIdentifier = @"MessageCell";
@@ -43,14 +42,8 @@ static NSString *CellIdentifier = @"MessageCell";
[self.messages removeAllObjects];
[self.tableView reloadData];
[Message pullNextFromURL:self.url callback:^(NSArray *next) {
- [self.tableView beginUpdates];
- CGPoint offset = self.tableView.contentOffset;
- for (int i = 0; i < [next count]; i++) {
- [self.messages addObject:[next objectAtIndex:i]];
- [self.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:self.messages.count-1 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
- }
- [self.tableView setContentOffset:offset animated:NO];
- [self.tableView endUpdates];
+ [self.messages addObjectsFromArray:next];
+ [self.tableView reloadData];
[refresh endRefreshing];
}];
}
@@ -61,7 +54,7 @@ static NSString *CellIdentifier = @"MessageCell";
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
- if (self.url.absoluteString == [Message threadUrl]) {
+ if ([self.url.absoluteString hasPrefix:[Message threadUrl]]) {
return;
}
CGPoint pos = scrollView.contentOffset;
@@ -72,14 +65,11 @@ static NSString *CellIdentifier = @"MessageCell";
Message * lastMessage = [self.messages lastObject];
NSURL *beforeUrl = [self.url URLByAppendingParameters:[NSDictionary dictionaryWithObjectsAndKeys:lastMessage.MID, @"before_mid", nil]];
[Message pullNextFromURL:beforeUrl callback:^(NSArray *next) {
- [self.tableView beginUpdates];
- for (int i = 0; i < [next count]; i++) {
- [self.messages addObject:[next objectAtIndex:i]];
- [self.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:self.messages.count-1 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
- }
- [self.tableView setContentOffset:pos animated:NO];
- [self.tableView endUpdates];
- self.dataLoading = NO;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self.messages addObjectsFromArray:next];
+ [self.tableView reloadData];
+ self.dataLoading = NO;
+ });
}];
});
@@ -184,7 +174,7 @@ static NSString *CellIdentifier = @"MessageCell";
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
- return 100.0f;
+ return 500.0f;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -192,7 +182,7 @@ static NSString *CellIdentifier = @"MessageCell";
return;
Message *msg = [_messages objectAtIndex:indexPath.row];
MessagesViewController *threadViewController = [[MessagesViewController alloc] init];
- [threadViewController loadFromURL:[[NSURL URLWithString:[Message threadUrl]] URLByAppendingParameters:[NSDictionary dictionaryWithObjectsAndKeys:msg.MID, @"mid", nil]] withTitle:[NSString stringWithFormat:@"#%@", msg.MID]];
+ [threadViewController loadFromURL:[[NSURL URLWithString:[Message threadUrl]] URLByAppendingParameters:[NSDictionary dictionaryWithObjectsAndKeys:msg.MID, @"mid", nil]] withTitle:@"Thread"];
[self.navigationController pushViewController:threadViewController animated:NO];
}
diff --git a/Podfile b/Podfile
index edb4893..41427a5 100644
--- a/Podfile
+++ b/Podfile
@@ -8,7 +8,7 @@ pod 'Masonry'
pod 'SWRevealViewController'
pod 'PDKeychainBindingsController'
pod 'RestKit'
-pod 'SDWebImage'
+pod 'JMImageCache'
end
target "JuickTests" do
diff --git a/Podfile.lock b/Podfile.lock
index 474fc11..286acea 100644
--- a/Podfile.lock
+++ b/Podfile.lock
@@ -2,6 +2,7 @@ PODS:
- AFNetworking (1.3.3)
- ISO8601DateFormatterValueTransformer (0.5.0):
- RKValueTransformers (~> 1.0.0)
+ - JMImageCache (0.4.0)
- Masonry (0.2.4)
- MWFeedParser (0.0.1):
- MWFeedParser/Feed
@@ -32,32 +33,29 @@ PODS:
- RestKit/Support (0.21.0):
- TransitionKit (= 1.1.1)
- RKValueTransformers (1.0.1)
- - SDWebImage (3.5):
- - SDWebImage/Core
- - SDWebImage/Core (3.5)
- SOCKit (1.1)
- SWRevealViewController (1.0.8)
- TransitionKit (1.1.1)
- TTTAttributedLabel (1.7.1)
DEPENDENCIES:
+ - JMImageCache
- Masonry
- MWFeedParser
- PDKeychainBindingsController
- RestKit
- - SDWebImage
- SWRevealViewController
- TTTAttributedLabel
SPEC CHECKSUMS:
AFNetworking: 0700ec7a58c36ad217173e167f6e4df7270df66b
ISO8601DateFormatterValueTransformer: d0af1f50a9df42db72d7418db31938b8473e0af8
+ JMImageCache: 4d764ca5819ce5b0b3bb1efb85c29977768c54bd
Masonry: 73df2f346bd1a0044dc9de969aa45aea2f8a9bd8
MWFeedParser: 2ca0852fac352f8333d5f46fdd4b583b921e0c4e
PDKeychainBindingsController: 463c207f8726e4aaec1ec20fd1876082ee86cb0a
RestKit: c11a30e7bc73513d9d2c2695672aba7697d24181
RKValueTransformers: 1562d458b9c9d59ce777bfc5982f2e1aef2e9182
- SDWebImage: f1a72472f8a2d54445f1fedafe2090593d9caf7f
SOCKit: 2f3bc4d07910de12dcc202815e07db68a3802581
SWRevealViewController: 5688d9d017e228c9edd92db359f670d8c47ab8e6
TransitionKit: d0e3344aac92991395d4c2e72d9c5a8ceeb12910