summaryrefslogtreecommitdiff
path: root/Juick
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 /Juick
parent08574251153406e4755f58c2ee5548ee32e308fb (diff)
RevealViewController and small other additions
Diffstat (limited to 'Juick')
-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
12 files changed, 361 insertions, 97 deletions
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