diff options
Diffstat (limited to 'Juick/ViewControllers')
-rw-r--r-- | Juick/ViewControllers/LoginViewController.h | 2 | ||||
-rw-r--r-- | Juick/ViewControllers/LoginViewController.m | 17 | ||||
-rw-r--r-- | Juick/ViewControllers/MessagesViewController.h | 5 | ||||
-rw-r--r-- | Juick/ViewControllers/MessagesViewController.m | 134 | ||||
-rw-r--r-- | Juick/ViewControllers/NewPostViewController.m | 42 | ||||
-rw-r--r-- | Juick/ViewControllers/RevealPanelViewController.h | 16 | ||||
-rw-r--r-- | Juick/ViewControllers/RevealPanelViewController.m | 179 | ||||
-rw-r--r-- | Juick/ViewControllers/RootNavigationController.h | 13 | ||||
-rw-r--r-- | Juick/ViewControllers/RootNavigationController.m | 24 | ||||
-rw-r--r-- | Juick/ViewControllers/ThreadViewController.h | 15 | ||||
-rw-r--r-- | Juick/ViewControllers/ThreadViewController.m | 63 |
11 files changed, 173 insertions, 337 deletions
diff --git a/Juick/ViewControllers/LoginViewController.h b/Juick/ViewControllers/LoginViewController.h index bf980fa..6a834a8 100644 --- a/Juick/ViewControllers/LoginViewController.h +++ b/Juick/ViewControllers/LoginViewController.h @@ -8,7 +8,7 @@ #import <UIKit/UIKit.h> #import "XLForm.h" -#import "PDKeychainbindingsController.h" +#import "PDKeychainBindingsController.h" @interface LoginViewController : XLFormViewController diff --git a/Juick/ViewControllers/LoginViewController.m b/Juick/ViewControllers/LoginViewController.m index eedc6d3..1718366 100644 --- a/Juick/ViewControllers/LoginViewController.m +++ b/Juick/ViewControllers/LoginViewController.m @@ -12,20 +12,9 @@ @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) awakeFromNib { + [super awakeFromNib]; + [self initializeForm]; } - (void)initializeForm { diff --git a/Juick/ViewControllers/MessagesViewController.h b/Juick/ViewControllers/MessagesViewController.h index 3dac200..fc3545a 100644 --- a/Juick/ViewControllers/MessagesViewController.h +++ b/Juick/ViewControllers/MessagesViewController.h @@ -7,9 +7,10 @@ // #import <UIKit/UIKit.h> +@import PHFComposeBarView; @interface MessagesViewController : UITableViewController<PHFComposeBarViewDelegate> -- (void)loadFromPath:(NSString *)messagesPath withParams:(NSDictionary *)params withTitle:(NSString *)title; +@property(nonatomic, strong) NSString *path; +@property(nonatomic, strong) NSMutableDictionary *params; - (void) refreshData; -- (void) composePressed; @end diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m index 95879bf..b877cd1 100644 --- a/Juick/ViewControllers/MessagesViewController.m +++ b/Juick/ViewControllers/MessagesViewController.m @@ -6,58 +6,34 @@ // Copyright (c) 2013 com.juick. All rights reserved. // -#import "SWRevealViewController/SWRevealViewController.h" #import "MessagesViewController.h" +@import YYWebImage; #import "MessageCell.h" #import "Message.h" #import "ColorScheme.h" #import "NewPostViewController.h" +#import "LoginViewController.h" +#import "ThreadViewController.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; -@property(nonatomic, strong) dispatch_queue_t concurrent_queue; -@property (nonatomic, readwrite, retain) UIView *inputAccessoryView; - @end @implementation MessagesViewController -- (id)init { - if (self = [super init]) { - self.concurrent_queue = dispatch_queue_create("Queue", DISPATCH_QUEUE_SERIAL); - }; - return self; -} - -- (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; - dispatch_sync(self.concurrent_queue, ^{ - [self.messages removeAllObjects]; - [weakSelf refreshData]; - }); -} - - (void) refreshData { self.dataLoading = YES; - [Message pullNextFromPath:self.path params:self.params callback:^(NSArray *next) { + [[APIClient sharedClient] pullNextFromPath:self.path params:self.params callback:^(NSArray *next, NSError *err) { NSArray *newMsgs = next; - if ([self.path isEqualToString:[Message threadUrl]]) { + if ([self.path isEqualToString:[APIClient threadUrl]]) { NSUInteger lastRid = [((Message *)[self.messages lastObject]).rid unsignedIntegerValue]; NSUInteger count = [next count] - 1; NSUInteger oldCount = [self.messages count]; @@ -84,30 +60,37 @@ static NSString *CellIdentifier = @"MessageCell"; - (void)viewDidLoad { [super viewDidLoad]; + self.dataLoading = NO; [self.view setBackgroundColor:[ColorScheme mainBackground]]; self.messages = [NSMutableArray array]; + self.params = [NSMutableDictionary new]; - 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];} + [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged]; + if ([User isAuthenticated]) { + [User checkIsValid:^(BOOL success) { + if (success) { + self.path = [APIClient feedUrl]; + [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeAlert|UIUserNotificationTypeSound|UIUserNotificationTypeBadge) categories:nil]]; + [self refreshData]; + } else { + [User throwUnableToLogin]; + } + }]; + + } else { + self.path = [APIClient messagesUrl]; + [self refreshData]; + } + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"profile_icon"] style:UIBarButtonItemStylePlain target:self action:@selector(composePressed)]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"settings_icon"] style:UIBarButtonItemStylePlain target:self action:@selector(composePressed)]; +} - (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 @@ -137,32 +120,20 @@ static NSString *CellIdentifier = @"MessageCell"; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - __block NSInteger count; - dispatch_sync(self.concurrent_queue, ^{ - count = self.messages.count; - }); - return count; + return self.messages.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; - __block Message *msg; - dispatch_sync(self.concurrent_queue, ^{ - msg = [self.messages objectAtIndex:indexPath.row]; - }); + MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"messageCell" forIndexPath:indexPath]; + Message *msg = [self.messages objectAtIndex:indexPath.row]; cell.layer.borderWidth = 6; cell.layer.borderColor = [ColorScheme mainBackground].CGColor; [cell setMessage:msg]; if ([msg.attach length] > 0) { [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) { - [[NSOperationQueue mainQueue] addOperationWithBlock:^{ - [cell setNeedsUpdateConstraints]; - [cell updateConstraintsIfNeeded]; - [cell setNeedsLayout]; - [cell layoutIfNeeded]; - }]; + [cell setNeedsUpdateConstraints]; + [cell updateConstraintsIfNeeded]; }]; - } else { cell.attach.image = nil; } @@ -171,14 +142,12 @@ static NSString *CellIdentifier = @"MessageCell"; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if ([self.path isEqualToString:[Message threadUrl]]) + if ([self.path isEqualToString:[APIClient threadUrl]]) return; - __block Message *msg; - dispatch_sync(self.concurrent_queue, ^{ - msg = [self.messages objectAtIndex:indexPath.row]; - }); - MessagesViewController *threadViewController = [[MessagesViewController alloc] init]; - [threadViewController loadFromPath:[Message threadUrl] withParams:[NSDictionary dictionaryWithObjectsAndKeys:msg.mid, @"mid", nil] withTitle:@"Thread"]; + Message *msg = [self.messages objectAtIndex:indexPath.row]; + ThreadViewController *threadViewController = [[ThreadViewController alloc] init]; + [threadViewController setPath:[APIClient threadUrl]]; + [threadViewController setParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:msg.mid, @"mid", nil]]; [self.navigationController pushViewController:threadViewController animated:NO]; } @@ -186,36 +155,15 @@ static NSString *CellIdentifier = @"MessageCell"; CGFloat actualPosition = scrollView_.contentOffset.y; CGFloat contentHeight = scrollView_.contentSize.height - scrollView_.contentSize.height / 2; if (actualPosition >= contentHeight && !self.dataLoading) { - __block Message *lastMsg; - dispatch_sync(self.concurrent_queue, ^{ - lastMsg = [self.messages lastObject]; + Message *lastMsg = [self.messages lastObject]; + if (lastMsg != nil) { NSNumber *lastMid = lastMsg.mid; - if (![self.path isEqualToString:[Message threadUrl]]) { - [self.params setValue:lastMid forKey:@"before_mid"]; + if (![self.path isEqualToString:[APIClient threadUrl]]) { + [self.params setObject:lastMid forKey:@"before_mid"]; } [self refreshData]; - }); - } -} - -- (BOOL) canBecomeFirstResponder { - return [self.path isEqualToString:[Message threadUrl]]; -} - -- (UIView *)inputAccessoryView { - if (!_inputAccessoryView) { - CGRect viewBounds = self.view.bounds; - CGRect frame = CGRectMake(0, viewBounds.size.height - PHFComposeBarViewInitialHeight, viewBounds.size.width, - PHFComposeBarViewInitialHeight); - PHFComposeBarView *_view = [[PHFComposeBarView alloc] initWithFrame:frame]; - _view.backgroundColor = [UIColor whiteColor]; - _view.buttonTintColor = [ColorScheme linkColor]; - _view.maxLinesCount = 4; - _view.utilityButtonImage = [UIImage imageNamed:@"Camera"]; - _view.delegate = self; - _inputAccessoryView = _view; + } } - return _inputAccessoryView; } @end diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m index 8c8fbf0..318de4e 100644 --- a/Juick/ViewControllers/NewPostViewController.m +++ b/Juick/ViewControllers/NewPostViewController.m @@ -7,55 +7,33 @@ // #import "NewPostViewController.h" +#import "ColorScheme.h" @interface NewPostViewController () +@property (nonatomic, assign) BOOL didSetupConstraints; + @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 + self.navigationController.visibleViewController.title = @"Post"; + self.view.backgroundColor = [ColorScheme mainBackground]; + self.navigationController.visibleViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelCompose)]; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone - target:self action:@selector(doneCompose)]; + self.navigationController.visibleViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd + 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]; + [self.navigationController.visibleViewController.navigationController popViewControllerAnimated:YES]; } - (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. + [self.navigationController.visibleViewController.navigationController popToRootViewControllerAnimated:YES]; } @end diff --git a/Juick/ViewControllers/RevealPanelViewController.h b/Juick/ViewControllers/RevealPanelViewController.h deleted file mode 100644 index 87cc257..0000000 --- a/Juick/ViewControllers/RevealPanelViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// 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 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 diff --git a/Juick/ViewControllers/RootNavigationController.h b/Juick/ViewControllers/RootNavigationController.h new file mode 100644 index 0000000..f7f6734 --- /dev/null +++ b/Juick/ViewControllers/RootNavigationController.h @@ -0,0 +1,13 @@ +// +// RootNavigationController.h +// Juick +// +// Created by Vitaly Takmazov on 24/09/2017. +// Copyright © 2017 com.juick. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface RootNavigationController : UINavigationController + +@end diff --git a/Juick/ViewControllers/RootNavigationController.m b/Juick/ViewControllers/RootNavigationController.m new file mode 100644 index 0000000..9be0a5f --- /dev/null +++ b/Juick/ViewControllers/RootNavigationController.m @@ -0,0 +1,24 @@ +// +// RootNavigationController.m +// Juick +// +// Created by Vitaly Takmazov on 24/09/2017. +// Copyright © 2017 com.juick. All rights reserved. +// + +#import "RootNavigationController.h" +#import "ColorScheme.h" + +@interface RootNavigationController () + +@end + +@implementation RootNavigationController + +- (void) awakeFromNib { + [super awakeFromNib]; + [self.toolbar setTintColor:[ColorScheme linkColor]]; + [self.visibleViewController setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"nearby_icon"] style:UIBarButtonItemStylePlain target:self action:nil],[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"new_chat_icon"] style:UIBarButtonItemStylePlain target:self action:nil],[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"chats_icon"] style:UIBarButtonItemStylePlain target:self action:nil],[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES]; +} + +@end diff --git a/Juick/ViewControllers/ThreadViewController.h b/Juick/ViewControllers/ThreadViewController.h new file mode 100644 index 0000000..3f2b59c --- /dev/null +++ b/Juick/ViewControllers/ThreadViewController.h @@ -0,0 +1,15 @@ +// +// ThreadViewController.h +// Juick +// +// Created by Vitaly Takmazov on 24/09/2017. +// Copyright © 2017 com.juick. All rights reserved. +// + +#import <UIKit/UIKit.h> +@import PHFComposeBarView; + +@interface ThreadViewController : UITableViewController<PHFComposeBarViewDelegate> +@property(nonatomic, strong) NSString *path; +@property(nonatomic, strong) NSMutableDictionary *params; +@end diff --git a/Juick/ViewControllers/ThreadViewController.m b/Juick/ViewControllers/ThreadViewController.m new file mode 100644 index 0000000..2ee4af5 --- /dev/null +++ b/Juick/ViewControllers/ThreadViewController.m @@ -0,0 +1,63 @@ +// +// ThreadViewController.m +// Juick +// +// Created by Vitaly Takmazov on 24/09/2017. +// Copyright © 2017 com.juick. All rights reserved. +// + +#import "ThreadViewController.h" +#import "ColorScheme.h" + +@interface ThreadViewController () + +@property (nonatomic, readwrite, retain) UIView *inputAccessoryView; + +@end + +@implementation ThreadViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Uncomment the following line to preserve selection between presentations. + // self.clearsSelectionOnViewWillAppear = NO; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { +#warning Incomplete implementation, return the number of sections + return 0; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { +#warning Incomplete implementation, return the number of rows + return 0; +} + + +- (BOOL) canBecomeFirstResponder { + return YES; +} + +- (UIView *)inputAccessoryView { + if (!_inputAccessoryView) { + CGRect viewBounds = self.view.bounds; + CGRect frame = CGRectMake(0, viewBounds.size.height - PHFComposeBarViewInitialHeight, viewBounds.size.width, + PHFComposeBarViewInitialHeight); + PHFComposeBarView *_view = [[PHFComposeBarView alloc] initWithFrame:frame]; + _view.backgroundColor = [UIColor whiteColor]; + _view.buttonTintColor = [ColorScheme linkColor]; + _view.maxLinesCount = 4; + _view.utilityButtonImage = [UIImage imageNamed:@"Camera"]; + _view.delegate = self; + _inputAccessoryView = _view; + } + return _inputAccessoryView; +} + +@end |