Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ Carthage/Build

fastlane/report.xml
fastlane/screenshots
.DS_Store
28 changes: 15 additions & 13 deletions FixaDaApp/FixaDaApp/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" showsUserLocation="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QhC-Y4-i8h">
<rect key="frame" x="0.0" y="0.0" width="600" height="100"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="225"/>
</mapView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="BMq-V3-f2f">
<rect key="frame" x="0.0" y="100" width="600" height="500"/>
<rect key="frame" x="0.0" y="225" width="600" height="375"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="4Wd-lS-p0j" style="IBUITableViewCellStyleDefault" id="5cm-8d-a5a">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="BeepBoopCellIdentifier" textLabel="4Wd-lS-p0j" style="IBUITableViewCellStyleDefault" id="5cm-8d-a5a">
<rect key="frame" x="0.0" y="28" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5cm-8d-a5a" id="cpW-0e-B2H">
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4Wd-lS-p0j">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<rect key="frame" x="15" y="0.0" width="570" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
Expand All @@ -47,14 +47,16 @@
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="BMq-V3-f2f" firstAttribute="top" secondItem="QhC-Y4-i8h" secondAttribute="bottom" id="829-uy-XA8"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="height" secondItem="BMq-V3-f2f" secondAttribute="height" multiplier="0.2" id="DcL-ga-xdl"/>
<constraint firstAttribute="trailing" secondItem="BMq-V3-f2f" secondAttribute="trailing" id="Ddx-sp-gAW"/>
<constraint firstItem="BMq-V3-f2f" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="PGd-F5-XwA"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="PS4-bX-CJK"/>
<constraint firstAttribute="trailing" secondItem="QhC-Y4-i8h" secondAttribute="trailing" id="mbZ-IW-xGJ"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="sq5-GT-TWp"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="BMq-V3-f2f" secondAttribute="bottom" id="vLg-lx-GXH"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="0HW-NH-py1"/>
<constraint firstAttribute="trailing" secondItem="BMq-V3-f2f" secondAttribute="trailing" id="5ID-le-xG2"/>
<constraint firstItem="BMq-V3-f2f" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="8zr-hH-Rmz"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="FeM-XW-F8B"/>
<constraint firstItem="BMq-V3-f2f" firstAttribute="top" secondItem="QhC-Y4-i8h" secondAttribute="bottom" id="Gcd-he-8G6"/>
<constraint firstItem="BMq-V3-f2f" firstAttribute="top" secondItem="QhC-Y4-i8h" secondAttribute="bottom" id="KjB-6Q-ELY"/>
<constraint firstAttribute="trailing" secondItem="QhC-Y4-i8h" secondAttribute="trailing" id="LLj-FW-RNc"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="width" secondItem="BMq-V3-f2f" secondAttribute="width" id="Np7-Z0-xAV"/>
<constraint firstItem="QhC-Y4-i8h" firstAttribute="height" secondItem="BMq-V3-f2f" secondAttribute="height" multiplier="0.6" id="PYF-My-HwS"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="BMq-V3-f2f" secondAttribute="bottom" id="cef-sT-XGj"/>
</constraints>
</view>
<connections>
Expand Down
13 changes: 5 additions & 8 deletions FixaDaApp/FixaDaApp/FoursquareAPIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "FoursquareAPIManager.h"
#import <CoreLocation/CoreLocation.h>
#import <AFNetworking/AFNetworking.h>

#define kFoursquareAPIClientID @"GWKJBVWFYBJQ02T3TRBB4VBL24AIO4TCMJCGIQ5ADKVKJXGP"
Expand Down Expand Up @@ -34,14 +35,10 @@ + (void)findSomething:(NSString *)query

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

[manager GET:url
parameters:nil
progress:nil
success:^(NSURLSessionTask *task, id responseObject)
{

} failure:^(NSURLSessionTask *operation, NSError *error)
{
[manager GET:url parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) {
NSArray *musicArray = responseObject[@"response"][@"venues"];
completion(musicArray);
} failure:^(NSURLSessionTask *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];

Expand Down
28 changes: 23 additions & 5 deletions FixaDaApp/FixaDaApp/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@

#import "ViewController.h"
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>
#import "FoursquareAPIManager.h"


@interface ViewController ()
<
UITableViewDataSource,
UITableViewDelegate,
MKMapViewDelegate
MKMapViewDelegate,
CLLocationManagerDelegate
>

@property (weak, nonatomic) IBOutlet MKMapView *mapView;
Expand All @@ -38,7 +41,20 @@ - (void)viewDidLoad {

self.mapView.delegate = self;

self.locationManager = [[CLLocationManager alloc] init];
[self checkForLocationService];

if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[self.locationManager requestWhenInUseAuthorization];
}

}

- (void)checkForLocationService {
// if ([CLLocationManager locationServicesEnabled] ) {
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
[self.locationManager startUpdatingLocation];
// }
}

- (void)viewDidAppear:(BOOL)animated
Expand All @@ -56,7 +72,7 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Expand All @@ -70,13 +86,16 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
return cell;
}

- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}

# pragma mark - Map view delegate

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
if (!self.foundPlaces) {
self.foundPlaces = YES;

[self zoomToLocation:userLocation.location];
[self fetchVenuesAtLocation:userLocation.location];
}
Expand All @@ -97,7 +116,6 @@ - (void)fetchVenuesAtLocation:(CLLocation *)location
[FoursquareAPIManager findSomething:@"music"
atLocation:location
completion:^(NSArray *data){

weakSelf.venues = data;
[weakSelf.tableView reloadData];
[weakSelf showPins];
Expand Down