From 6b40f06a691e1264f6e35b6a5616198e6977787d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 21 Mar 2019 20:17:42 +0300 Subject: Named colours --- Juick/ViewControllers/DialogsViewController.m | 3 +- Juick/ViewControllers/FeedViewController.m | 38 ++---------------------- Juick/ViewControllers/LoginViewController.m | 5 ++-- Juick/ViewControllers/MessagesViewController.m | 40 ++++++++++++++++++++++++-- Juick/ViewControllers/NewPostViewController.m | 3 +- 5 files changed, 44 insertions(+), 45 deletions(-) (limited to 'Juick/ViewControllers') diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m index 1f9f8e0..cbf0024 100644 --- a/Juick/ViewControllers/DialogsViewController.m +++ b/Juick/ViewControllers/DialogsViewController.m @@ -8,7 +8,6 @@ #import "DialogsViewController.h" #import "ChatViewController.h" -#import "ColorScheme.h" #import "ConversationCell.h" #import "APIClient.h" #import "AppDelegate.h" @@ -17,7 +16,7 @@ - (void)viewDidLoad { [super viewDidLoad]; self.navigationController.visibleViewController.navigationItem.title = @"Chats"; - [self.view setBackgroundColor:[ColorScheme mainBackground]]; + [self.view setBackgroundColor:[UIColor colorNamed:@"Background"]]; [self.tableView registerNib:[UINib nibWithNibName:@"ConversationCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"notificationCell"]; [self refreshData]; self.refreshControl = [UIRefreshControl new]; diff --git a/Juick/ViewControllers/FeedViewController.m b/Juick/ViewControllers/FeedViewController.m index 67d80e1..d7b51a8 100644 --- a/Juick/ViewControllers/FeedViewController.m +++ b/Juick/ViewControllers/FeedViewController.m @@ -12,7 +12,6 @@ #import "MessageCell.h" #import "APIClient.h" #import "AppDelegate.h" -#import "ColorScheme.h" @interface FeedViewController () @@ -48,11 +47,6 @@ [super viewDidLoad]; } --(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSString * cellIdentifier = @"messageCell"; - MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath]; - [self performSegueWithIdentifier:@"threadViewSegue" sender:cell]; -} - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (!self.dataLoading) { MessageCell *cell = (MessageCell *)[super tableView:tableView cellForRowAtIndexPath:indexPath]; @@ -67,35 +61,7 @@ self.selectedUser = uname; [self performSegueWithIdentifier:@"profileSegue" sender:self]; } - --(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - if ([segue.identifier isEqual: @"threadViewSegue"]) { - NSNumber *mid; - BOOL scrollToEnd = NO; - if ([AppDelegate shared].pushedThread != nil) { - mid = [[AppDelegate shared].pushedThread copy]; - [AppDelegate shared].pushedThread = nil; - [AppDelegate shared].pushedUname = nil; - scrollToEnd = YES; - } else { - Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row]; - mid = msg.mid; - } - if ([mid integerValue] > 0) { - ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController; - [threadVC setPath:[APIClient threadUrl]]; - [threadVC setParams:@{@"mid": mid }]; - [threadVC setShouldScrollToBottomOnRefresh:scrollToEnd]; - } - } - if ([segue.identifier isEqual: @"profileSegue"]) { - BlogViewController *blogVC = (BlogViewController *)segue.destinationViewController; - [blogVC setUname:self.selectedUser]; - [blogVC setTitle:self.selectedUser]; - blogVC.path = [NSString stringWithFormat:@"/messages?uname=%@", self.selectedUser]; - [blogVC setShouldScrollToBottomOnRefresh:NO]; - } -} +/* - (IBAction)filterAction:(id)sender { if (![[APIClient sharedClient] isAuthenticated]) { [self.navigationController performSegueWithIdentifier:@"loginSegue" sender:self.navigationController]; @@ -135,7 +101,7 @@ popover.permittedArrowDirections = UIPopoverArrowDirectionUp; } [self presentViewController:filterAlert animated:YES completion:nil]; -} +}*/ -(void) loadMore { Message *lastMsg = [self.messages lastObject]; diff --git a/Juick/ViewControllers/LoginViewController.m b/Juick/ViewControllers/LoginViewController.m index de18286..1894b1c 100644 --- a/Juick/ViewControllers/LoginViewController.m +++ b/Juick/ViewControllers/LoginViewController.m @@ -8,7 +8,6 @@ #import "LoginViewController.h" #import "User.h" -#import "ColorScheme.h" #import "AppDelegate.h" #import "APIClient.h" @@ -21,8 +20,8 @@ - (void) awakeFromNib { [super awakeFromNib]; self.title = @"Sign in"; - [self.view setBackgroundColor:[ColorScheme mainBackground]]; - [self.visualEffectView.contentView setBackgroundColor:[ColorScheme headerBackground]]; + [self.view setBackgroundColor:[UIColor colorNamed:@"Background"]]; + [self.visualEffectView.contentView setBackgroundColor:[UIColor colorNamed:@"Background"]]; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelSignIn)]; diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m index 9cece2c..8b4bfae 100644 --- a/Juick/ViewControllers/MessagesViewController.m +++ b/Juick/ViewControllers/MessagesViewController.m @@ -9,9 +9,9 @@ #import "MessagesViewController.h" #import "MessageCell.h" +#import "AppDelegate.h" #import "APIClient.h" #import "Message.h" -#import "ColorScheme.h" #import "NewPostViewController.h" #import "LoginViewController.h" @@ -85,7 +85,7 @@ { [super viewDidLoad]; self.dataLoading = YES; - [self.view setBackgroundColor:[ColorScheme mainBackground]]; + [self.view setBackgroundColor:[UIColor colorNamed:@"Background"]]; [self.tableView registerNib:[UINib nibWithNibName:@"MessageCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"messageCell"]; [self.tableView registerNib:[UINib nibWithNibName:@"ContentLoadingCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"contentLoadingCell"]; self.tableView.rowHeight = UITableViewAutomaticDimension; @@ -126,6 +126,42 @@ return self.dataLoading && self.messages.count == 0 ? 200.0f : [super tableView:tableView heightForRowAtIndexPath:indexPath]; } +-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + NSString * cellIdentifier = @"messageCell"; + MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath]; + [self performSegueWithIdentifier:@"threadViewSegue" sender:cell]; +} + +-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + if ([segue.identifier isEqual: @"threadViewSegue"]) { + NSNumber *mid; + BOOL scrollToEnd = NO; + if ([AppDelegate shared].pushedThread != nil) { + mid = [[AppDelegate shared].pushedThread copy]; + [AppDelegate shared].pushedThread = nil; + [AppDelegate shared].pushedUname = nil; + scrollToEnd = YES; + } else { + Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row]; + mid = msg.mid; + } + if ([mid integerValue] > 0) { + ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController; + [threadVC setPath:[APIClient threadUrl]]; + [threadVC setParams:@{@"mid": mid }]; + [threadVC setShouldScrollToBottomOnRefresh:scrollToEnd]; + } + } + /* + if ([segue.identifier isEqual: @"profileSegue"]) { + BlogViewController *blogVC = (BlogViewController *)segue.destinationViewController; + [blogVC setUname:self.selectedUser]; + [blogVC setTitle:self.selectedUser]; + blogVC.path = [NSString stringWithFormat:@"/messages?uname=%@", self.selectedUser]; + [blogVC setShouldScrollToBottomOnRefresh:NO]; + }*/ +} + -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView_ { CGFloat actualPosition = scrollView_.contentOffset.y; CGFloat contentHeight = scrollView_.contentSize.height - scrollView_.contentSize.height / 2; diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m index 95672e8..5a59867 100644 --- a/Juick/ViewControllers/NewPostViewController.m +++ b/Juick/ViewControllers/NewPostViewController.m @@ -8,7 +8,6 @@ #import "NewPostViewController.h" #import "MessagesViewController.h" -#import "ColorScheme.h" #import "QuoteView.h" #import "APIClient.h" @@ -27,7 +26,7 @@ { [super viewDidLoad]; self.paddingValue = self.bottomConstraint.constant; - [self.view setBackgroundColor:[ColorScheme mainBackground]]; + [self.view setBackgroundColor:[UIColor colorNamed:@"Background"]]; if (_replyTo != nil) { QuoteView *inputView = (QuoteView *) self.inputAccessoryView; inputView.quoteText.text = _replyTo.text; -- cgit v1.2.3