summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/RevealPanelViewController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-09-27 22:24:38 +0300
committerGravatar Vitaly Takmazov2017-09-27 22:24:38 +0300
commit6499148cb3f62e20534b62c181125ebeacfa3438 (patch)
tree3aa289caa409366e70dd1802d67df61903fa992b /Juick/ViewControllers/RevealPanelViewController.m
parent25bc4f1357252dc0aeee70f0a638a4226231d5fb (diff)
cleanup
Diffstat (limited to 'Juick/ViewControllers/RevealPanelViewController.m')
-rw-r--r--Juick/ViewControllers/RevealPanelViewController.m179
1 files changed, 0 insertions, 179 deletions
diff --git a/Juick/ViewControllers/RevealPanelViewController.m b/Juick/ViewControllers/RevealPanelViewController.m
deleted file mode 100644
index 623bb87..0000000
--- a/Juick/ViewControllers/RevealPanelViewController.m
+++ /dev/null
@@ -1,179 +0,0 @@
-//
-// 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"
-#import "AppDelegate.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:[UIColor whiteColor]];
- self.tableView = [[UITableView alloc] init];
- //[self.tableView setBackgroundColor:[UIColor whiteColor]];
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- [self.tableView setSeparatorInset:UIEdgeInsetsZero];
- self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
- self.tableView.separatorColor =[UIColor whiteColor];
- [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];
- AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
- [appDelegate 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 colorWithHex:0x222222];
- cell.descriptionText.textColor = [ColorScheme colorWithHex:0x222222];
- 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 = [ColorScheme colorWithHex:0xddddd5];
- bgColorView.layer.masksToBounds = YES;
- [cell setSelectedBackgroundView:bgColorView];
- [cell.contentView setNeedsLayout];
- [cell.contentView layoutIfNeeded];
- return cell;
-}
-
-- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- NSInteger row = indexPath.row;
- NSString *targetPath;
- NSDictionary *targetParams;
- NSString *targetTitle;
- SWRevealViewController *reveal = self.revealViewController;
- [reveal revealToggle:self];
- if (row == 0) {
- if ([[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] == nil) {
- AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
- [appDelegate 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];
- }
-
- UINavigationController *front = (UINavigationController *)reveal.frontViewController;
- MessagesViewController *messages = (MessagesViewController *)[front.viewControllers objectAtIndex:0];
- [messages loadFromPath:targetPath withParams:targetParams withTitle:targetTitle];
-}
-
-@end