summaryrefslogtreecommitdiff
path: root/Juick/RevealPanelViewController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2014-01-30 17:16:06 +0400
committerGravatar Vitaly Takmazov2014-01-30 17:16:17 +0400
commit63f9e9576991fa8e50ca728836c6ba6917bbbc26 (patch)
treefed956ca4f77869f37ddd561d7fc3e4129d66317 /Juick/RevealPanelViewController.m
parentc0a5f540950dcf34eb08dc990ec753df6ae98ede (diff)
LoginView
Diffstat (limited to 'Juick/RevealPanelViewController.m')
-rw-r--r--Juick/RevealPanelViewController.m27
1 files changed, 22 insertions, 5 deletions
diff --git a/Juick/RevealPanelViewController.m b/Juick/RevealPanelViewController.m
index a9c71e8..c39c6cd 100644
--- a/Juick/RevealPanelViewController.m
+++ b/Juick/RevealPanelViewController.m
@@ -14,6 +14,7 @@
#import "ColorScheme.h"
#import "NSURL+PathParameters.h"
#import "NavCell.h"
+#import "Message.h"
@@ -95,23 +96,39 @@ static NSString *CellIdentifier = @"NavCell";
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = indexPath.row;
- NSURL *targetUrl;
+ NSString *targetPath;
+ NSDictionary *targetParams;
NSString *targetTitle;
+ if (row == 0) {
+ if ([[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] == nil) {
+ [self.revealViewController revealToggle:self];
+ UIViewController *loginView = [[LoginViewController alloc] initWithStyle:UITableViewStyleGrouped];
+ UINavigationController *messages = (UINavigationController *)self.revealViewController.frontViewController;
+ [messages pushViewController:loginView animated:YES];
+ return;
+ } else {
+ targetTitle = @"My feed";
+ targetPath = [Message feedUrl];
+ }
+
+ }
if (row == 1) {
targetTitle = @"Popular";
- targetUrl = [[NSURL URLWithString:@"https://api.juick.com/messages"] URLByAppendingParameters:[NSDictionary dictionaryWithObjectsAndKeys:@"1", @"popular", nil]];
+ targetPath = [Message messagesUrl];
+ targetParams = [NSDictionary dictionaryWithObjectsAndKeys:@"1", @"popular", nil];
} else if (row == 2) {
targetTitle = @"Discover";
- targetUrl = [NSURL URLWithString:@"https://api.juick.com/messages"];
+ targetPath = [Message messagesUrl];
}
if (row == 3) {
targetTitle = @"Images";
- targetUrl = [[NSURL URLWithString:@"https://api.juick.com/messages"] URLByAppendingParameters:[NSDictionary dictionaryWithObjectsAndKeys:@"photo", @"media", nil]];
+ targetPath = [Message messagesUrl];
+ targetParams = [NSDictionary dictionaryWithObjectsAndKeys:@"photo", @"media", nil];
}
SWRevealViewController *reveal = self.revealViewController;
UINavigationController *front = (UINavigationController *)reveal.frontViewController;
MessagesViewController *messages = (MessagesViewController *)[front.viewControllers objectAtIndex:0];
- [messages loadFromURL:targetUrl withTitle:targetTitle];
+ [messages loadFromPath:targetPath withParams:targetParams withTitle:targetTitle];
[reveal revealToggle:self];
}