summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2013-11-05 00:10:01 +0400
committerGravatar Vitaly Takmazov2013-11-05 00:10:01 +0400
commitfad0e1e93e1f2e145970829f81a0c20e42eba09a (patch)
tree2f69b3fb901e66e9fa01f876b110649ac4acef41
parent08574251153406e4755f58c2ee5548ee32e308fb (diff)
RevealViewController and small other additions
-rw-r--r--Juick.xcodeproj/project.pbxproj36
-rw-r--r--Juick/AppDelegate.h3
-rw-r--r--Juick/AppDelegate.m26
-rw-r--r--Juick/Juick-Info.plist6
-rw-r--r--Juick/Main.storyboard81
-rw-r--r--Juick/MessagesViewController.h (renamed from Juick/MasterViewController.h)3
-rw-r--r--Juick/MessagesViewController.m (renamed from Juick/MasterViewController.m)47
-rw-r--r--Juick/NSURL+PathParameters.h37
-rw-r--r--Juick/NSURL+PathParameters.m173
-rw-r--r--Juick/RevealPanelViewController.h13
-rw-r--r--Juick/RevealPanelViewController.m69
-rw-r--r--Juick/reveal-icon.pngbin0 -> 1118 bytes
-rw-r--r--Juick/reveal-icon@2x.pngbin0 -> 1066 bytes
-rw-r--r--Podfile1
-rw-r--r--Podfile.lock3
15 files changed, 391 insertions, 107 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj
index 978e6d5..0b5eb79 100644
--- a/Juick.xcodeproj/project.pbxproj
+++ b/Juick.xcodeproj/project.pbxproj
@@ -14,7 +14,7 @@
77317BB6181BBE8500D60005 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 77317BB4181BBE8500D60005 /* InfoPlist.strings */; };
77317BB8181BBE8500D60005 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 77317BB7181BBE8500D60005 /* main.m */; };
77317BBC181BBE8500D60005 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 77317BBB181BBE8500D60005 /* AppDelegate.m */; };
- 77317BC2181BBE8500D60005 /* MasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77317BC1181BBE8500D60005 /* MasterViewController.m */; };
+ 77317BC2181BBE8500D60005 /* MessagesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77317BC1181BBE8500D60005 /* MessagesViewController.m */; };
77317BC7181BBE8500D60005 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 77317BC6181BBE8500D60005 /* Images.xcassets */; };
77317BCE181BBE8500D60005 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77317BCD181BBE8500D60005 /* XCTest.framework */; };
77317BCF181BBE8500D60005 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77317BAB181BBE8500D60005 /* Foundation.framework */; };
@@ -22,7 +22,10 @@
77317BD8181BBE8500D60005 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 77317BD6181BBE8500D60005 /* InfoPlist.strings */; };
77317BDA181BBE8500D60005 /* JuickTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 77317BD9181BBE8500D60005 /* JuickTests.m */; };
77A0954A181F1F25002BDECD /* Message.m in Sources */ = {isa = PBXBuildFile; fileRef = 77A09549181F1F25002BDECD /* Message.m */; };
- 77A09569181F98D0002BDECD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 77A09568181F98D0002BDECD /* Main.storyboard */; };
+ 77C67EDE182827DB00427098 /* reveal-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 77C67EDC182827DB00427098 /* reveal-icon.png */; };
+ 77C67EDF182827DB00427098 /* reveal-icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 77C67EDD182827DB00427098 /* reveal-icon@2x.png */; };
+ 77C67EE21828288C00427098 /* RevealPanelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE11828288C00427098 /* RevealPanelViewController.m */; };
+ 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE41828342000427098 /* NSURL+PathParameters.m */; };
77D163C2181F048F00401EF0 /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 77D163C1181F048F00401EF0 /* MessageCell.m */; };
/* End PBXBuildFile section */
@@ -47,8 +50,8 @@
77317BB9181BBE8500D60005 /* Juick-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Juick-Prefix.pch"; sourceTree = "<group>"; };
77317BBA181BBE8500D60005 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
77317BBB181BBE8500D60005 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
- 77317BC0181BBE8500D60005 /* MasterViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MasterViewController.h; sourceTree = "<group>"; };
- 77317BC1181BBE8500D60005 /* MasterViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MasterViewController.m; sourceTree = "<group>"; };
+ 77317BC0181BBE8500D60005 /* MessagesViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessagesViewController.h; sourceTree = "<group>"; };
+ 77317BC1181BBE8500D60005 /* MessagesViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessagesViewController.m; sourceTree = "<group>"; };
77317BC6181BBE8500D60005 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
77317BCC181BBE8500D60005 /* JuickTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JuickTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
77317BCD181BBE8500D60005 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
@@ -57,7 +60,12 @@
77317BD9181BBE8500D60005 /* JuickTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JuickTests.m; sourceTree = "<group>"; };
77A09548181F1F25002BDECD /* Message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Message.h; sourceTree = "<group>"; };
77A09549181F1F25002BDECD /* Message.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Message.m; sourceTree = "<group>"; };
- 77A09568181F98D0002BDECD /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
+ 77C67EDC182827DB00427098 /* reveal-icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "reveal-icon.png"; sourceTree = "<group>"; };
+ 77C67EDD182827DB00427098 /* reveal-icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "reveal-icon@2x.png"; sourceTree = "<group>"; };
+ 77C67EE01828288C00427098 /* RevealPanelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RevealPanelViewController.h; sourceTree = "<group>"; };
+ 77C67EE11828288C00427098 /* RevealPanelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RevealPanelViewController.m; sourceTree = "<group>"; };
+ 77C67EE31828342000427098 /* NSURL+PathParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+PathParameters.h"; sourceTree = "<group>"; };
+ 77C67EE41828342000427098 /* NSURL+PathParameters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+PathParameters.m"; sourceTree = "<group>"; };
77D163C0181F048F00401EF0 /* MessageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageCell.h; sourceTree = "<group>"; };
77D163C1181F048F00401EF0 /* MessageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageCell.m; sourceTree = "<group>"; };
AD52EBAFFD6B4395B342F246 /* Pods-Juick.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Juick.xcconfig"; path = "Pods/Pods-Juick.xcconfig"; sourceTree = "<group>"; };
@@ -124,17 +132,22 @@
77317BB1181BBE8500D60005 /* Juick */ = {
isa = PBXGroup;
children = (
+ 77C67EE31828342000427098 /* NSURL+PathParameters.h */,
+ 77C67EE41828342000427098 /* NSURL+PathParameters.m */,
+ 77C67EDC182827DB00427098 /* reveal-icon.png */,
+ 77C67EDD182827DB00427098 /* reveal-icon@2x.png */,
77317BBA181BBE8500D60005 /* AppDelegate.h */,
77317BBB181BBE8500D60005 /* AppDelegate.m */,
- 77317BC0181BBE8500D60005 /* MasterViewController.h */,
- 77317BC1181BBE8500D60005 /* MasterViewController.m */,
+ 77317BC0181BBE8500D60005 /* MessagesViewController.h */,
+ 77317BC1181BBE8500D60005 /* MessagesViewController.m */,
77317BC6181BBE8500D60005 /* Images.xcassets */,
77317BB2181BBE8500D60005 /* Supporting Files */,
77D163C0181F048F00401EF0 /* MessageCell.h */,
77D163C1181F048F00401EF0 /* MessageCell.m */,
77A09548181F1F25002BDECD /* Message.h */,
77A09549181F1F25002BDECD /* Message.m */,
- 77A09568181F98D0002BDECD /* Main.storyboard */,
+ 77C67EE01828288C00427098 /* RevealPanelViewController.h */,
+ 77C67EE11828288C00427098 /* RevealPanelViewController.m */,
);
path = Juick;
sourceTree = "<group>";
@@ -246,9 +259,10 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 77A09569181F98D0002BDECD /* Main.storyboard in Resources */,
+ 77C67EDF182827DB00427098 /* reveal-icon@2x.png in Resources */,
77317BC7181BBE8500D60005 /* Images.xcassets in Resources */,
77317BB6181BBE8500D60005 /* InfoPlist.strings in Resources */,
+ 77C67EDE182827DB00427098 /* reveal-icon.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -303,7 +317,9 @@
77D163C2181F048F00401EF0 /* MessageCell.m in Sources */,
77317BBC181BBE8500D60005 /* AppDelegate.m in Sources */,
77A0954A181F1F25002BDECD /* Message.m in Sources */,
- 77317BC2181BBE8500D60005 /* MasterViewController.m in Sources */,
+ 77317BC2181BBE8500D60005 /* MessagesViewController.m in Sources */,
+ 77C67EE21828288C00427098 /* RevealPanelViewController.m in Sources */,
+ 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */,
77317BB8181BBE8500D60005 /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/Juick/AppDelegate.h b/Juick/AppDelegate.h
index ae4c86a..087b6fd 100644
--- a/Juick/AppDelegate.h
+++ b/Juick/AppDelegate.h
@@ -8,8 +8,11 @@
#import <UIKit/UIKit.h>
+@class SWRevealViewController;
+
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
+@property (strong, nonatomic) SWRevealViewController *viewController;
@end
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m
index 23cef5e..3fa3030 100644
--- a/Juick/AppDelegate.m
+++ b/Juick/AppDelegate.m
@@ -7,12 +7,36 @@
//
#import "AppDelegate.h"
-#import "MasterViewController.h"
+#import "MessagesViewController.h"
+#import "RevealPanelViewController.h"
+#import "SWRevealViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
+ // style the navigation bar
+ UIColor* navColor = [UIColor colorWithRed:44/255.0f green:44/255.0f blue:44/255.0f alpha:1];
+ [[UINavigationBar appearance] setBarTintColor:navColor];
+ [[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1]];
+ [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1]}];
+
+ // make the status bar white
+ [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
+
+ MessagesViewController *messages = [[MessagesViewController alloc] initWithURL:[NSURL URLWithString:@"https://api.juick.com/messages"]];
+ RevealPanelViewController *rear = [[RevealPanelViewController alloc] init];
+
+ UINavigationController *main = [[UINavigationController alloc] initWithRootViewController:messages];
+ UINavigationController *rearNav = [[UINavigationController alloc] initWithRootViewController:rear];
+
+ SWRevealViewController *reveal = [[SWRevealViewController alloc] initWithRearViewController:rearNav frontViewController:main];
+ self.viewController = reveal;
+
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ self.window.rootViewController = reveal;
+ [self.window makeKeyAndVisible];
+
return YES;
}
diff --git a/Juick/Juick-Info.plist b/Juick/Juick-Info.plist
index f23f598..d651337 100644
--- a/Juick/Juick-Info.plist
+++ b/Juick/Juick-Info.plist
@@ -24,10 +24,6 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
- <key>NSMainNibFile~ipad</key>
- <string>Main-iPad</string>
- <key>UIMainStoryboardFile</key>
- <string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
@@ -48,5 +44,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
+ <key>UIViewControllerBasedStatusBarAppearance</key>
+ <false/>
</dict>
</plist>
diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard
deleted file mode 100644
index cac2c7f..0000000
--- a/Juick/Main.storyboard
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4514" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="Qpj-SN-g7s">
- <dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3746"/>
- </dependencies>
- <scenes>
- <!--Master View Controller - Root View Controller-->
- <scene sceneID="mFC-R0-94t">
- <objects>
- <tableViewController id="zP3-J3-AlH" customClass="MasterViewController" sceneMemberID="viewController">
- <tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="xve-h9-u9y">
- <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
- <prototypes>
- <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="hPo-AH-JGS">
- <rect key="frame" x="0.0" y="86" width="320" height="44"/>
- <autoresizingMask key="autoresizingMask"/>
- <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="hPo-AH-JGS" id="xzw-7U-vR0">
- <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
- <autoresizingMask key="autoresizingMask"/>
- </tableViewCellContentView>
- </tableViewCell>
- </prototypes>
- </tableView>
- <navigationItem key="navigationItem" title="Root View Controller" id="Fbj-Lo-jp7"/>
- </tableViewController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="IPJ-Mn-WGD" userLabel="First Responder" sceneMemberID="firstResponder"/>
- </objects>
- <point key="canvasLocation" x="-463" y="-520"/>
- </scene>
- <!--Table View Controller-->
- <scene sceneID="CD2-1U-nQh">
- <objects>
- <tableViewController id="bNv-gr-Gk5" sceneMemberID="viewController">
- <tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="akB-3D-ShF">
- <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
- <prototypes>
- <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="7nM-K0-Cs7">
- <rect key="frame" x="0.0" y="22" width="320" height="44"/>
- <autoresizingMask key="autoresizingMask"/>
- <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="7nM-K0-Cs7" id="9Oc-sb-RWf">
- <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
- <autoresizingMask key="autoresizingMask"/>
- </tableViewCellContentView>
- </tableViewCell>
- </prototypes>
- <connections>
- <outlet property="dataSource" destination="bNv-gr-Gk5" id="I2K-66-RJv"/>
- <outlet property="delegate" destination="bNv-gr-Gk5" id="XnG-ma-SEL"/>
- </connections>
- </tableView>
- </tableViewController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="3Ep-3c-Tc4" userLabel="First Responder" sceneMemberID="firstResponder"/>
- </objects>
- <point key="canvasLocation" x="75" y="-520"/>
- </scene>
- <!--Navigation Controller-->
- <scene sceneID="x3r-t4-FOl">
- <objects>
- <navigationController definesPresentationContext="YES" id="Qpj-SN-g7s" sceneMemberID="viewController">
- <navigationBar key="navigationBar" contentMode="scaleToFill" id="Kvi-Yn-XO9">
- <autoresizingMask key="autoresizingMask"/>
- </navigationBar>
- <connections>
- <segue destination="zP3-J3-AlH" kind="relationship" relationship="rootViewController" id="Uza-Dn-uOg"/>
- </connections>
- </navigationController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="hiT-dp-hgn" userLabel="First Responder" sceneMemberID="firstResponder"/>
- </objects>
- <point key="canvasLocation" x="-1153" y="-520"/>
- </scene>
- </scenes>
- <simulatedMetricsContainer key="defaultSimulatedMetrics">
- <simulatedStatusBarMetrics key="statusBar"/>
- <simulatedOrientationMetrics key="orientation"/>
- <simulatedScreenMetrics key="destination" type="retina4"/>
- </simulatedMetricsContainer>
-</document> \ No newline at end of file
diff --git a/Juick/MasterViewController.h b/Juick/MessagesViewController.h
index 5e92717..ceff611 100644
--- a/Juick/MasterViewController.h
+++ b/Juick/MessagesViewController.h
@@ -8,6 +8,7 @@
#import <UIKit/UIKit.h>
-@interface MasterViewController : UITableViewController
+@interface MessagesViewController : UITableViewController
+- (id)initWithURL:(NSURL *)messagesURL;
- (void) refreshData:(UIRefreshControl *)refresh;
@end
diff --git a/Juick/MasterViewController.m b/Juick/MessagesViewController.m
index 4ed8df1..19eebf4 100644
--- a/Juick/MasterViewController.m
+++ b/Juick/MessagesViewController.m
@@ -6,30 +6,43 @@
// Copyright (c) 2013 com.juick. All rights reserved.
//
-#import "MasterViewController.h"
+#import "SWRevealViewController.h"
+
+#import "MessagesViewController.h"
#import "MessageCell.h"
#import "Message.h"
+#import "NSURL+PathParameters.h"
+
static NSString *CellIdentifier = @"MessageCell";
-@interface MasterViewController ();
+@interface MessagesViewController ();
@property(nonatomic, strong) NSMutableArray *messages;
@property(nonatomic, assign) Boolean dataLoading;
+@property(nonatomic, strong) NSURL *url;
@end
-@implementation MasterViewController
+@implementation MessagesViewController
+
+- (id)initWithURL:(NSURL *)messagesURL
+{
+ self = [super init];
+ if (self) {
+ self.url = messagesURL;
+ }
+ return self;
+}
- (void) refreshData:(UIRefreshControl *)refresh {
[self.messages removeAllObjects];
[self.tableView reloadData];
- NSURL *url = [NSURL URLWithString:@"https://api.juick.com/messages"];
- NSArray *next = [Message pullNextFromURL:url];
- int64_t delayInSeconds = 2.0;
+ NSArray *next = [Message pullNextFromURL:self.url];
+ int64_t delayInSeconds = 1.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self.tableView beginUpdates];
@@ -44,15 +57,20 @@ static NSString *CellIdentifier = @"MessageCell";
});
}
+- (UIStatusBarStyle)preferredStatusBarStyle
+{
+ return UIStatusBarStyleLightContent;
+}
+
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGPoint pos = scrollView.contentOffset;
CGFloat contentHeight = scrollView.contentSize.height - scrollView.contentSize.height / 3;
if (pos.y >= contentHeight && !self.dataLoading) {
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
self.dataLoading = YES;
Message * lastMessage = [self.messages lastObject];
- NSArray *next = [Message pullNextFromURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://api.juick.com/messages?before_mid=%@", lastMessage.MID]]];
- int64_t delayInSeconds = 2.0;
+ NSArray *next = [Message pullNextFromURL:[self.url URLByAppendingParameters:[NSDictionary dictionaryWithObjectsAndKeys:lastMessage.MID, @"before_mid", nil]]];
+ int64_t delayInSeconds = 1.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self.tableView beginUpdates];
@@ -73,7 +91,14 @@ static NSString *CellIdentifier = @"MessageCell";
{
[super viewDidLoad];
self.dataLoading = NO;
- self.title = @"Messages";
+ self.title = @"Discover";
+ [self.view setBackgroundColor:[UIColor colorWithRed:238/255.0f green:238/255.0f blue:229/255.0f alpha:1.0f]];
+ SWRevealViewController *revealController = [self revealViewController];
+ [self.navigationController.navigationBar addGestureRecognizer:revealController.panGestureRecognizer];
+ UIBarButtonItem *revealButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reveal-icon.png"]
+ style:UIBarButtonItemStyleBordered target:revealController action:@selector(revealToggle:)];
+
+ self.navigationItem.leftBarButtonItem = revealButtonItem;
self.messages = [NSMutableArray array];
UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
[refresh addTarget:self action:@selector(refreshData:) forControlEvents:UIControlEventValueChanged];
@@ -129,7 +154,9 @@ static NSString *CellIdentifier = @"MessageCell";
Message *msg = [_messages objectAtIndex:indexPath.row];
[cell.avatar setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://i.juick.com/as/%@.png", msg.userID]]]]];
cell.titleLabel.text = msg.user;
+ cell.titleLabel.textColor = [UIColor colorWithRed:0 green:102/255.0f blue:153/255.0f alpha:1.0f];
cell.bodyLabel.text = msg.text;
+ [cell setBackgroundColor:[UIColor whiteColor]];
[cell setNeedsUpdateConstraints];
return cell;
}
diff --git a/Juick/NSURL+PathParameters.h b/Juick/NSURL+PathParameters.h
new file mode 100644
index 0000000..73fc004
--- /dev/null
+++ b/Juick/NSURL+PathParameters.h
@@ -0,0 +1,37 @@
+//
+// NSURL+PathParameters.h
+//
+// Created by Johan Kool on 27/9/2011.
+// Copyright 2011 Koolistov Pte. Ltd. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+// * Neither the name of KOOLISTOV PTE. LTD. nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+
+#import <Foundation/Foundation.h>
+
+@interface NSURL (PathParameters)
+
+- (NSURL *)URLByReplacingPathWithPath:(NSString *)path;
+- (NSURL *)URLByAppendingPathWithRelativePath:(NSString *)path;
+- (NSURL *)URLByAppendingParameters:(NSDictionary *)parameters;
+- (NSURL *)URLByAppendingParameterName:(NSString *)parameter value:(id)value;
+
+@end
diff --git a/Juick/NSURL+PathParameters.m b/Juick/NSURL+PathParameters.m
new file mode 100644
index 0000000..83a55bb
--- /dev/null
+++ b/Juick/NSURL+PathParameters.m
@@ -0,0 +1,173 @@
+//
+// NSURL+PathParameters.m
+//
+// Created by Johan Kool on 27/9/2011.
+// Copyright 2011 Koolistov Pte. Ltd. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification, are
+// permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice, this list of
+// conditions and the following disclaimer.
+// * Neither the name of KOOLISTOV PTE. LTD. nor the names of its contributors may be used to
+// endorse or promote products derived from this software without specific prior written
+// permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+// THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+// OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+
+#import "NSURL+PathParameters.h"
+
+@interface NSString (URLParameters)
+
+- (NSString *)stringByEscapingForURLArgument;
+
+@end
+
+@implementation NSString (URLParameters)
+
+- (NSString *)stringByEscapingForURLArgument {
+ // Encode all the reserved characters, per RFC 3986 (<http://www.ietf.org/rfc/rfc3986.txt>)
+ NSString *escapedString = (__bridge NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
+ (CFStringRef)self,
+ NULL,
+ (CFStringRef)@"!*'\"();:@&=+$,/?%#[] ",
+ kCFStringEncodingUTF8);
+ return [escapedString copy];
+}
+
+@end
+
+@implementation NSURL (PathParameters)
+
+- (NSURL *)URLByReplacingPathWithPath:(NSString *)path {
+ // scheme://username:password@domain:port/path?query_string#fragment_id
+
+ // Chop off path, query and fragment from absoluteString, then add new path and put back query and fragment
+
+ NSString *absoluteString = [self absoluteString];
+ NSUInteger endIndex = [absoluteString length];
+
+ NSString *fragment = [self fragment];
+ if (fragment) {
+ endIndex -= [fragment length];
+ endIndex--; // The # character
+ }
+
+ NSString *query = [self query];
+ if (query) {
+ endIndex -= [query length];
+ endIndex--; // The ? character
+ }
+
+ // Check if the last character of the path is a slash (range must be valid as endIndex must be smaller or equal to length)
+ BOOL trailingSlashOnPath = [[absoluteString substringWithRange:NSMakeRange(endIndex - 1, 1)] isEqualToString:@"/"];
+
+ NSString *originalPath = [self path]; // This method strips any trailing slash "/"
+ if (originalPath) {
+ endIndex -= [originalPath length];
+ if (trailingSlashOnPath && [originalPath length] > 1) { // Don't get confused with the starting slash
+ endIndex--;
+ }
+ }
+
+ absoluteString = [absoluteString substringToIndex:endIndex];
+ absoluteString = [absoluteString stringByAppendingString:path];
+ if (query) {
+ absoluteString = [absoluteString stringByAppendingString:@"?"];
+ absoluteString = [absoluteString stringByAppendingString:query];
+ }
+ if (fragment) {
+ absoluteString = [absoluteString stringByAppendingString:@"#"];
+ absoluteString = [absoluteString stringByAppendingString:fragment];
+ }
+
+ return [NSURL URLWithString:absoluteString];
+}
+
+- (NSURL *)URLByAppendingPathWithRelativePath:(NSString *)path {
+ NSString *originalPath = [self path];
+ NSString *combinedPath = [[originalPath stringByAppendingPathComponent:path] stringByStandardizingPath];
+ // Don't standardize away a trailing slash
+ if ([path length] > 1 && [path hasSuffix:@"/"]) {
+ combinedPath = [combinedPath stringByAppendingString:@"/"];
+ }
+ return [self URLByReplacingPathWithPath:combinedPath];
+}
+
+- (NSURL *)URLByAppendingParameters:(NSDictionary *)parameters {
+ NSMutableString *query = [[self query] mutableCopy];
+
+ if (!query) {
+ query = [NSMutableString stringWithString:@""];
+ }
+
+ // Sort parameters to be appended so that our solution is stable (and testable)
+ NSArray *parameterNames = [parameters allKeys];
+ parameterNames = [parameterNames sortedArrayUsingSelector:@selector(compare:)];
+
+ for (NSString *parameterName in parameterNames) {
+ id value = [parameters objectForKey:parameterName];
+ NSAssert3([parameterName isKindOfClass:[NSString class]], @"Got '%@' of type %@ as key for parameter with value '%@'. Expected an NSString.", parameterName, NSStringFromClass([parameterName class]), value);
+
+ // The value needs to be an NSString, or be able to give us an NSString
+ if (![value isKindOfClass:[NSString class]]) {
+ if ([value respondsToSelector:@selector(stringValue)]) {
+ value = [value stringValue];
+ } else {
+ // Fallback to simply giving the description
+ value = [value description];
+ }
+ }
+
+ if ([query length] == 0) {
+ [query appendFormat:@"%@=%@", [parameterName stringByEscapingForURLArgument], [value stringByEscapingForURLArgument]];
+ } else {
+ [query appendFormat:@"&%@=%@", [parameterName stringByEscapingForURLArgument], [value stringByEscapingForURLArgument]];
+ }
+ }
+
+ // scheme://username:password@domain:port/path?query_string#fragment_id
+
+ // Chop off query and fragment from absoluteString, then add new query and put back fragment
+
+ NSString *absoluteString = [self absoluteString];
+ NSUInteger endIndex = [absoluteString length];
+
+ NSString *fragment = [self fragment];
+ if (fragment) {
+ endIndex -= [fragment length];
+ endIndex--; // The # character
+ }
+
+ NSString *originalQuery = [self query];
+ if (originalQuery) {
+ endIndex -= [originalQuery length];
+ endIndex--; // The ? character
+ }
+
+ absoluteString = [absoluteString substringToIndex:endIndex];
+ absoluteString = [absoluteString stringByAppendingString:@"?"];
+ absoluteString = [absoluteString stringByAppendingString:query];
+ if (fragment) {
+ absoluteString = [absoluteString stringByAppendingString:@"#"];
+ absoluteString = [absoluteString stringByAppendingString:fragment];
+ }
+
+ return [NSURL URLWithString:absoluteString];
+}
+
+- (NSURL *)URLByAppendingParameterName:(NSString *)parameter value:(id)value {
+ return [self URLByAppendingParameters:[NSDictionary dictionaryWithObjectsAndKeys:value, parameter, nil]];
+}
+
+
+@end
diff --git a/Juick/RevealPanelViewController.h b/Juick/RevealPanelViewController.h
new file mode 100644
index 0000000..a8196fe
--- /dev/null
+++ b/Juick/RevealPanelViewController.h
@@ -0,0 +1,13 @@
+//
+// RevealPanelViewController.h
+// Juick
+//
+// Created by Vitaly Takmazov on 04.11.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface RevealPanelViewController : UITableViewController
+
+@end
diff --git a/Juick/RevealPanelViewController.m b/Juick/RevealPanelViewController.m
new file mode 100644
index 0000000..3381e28
--- /dev/null
+++ b/Juick/RevealPanelViewController.m
@@ -0,0 +1,69 @@
+//
+// RevealPanelViewController.m
+// Juick
+//
+// Created by Vitaly Takmazov on 04.11.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import "RevealPanelViewController.h"
+
+@interface RevealPanelViewController ()
+
+@end
+
+@implementation RevealPanelViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ self.title = @"Juick";
+ [self.view setBackgroundColor:[UIColor colorWithRed:238/255.0f green:238/255.0f blue:229/255.0f alpha:1.0f]];
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ return 1;
+}
+
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ return 4;
+}
+
+- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ static NSString *cellIdentifier = @"MenuCell";
+ UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
+ NSInteger row = indexPath.row;
+ if (cell == nil) {
+ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
+ [cell setBackgroundColor:[UIColor colorWithRed:236/255.0f green:237/255.0f blue:227/255.0f alpha:1]];
+ cell.textLabel.textColor = [UIColor colorWithRed:0 green:102/255.0f blue:153/255.0f alpha:1.0f];
+ }
+ if (row == 0) {
+ cell.textLabel.text = @"My feed";
+ } else if (row == 1) {
+ cell.textLabel.text = @"Popular";
+ } else if (row == 2) {
+ cell.textLabel.text = @"Discover";
+ } else if (row == 3) {
+ cell.textLabel.text = @"Images";
+ }
+ return cell;
+}
+
+@end
diff --git a/Juick/reveal-icon.png b/Juick/reveal-icon.png
new file mode 100644
index 0000000..4a4d467
--- /dev/null
+++ b/Juick/reveal-icon.png
Binary files differ
diff --git a/Juick/reveal-icon@2x.png b/Juick/reveal-icon@2x.png
new file mode 100644
index 0000000..08dc402
--- /dev/null
+++ b/Juick/reveal-icon@2x.png
Binary files differ
diff --git a/Podfile b/Podfile
index b17b80a..f254f2d 100644
--- a/Podfile
+++ b/Podfile
@@ -5,6 +5,7 @@ target "Juick" do
pod 'MWFeedParser'
pod 'TTTAttributedLabel'
pod 'Masonry'
+pod 'SWRevealViewController'
end
target "JuickTests" do
diff --git a/Podfile.lock b/Podfile.lock
index b43bda3..9c2ff0f 100644
--- a/Podfile.lock
+++ b/Podfile.lock
@@ -9,16 +9,19 @@ PODS:
- MWFeedParser/NSDate+InternetDateTime (0.0.1)
- MWFeedParser/NSString+HTML (0.0.1)
- MWFeedParser/NSString+XMLEntities (0.0.1)
+ - SWRevealViewController (1.0.8)
- TTTAttributedLabel (1.7.1)
DEPENDENCIES:
- Masonry
- MWFeedParser
+ - SWRevealViewController
- TTTAttributedLabel
SPEC CHECKSUMS:
Masonry: 73df2f346bd1a0044dc9de969aa45aea2f8a9bd8
MWFeedParser: 2ca0852fac352f8333d5f46fdd4b583b921e0c4e
+ SWRevealViewController: 5688d9d017e228c9edd92db359f670d8c47ab8e6
TTTAttributedLabel: e504133915a9b11de63cb470ffa2790383a3eb23
COCOAPODS: 0.27.1