Browse files

Removing Check-In functionality

  • Loading branch information...
1 parent 40dbd77 commit 13094a4be2e41ac9edd059f3cf0d4a36712705d3 @mattt mattt committed Jul 1, 2010
Showing with 7 additions and 155 deletions.
  1. +1 −8 Classes/Controllers/SpotViewController.h
  2. +3 −74 Classes/Controllers/SpotViewController.m
  3. +3 −73 Resources/XIB/SpotView.xib
View
9 Classes/Controllers/SpotViewController.h
@@ -17,22 +17,15 @@
@interface SpotViewController : UITableViewController <CLLocationManagerDelegate> {
Spot * spot;
NSArray * checkIns;
-
- CLLocationManager * locationManager;
-
+
IBOutlet UILabel * nameLabel;
IBOutlet EGOImageView * imageView;
- IBOutlet UIButton * checkInButton;
IBOutlet MKMapView * mapView;
}
@property (nonatomic, retain) Spot * spot;
@property (nonatomic, retain) NSArray * checkIns;
-@property (nonatomic, retain) CLLocationManager * locationManager;
-
- (id)initWithSpot:(Spot *)someSpot;
-- (IBAction)checkIn:(id)sender;
-
@end
View
77 Classes/Controllers/SpotViewController.m
@@ -25,7 +25,6 @@
@interface SpotViewController ()
- (void)updateContent;
-- (void)handleCheckInState;
@end
static NSDateFormatter * _dateFormatter;
@@ -37,41 +36,20 @@ @implementation SpotViewController
@synthesize spot;
@synthesize checkIns;
-@synthesize locationManager;
- (id)initWithSpot:(Spot *)someSpot {
if (self = [super initWithNibName:@"SpotView" bundle:nil]) {
self.spot = someSpot;
-
- self.locationManager = [[CLLocationManager alloc] init];
- self.locationManager.delegate = self;
- self.locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
- self.locationManager.distanceFilter = 80.0;
}
return self;
}
-- (void)dealloc {
- self.locationManager.delegate = nil;
-
+- (void)dealloc {
[spot release];
- [locationManager release];
[super dealloc];
}
-- (void)handleCheckInState {
- if ([Spot canCheckInAtSpot:self.spot fromLocation:self.locationManager.location]) {
- [checkInButton setTitle:NSLocalizedString(@"Check In", nil)
- forState:UIControlStateNormal];
- checkInButton.enabled = YES;
- } else {
- [checkInButton setTitle:[self.locationManager distanceAndDirectionTo:self.spot.location]
- forState:UIControlStateDisabled];
- checkInButton.enabled = NO;
- }
-}
-
#pragma mark -
#pragma mark View Lifecycle
@@ -93,58 +71,22 @@ - (void)viewDidLoad {
delegate:self
selector:@selector(requestDidFinish:)];
- [spotRequest startAsynchronous];
-
- [self.locationManager startUpdatingLocation];
+ [spotRequest startAsynchronous];
}
- (void)viewDidUnload {
[super viewDidUnload];
- [self.locationManager stopUpdatingLocation];
}
- (void)updateContent {
nameLabel.text = self.spot.name;
[imageView setImageURL:self.spot.imageURL];
- checkInButton.titleLabel.numberOfLines = 2;
- checkInButton.titleLabel.adjustsFontSizeToFitWidth = YES;
-
[mapView addAnnotation:self.spot];
[mapView setRegion:MKCoordinateRegionMakeWithDistance(self.spot.coordinate, 1000, 1000) animated:YES];
}
#pragma mark -
-#pragma mark IBAction
-
-- (IBAction)checkIn:(id)sender {
- [checkInButton setEnabled:NO];
-
- CLLocation * currentLocation = self.locationManager.location;
- CLLocationAccuracy accuracy = currentLocation.horizontalAccuracy;
- CLLocationDegrees latitude = currentLocation.coordinate.latitude;
- CLLocationDegrees longitude = currentLocation.coordinate.longitude;
-
- NSString * URLString = [@"http://api.gowalla.com/checkins.json" stringByAppendingFormat:@"?oauth_token=%@", [[NSUserDefaults standardUserDefaults] objectForKey:@"gowalla_basic_oauth_access_token"]];
-
- checkInRequest = [[EGOHTTPFormRequest alloc] initWithURL:[NSURL URLWithString:URLString]
- delegate:self];
- [checkInRequest setDidFailSelector:@selector(requestDidFinish:)];
-
- [checkInRequest setPostValue:self.spot.identifier
- forKey:@"spot_id"];
- [checkInRequest setPostValue:[[NSNumber numberWithDouble:latitude] stringValue]
- forKey:@"lat"];
- [checkInRequest setPostValue:[[NSNumber numberWithDouble:longitude] stringValue]
- forKey:@"lng"];
- [checkInRequest setPostValue:[[NSNumber numberWithDouble:accuracy] stringValue]
- forKey:@"accuracy"];
-
-
- [checkInRequest startSynchronous];
-}
-
-#pragma mark -
#pragma mark EGOHTTPRequest
- (void)requestDidFinish:(EGOHTTPRequest *)request {
@@ -174,20 +116,7 @@ - (void)requestDidFinish:(EGOHTTPRequest *)request {
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", nil)
otherButtonTitles:nil] autorelease] show];
- }
-
- [self handleCheckInState];
-}
-
-#pragma mark -
-#pragma mark CLLocationManagerDelegate
-
-- (void)locationManager:(CLLocationManager *)manager
- didUpdateToLocation:(CLLocation *)newLocation
- fromLocation:(CLLocation *)oldLocation
-{
- NSLog(@"locationManager:didUpdateToLocation:fromLocation:");
- [self handleCheckInState];
+ }
}
#pragma mark -
View
76 Resources/XIB/SpotView.xib
@@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="4"/>
+ <integer value="8"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -58,40 +58,6 @@
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
- <object class="IBUIButton" id="228951126">
- <reference key="NSNextResponder" ref="360812180"/>
- <int key="NSvFlags">292</int>
- <string key="NSFrame">{{10, 130}, {300, 44}}</string>
- <reference key="NSSuperview" ref="360812180"/>
- <bool key="IBUIOpaque">NO</bool>
- <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <bool key="IBUIEnabled">NO</bool>
- <int key="IBUIContentHorizontalAlignment">0</int>
- <int key="IBUIContentVerticalAlignment">0</int>
- <object class="NSFont" key="IBUIFont">
- <string key="NSName">Helvetica-Bold</string>
- <double key="NSSize">15</double>
- <int key="NSfFlags">16</int>
- </object>
- <int key="IBUIButtonType">1</int>
- <string key="IBUINormalTitle">Check In</string>
- <object class="NSColor" key="IBUIHighlightedTitleColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- </object>
- <object class="NSColor" key="IBUIDisabledTitleColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
- </object>
- <object class="NSColor" key="IBUINormalTitleColor">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
- </object>
- <object class="NSColor" key="IBUINormalTitleShadowColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC41AA</bytes>
- </object>
- </object>
<object class="IBUILabel" id="576862806">
<reference key="NSNextResponder" ref="360812180"/>
<int key="NSvFlags">292</int>
@@ -119,7 +85,7 @@
<object class="IBMKMapView" id="557916713">
<reference key="NSNextResponder" ref="360812180"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{10, 195}, {300, 120}}</string>
+ <string key="NSFrame">{{10, 130}, {300, 120}}</string>
<reference key="NSSuperview" ref="360812180"/>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
@@ -128,7 +94,7 @@
<bool key="IBMKShowsUserLocation">YES</bool>
</object>
</object>
- <string key="NSFrameSize">{320, 330}</string>
+ <string key="NSFrameSize">{320, 270}</string>
<reference key="NSSuperview" ref="873029372"/>
<reference key="IBUIBackgroundColor" ref="441539931"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@@ -226,23 +192,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">checkInButton</string>
- <reference key="source" ref="372490531"/>
- <reference key="destination" ref="228951126"/>
- </object>
- <int key="connectionID">18</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchEventConnection" key="connection">
- <string key="label">checkIn:</string>
- <reference key="source" ref="228951126"/>
- <reference key="destination" ref="372490531"/>
- <int key="IBEventType">7</int>
- </object>
- <int key="connectionID">19</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">mapView</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="557916713"/>
@@ -285,7 +234,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="53798147"/>
- <reference ref="228951126"/>
<reference ref="576862806"/>
<reference ref="557916713"/>
</object>
@@ -297,11 +245,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<reference key="parent" ref="360812180"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">14</int>
- <reference key="object" ref="228951126"/>
- <reference key="parent" ref="360812180"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">16</int>
<reference key="object" ref="576862806"/>
<reference key="parent" ref="360812180"/>
@@ -319,7 +262,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
- <string>14.IBPluginDependency</string>
<string>16.IBPluginDependency</string>
<string>20.IBPluginDependency</string>
<string>4.IBEditorWindowLastContentRect</string>
@@ -335,7 +277,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>UIResponder</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>{{329, 504}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@@ -419,17 +360,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="IBPartialClassDescription">
<string key="className">SpotViewController</string>
<string key="superclassName">UITableViewController</string>
- <object class="NSMutableDictionary" key="actions">
- <string key="NS.key.0">checkIn:</string>
- <string key="NS.object.0">id</string>
- </object>
- <object class="NSMutableDictionary" key="actionInfosByName">
- <string key="NS.key.0">checkIn:</string>
- <object class="IBActionInfo" key="NS.object.0">
- <string key="name">checkIn:</string>
- <string key="candidateClassName">id</string>
- </object>
- </object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">

0 comments on commit 13094a4

Please sign in to comment.