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.xcodeproj/project.pbxproj | 10 +-- Juick/AppDelegate.m | 9 +- .../Background.colorset/Contents.json | 20 +++++ Juick/Colors.xcassets/Chat.colorset/Contents.json | 20 +++++ Juick/Colors.xcassets/Contents.json | 6 ++ Juick/Colors.xcassets/Funny.colorset/Contents.json | 20 +++++ Juick/Colors.xcassets/Muted.colorset/Contents.json | 20 +++++ Juick/Colors.xcassets/Text.colorset/Contents.json | 20 +++++ Juick/Colors.xcassets/Title.colorset/Contents.json | 20 +++++ Juick/Helpers/ColorScheme.h | 20 ----- Juick/Helpers/ColorScheme.m | 47 ---------- .../ei-clock.imageset/Contents.json | 1 + .../Images.xcassets/ei-clock.imageset/ei-clock.pdf | Bin 3973 -> 4035 bytes Juick/Main.storyboard | 97 ++++----------------- 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 +- Juick/Views/BubbleMessageCell.m | 7 +- Juick/Views/ConversationCell.m | 3 +- Juick/Views/MessageCell.m | 11 ++- Juick/Views/MessageInputView.m | 3 +- Juick/Views/QuoteView.m | 3 +- 24 files changed, 207 insertions(+), 219 deletions(-) create mode 100644 Juick/Colors.xcassets/Background.colorset/Contents.json create mode 100644 Juick/Colors.xcassets/Chat.colorset/Contents.json create mode 100644 Juick/Colors.xcassets/Contents.json create mode 100644 Juick/Colors.xcassets/Funny.colorset/Contents.json create mode 100644 Juick/Colors.xcassets/Muted.colorset/Contents.json create mode 100644 Juick/Colors.xcassets/Text.colorset/Contents.json create mode 100644 Juick/Colors.xcassets/Title.colorset/Contents.json delete mode 100644 Juick/Helpers/ColorScheme.h delete mode 100644 Juick/Helpers/ColorScheme.m diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index 7302e7d..495e857 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -49,8 +49,8 @@ 77B8B39C207A5629005CB20C /* MessageInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 77B8B39B207A5629005CB20C /* MessageInputView.m */; }; 77B8DCD62093FC03000DBB04 /* BlogViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77B8DCD52093FC03000DBB04 /* BlogViewController.m */; }; 77C3648C2241B3060017522C /* DeviceRegistration.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C3648B2241B3060017522C /* DeviceRegistration.m */; }; + 77C364922243FAEF0017522C /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 77C364912243FAEF0017522C /* Colors.xcassets */; }; 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE41828342000427098 /* NSURL+PathParameters.m */; }; - 77C67EE81828379700427098 /* ColorScheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE71828379700427098 /* ColorScheme.m */; }; 77C67EEC18283F2D00427098 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77C67EEB18283F2D00427098 /* QuartzCore.framework */; }; 77C6ADDE1F770EB2000AEA8C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 77C6ADDD1F770EB2000AEA8C /* Main.storyboard */; }; 77C6ADE41F7717BC000AEA8C /* ThreadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C6ADE31F7717BC000AEA8C /* ThreadViewController.m */; }; @@ -155,10 +155,9 @@ 77B8DCD42093FC03000DBB04 /* BlogViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BlogViewController.h; sourceTree = ""; }; 77B8DCD52093FC03000DBB04 /* BlogViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BlogViewController.m; sourceTree = ""; }; 77C3648B2241B3060017522C /* DeviceRegistration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DeviceRegistration.m; sourceTree = ""; }; + 77C364912243FAEF0017522C /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; 77C67EE31828342000427098 /* NSURL+PathParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+PathParameters.h"; sourceTree = ""; }; 77C67EE41828342000427098 /* NSURL+PathParameters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+PathParameters.m"; sourceTree = ""; }; - 77C67EE61828379700427098 /* ColorScheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorScheme.h; sourceTree = ""; }; - 77C67EE71828379700427098 /* ColorScheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ColorScheme.m; sourceTree = ""; }; 77C67EEB18283F2D00427098 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 77C6ADDD1F770EB2000AEA8C /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 77C6ADE21F7717BC000AEA8C /* ThreadViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ThreadViewController.h; sourceTree = ""; }; @@ -262,6 +261,7 @@ 77317BBB181BBE8500D60005 /* AppDelegate.m */, 77317BC6181BBE8500D60005 /* Images.xcassets */, 77C6ADDD1F770EB2000AEA8C /* Main.storyboard */, + 77C364912243FAEF0017522C /* Colors.xcassets */, ); path = Juick; sourceTree = ""; @@ -325,8 +325,6 @@ 774DD4601D735E1D00C7F290 /* Helpers */ = { isa = PBXGroup; children = ( - 77C67EE61828379700427098 /* ColorScheme.h */, - 77C67EE71828379700427098 /* ColorScheme.m */, 77C67EE31828342000427098 /* NSURL+PathParameters.h */, 77C67EE41828342000427098 /* NSURL+PathParameters.m */, 77B09992189D0B9900A84F59 /* UIImage+Utils.h */, @@ -475,6 +473,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 77C364922243FAEF0017522C /* Colors.xcassets in Resources */, 77317BC7181BBE8500D60005 /* Images.xcassets in Resources */, 773F23391F76ED5E00B5B0DF /* Splash@3x.png in Resources */, 77B8B399207A52BD005CB20C /* MessageInputView.xib in Resources */, @@ -568,7 +567,6 @@ 77C6ADE41F7717BC000AEA8C /* ThreadViewController.m in Sources */, 773E63A3204BE036008B8F8D /* BubbleMessageCell.m in Sources */, 77975A1D182B6E9A00410C2B /* NewPostViewController.m in Sources */, - 77C67EE81828379700427098 /* ColorScheme.m in Sources */, 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */, 77E35A82189A5B5A00B2D216 /* LoginViewController.m in Sources */, 773E6397204BCB64008B8F8D /* ConversationCell.m in Sources */, diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m index b3f544c..b58251b 100644 --- a/Juick/AppDelegate.m +++ b/Juick/AppDelegate.m @@ -10,7 +10,6 @@ #import "MessagesViewController.h" #import "LoginViewController.h" -#import "ColorScheme.h" #import "APIClient.h" #import "Message.h" #import "User.h" @@ -26,11 +25,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - [[UINavigationBar appearance] setTintColor:[ColorScheme linkColor]]; + [[UINavigationBar appearance] setTintColor:[UIColor colorNamed:@"Title"]]; //[[UINavigationBar appearance] setBarTintColor:[ColorScheme headerBackground]]; - [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorScheme linkColor]}]; - [[UIToolbar appearance] setTintColor:[ColorScheme linkColor]]; - [[UITabBar appearance] setTintColor:[ColorScheme linkColor]]; + [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor colorNamed:@"Title"]}]; + [[UIToolbar appearance] setTintColor:[UIColor colorNamed:@"Title"]]; + [[UITabBar appearance] setTintColor:[UIColor colorNamed:@"Title"]]; [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault; diff --git a/Juick/Colors.xcassets/Background.colorset/Contents.json b/Juick/Colors.xcassets/Background.colorset/Contents.json new file mode 100644 index 0000000..53e5f34 --- /dev/null +++ b/Juick/Colors.xcassets/Background.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xFD", + "alpha" : "1.000", + "blue" : "0xFE", + "green" : "0xFD" + } + } + } + ] +} \ No newline at end of file diff --git a/Juick/Colors.xcassets/Chat.colorset/Contents.json b/Juick/Colors.xcassets/Chat.colorset/Contents.json new file mode 100644 index 0000000..2702bf1 --- /dev/null +++ b/Juick/Colors.xcassets/Chat.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF8", + "alpha" : "1.000", + "blue" : "0xF8", + "green" : "0xF8" + } + } + } + ] +} \ No newline at end of file diff --git a/Juick/Colors.xcassets/Contents.json b/Juick/Colors.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Juick/Colors.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Colors.xcassets/Funny.colorset/Contents.json b/Juick/Colors.xcassets/Funny.colorset/Contents.json new file mode 100644 index 0000000..dfe4629 --- /dev/null +++ b/Juick/Colors.xcassets/Funny.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xFF", + "alpha" : "1.000", + "blue" : "0x9A", + "green" : "0x33" + } + } + } + ] +} \ No newline at end of file diff --git a/Juick/Colors.xcassets/Muted.colorset/Contents.json b/Juick/Colors.xcassets/Muted.colorset/Contents.json new file mode 100644 index 0000000..679b256 --- /dev/null +++ b/Juick/Colors.xcassets/Muted.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x88", + "alpha" : "1.000", + "blue" : "0x8D", + "green" : "0x95" + } + } + } + ] +} \ No newline at end of file diff --git a/Juick/Colors.xcassets/Text.colorset/Contents.json b/Juick/Colors.xcassets/Text.colorset/Contents.json new file mode 100644 index 0000000..ee1c5bc --- /dev/null +++ b/Juick/Colors.xcassets/Text.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x22", + "alpha" : "1.000", + "blue" : "0x22", + "green" : "0x22" + } + } + } + ] +} \ No newline at end of file diff --git a/Juick/Colors.xcassets/Title.colorset/Contents.json b/Juick/Colors.xcassets/Title.colorset/Contents.json new file mode 100644 index 0000000..2456f54 --- /dev/null +++ b/Juick/Colors.xcassets/Title.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x00", + "alpha" : "1.000", + "blue" : "0x99", + "green" : "0x66" + } + } + } + ] +} \ No newline at end of file diff --git a/Juick/Helpers/ColorScheme.h b/Juick/Helpers/ColorScheme.h deleted file mode 100644 index 6620a96..0000000 --- a/Juick/Helpers/ColorScheme.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// Colors.h -// Juick -// -// Created by Vitaly Takmazov on 05.11.13. -// Copyright (c) 2013 com.juick. All rights reserved. -// - -#import - -@interface ColorScheme : NSObject - -+ (UIColor *)colorWithHex:(UInt32)col; - -+(UIColor *) mainBackground; -+(UIColor *) textColor; -+(UIColor *) headerBackground; -+(UIColor *) linkColor; -+(UIColor *) secondaryBackground; -@end diff --git a/Juick/Helpers/ColorScheme.m b/Juick/Helpers/ColorScheme.m deleted file mode 100644 index 1b72da2..0000000 --- a/Juick/Helpers/ColorScheme.m +++ /dev/null @@ -1,47 +0,0 @@ -// -// Colors.m -// Juick -// -// Created by Vitaly Takmazov on 05.11.13. -// Copyright (c) 2013 com.juick. All rights reserved. -// - -#import "ColorScheme.h" - -@implementation ColorScheme - -+ (void) initialize -{ - [super initialize]; -} - -// takes 0x123456 -+ (UIColor *)colorWithHex:(UInt32)col { - unsigned char r, g, b; - b = col & 0xFF; - g = (col >> 8) & 0xFF; - r = (col >> 16) & 0xFF; - return [UIColor colorWithRed:(float)r/255.0f green:(float)g/255.0f blue:(float)b/255.0f alpha:1]; -} - -+ (UIColor *) headerBackground { - return [self colorWithHex:0xffffff]; -} - -+ (UIColor *) mainBackground { - return [self colorWithHex:0xf8f8f8]; -} -+ (UIColor *) textColor { - return [self colorWithHex:0x222222]; -} - -+ (UIColor *) linkColor { - return [self colorWithHex:0x006699]; -} - -+ (UIColor *) secondaryBackground { - return [self colorWithHex:0xff339a]; -} - - -@end diff --git a/Juick/Images.xcassets/ei-clock.imageset/Contents.json b/Juick/Images.xcassets/ei-clock.imageset/Contents.json index 9ab4b4d..627d5f6 100644 --- a/Juick/Images.xcassets/ei-clock.imageset/Contents.json +++ b/Juick/Images.xcassets/ei-clock.imageset/Contents.json @@ -10,6 +10,7 @@ "author" : "xcode" }, "properties" : { + "template-rendering-intent" : "template", "preserves-vector-representation" : true } } \ No newline at end of file diff --git a/Juick/Images.xcassets/ei-clock.imageset/ei-clock.pdf b/Juick/Images.xcassets/ei-clock.imageset/ei-clock.pdf index c63a095..2a80373 100644 Binary files a/Juick/Images.xcassets/ei-clock.imageset/ei-clock.pdf and b/Juick/Images.xcassets/ei-clock.imageset/ei-clock.pdf differ diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard index 68df202..13f6304 100644 --- a/Juick/Main.storyboard +++ b/Juick/Main.storyboard @@ -42,15 +42,13 @@ - + - - - - - + + + @@ -62,10 +60,10 @@ - + - + @@ -88,9 +86,7 @@ - - - + @@ -231,13 +227,11 @@ - + - - - + @@ -276,8 +270,7 @@ - - + @@ -295,7 +288,7 @@ - + @@ -394,35 +387,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -438,7 +402,6 @@ - @@ -474,13 +437,11 @@ - + - - - - + + @@ -495,13 +456,11 @@ - + - - - + @@ -516,34 +475,12 @@ - - - - - - - - - - - - - - - - - - - - - - + - 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; diff --git a/Juick/Views/BubbleMessageCell.m b/Juick/Views/BubbleMessageCell.m index 70746cf..ce41002 100644 --- a/Juick/Views/BubbleMessageCell.m +++ b/Juick/Views/BubbleMessageCell.m @@ -7,7 +7,6 @@ // #import "BubbleMessageCell.h" -#import "ColorScheme.h" @implementation BubbleMessageCell @@ -23,10 +22,10 @@ } -(void) configureWithMessage:(Message *)message isMe:(BOOL)isMe { - self.message.backgroundColor = isMe ? [ColorScheme secondaryBackground] : [ColorScheme mainBackground]; - self.message.textColor = isMe ? [UIColor whiteColor] : [ColorScheme textColor]; + self.message.backgroundColor = isMe ? [UIColor colorNamed:@"Funny"] : [UIColor colorNamed:@"Chat"]; + self.message.textColor = isMe ? [UIColor whiteColor] : [UIColor colorNamed:@"Text"]; self.message.dataDetectorTypes = UIDataDetectorTypeAll; - self.message.tintColor = isMe? [UIColor whiteColor] : [ColorScheme linkColor]; + self.message.tintColor = isMe? [UIColor whiteColor] : [UIColor colorNamed:@"Title"]; self.name.text = message.user.uname; self.message.text = message.text; self.unreadMarker.text = @""; diff --git a/Juick/Views/ConversationCell.m b/Juick/Views/ConversationCell.m index bcf99e7..e4a000c 100644 --- a/Juick/Views/ConversationCell.m +++ b/Juick/Views/ConversationCell.m @@ -7,12 +7,11 @@ // #import "ConversationCell.h" -#import "ColorScheme.h" @implementation ConversationCell -(void) configureWithChat:(Chat *)chat { - self.chatName.textColor = [ColorScheme linkColor]; + self.chatName.textColor = [UIColor colorNamed:@"Title"]; self.chatName.text = chat.uname; self.lastMessage.text = chat.lastMessageText; self.unreadMarker.hidden = true; diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index 6929436..fc7a821 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -7,7 +7,6 @@ // #import "MessageCell.h" -#import "ColorScheme.h" #import "APIClient.h" #import "Entity.h" @@ -21,12 +20,12 @@ - (void)awakeFromNib { [super awakeFromNib]; - self.text.textColor = [ColorScheme textColor]; + self.text.textColor = [UIColor colorNamed:@"Text"]; self.text.dataDetectorTypes = UIDataDetectorTypeAll; - self.text.tintColor = [ColorScheme linkColor]; - self.title.textColor = [ColorScheme linkColor]; - self.timestamp.textColor = [UIColor grayColor]; - self.summary.textColor = [UIColor grayColor]; + self.text.tintColor = [UIColor colorNamed:@"Title"]; + self.title.textColor = [UIColor colorNamed:@"Title"]; + self.timestamp.textColor = [UIColor colorNamed:@"Muted"]; + self.summary.textColor = [UIColor colorNamed:@"Muted"]; UIGestureRecognizer *avatarTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarClicked:)]; [avatarTapRecognizer setEnabled:YES]; [self.avatar addGestureRecognizer:avatarTapRecognizer]; diff --git a/Juick/Views/MessageInputView.m b/Juick/Views/MessageInputView.m index f16f490..ab6b3e5 100644 --- a/Juick/Views/MessageInputView.m +++ b/Juick/Views/MessageInputView.m @@ -7,13 +7,12 @@ // #import "MessageInputView.h" -#import "ColorScheme.h" @implementation MessageInputView -(void) awakeFromNib { [super awakeFromNib]; - [self setTintColor:[ColorScheme linkColor]]; + [self setTintColor:[UIColor colorNamed:@"Title"]]; } @end diff --git a/Juick/Views/QuoteView.m b/Juick/Views/QuoteView.m index bb9cd75..4ff78ce 100644 --- a/Juick/Views/QuoteView.m +++ b/Juick/Views/QuoteView.m @@ -7,12 +7,11 @@ // #import "QuoteView.h" -#import "ColorScheme.h" @implementation QuoteView -(void) awakeFromNib { [super awakeFromNib]; - self.contentView.backgroundColor = [ColorScheme headerBackground]; + self.contentView.backgroundColor = [UIColor whiteColor]; } @end -- cgit v1.2.3