Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed app - Lauren #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
23 changes: 17 additions & 6 deletions FixaDaApp/FixaDaApp/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
Expand All @@ -18,14 +18,17 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<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"/>
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="QhC-Y4-i8h">
<rect key="frame" x="0.0" y="0.0" width="600" height="300"/>
<constraints>
<constraint firstAttribute="height" constant="300" id="iEG-gI-VJg"/>
</constraints>
</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="300" width="600" height="300"/>
<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="cellIdentifier" 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">
Expand All @@ -36,13 +39,16 @@
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="delegate" destination="8bC-Xf-vdC" id="B2S-Dc-sNR"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
Expand All @@ -56,6 +62,11 @@
<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"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="DcL-ga-xdl"/>
</mask>
</variation>
</view>
<connections>
<outlet property="mapView" destination="QhC-Y4-i8h" id="SMQ-g7-itJ"/>
Expand Down
5 changes: 5 additions & 0 deletions FixaDaApp/FixaDaApp/FoursquareAPIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ + (void)findSomething:(NSString *)query
NSString *baseURL = @"https://api.foursquare.com/v2/venues/search";
NSString *url = [NSString stringWithFormat:@"%@?client_id=%@&client_secret=%@&v=20160215&ll=%f,%f&query=%@", baseURL, kFoursquareAPIClientID, kFoursquareAPIClientSecret, location.coordinate.latitude, location.coordinate.longitude, query];

NSLog(@"Latitude: %f, Longitude: %f", location.coordinate.latitude, location.coordinate.longitude);

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

[manager GET:url
Expand All @@ -40,6 +42,9 @@ + (void)findSomething:(NSString *)query
success:^(NSURLSessionTask *task, id responseObject)
{

NSLog(@"%@", responseObject);
completion(responseObject[@"response"][@"venues"]);

} failure:^(NSURLSessionTask *operation, NSError *error)
{
NSLog(@"Error: %@", error);
Expand Down
9 changes: 8 additions & 1 deletion FixaDaApp/FixaDaApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSLocationAlwaysUsageDescription</key>
<string>This requires location services to work 💩</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Show you the places!</string>
<string>💩</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand Down
27 changes: 14 additions & 13 deletions FixaDaApp/FixaDaApp/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,14 @@
#import "ViewController.h"
#import <MapKit/MapKit.h>
#import "FoursquareAPIManager.h"
#import <CoreLocation/CoreLocation.h>

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

@property (weak, nonatomic) IBOutlet MKMapView *mapView;
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@property (nonatomic) CLLocationManager *locationManager;

@property (nonatomic, assign) BOOL foundPlaces;

@property (nonatomic) NSArray *venues;

@end
Expand All @@ -35,15 +28,18 @@ - (void)viewDidLoad {

self.tableView.delegate = self;
self.tableView.dataSource = self;

self.mapView.delegate = self;

self.mapView.showsUserLocation = YES;
self.locationManager = [[CLLocationManager alloc] init];

}

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[super viewDidAppear:YES];
[self.locationManager requestAlwaysAuthorization];

}


Expand All @@ -56,15 +52,16 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BeepBoopCellIdentifier"];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellIdentifier"];

NSDictionary *venue = self.venues[indexPath.row];
NSString *name = venue[@"name"];

cell.textLabel.text = name;

return cell;
Expand All @@ -79,6 +76,7 @@ - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)use

[self zoomToLocation:userLocation.location];
[self fetchVenuesAtLocation:userLocation.location];
[self showPins];
}
}

Expand All @@ -103,6 +101,9 @@ - (void)fetchVenuesAtLocation:(CLLocation *)location
[weakSelf showPins];

}];



}

- (void)showPins
Expand Down