summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-08-28 21:03:22 +0300
committerGravatar Vitaly Takmazov2016-08-28 21:03:22 +0300
commit188d8e4ea870d1a6c8edd5a9b323742804badeba (patch)
tree071067f7189a6474d49abb952b1b04b820985b7a /Juick/ViewControllers
parenta74588083c4950e9237dff7a84ccdd129b72c950 (diff)
project cleanup
Diffstat (limited to 'Juick/ViewControllers')
-rw-r--r--Juick/ViewControllers/LoginViewController.h15
-rw-r--r--Juick/ViewControllers/LoginViewController.m92
-rw-r--r--Juick/ViewControllers/MessagesViewController.h15
-rw-r--r--Juick/ViewControllers/MessagesViewController.m181
-rw-r--r--Juick/ViewControllers/NewPostViewController.h13
-rw-r--r--Juick/ViewControllers/NewPostViewController.m61
-rw-r--r--Juick/ViewControllers/RevealPanelViewController.h16
-rw-r--r--Juick/ViewControllers/RevealPanelViewController.m182
8 files changed, 575 insertions, 0 deletions
diff --git a/Juick/ViewControllers/LoginViewController.h b/Juick/ViewControllers/LoginViewController.h
new file mode 100644
index 0000000..bf980fa
--- /dev/null
+++ b/Juick/ViewControllers/LoginViewController.h
@@ -0,0 +1,15 @@
+//
+// LoginViewController.h
+// Juick
+//
+// Created by Vitaly on 30.01.14.
+// Copyright (c) 2014 com.juick. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "XLForm.h"
+#import "PDKeychainbindingsController.h"
+
+@interface LoginViewController : XLFormViewController
+
+@end
diff --git a/Juick/ViewControllers/LoginViewController.m b/Juick/ViewControllers/LoginViewController.m
new file mode 100644
index 0000000..eedc6d3
--- /dev/null
+++ b/Juick/ViewControllers/LoginViewController.m
@@ -0,0 +1,92 @@
+//
+// LoginViewController.m
+// Juick
+//
+// Created by Vitaly on 30.01.14.
+// Copyright (c) 2014 com.juick. All rights reserved.
+//
+
+#import "LoginViewController.h"
+#import "User.h"
+#import "ColorScheme.h"
+
+@implementation LoginViewController
+
+- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self){
+ [self initializeForm];
+ }
+ return self;
+}
+
+- (id)initWithCoder:(NSCoder *)aDecoder {
+ self = [super initWithCoder:aDecoder];
+ if (self){
+ [self initializeForm];
+ }
+ return self;
+}
+
+- (void)initializeForm {
+ self.title = @"Sign in";
+ [self.view setBackgroundColor:[ColorScheme mainBackground]];
+
+ self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
+ target:self action:@selector(cancelSignIn)];
+ self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave
+ target:self action:@selector(doneSignIn)];
+ XLFormDescriptor *form = [XLFormDescriptor formDescriptorWithTitle:@"Sign in"];
+ form.rowNavigationOptions = XLFormRowNavigationOptionEnabled;
+ XLFormSectionDescriptor *section = [XLFormSectionDescriptor formSection];
+ [form addFormSection:section];
+ XLFormRowDescriptor * usernameRow = [XLFormRowDescriptor
+ formRowDescriptorWithTag:@"com.juick.username"
+ rowType:XLFormRowDescriptorTypeText title:@"Username"];
+ usernameRow.value = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"];
+ [section addFormRow:usernameRow];
+ XLFormRowDescriptor * passwordRow = [XLFormRowDescriptor
+ formRowDescriptorWithTag:@"com.juick.password"
+ rowType:XLFormRowDescriptorTypePassword title:@"Password"];
+ passwordRow.value = [[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"];
+ [section addFormRow:passwordRow];
+
+ self.form = form;
+}
+
+
+- (void) cancelSignIn {
+ CATransition* transition = [CATransition animation];
+ transition.duration = 0.3;
+ transition.type = kCATransitionFade;
+ transition.subtype = kCATransitionFromTop;
+
+ [self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
+ [self.navigationController popViewControllerAnimated:NO];
+}
+
+- (void) doneSignIn {
+ [User checkIsValid:^(BOOL success) {
+ if (success) {
+ CATransition* transition = [CATransition animation];
+ transition.duration = 0.3;
+ transition.type = kCATransitionFade;
+ transition.subtype = kCATransitionFromTop;
+
+ [self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
+ [self.navigationController popToRootViewControllerAnimated:NO];
+ } else {
+ [User throwUnableToLogin];
+ }
+ }];
+
+}
+
+-(void) formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)formRow oldValue:(id)oldValue newValue:(id)newValue {
+ [super formRowDescriptorValueHasChanged:formRow oldValue:oldValue newValue:newValue];
+ if ([newValue isKindOfClass:[NSString class]]) {
+ [[PDKeychainBindings sharedKeychainBindings] setObject:newValue forKey:formRow.tag];
+ }
+}
+
+@end
diff --git a/Juick/ViewControllers/MessagesViewController.h b/Juick/ViewControllers/MessagesViewController.h
new file mode 100644
index 0000000..38123bd
--- /dev/null
+++ b/Juick/ViewControllers/MessagesViewController.h
@@ -0,0 +1,15 @@
+//
+// MasterViewController.h
+// Juick
+//
+// Created by Vitaly Takmazov on 26.10.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MessagesViewController : UITableViewController<UISplitViewControllerDelegate>
+- (void)loadFromPath:(NSString *)messagesPath withParams:(NSDictionary *)params withTitle:(NSString *)title;
+- (void) refreshData;
+- (void) composePressed;
+@end
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
new file mode 100644
index 0000000..28e7613
--- /dev/null
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -0,0 +1,181 @@
+//
+// MasterViewController.m
+// Juick
+//
+// Created by Vitaly Takmazov on 26.10.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import "MessagesViewController.h"
+#import "MessageCell.h"
+
+#import "Message.h"
+#import "ColorScheme.h"
+
+#import "NewPostViewController.h"
+
+
+#import "NSURL+PathParameters.h"
+
+static NSString *CellIdentifier = @"MessageCell";
+
+
+@interface MessagesViewController ();
+
+@property(nonatomic, strong) NSMutableArray *messages;
+@property(nonatomic, assign) Boolean dataLoading;
+@property(nonatomic, strong) NSString *path;
+@property(nonatomic, strong) NSMutableDictionary *params;
+
+@end
+
+@implementation MessagesViewController
+
+- (void)loadFromPath:(NSString *)messagesPath withParams:(NSDictionary *)params withTitle:(NSString *)title
+{
+ [self setPath:messagesPath];
+ [self setParams:[[NSMutableDictionary alloc] initWithDictionary:params]];
+ self.title = title;
+ __weak MessagesViewController * weakSelf = self;
+ [self.messages removeAllObjects];
+ [weakSelf refreshData];
+}
+
+- (void) refreshData {
+ if ([self.path isEqualToString:[Message threadUrl]]) {
+ [self.messages removeAllObjects];
+ }
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ self.dataLoading = YES;
+ [Message pullNextFromPath:self.path params:self.params callback:^(NSArray *next) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self.messages addObjectsFromArray:next];
+ [self.tableView reloadData];
+ [self.refreshControl endRefreshing];
+ self.dataLoading = NO;
+ });
+ }];
+ });
+}
+
+- (UIStatusBarStyle)preferredStatusBarStyle
+{
+ return UIStatusBarStyleLightContent;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ self.dataLoading = NO;
+ [self.view setBackgroundColor:[ColorScheme mainBackground]];
+ self.messages = [NSMutableArray array];
+
+ SWRevealViewController *revealController = [self revealViewController];
+ if (revealController) {
+ // TODO: add to thread view too
+ [self.view addGestureRecognizer:[revealController panGestureRecognizer]];
+ }
+
+ [self.tableView registerNib:[UINib nibWithNibName:@"MessageCell" bundle:nil] forCellReuseIdentifier:CellIdentifier];
+ self.tableView.rowHeight = UITableViewAutomaticDimension;
+ self.tableView.estimatedRowHeight = 500.0f;
+ self.refreshControl = [UIRefreshControl new];
+ [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged];}
+
+- (void) composePressed {
+ CATransition* transition = [CATransition animation];
+ transition.duration = 0.3;
+ transition.type = kCATransitionFade;
+ transition.subtype = kCATransitionFromTop;
+
+ [self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
+ [self.navigationController pushViewController:[[NewPostViewController alloc] init] animated:NO];
+}
+
+- (void)viewDidAppear:(BOOL)animated
+{
+ [super viewDidAppear:animated];
+ if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(contentSizeCategoryChanged:)
+ name:UIContentSizeCategoryDidChangeNotification
+ object:nil];
+ }
+}
+
+- (void)viewDidDisappear:(BOOL)animated
+{
+ [super viewDidDisappear:animated];
+ if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:UIContentSizeCategoryDidChangeNotification
+ object:nil];
+ }
+}
+
+- (void)contentSizeCategoryChanged:(NSNotification *)notification
+{
+ [self.tableView reloadData];
+}
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ return 1;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ return _messages.count;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+ Message *msg = [_messages objectAtIndex:indexPath.row];
+ [cell setMessage:msg];
+ if ([msg.attach length] > 0) {
+ __weak MessagesViewController * weakSelf = self;
+ [cell.attach yy_setImageWithURL:[NSURL URLWithString:msg.attach] placeholder:[UIImage imageNamed:@"AttachPlaceholder"] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [cell setNeedsUpdateConstraints];
+ [cell updateConstraintsIfNeeded];
+ [cell setNeedsLayout];
+ [cell layoutIfNeeded];
+ });
+ }];
+
+ } else {
+ cell.attach.image = nil;
+ }
+
+ return cell;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ if ([self.path isEqualToString:[Message threadUrl]])
+ return;
+ Message *msg = [_messages objectAtIndex:indexPath.row];
+ MessagesViewController *threadViewController = [[MessagesViewController alloc] init];
+ [threadViewController loadFromPath:[Message threadUrl] withParams:[NSDictionary dictionaryWithObjectsAndKeys:msg.MID, @"mid", nil] withTitle:@"Thread"];
+ [self.navigationController pushViewController:threadViewController animated:NO];
+}
+
+-(void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {
+ self.navigationItem.leftBarButtonItem = nil;
+}
+
+-(void)splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc {
+ self.navigationItem.leftBarButtonItem = barButtonItem;
+}
+
+-(void)scrollViewDidScroll:(UIScrollView *)scrollView_ {
+ CGFloat actualPosition = scrollView_.contentOffset.y;
+ CGFloat contentHeight = scrollView_.contentSize.height - scrollView_.contentSize.height / 2;
+ if (actualPosition >= contentHeight && !self.dataLoading) {
+ NSNumber *lastMid = ((Message *)[self.messages lastObject]).MID;
+ if (![self.path isEqualToString:[Message threadUrl]]) {
+ [self.params setValue:lastMid forKey:@"before_mid"];
+ }
+ [self refreshData];
+ }
+}
+
+
+@end
diff --git a/Juick/ViewControllers/NewPostViewController.h b/Juick/ViewControllers/NewPostViewController.h
new file mode 100644
index 0000000..ceaca49
--- /dev/null
+++ b/Juick/ViewControllers/NewPostViewController.h
@@ -0,0 +1,13 @@
+//
+// NewPostViewController.h
+// Juick
+//
+// Created by Vitaly Takmazov on 07.11.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface NewPostViewController : UIViewController
+
+@end
diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m
new file mode 100644
index 0000000..8c8fbf0
--- /dev/null
+++ b/Juick/ViewControllers/NewPostViewController.m
@@ -0,0 +1,61 @@
+//
+// NewPostViewController.m
+// Juick
+//
+// Created by Vitaly Takmazov on 07.11.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import "NewPostViewController.h"
+
+@interface NewPostViewController ()
+
+@end
+
+@implementation NewPostViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ // Custom initialization
+ }
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
+ target:self action:@selector(cancelCompose)];
+ self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
+ target:self action:@selector(doneCompose)];
+}
+
+- (void) cancelCompose {
+ CATransition* transition = [CATransition animation];
+ transition.duration = 0.3;
+ transition.type = kCATransitionFade;
+ transition.subtype = kCATransitionFromTop;
+
+ [self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
+ [self.navigationController popViewControllerAnimated:NO];
+}
+
+- (void) doneCompose {
+ CATransition* transition = [CATransition animation];
+ transition.duration = 0.3;
+ transition.type = kCATransitionFade;
+ transition.subtype = kCATransitionFromTop;
+
+ [self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
+ [self.navigationController popToRootViewControllerAnimated:NO];
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+@end
diff --git a/Juick/ViewControllers/RevealPanelViewController.h b/Juick/ViewControllers/RevealPanelViewController.h
new file mode 100644
index 0000000..ff5006c
--- /dev/null
+++ b/Juick/ViewControllers/RevealPanelViewController.h
@@ -0,0 +1,16 @@
+//
+// RevealPanelViewController.h
+// Juick
+//
+// Created by Vitaly Takmazov on 04.11.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import <FAImageView.h>
+#import "LoginViewController.h"
+
+@interface RevealPanelViewController : UIViewController<UITableViewDataSource, UITableViewDelegate>
+@property (nonatomic, strong) IBOutlet UITableView *tableView;
+@property (nonatomic, strong) IBOutlet UIButton *signButton;
+@end
diff --git a/Juick/ViewControllers/RevealPanelViewController.m b/Juick/ViewControllers/RevealPanelViewController.m
new file mode 100644
index 0000000..d890f97
--- /dev/null
+++ b/Juick/ViewControllers/RevealPanelViewController.m
@@ -0,0 +1,182 @@
+//
+// RevealPanelViewController.m
+// Juick
+//
+// Created by Vitaly Takmazov on 04.11.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import "SWRevealViewController.h"
+
+#import "RevealPanelViewController.h"
+#import "MessagesViewController.h"
+
+#import "ColorScheme.h"
+#import "NSURL+PathParameters.h"
+#import "NavCell.h"
+#import "Message.h"
+#import "User.h"
+
+
+static NSString *CellIdentifier = @"NavCell";
+
+@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.view setBackgroundColor:[ColorScheme mainBackground]];
+ self.tableView = [[UITableView alloc] init];
+ [self.tableView setBackgroundColor:[ColorScheme mainBackground]];
+ self.tableView.delegate = self;
+ self.tableView.dataSource = self;
+ [self.tableView setSeparatorInset:UIEdgeInsetsZero];
+ self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
+ self.tableView.separatorColor =[UIColor darkGrayColor];
+ [self.tableView registerNib:[UINib nibWithNibName:@"NavCell" bundle:nil] forCellReuseIdentifier:CellIdentifier];
+ [self.view addSubview:self.tableView];
+ self.signButton = [[UIButton alloc] init];
+ [self.signButton addTarget:self action:@selector(signInOut) forControlEvents:UIControlEventTouchUpInside];
+ [self.view addSubview:self.signButton];
+ [self refreshInfo];
+}
+
+-(void) refreshInfo {
+ NSString *text;
+ UIColor *color;
+
+ if ([User isAuthenticated]) {
+ text = @"Sign Out";
+ color = [UIColor redColor];
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
+ [User get:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] callback:^(User *user) {
+ if (user != nil) {
+ /*[self.titleView.image setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/as/%@.png", user.uid]]];
+ [self.titleView.title setText:user.uname];*/
+ }
+ }];
+ });
+ } else {
+ text = @"Sign In";
+ color = [UIColor greenColor];
+ }
+ [self.signButton setTitle:text forState:UIControlStateNormal];
+ [self.signButton setBackgroundColor:color];
+}
+
+-(void) signInOut {
+ [self refreshInfo];
+ [self pushLoginForm];
+}
+
+-(void) viewWillLayoutSubviews {
+ [super viewWillLayoutSubviews];
+ self.tableView.frame = CGRectMake(0, 0, self.view.bounds.size.width, 400);
+ self.signButton.frame = CGRectMake(0, self.view.bounds.size.height - 40, self.view.bounds.size.width, 40);
+}
+
+- (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;
+}
+
+- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+ return 32 + 10*2; // icon size + insets
+}
+
+- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ NavCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+ NSInteger row = indexPath.row;
+ [cell.contentView setBackgroundColor:[UIColor whiteColor]];
+ cell.icon.font = [UIFont fontWithName:kFontAwesomeFamilyName size:32.f];
+ cell.icon.textColor = [ColorScheme linkColor];
+ cell.descriptionText.textColor = [ColorScheme linkColor];
+ if (row == 0) {
+ cell.descriptionText.text = @"My feed";
+ cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconHome];
+
+ } else if (row == 1) {
+ cell.descriptionText.text = @"Popular";
+ cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconComments];
+ } else if (row == 2) {
+ cell.descriptionText.text = @"Discover";
+ cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconSearch];
+ } else if (row == 3) {
+ cell.descriptionText.text = @"Images";
+ cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconPicture];
+ }
+ UIView *bgColorView = [[UIView alloc] init];
+ bgColorView.backgroundColor = [UIColor blackColor];
+ bgColorView.layer.masksToBounds = YES;
+ [cell setSelectedBackgroundView:bgColorView];
+ [cell.contentView setNeedsLayout];
+ [cell.contentView layoutIfNeeded];
+ return cell;
+}
+
+- (void) pushLoginForm {
+ [self.revealViewController revealToggle:self];
+ UIViewController *loginView = [[LoginViewController alloc] init];
+ UINavigationController *messages = (UINavigationController *)self.revealViewController.frontViewController;
+ [messages pushViewController:loginView animated:YES];
+}
+
+- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ NSInteger row = indexPath.row;
+ NSString *targetPath;
+ NSDictionary *targetParams;
+ NSString *targetTitle;
+ if (row == 0) {
+ if ([[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] == nil) {
+ [self pushLoginForm];
+ return;
+ } else {
+ targetTitle = @"My feed";
+ targetPath = [Message feedUrl];
+ }
+
+ }
+ if (row == 1) {
+ targetTitle = @"Popular";
+ targetPath = [Message messagesUrl];
+ targetParams = [NSDictionary dictionaryWithObjectsAndKeys:@"1", @"popular", nil];
+ } else if (row == 2) {
+ targetTitle = @"Discover";
+ targetPath = [Message messagesUrl];
+ }
+ if (row == 3) {
+ targetTitle = @"Images";
+ 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 loadFromPath:targetPath withParams:targetParams withTitle:targetTitle];
+ [reveal revealToggle:self];
+}
+
+@end