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

work in progress #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
work in progress
SubCipher committed Sep 26, 2015
commit 31567364ac2cc1ed6d7b7f3fa21b98c42c4c3602
595 changes: 595 additions & 0 deletions TalkinToTheNet/KPgoLoco.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions TalkinToTheNet/KPgoLoco.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//
// AppDelegate.h
// TalkinToTheNet
// KPgoLoco
//
// Created by Michael Kavouras on 9/20/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
// Created by MacMan on 9/25/15.
// Copyright © 2015 MacManApp. All rights reserved.
//

#import <UIKit/UIKit.h>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//
// AppDelegate.m
// TalkinToTheNet
// KPgoLoco
//
// Created by Michael Kavouras on 9/20/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
// Created by MacMan on 9/25/15.
// Copyright © 2015 MacManApp. All rights reserved.
//

#import "AppDelegate.h"
Original file line number Diff line number Diff line change
@@ -29,6 +29,36 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9046" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9035"/>
</dependencies>
<scenes>
<!--View Controller-->
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" 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="9046" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9035"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
19 changes: 19 additions & 0 deletions TalkinToTheNet/KPgoLoco/FoursquareAnnotation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// FourSquareAnnotation.h
// KPgoLoco
//
// Created by MacMan on 9/25/15.
// Copyright © 2015 MacManApp. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <MapKit/MKAnnotation.h>


@interface FoursquareAnnotation : UIView <MKAnnotation>

@property (nonatomic, assign)CLLocationCoordinate2D coordinate;
@property (nonatomic, copy)NSString *title;
@property (nonatomic, copy)NSString *subtitle;

@end
41 changes: 41 additions & 0 deletions TalkinToTheNet/KPgoLoco/FoursquareAnnotation.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// FourSquareAnnotation.m
// KPgoLoco
//
// Created by MacMan on 9/25/15.
// Copyright © 2015 MacManApp. All rights reserved.
//

#import "FoursquareAnnotation.h"


@implementation FoursquareAnnotation


@synthesize coordinate;
@synthesize title;
@synthesize subtitle;



-(id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self){
//[self superclass];

}
return self;

}


/*
Only override drawRect: if you perform custom drawing.
An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
Drawing code
}
*/

@end
Original file line number Diff line number Diff line change
@@ -36,5 +36,12 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
28 changes: 28 additions & 0 deletions TalkinToTheNet/KPgoLoco/KPgoLocoViewConViewCon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// KPgoLocoViewConViewCon.h
// KPgoLoco
//
// Created by MacMan on 9/25/15.
// Copyright © 2015 MacManApp. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>


@interface KPgoLocoViewConViewCon : UIViewController <MKMapViewDelegate>

@property (nonatomic, weak) IBOutlet MKMapView *mvFoursquare;

@property (nonatomic, weak) MKUserLocation *userCurrentLocation;

@property (nonatomic, strong) NSURLConnection *urlConnection;

@property (nonatomic, copy) NSMutableData *mutableData;






@end
126 changes: 126 additions & 0 deletions TalkinToTheNet/KPgoLoco/KPgoLocoViewConViewCon.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
//
// KPgoLocoViewConViewCon.m
// KPgoLoco
//
// Created by MacMan on 9/25/15.
// Copyright © 2015 MacManApp. All rights reserved.
//


#import <MapKit/MapKit.h>
#import "KPgoLocoViewConViewCon.h"
#import "SBJSON4.h"
#import "FoursquareAnnotation.h"

@interface KPgoLocoViewConViewCon ()

@end

@implementation KPgoLocoViewConViewCon

@synthesize mvFoursquare;
@synthesize userCurrentLocation;
@synthesize urlConnection;
@synthesize mutableData;




- (void)viewDidLoad {
[super viewDidLoad];
[self setMutableData:nil];

}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}



- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
[self setMutableData: nil];

[mapView removeAnnotations: [mapView annotations]];

NSString *stringURL = [NSString stringWithFormat: @"https://api.foursquare.com/v2/venues/search?ll=%f,%f&client_id=TRVGUWRGA0LPBCQGL5OFNSTMXUYT05JR4SIRPHNSTE43YQNU&client_secret=DRCHGGJGOYXUH5L0GL444J3ZSKWKZZ2P4DH0GIM5QVM0ATCR", [userLocation coordinate].latitude, [userLocation coordinate].longitude];
NSURL *URLWithString = [NSURL URLWithString: stringURL];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL: URLWithString cachePolicy: NSURLRequestReloadIgnoringCacheData timeoutInterval: 30.f];
urlConnection = [[NSURLConnection alloc] initWithRequest: urlRequest delegate: self];

CLLocationCoordinate2D userCoords = [userLocation coordinate];
MKCoordinateRegion region = { { userCoords.latitude , userCoords.longitude }, { 0.009f , 0.009f } };
[mapView setRegion: region animated: YES];
}


- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
if (mutableData == nil)
{
mutableData = [[NSMutableData alloc] init];
}

[mutableData appendData: data];
}








- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
SBJson4Parser *jsonParser = [[SBJson4Parser alloc] init];

NSString *strData = [[NSString alloc] initWithData: mutableData encoding: NSUTF8StringEncoding];

NSDictionary *dictVenues = [jsonParser objectWithString: strData error: nil];
NSDictionary *items = [[[[dictVenues objectForKey: @"response"] objectForKey: @"groups"] objectAtIndex: 0] objectForKey: @"items"];

NSMutableArray *annotations = [[NSMutableArray alloc] init];

for (NSDictionary *venues in items)
{
NSString *name = [venues objectForKey: @"name"];
NSString *address = [[venues objectForKey: @"location"] objectForKey: @"address"];

CGFloat latitude = [[[venues objectForKey: @"location"] objectForKey: @"lat"] floatValue];
CGFloat longitude = [[[venues objectForKey: @"location"] objectForKey: @"lng"] floatValue];

FoursquareAnnotation *foursquareAnnotation = [[FoursquareAnnotation alloc] init];
MKCoordinateRegion region = { { latitude , longitude } , { 0.01f , 0.01f } };

[FoursquareAnnotation setCoordinate: region.center];
[FoursquareAnnotation title: name];
[FoursquareAnnotation subtitle: address];

[annotations addObject: foursquareAnnotation];
// [foursquareAnnotation release];
}

[mvFoursquare addAnnotations: annotations];

// [jsonParser release];
// [strData release];
// [annotations release];

[self setMutableData: nil];

}


/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/

@end
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//
// main.m
// TalkinToTheNet
// KPgoLoco
//
// Created by Michael Kavouras on 9/20/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
// Created by MacMan on 9/25/15.
// Copyright © 2015 MacManApp. All rights reserved.
//

#import <UIKit/UIKit.h>
24 changes: 24 additions & 0 deletions TalkinToTheNet/KPgoLocoTests/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Loading