@@ -0,0 +1,186 @@
#import <JTCalendar/JTCalendar.h>
#import <Masonry/Masonry.h>

#import "DateModalViewController.h"
#import "ShadowUIView.h"
#import "UIColor+Helper.h"
#import "UIView+Helper.h"
#import "UIFont+Helper.h"
#import "NSDate+Helper.h"

@interface DateModalViewController()<JTCalendarDelegate>

@property (strong, nonatomic) UIView *containerView;
@property (strong, nonatomic) UIButton *backgroundButton;

@property (strong, nonatomic) JTCalendarMenuView *calendarMenuView;
@property (strong, nonatomic) JTHorizontalCalendarView *calendarContentView;
@property (strong, nonatomic) JTCalendarManager *calendarManager;

@end

@implementation DateModalViewController

#pragma mark - View Controller Setup
- (void)viewDidLoad {
[super viewDidLoad];

if (!self.primaryColor) {
self.primaryColor = [UIColor appPrimaryColor];
}
[self configureBackgroundButton];
[self configureModalView];
[self configureCalendarMenuView];
[self configureCalendarContentView];
[self configureCalendarBehavior];
}

- (void)configureBackgroundButton {
self.backgroundButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.view addSubview:self.backgroundButton];

[self.backgroundButton setBackgroundColor:[UIColor colorWithWhite:1.0 alpha:0.95]];
[self.backgroundButton addTarget:self
action:@selector(backgroundButtonPressed:)
forControlEvents:UIControlEventTouchUpInside];

[self.backgroundButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top);
make.left.mas_equalTo(self.view.mas_left);
make.size.mas_equalTo(self.view);
}];
}

- (void)configureModalView {
ShadowUIView *modalView = [[ShadowUIView alloc] init];
[self.view addSubview:modalView];

[modalView setBackgroundColor:[UIColor whiteColor]];
[modalView setCornerRadius:5.0];
[modalView configureForShadows];
[modalView setShadowColor:[UIColor blackColor]];
[modalView setShadowOpacity:0.4];
[modalView setShadowOffset:CGSizeMake(0, 2.0)];
[modalView setShadowRadius:3.0];

[modalView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.view);
make.width.mas_equalTo(300);
make.height.mas_equalTo(400);
}];

self.containerView = [[UIView alloc] init];
[modalView addSubview:self.containerView];

[self.containerView setCornerRadius:modalView.layer.cornerRadius];
[self.containerView setBackgroundColor:[UIColor whiteColor]];
[self.containerView setClipsToBounds:TRUE];

[self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(modalView);
}];
}

- (void)configureCalendarMenuView {
self.calendarMenuView = [[JTCalendarMenuView alloc] init];
[self.containerView addSubview:self.calendarMenuView];

[self.calendarMenuView setBackgroundColor:_primaryColor];

[self.calendarMenuView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.containerView.mas_top);
make.left.mas_equalTo(self.containerView.mas_left);
make.width.mas_equalTo(self.containerView.mas_width);
make.height.mas_equalTo(60);
}];
}

- (void)configureCalendarContentView {
self.calendarContentView = [[JTHorizontalCalendarView alloc] init];
[self.containerView addSubview:self.calendarContentView];

[self.calendarContentView setBackgroundColor:[UIColor whiteColor]];

[self.calendarContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.calendarMenuView.mas_bottom);
make.left.mas_equalTo(self.containerView.mas_left);
make.width.mas_equalTo(self.containerView.mas_width);
make.bottom.mas_equalTo(self.containerView.mas_bottom);
}];
}

- (void)configureCalendarBehavior {
self.calendarManager = [JTCalendarManager new];
[self.calendarManager setDelegate:self];
[self.calendarManager setMenuView:self.calendarMenuView];
[self.calendarManager setContentView:self.calendarContentView];
[self.calendarManager setDate:[NSDate date]];
}

#pragma mark - JTCalendar Delegate
- (void)calendar:(JTCalendarManager *)calendar prepareDayView:(JTCalendarDayView *)dayView {
// Today
if ([_calendarManager.dateHelper date:[NSDate date] isTheSameDayThan:dayView.date]) {
dayView.circleView.hidden = NO;
dayView.circleView.backgroundColor = [UIColor appWarningColor];
dayView.textLabel.textColor = [UIColor whiteColor];
}
// Selected date
else if (_dateSelected && [_calendarManager.dateHelper date:_dateSelected isTheSameDayThan:dayView.date]) {
dayView.circleView.hidden = NO;
dayView.circleView.backgroundColor = self.primaryColor;
dayView.textLabel.textColor = [UIColor whiteColor];
}
// Other month
else if (![_calendarManager.dateHelper date:_calendarContentView.date isTheSameMonthThan:dayView.date]) {
dayView.circleView.hidden = YES;
dayView.textLabel.textColor = [UIColor lightGrayColor];
}
// Another day of the current month
else {
dayView.circleView.hidden = YES;
dayView.textLabel.textColor = [UIColor blackColor];
}
dayView.dotView.hidden = TRUE;
}

- (void)calendar:(JTCalendarManager *)calendar didTouchDayView:(JTCalendarDayView *)dayView {
_dateSelected = dayView.date;

// Animation for the circleView
dayView.circleView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.1, 0.1);
[UIView transitionWithView:dayView
duration:.3
options:0
animations:^{
dayView.circleView.transform = CGAffineTransformIdentity;
[_calendarManager reload];
} completion:nil];


[self.delegate dateSelected:_dateSelected];
[self dismissViewControllerAnimated:FALSE completion:nil];
}

- (UIView *)calendarBuildMenuItemView:(JTCalendarManager *)calendar {
UILabel *label = [UILabel new];

label.textAlignment = NSTextAlignmentCenter;
label.font = [UIFont mediumPrimaryFontWithSize:20];
label.textColor = [UIColor whiteColor];

return label;
}

- (void)calendar:(JTCalendarManager *)calendar prepareMenuItemView:(UILabel *)menuItemView
date:(NSDate *)date {
menuItemView.text = [[date formattedDateWithFormat:@"MMM yyyy"] uppercaseString];
}

#pragma mark - Button Handler
- (void)backgroundButtonPressed:(UIButton *)backgroundButton {
[self.delegate emptySelected];
[self dismissViewControllerAnimated:FALSE completion:nil];
}

@end
@@ -0,0 +1,11 @@
#import <UIKit/UIKit.h>

@interface FlightCell : UITableViewCell

#pragma mark - Appearance Properties
@property (strong, nonatomic) NSString *flightNumber;
@property (strong, nonatomic) NSDate *startDate;
@property (strong, nonatomic) NSString *startLocation;
@property (strong, nonatomic) NSString *endLocation;

@end
@@ -0,0 +1,107 @@
#import <Masonry/Masonry.h>

#import "FlightCell.h"

#import "UIColor+Helper.h"
#import "NSDate+Helper.h"
#import "UIFont+Helper.h"

@implementation FlightCell {
UILabel *flightNumberLabel;
UILabel *startDateLabel;
UILabel *startLocationLabel;
UILabel *endLocationLabel;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style
reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self initializeCell];
}

return self;
}

- (void)initializeCell {
[self setBackgroundColor:[UIColor whiteColor]];
[self initializeFlightNumberLabel];
[self initializeStartDateLabel];
[self initializeStartLocationLabel];
[self initializeEndLocationLabel];
}

- (void)initializeFlightNumberLabel {
flightNumberLabel = [[UILabel alloc] init];
[self addSubview:flightNumberLabel];

[flightNumberLabel setFont:[UIFont mediumSecondaryFontWithSize:18]];
[flightNumberLabel setTextColor:[UIColor blackColor]];

[flightNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.mas_left).with.offset(15);
make.centerY.mas_equalTo(self.mas_centerY);
}];
}

- (void)initializeStartDateLabel {
startDateLabel = [[UILabel alloc] init];
[self addSubview:startDateLabel];

[startDateLabel setFont:[UIFont mediumPrimaryFontWithSize:14]];
[startDateLabel setTextColor:[UIColor darkGrayColor]];

[startDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(flightNumberLabel.mas_right).with.offset(10);
make.top.mas_equalTo(self.mas_top).with.offset(10);
}];
}

- (void)initializeStartLocationLabel {
startLocationLabel = [[UILabel alloc] init];
[self addSubview:startLocationLabel];

[startLocationLabel setFont:[UIFont mediumPrimaryFontWithSize:14]];
[startLocationLabel setTextColor:[UIColor darkGrayColor]];

[startLocationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.mas_right).with.offset(-10);
make.bottom.mas_equalTo(self.mas_centerY).with.offset(-10);
}];
}

- (void)initializeEndLocationLabel {
endLocationLabel = [[UILabel alloc] init];
[self addSubview:endLocationLabel];

[endLocationLabel setFont:[UIFont mediumPrimaryFontWithSize:14]];
[endLocationLabel setTextColor:[UIColor darkGrayColor]];

[endLocationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.mas_right).with.offset(-10);
make.top.mas_equalTo(self.mas_centerY).with.offset(10);
}];
}

#pragma mark - Property Accessors
- (void)setFlightNumber:(NSString *)flightNumber {
_flightNumber = flightNumber;
[flightNumberLabel setText:flightNumber];
}

- (void)setStartDate:(NSDate *)startDate {
_startDate = startDate;
[startDateLabel setText:[startDate formattedDateWithFormat:@"dd/MM/YYYY"]];
}

- (void)setStartLocation:(NSString *)startLocation {
_startLocation = startLocation;
[startLocationLabel setText:startLocation];
}

- (void)setEndLocation:(NSString *)endLocation {
_endLocation = endLocation;
[endLocationLabel setText:endLocation];
}

@end
@@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>

@interface FlightInspireViewController : UIViewController

@end
@@ -0,0 +1,186 @@
#import <Masonry/Masonry.h>
#import <ZLSwipeableView/ZLSwipeableView.h>
#import <SDWebImage/UIImageView+WebCache.h>
#import <FontAwesomeKit/FontAwesomeKit.h>

#import "FlightInspireViewController.h"

#import "UIColor+Helper.h"
#import "ShadowedUIButton.h"
#import "ShadowUIView.h"
#import "UIView+Helper.h"

@interface FlightInspireViewController ()<ZLSwipeableViewDataSource, ZLSwipeableViewDelegate>

@property (strong, nonatomic) ZLSwipeableView *swipeView;
@property (strong, nonatomic) UIButton *rejectButton;
@property (strong, nonatomic) UIButton *acceptButton;

@end

@implementation FlightInspireViewController {
NSArray *places;
int index;
}

static NSInteger const kFAButtonSize = 50;

- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteGrayColor];
[self stubData];
index = -1;
[self initializeSwipeView];
[self initializeButtons];
}

- (void)stubData {
places = @[
@{
@"image": @"http://www.jimcoda.com/data/photos/887_1_04p0198_golden_gate_bridge_fort_baker.jpg"
},
@{
@"image": @"http://www.jimcoda.com/data/photos/887_1_04p0198_golden_gate_bridge_fort_baker.jpg"
},
@{
@"image": @"http://www.jimcoda.com/data/photos/887_1_04p0198_golden_gate_bridge_fort_baker.jpg"
},
@{
@"image": @"http://www.jimcoda.com/data/photos/887_1_04p0198_golden_gate_bridge_fort_baker.jpg"
},
@{
@"image": @"http://www.jimcoda.com/data/photos/887_1_04p0198_golden_gate_bridge_fort_baker.jpg"
},
@{
@"image": @"http://www.jimcoda.com/data/photos/887_1_04p0198_golden_gate_bridge_fort_baker.jpg"
}
];
}

- (void)initializeSwipeView {
CGRect swipeViewBounds = self.view.bounds;
swipeViewBounds.origin = CGPointMake(25, 50);
swipeViewBounds.size = CGSizeMake(self.view.bounds.size.width - 50, self.view.bounds.size.height / 2.0);

self.swipeView = [[ZLSwipeableView alloc] initWithFrame:swipeViewBounds];
self.swipeView.dataSource = self;
self.swipeView.delegate = self;

[self.view addSubview:self.swipeView];
}

- (void)initializeButtons {
// Initialize button as the front-most UIControl
self.rejectButton = [ShadowedUIButton buttonWithType:UIButtonTypeCustom];
[self.view addSubview:self.rejectButton];
[self.view bringSubviewToFront:self.rejectButton];

// Configure appearance & behaviors
[self.rejectButton setBackgroundColor:[UIColor redColor]];
[self.rejectButton setCornerRadius:kFAButtonSize / 2.0];
[self.rejectButton configureForShadows];
[self.rejectButton setShadowColor:[UIColor blackColor]];
[self.rejectButton setShadowOpacity:0.4];
[self.rejectButton setShadowOffset:CGSizeMake(0.0, 2.0)];
[self.rejectButton setShadowRadius:3.0];
[self.rejectButton addTarget:self
action:@selector(rejectButtonPressed:)
forControlEvents:UIControlEventTouchUpInside];
FAKIcon *addIcon = [FAKIonIcons plusRoundIconWithSize:25];
[addIcon addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor]];
[self.rejectButton setAttributedTitle:[addIcon attributedString] forState:UIControlStateNormal];

// Configure layout
[self.rejectButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.view.mas_centerX).with.offset(-50);
make.top.mas_equalTo(self.swipeView.mas_bottom).with.offset(20);
make.size.mas_equalTo(CGSizeMake(kFAButtonSize, kFAButtonSize));
}];

// Initialize button as the front-most UIControl
self.acceptButton = [ShadowedUIButton buttonWithType:UIButtonTypeCustom];
[self.view addSubview:self.acceptButton];
[self.view bringSubviewToFront:self.acceptButton];

// Configure appearance & behaviors
[self.acceptButton setBackgroundColor:[UIColor greenColor]];
[self.acceptButton setCornerRadius:kFAButtonSize / 2.0];
[self.acceptButton configureForShadows];
[self.acceptButton setShadowColor:[UIColor blackColor]];
[self.acceptButton setShadowOpacity:0.4];
[self.acceptButton setShadowOffset:CGSizeMake(0.0, 2.0)];
[self.acceptButton setShadowRadius:3.0];
[self.acceptButton addTarget:self
action:@selector(acceptButtonPressed:)
forControlEvents:UIControlEventTouchUpInside];
FAKIcon *acceptIcon = [FAKIonIcons plusRoundIconWithSize:25];
[acceptIcon addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor]];
[self.acceptButton setAttributedTitle:[acceptIcon attributedString] forState:UIControlStateNormal];

// Configure layout
[self.acceptButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view.mas_centerX).with.offset(50);
make.top.mas_equalTo(self.swipeView.mas_bottom).with.offset(20);
make.size.mas_equalTo(CGSizeMake(kFAButtonSize, kFAButtonSize));
}];

}

#pragma mark - SwipableViewDelegate
- (void)swipeableView:(ZLSwipeableView *)swipeableView
didSwipeView:(UIView *)view
inDirection:(ZLSwipeableViewDirection)direction {
if (direction == ZLSwipeableViewDirectionLeft) {

} else if (direction == ZLSwipeableViewDirectionRight) {

}
}

- (void)swipeableView:(ZLSwipeableView *)swipeableView
didCancelSwipe:(UIView *)view {

}

#pragma mark - Reject Button Pressed
- (void)rejectButtonPressed:(UIButton *)rejectButton {
[self.swipeView swipeTopViewToLeft];
}

- (void)acceptButtonPressed:(UIButton *)acceptButton {
[self.swipeView swipeTopViewToRight];
}


#pragma mark - SwipableViewDataSource
- (UIView *)nextViewForSwipeableView:(ZLSwipeableView *)swipeableView {
index++;
if (index >= places.count) {
return nil;
}
NSDictionary *currentPlace = places[index];

ShadowUIView *cardView = [[ShadowUIView alloc] initWithFrame:swipeableView.bounds];
cardView.backgroundColor = [UIColor lightGrayColor];
[cardView configureForShadows];
[cardView setShadowColor:[UIColor blackColor]];
[cardView setShadowOpacity:0.33];
[cardView setShadowOffset:CGSizeMake(0, 1.5)];
[cardView setShadowRadius:4.0];

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
[cardView addSubview:imageView];

imageView.contentMode = UIViewContentModeScaleAspectFill;
imageView.clipsToBounds = TRUE;
[imageView sd_setImageWithURL:currentPlace[@"image"]
placeholderImage:nil];

[imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(cardView);
}];

return cardView;
}

@end
@@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>

@interface FlightResultViewController : UIViewController

@end
@@ -0,0 +1,121 @@
#import <FontAwesomeKit/FontAwesomeKit.h>
#import <Masonry/Masonry.h>

#import "FlightResultViewController.h"

#import "UIColor+Helper.h"
#import "NSDate+Helper.h"
#import "UIViewController+SideBarViewController.h"
#import "FlightCell.h"

@interface FlightResultViewController() <UITableViewDataSource, UITableViewDelegate>

@end

@implementation FlightResultViewController {
// Flight Table View
UITableView *flightTableView;

// Array of flights
NSArray *flightList;
}

static NSString *const kFlightCellIdentifier = @"FlightCellIdentifier";

- (void)viewDidLoad {
[super viewDidLoad];
[self stubFlightList];
[self configureNavigationBar];
[self configureFlightList];
}

- (void)stubFlightList {
flightList = @[
@{
@"flightNumbers": @"A123",
@"startDate": [[NSDate new] isoDateString],
@"startLocation": @"Singapore",
@"endLocation": @"San Francisco"
},
@{
@"flightNumbers": @"B238",
@"startDate": [[NSDate new] isoDateString],
@"startLocation": @"Viet Nam",
@"endLocation": @"Los Angeles"
}
];
}


- (void)configureNavigationBar {
// [QuickDeskHelper removeNavigationBarOutline:self];
self.navigationItem.title = @"RESULTS";
self.navigationController.navigationBar.barTintColor = [UIColor appPrimaryColor];
self.navigationController.navigationBar.translucent = FALSE;
self.edgesForExtendedLayout = UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars = FALSE;
self.automaticallyAdjustsScrollViewInsets = FALSE;

// Configure back button for subsequent views
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@""
style:UIBarButtonItemStylePlain
target:nil
action:nil];
}

- (void)configureFlightList {
flightTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
[self.view addSubview:flightTableView];
flightTableView.dataSource = self;
flightTableView.delegate = self;

[flightTableView registerClass:[FlightCell class]
forCellReuseIdentifier:kFlightCellIdentifier];

[flightTableView setBackgroundColor:[UIColor whiteColor]];
flightTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];

[flightTableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view.mas_left);
make.top.mas_equalTo(self.view.mas_top);
make.size.mas_equalTo(self.view);
}];
}

#pragma mark - Table View Data Source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return flightList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
FlightCell *cell = [tableView dequeueReusableCellWithIdentifier:kFlightCellIdentifier];
if (cell == nil) {
cell = [[FlightCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:kFlightCellIdentifier];
}
NSDictionary *flight = flightList[indexPath.row];
[cell setFlightNumber:flight[@"flightNumbers"]];
[cell setStartDate:[NSDate isoDateFromString:flight[@"startDate"]]];
[cell setStartLocation:flight[@"startLocation"]];
[cell setEndLocation:flight[@"endLocation"]];

return cell;
}

#pragma mark - Table View Delegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 80;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// [tableView deselectRowAtIndexPath:indexPath animated:TRUE];
// FlightUserViewController *flightUserViewController = [[FlightUserViewController alloc] init];
// [self.navigationController pushViewController:flightUserViewController animated:TRUE];
// Select Flight
}

@end
@@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>

@interface FlightSearchViewController : UIViewController

@end
@@ -0,0 +1,101 @@
#import <Masonry/Masonry.h>

#import "FlightSearchViewController.h"
#import "FromLocationSelectViewController.h"
#import "ToLocationSelectViewController.h"
#import "DateModalViewController.h"

@interface FlightSearchViewController()<DateModalViewControllerDelegate>

@end

@implementation FlightSearchViewController {
UIButton *flightDateButton;
UIButton *fromLocationButton;
UIButton *toLocationButton;
}

- (void)viewDidLoad {
[super viewDidLoad];
[self.view setBackgroundColor:[UIColor whiteColor]];

[self configureFlightDateButton];
[self configureFromLocationButton];
[self configureToLocationButton];
}

- (void)configureFlightDateButton {
flightDateButton = [UIButton buttonWithType:UIButtonTypeSystem];
[self.view addSubview:flightDateButton];

[flightDateButton setTitle:@"Flight Date" forState:UIControlStateNormal];
[flightDateButton setBackgroundColor:[UIColor redColor]];
[flightDateButton addTarget:self action:@selector(flightDateButtonPressed:) forControlEvents:UIControlEventTouchUpInside];

[flightDateButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view.mas_centerX);
make.top.mas_equalTo(self.view.mas_top).with.offset(20);
}];
}

- (void)configureFromLocationButton {
fromLocationButton = [UIButton buttonWithType:UIButtonTypeSystem];
[self.view addSubview:fromLocationButton];

[fromLocationButton setTitle:@"Flight Start Location" forState:UIControlStateNormal];
[fromLocationButton setBackgroundColor:[UIColor redColor]];
[fromLocationButton addTarget:self
action:@selector(fromLocationButtonPressed:)
forControlEvents:UIControlEventTouchUpInside];

[fromLocationButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view.mas_centerX);
make.top.mas_equalTo(flightDateButton.mas_bottom).with.offset(20);
}];
}

- (void)configureToLocationButton {
toLocationButton = [UIButton buttonWithType:UIButtonTypeSystem];
[self.view addSubview:toLocationButton];

[toLocationButton setTitle:@"Flight To Location" forState:UIControlStateNormal];
[toLocationButton setBackgroundColor:[UIColor redColor]];
[toLocationButton addTarget:self
action:@selector(toLocationButtonPressed:)
forControlEvents:UIControlEventTouchUpInside];

[toLocationButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view.mas_centerX);
make.top.mas_equalTo(fromLocationButton.mas_bottom).with.offset(20);
}];
}

#pragma mark - Button Pressed
- (void)fromLocationButtonPressed:(UIButton *)sender {
FromLocationSelectViewController *selectViewController = [[FromLocationSelectViewController alloc] init];
[self.navigationController pushViewController:selectViewController animated:YES];
}

- (void)toLocationButtonPressed:(UIButton *)sender {
ToLocationSelectViewController *selectViewController = [[ToLocationSelectViewController alloc] init];
[self.navigationController pushViewController:selectViewController animated:YES];
}

- (void)flightDateButtonPressed:(UIButton *)sender {
DateModalViewController *dateModalVc = [[DateModalViewController alloc] init];
dateModalVc.delegate = self;
dateModalVc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
dateModalVc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:dateModalVc animated:TRUE completion:nil];
}

#pragma mark - Date Modal View Controller
- (void)dateSelected:(NSDate *)date {

}

- (void)emptySelected {

}

@end
@@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>

@interface FlightSummaryViewController : UIViewController

@end
@@ -0,0 +1,9 @@
#import "FlightSummaryViewController.h"

@implementation FlightSummaryViewController

- (void)viewDidLoad {

}

@end
@@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>

@interface FlightUserViewController : UIViewController

@end
@@ -0,0 +1,134 @@
#import <FontAwesomeKit/FontAwesomeKit.h>
#import <Masonry/Masonry.h>

#import "FlightUserViewController.h"

#import "UIColor+Helper.h"
#import "NSDate+Helper.h"
#import "FlightInspireViewController.h"
#import "UserCell.h"

@interface FlightUserViewController() <UITableViewDataSource, UITableViewDelegate>

@end

@implementation FlightUserViewController {
// Flight Table View
UITableView *userTableView;

// Array of flights
NSArray *userList;
}

static NSString *const kUserCellIdentifier = @"UserCellIdentifier";

- (void)viewDidLoad {
[super viewDidLoad];
[self stubUserList];
[self configureNavigationBar];
[self configureFlightList];
}

- (void)stubUserList {
userList = @[
@{
@"id": @"1",
@"name": @"Bui Trong Nhan",
@"purpose": @"To have fun haha"
},
@{
@"id": @"2",
@"name": @"Loli Otaku",
@"purpose": @"~La la la~"
}
];
}

- (void)configureNavigationBar {
// [QuickDeskHelper removeNavigationBarOutline:self];
self.navigationItem.title = @"PASSENGERS";
self.navigationController.navigationBar.barTintColor = [UIColor appPrimaryColor];
self.navigationController.navigationBar.translucent = FALSE;
self.edgesForExtendedLayout = UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars = FALSE;
self.automaticallyAdjustsScrollViewInsets = FALSE;

// Configure back button for subsequent views
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@""
style:UIBarButtonItemStylePlain
target:nil
action:nil];

// Configure search button on the right of nav bar
FAKIcon *addIcon = [FAKIonIcons paperAirplaneIconWithSize:28];
[addIcon addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor]];
UIImage *addIconImage = [addIcon imageWithSize:CGSizeMake(28, 28)];
UIButton *addButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 28, 28)];
[addButton setAdjustsImageWhenHighlighted:FALSE];
[addButton setImage:addIconImage forState:UIControlStateNormal];
[addButton addTarget:self action:@selector(addButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *addBarButton = [[UIBarButtonItem alloc] initWithCustomView:addButton];

UIBarButtonItem *rightSpacer = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nil action:nil];
rightSpacer.width = -10;


[self.navigationItem setRightBarButtonItems:@[rightSpacer, addBarButton]];
}

- (void)configureFlightList {
userTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
[self.view addSubview:userTableView];
userTableView.dataSource = self;
userTableView.delegate = self;

[userTableView registerClass:[UserCell class]
forCellReuseIdentifier:kUserCellIdentifier];

[userTableView setBackgroundColor:[UIColor whiteColor]];
userTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];

[userTableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view.mas_left);
make.top.mas_equalTo(self.view.mas_top);
make.size.mas_equalTo(self.view);
}];
}

#pragma mark - Table View Data Source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return userList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UserCell *cell = [tableView dequeueReusableCellWithIdentifier:kUserCellIdentifier];
if (cell == nil) {
cell = [[UserCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:kUserCellIdentifier];
}
NSDictionary *user = userList[indexPath.row];
[cell setUserId:user[@"id"]];
[cell setName:user[@"name"]];
[cell setPurpose:user[@"purpose"]];

return cell;
}

#pragma mark - Table View Delegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 80;
}

#pragma mark - Button Handler
- (void)addButtonPressed:(UIButton *)sender {
FlightInspireViewController *flightInspireViewController = [[FlightInspireViewController alloc] init];
[self.navigationController pushViewController:flightInspireViewController animated:YES];
}

@end
@@ -1,5 +1,191 @@
#import <FontAwesomeKit/FontAwesomeKit.h>
#import <Masonry/Masonry.h>

#import "FlightViewController.h"

@implementation FlightViewController
#import "UIColor+Helper.h"
#import "NSDate+Helper.h"
#import "FlightUserViewController.h"
#import "FlightSearchViewController.h"
#import "UIViewController+SideBarViewController.h"
#import "FlightCell.h"

@interface FlightViewController() <UITableViewDataSource, UITableViewDelegate>

@end

@implementation FlightViewController {
// Flight Table View
UITableView *flightTableView;

// Array of flights
NSArray *flightList;
}

static NSString *const kFlightCellIdentifier = @"FlightCellIdentifier";

- (void)viewDidLoad {
[super viewDidLoad];
[self stubFlightList];
[self configureGesture];
[self configureNavigationBar];
[self configureFlightList];
}

- (void)stubFlightList {
flightList = @[
@{
@"flightNumbers": @"A123",
@"startDate": [[NSDate new] isoDateString],
@"startLocation": @"Singapore",
@"endLocation": @"San Francisco"
},
@{
@"flightNumbers": @"B238",
@"startDate": [[NSDate new] isoDateString],
@"startLocation": @"Viet Nam",
@"endLocation": @"Los Angeles"
}
];
}

- (void)configureGesture {
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc]
initWithTarget:self
action:@selector(panGestureRecognized:)];
[self.view addGestureRecognizer:panGesture];
}

- (void)configureNavigationBar {
// [QuickDeskHelper removeNavigationBarOutline:self];
self.navigationItem.title = @"FLIGHTS";
self.navigationController.navigationBar.barTintColor = [UIColor appPrimaryColor];
self.navigationController.navigationBar.translucent = FALSE;
self.edgesForExtendedLayout = UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars = FALSE;
self.automaticallyAdjustsScrollViewInsets = FALSE;

// Configure back button for subsequent views
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@""
style:UIBarButtonItemStylePlain
target:nil
action:nil];

// Configure search button on the right of nav bar
FAKIcon *addIcon = [FAKIonIcons paperAirplaneIconWithSize:28];
[addIcon addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor]];
UIImage *addIconImage = [addIcon imageWithSize:CGSizeMake(28, 28)];
UIButton *addButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 28, 28)];
[addButton setAdjustsImageWhenHighlighted:FALSE];
[addButton setImage:addIconImage forState:UIControlStateNormal];
[addButton addTarget:self action:@selector(addButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *addBarButton = [[UIBarButtonItem alloc] initWithCustomView:addButton];

UIBarButtonItem *rightSpacer = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nil action:nil];
rightSpacer.width = -10;


[self.navigationItem setRightBarButtonItems:@[rightSpacer, addBarButton]];

// Configure menu button on the left of nav bar
UIBarButtonItem *leftSpacer = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nil action:nil];
leftSpacer.width = -10;

FAKIcon *menuIcon = [FAKIonIcons naviconIconWithSize:30];
[menuIcon addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor]];
UIImage *menuIconImage = [menuIcon imageWithSize:CGSizeMake(30, 30)];
UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithImage:menuIconImage
style:UIBarButtonItemStylePlain
target:self
action:@selector(menuButtonPressed:)];
[self.navigationItem setLeftBarButtonItems:@[leftSpacer,menuButton]];
}

- (void)configureFlightList {
flightTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
[self.view addSubview:flightTableView];
flightTableView.dataSource = self;
flightTableView.delegate = self;

[flightTableView registerClass:[FlightCell class]
forCellReuseIdentifier:kFlightCellIdentifier];

[flightTableView setBackgroundColor:[UIColor whiteColor]];
flightTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];

[flightTableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view.mas_left);
make.top.mas_equalTo(self.view.mas_top);
make.size.mas_equalTo(self.view);
}];
}

#pragma mark - Table View Data Source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return flightList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
FlightCell *cell = [tableView dequeueReusableCellWithIdentifier:kFlightCellIdentifier];
if (cell == nil) {
cell = [[FlightCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:kFlightCellIdentifier];
}
NSDictionary *flight = flightList[indexPath.row];
[cell setFlightNumber:flight[@"flightNumbers"]];
[cell setStartDate:[NSDate isoDateFromString:flight[@"startDate"]]];
[cell setStartLocation:flight[@"startLocation"]];
[cell setEndLocation:flight[@"endLocation"]];

return cell;
}

#pragma mark - Table View Delegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 80;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:TRUE];
FlightUserViewController *flightUserViewController = [[FlightUserViewController alloc] init];
[self.navigationController pushViewController:flightUserViewController animated:TRUE];
}


#pragma mark - Gesture Recognizer
- (void)panGestureRecognized:(UIPanGestureRecognizer *)sender {
SideBarViewController *sideBarVc = self.sideBarViewController;
// Dismiss keyboard (optional)
[self.view endEditing:YES];
[sideBarVc.view endEditing:YES];

// Present the view controller
[sideBarVc panGestureRecognized:sender];
}

#pragma mark - Button Handler
- (void)addButtonPressed:(UIButton *)sender {
FlightSearchViewController *flightSearchViewController = [[FlightSearchViewController alloc] init];
[self.navigationController pushViewController:flightSearchViewController animated:TRUE];
}

- (void)menuButtonPressed:(UIButton *)sender {
SideBarViewController *sideBarVc = self.sideBarViewController;
// Dismiss keyboard (optional)
[self.view endEditing:YES];
[sideBarVc.view endEditing:YES];

// Present the view controller
[sideBarVc presentMenuViewController];
}


@end
@@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>

@interface FromLocationSelectViewController : UIViewController

@end
@@ -0,0 +1,77 @@
#import <Masonry/Masonry.h>

#import "FromLocationSelectViewController.h"

#import "LocationCell.h"

@interface FromLocationSelectViewController() <UITableViewDataSource, UITableViewDelegate>

@end

@implementation FromLocationSelectViewController {
UITableView *locationTableView;
NSArray *locationList;
}

static NSString *const kLocationCellIdentifier = @"LocationCellIdentifier";

- (void)viewDidLoad {
[super viewDidLoad];
[self configureTableView];
[self stubData];
}

- (void) stubData {
locationList = @[@"Arizona", @"Singapore", @"San Francisco"];
}

- (void)configureTableView {
locationTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
locationTableView.dataSource = self;
locationTableView.delegate = self;
[self.view addSubview:locationTableView];

[locationTableView registerClass:[LocationCell class]
forCellReuseIdentifier:kLocationCellIdentifier];

[locationTableView setBackgroundColor:[UIColor whiteColor]];
locationTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];

[locationTableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view.mas_left);
make.top.mas_equalTo(self.view.mas_top);
make.size.mas_equalTo(self.view);
}];
}

#pragma mark - Table View Data Source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return locationList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
LocationCell *cell = [tableView dequeueReusableCellWithIdentifier:kLocationCellIdentifier];
if (cell == nil) {
cell = [[LocationCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:kLocationCellIdentifier];
}
[cell setTitle:locationList[indexPath.row]];

return cell;
}

#pragma mark - Table View Delegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 80;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

}


@end

This file was deleted.

This file was deleted.

@@ -0,0 +1,7 @@
#import <UIKit/UIKit.h>

@interface LocationCell : UITableViewCell

@property (strong, nonatomic) NSString *title;

@end
@@ -0,0 +1,47 @@
#import <Masonry/Masonry.h>

#import "LocationCell.h"

#import "UIColor+Helper.h"
#import "NSDate+Helper.h"
#import "UIFont+Helper.h"

@implementation LocationCell {
UILabel *titleLabel;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style
reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self initializeCell];
}

return self;
}

- (void)initializeCell {
[self setBackgroundColor:[UIColor whiteColor]];
[self intializeTitleLabel];
}

- (void)intializeTitleLabel {
titleLabel = [[UILabel alloc] init];
[self addSubview:titleLabel];

[titleLabel setFont:[UIFont mediumSecondaryFontWithSize:18]];
[titleLabel setTextColor:[UIColor blackColor]];

[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.mas_left).with.offset(15);
make.centerY.mas_equalTo(self.mas_centerY);
}];
}

#pragma mark - Property Accessors
- (void)setTitle:(NSString *)title {
_title = title;
[titleLabel setText:_title];
}

@end
@@ -4,7 +4,7 @@

#import "LoginViewController.h"

#import "InspiredViewController.h"
#import "MainViewController.h"
#import "Constants.h"
#import "HttpClient.h"
#import "AppDelegate.h"
@@ -37,7 +37,7 @@ - (void) loginButton:(FBSDKLoginButton *)loginButton
[HttpClient postWithUrl:url body:@{@"facebookId": result.token.userID}]
.then(^{
AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
InspiredViewController *mainViewController = [[InspiredViewController alloc] init];
MainViewController *mainViewController = [[MainViewController alloc] init];
[appDelegate setRootViewController:mainViewController];
})
.catch(^(NSError *error) {
@@ -18,7 +18,6 @@ @interface MainViewController()<MenuViewControllerDelegate>
@end

static NSInteger const kMainSectionIndex = 0;
static NSInteger const kOtherSectionIndex = 1;

@implementation MainViewController

@@ -22,7 +22,7 @@ @interface MenuViewController()<UITableViewDataSource, UITableViewDelegate>

@end

static CGFloat const kProfilePictureSize = 60;
static CGFloat const kProfilePictureSize = 130;
static CGFloat const kCellHeight = 60;

static NSInteger const kMainMenuCellCount = 3;
@@ -65,6 +65,7 @@ - (void)viewWillAppear:(BOOL)animated {
if (self.nameLabel.text == nil || [self.nameLabel.text trim].length == 0) {
self.nameLabel.text = [FBSDKProfile currentProfile].name;
NSInteger width = self.view.frame.size.width;
NSLog(@"%@", [FBSDKProfile currentProfile].userID);
NSString *avatarUrl = [NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?width=%td",
[FBSDKProfile currentProfile].userID, width];
[self.backgroundImageView sd_setImageWithURL:[NSURL URLWithString:avatarUrl]
@@ -123,7 +124,7 @@ - (void)configureProfile {

[_profileImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.profileContainerView.mas_centerX);
make.bottom.mas_equalTo(self.profileContainerView.mas_centerY).with.offset(-10);
make.top.mas_equalTo(self.profileContainerView.mas_top).with.offset(10);
make.size.mas_equalTo(CGSizeMake(kProfilePictureSize, kProfilePictureSize));
}];

@@ -0,0 +1,68 @@
#import <NSDate+DateTools.h>

/**
* Set of NSDate helper functions
*/
@interface NSDate (Helper)

#pragma mark - Date Helpers
/**
* Retrieve the date without consideration of time from the called date
*
* @return The date without information of time of the givend ate
*/
- (NSDate *)dateWithoutTime;

/**
* Get the weekday notation of the called date
*
* @return The weekdaty notation string
*/
- (NSString *)weekdayNotation;

/**
* Get the ISO format of the called date
*
* @return The ISO formatted string
*/
- (NSString *)isoDateString;

+ (NSDate *)isoDateFromString:(NSString *)dateString;

/**
* Retrieve the date with time as the end of that day of the called date
*
* @return The date with time as the end of the day
*/
- (NSDate *)endDay;

#pragma mark - Date Transformer and Formatter
/**
* Get the date transformer with ISO format
*
* @return The date transformer with ISO date format
*/
+ (NSValueTransformer *)dateTransformer;

/**
* Get ISO date formatter
*
* @return The defined formatter
*/
+ (NSDateFormatter *)isoDateFormatter;

/**
* get Day formatter which will ignore the time
*
* @return The defined formatter
*/
+ (NSDateFormatter *)dayFormatter;

/**
* Get list of time with each elements away from the previous one of 15 minutes
*
* @return the array of times
*/
+ (NSArray *)getTimeList;

@end
@@ -0,0 +1,104 @@
#import <Mantle/Mantle.h>

#import "NSDate+Helper.h"

@implementation NSDate (Helper)

- (NSDate *)dateWithoutTime {
return [[NSDate dayFormatter] dateFromString:[[NSDate dayFormatter] stringFromDate:self]];
}

- (NSString *)weekdayNotation {
NSInteger weekday = [self weekday];
switch (weekday) {
case 1:
return @"SUN";
break;
case 2:
return @"MON";
break;
case 3:
return @"TUE";
break;
case 4:
return @"WED";
break;
case 5:
return @"THU";
break;
case 6:
return @"FRI";
break;
case 7:
return @"SAT";
default:
NSAssert(false, @"Invalid weekday");
return nil;
break;
}
}

- (NSDate *)endDay {
return [NSDate dateWithYear:self.year month:self.month day:self.day hour:23 minute:59 second:59];
}

- (NSString *)isoDateString {
return [[NSDate isoDateFormatter] stringFromDate:self];
}

+ (NSDate *)isoDateFromString:(NSString *)dateString {
return [[NSDate isoDateFormatter] dateFromString:dateString];
}

#pragma mark - Date Helper
+ (NSValueTransformer *)dateTransformer {
return [MTLValueTransformer transformerUsingForwardBlock:
^(NSString *str, BOOL *success, NSError *__autoreleasing *error) {
return [[NSDate isoDateFormatter] dateFromString:str];
}
reverseBlock:
^(NSDate *date, BOOL *success, NSError *__autoreleasing *error) {
return [[NSDate isoDateFormatter] stringFromDate:date];
}
];

}

+ (NSDateFormatter *)isoDateFormatter {
static NSDateFormatter *dateFormatter = nil;
if (dateFormatter == nil) {
dateFormatter = [[NSDateFormatter alloc] init];
NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
[dateFormatter setLocale:enUSPOSIXLocale];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"];
}

return dateFormatter;
}

+ (NSDateFormatter *)dayFormatter {
static NSDateFormatter *dayFormatter = nil;
if (dayFormatter == nil) {
dayFormatter = [[NSDateFormatter alloc] init];
NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
[dayFormatter setLocale:enUSPOSIXLocale];
[dayFormatter setTimeZone:[NSTimeZone localTimeZone]];
[dayFormatter setDateFormat:@"yyyy-MM-dd"];
}

return dayFormatter;
}

+ (NSArray *)getTimeList {
NSMutableArray *arr = [NSMutableArray new];
for (NSInteger i = 0; i < 24; i++) {
for (NSInteger j = 0; j < 60; j += 15) {
[arr addObject:[NSString stringWithFormat:@"%02td:%02td", i, j]];
}
}

return [arr copy];
}

@end
@@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>

@interface PlaceDetailViewController : UIViewController

@end
@@ -0,0 +1,97 @@
#import <Masonry/Masonry.h>
#import <SDWebImage/UIImageView+WebCache.h>

#import "PlaceDetailViewController.h"

@implementation PlaceDetailViewController {
UIImageView *profileImage;
UILabel *titleLabel;
UILabel *addressLabel;
UILabel *descriptionLabel;
UITableView *chatListView;
UIButton *leftTab;
UIButton *rightTab;
}

- (void)viewDidLoad {
[super viewDidLoad];
[self configurePicture];
[self configureTitle];
[self configureTabBar];

}

- (void)configurePicture {
profileImage = [[UIImageView alloc] initWithFrame:CGRectZero];
[self.view addSubview:profileImage];

profileImage.contentMode = UIViewContentModeScaleAspectFill;
profileImage.clipsToBounds = TRUE;
[profileImage sd_setImageWithURL:
[NSURL URLWithString:@"http://www.jimcoda.com/data/photos/887_1_04p0198_golden_gate_bridge_fort_baker.jpg"]
placeholderImage:nil];

[profileImage mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view.mas_left);
make.top.mas_equalTo(self.view.mas_top);
make.size.mas_equalTo(CGSizeMake(self.view.frame.size.width, self.view.frame.size.width));
}];
}

- (void)configureTitle {
titleLabel = [[UILabel alloc] init];
[self.view addSubview:titleLabel];

[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.view.mas_centerX);
make.top.mas_equalTo(profileImage.mas_bottom).with.offset(20);
}];
}

- (void)configureTabBar {
leftTab = [UIButton buttonWithType:UIButtonTypeSystem];
[self.view addSubview:leftTab];

[leftTab setTitle:@"DETAILS" forState:UIControlStateNormal];
[leftTab addTarget:self
action:@selector(leftTabButtonPressed:)
forControlEvents:UIControlEventTouchUpInside];

[leftTab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view.mas_left);
make.right.mas_equalTo(self.view.mas_centerX);
make.top.mas_equalTo(titleLabel.mas_bottom).with.offset(20);
}];

rightTab = [UIButton buttonWithType:UIButtonTypeSystem];
[self.view addSubview:rightTab];

[rightTab setTitle:@"GROUPS" forState:UIControlStateNormal];
[rightTab addTarget:self
action:@selector(rightTabButtonPressed:)
forControlEvents:UIControlEventTouchUpInside];
[rightTab mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view.mas_centerX);
make.right.mas_equalTo(self.view.mas_right);
make.top.mas_equalTo(titleLabel.mas_bottom).with.offset(20);
}];
}

- (void)configureScrollView {

}

- (void)configureChatList {

}

#pragma mark - Tab Bar Button Pressed
- (void)leftTabButtonPressed:(UIButton *)leftTab {

}

- (void)rightTabButtonPressed:(UIButton *)rightTab {

}

@end
@@ -0,0 +1,5 @@
#import <UIKit/UIKit.h>

@interface ShadowedUIButton : UIButton

@end
@@ -0,0 +1,14 @@
#import "ShadowedUIButton.h"

#import "UIView+Helper.h"

@implementation ShadowedUIButton

#pragma mark - Auto Layout Handler
- (void)layoutSubviews {
[super layoutSubviews];
[self setShadowPath:[[UIBezierPath bezierPathWithRoundedRect:self.bounds
cornerRadius:self.layer.cornerRadius] CGPath]];
}

@end
@@ -0,0 +1,10 @@
#import <UIKit/UIKit.h>

@interface UserCell : UITableViewCell

#pragma mark - Appearance Properties
@property (strong, nonatomic) NSString *userId;
@property (strong, nonatomic) NSString *name;
@property (strong, nonatomic) NSString *purpose;

@end
@@ -0,0 +1,101 @@
#import <Masonry/Masonry.h>
#import <SDWebImage/UIImageView+WebCache.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>

#import "UserCell.h"

#import "UIView+Helper.h"
#import "UIColor+Helper.h"
#import "NSDate+Helper.h"
#import "UIFont+Helper.h"

@interface UserCell()

@end

@implementation UserCell {
UIImageView *userAvatar;
UILabel *nameLabel;
UILabel *purposeLabel;
}

static CGFloat const kProfilePictureSize = 60;

- (instancetype)initWithStyle:(UITableViewCellStyle)style
reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self initializeCell];
}

return self;
}

- (void)initializeCell {
[self setBackgroundColor:[UIColor whiteColor]];
[self initializeUserAvatar];
[self initializeNameLabel];
[self initializePurposeLabel];
}

- (void)initializeUserAvatar {
userAvatar = [[UIImageView alloc] initWithFrame:CGRectZero];
[self addSubview:userAvatar];

userAvatar.contentMode = UIViewContentModeScaleAspectFill;
[userAvatar setCornerRadius:kProfilePictureSize / 2.0];
userAvatar.clipsToBounds = TRUE;

[userAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.mas_left).with.offset(10);
make.centerY.mas_equalTo(self.mas_centerY);
make.size.mas_equalTo(CGSizeMake(kProfilePictureSize, kProfilePictureSize));
}];
}

- (void)initializeNameLabel {
nameLabel = [[UILabel alloc] init];
[self addSubview:nameLabel];

[nameLabel setFont:[UIFont mediumPrimaryFontWithSize:18]];
[nameLabel setTextColor:[UIColor blackColor]];

[nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(userAvatar.mas_right).with.offset(10);
make.bottom.mas_equalTo(self.mas_centerY).with.offset(-10);
}];
}

- (void)initializePurposeLabel {
purposeLabel = [[UILabel alloc] init];
[self addSubview:purposeLabel];

[purposeLabel setFont:[UIFont mediumPrimaryFontWithSize:18]];
[purposeLabel setTextColor:[UIColor blackColor]];

[purposeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(userAvatar.mas_right).with.offset(10);
make.top.mas_equalTo(self.mas_centerY).with.offset(10);
}];
}

#pragma mark - Property Accessors
- (void)setUserId:(NSString *)userId {
_userId = userId;
NSString *avatarUrl = [NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?width=%td",
userId, (long) kProfilePictureSize];
[userAvatar sd_setImageWithURL:[NSURL URLWithString:avatarUrl]
placeholderImage:nil];
}

- (void)setName:(NSString *)name {
_name = name;
[nameLabel setText:_name];
}

- (void)setPurpose:(NSString *)purpose {
_purpose = purpose;
[purposeLabel setText:_purpose];
}

@end

Large diffs are not rendered by default.

Large diffs are not rendered by default.