Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Setting up login screen and Geoloqi API client.

  • Loading branch information...
commit fb1ace076acc723124db780a485ced6544d37994 1 parent e1fcd0f
@aaronpk aaronpk authored
View
16 Classes/AuthView.h
@@ -0,0 +1,16 @@
+//
+// AuthView.h
+// MapAttack
+//
+// Created by Aaron Parecki on 2011-09-01.
+// Copyright 2011 Geoloqi.com. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+
+@interface AuthView : UIViewController {
+
+}
+
+@end
View
59 Classes/AuthView.m
@@ -0,0 +1,59 @@
+//
+// AuthView.m
+// MapAttack
+//
+// Created by Aaron Parecki on 2011-09-01.
+// Copyright 2011 Geoloqi.com. All rights reserved.
+//
+
+#import "AuthView.h"
+
+
+@implementation AuthView
+
+// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
+/*
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ // Custom initialization.
+ }
+ return self;
+}
+*/
+
+/*
+// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
+- (void)viewDidLoad {
+ [super viewDidLoad];
+}
+*/
+
+/*
+// Override to allow orientations other than the default portrait orientation.
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ // Return YES for supported orientations.
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+*/
+
+- (void)didReceiveMemoryWarning {
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc. that aren't in use.
+}
+
+- (void)viewDidUnload {
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+
+@end
View
150 Classes/AuthView.xib
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">784</int>
+ <string key="IBDocument.SystemVersion">10B500</string>
+ <string key="IBDocument.InterfaceBuilderVersion">732</string>
+ <string key="IBDocument.AppKitVersion">1038.2</string>
+ <string key="IBDocument.HIToolboxVersion">437.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">62</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="1"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ </object>
+ <object class="IBProxyObject" id="975951072">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ </object>
+ <object class="IBUIView" id="191373211">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <string key="NSFrameSize">{320, 460}</string>
+ <reference key="NSSuperview"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace">
+ <int key="NSID">2</int>
+ </object>
+ </object>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="191373211"/>
+ </object>
+ <int key="connectionID">3</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="191373211"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="975951072"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>1.IBEditorWindowLastContentRect</string>
+ <string>1.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>AuthView</string>
+ <string>UIResponder</string>
+ <string>{{556, 412}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">3</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">AuthView</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">AuthView.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3000" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <nil key="IBDocument.LastKnownRelativeProjectPath"/>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">3.1</string>
+ </data>
+</archive>
View
1  Classes/FirstViewController.h
@@ -9,6 +9,7 @@
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import "MapAttack.h"
+#import "LQConfig.h"
#import "GeoloqiReadClient.h"
View
18 Classes/GameListViewController.h
@@ -0,0 +1,18 @@
+//
+// GameList.h
+// MapAttack
+//
+// Created by Aaron Parecki on 2011-08-31.
+// Copyright 2011 Geoloqi.com. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+
+@interface GameListViewController : UIViewController {
+
+}
+
+@property (nonatomic, retain) IBOutlet UITextView *text;
+
+@end
View
74 Classes/GameListViewController.m
@@ -0,0 +1,74 @@
+ //
+// GameList.m
+// MapAttack
+//
+// Created by Aaron Parecki on 2011-08-31.
+// Copyright 2011 Geoloqi.com. All rights reserved.
+//
+
+#import "GameListViewController.h"
+#import "LQClient.h"
+#import "LQConfig.h"
+
+
+@implementation GameListViewController
+
+@synthesize text;
+
+// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
+/*
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ // Custom initialization.
+ }
+ return self;
+}
+*/
+
+/*
+// Implement loadView to create a view hierarchy programmatically, without using a nib.
+- (void)loadView {
+}
+*/
+
+
+// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
+- (void)viewDidLoad {
+ [super viewDidLoad];
+
+ [[LQClient single] getNearbyLayers:^(NSError *error, NSDictionary *response){
+ NSLog(@"Callback: %@", response);
+ }];
+
+}
+
+
+/*
+// Override to allow orientations other than the default portrait orientation.
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ // Return YES for supported orientations.
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+*/
+
+- (void)didReceiveMemoryWarning {
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc. that aren't in use.
+}
+
+- (void)viewDidUnload {
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+
+@end
View
3  Classes/GeoloqiReadClient.h
@@ -9,9 +9,6 @@
#import <Foundation/Foundation.h>
#import "AsyncSocket.h"
-#define LQ_READ_SOCKET_HOST @"localhost"
-#define LQ_READ_SOCKET_PORT 40001
-
@interface GeoloqiReadClient : NSObject {
AsyncSocket *asyncSocket;
View
1  Classes/GeoloqiReadClient.m
@@ -10,6 +10,7 @@
#import "CJSONDeserializer.h"
#import "CJSONSerializer.h"
#import "MapAttack.h"
+#import "LQConfig.h"
#define TIMEOUT_SEC 6.0
#define TAG_DEVICE_ID_SENT 1
View
4 Classes/GeoloqiSocketClient.h
@@ -9,9 +9,6 @@
#import <CoreLocation/CoreLocation.h>
#include "FTLocationSimulator.h"
-#define LQ_SOCKET_HOST @"loki.geoloqi.com"
-#define LQ_SOCKET_PORT 40000
-
@class AsyncUdpSocket;
// class GeoloqiSocketClient extends NSObject implements CLLocationManagerDelegate
@interface GeoloqiSocketClient : NSObject <CLLocationManagerDelegate>
@@ -28,6 +25,7 @@
CLLocationDistance distanceFilterDistance;
NSTimeInterval trackingFrequency;
NSTimeInterval sendingFrequency;
+ NSData *uuid;
}
- (void)normalConnect;
View
18 Classes/GeoloqiSocketClient.m
@@ -7,8 +7,9 @@
#import "GeoloqiSocketClient.h"
#import "CJSONDeserializer.h"
-#import "LQConstants.h"
+#import "LQConfig.h"
#import "AsyncUdpSocket.h"
+#import "MapAttackAppDelegate.h"
#define TIMEOUT_SEC 6.0
#define TAG_DEVICE_ID_SENT 1
@@ -49,9 +50,7 @@ - (id) init
distanceFilterDistance = 1.0;
trackingFrequency = 1;
sendingFrequency = 1;
- // [self normalConnect];
- [self startMonitoringLocation];
-
+ // [self normalConnect];
}
return self;
@@ -61,13 +60,13 @@ - (void) normalConnect
{
NSError *error = nil;
- NSString *host = LQ_SOCKET_HOST;
- UInt16 port = LQ_SOCKET_PORT;
+ NSString *host = LQ_WRITE_SOCKET_HOST;
+ UInt16 port = LQ_WRITE_SOCKET_PORT;
NSLog(@"Connecting to %@:%i", host, port);
// Change to use UDP
- if (![asyncSocket connectToHost:LQ_SOCKET_HOST onPort:LQ_SOCKET_PORT error:&error])
+ if (![asyncSocket connectToHost:LQ_WRITE_SOCKET_HOST onPort:LQ_WRITE_SOCKET_PORT error:&error])
{
NSLog(@"Error connecting: %@", error);
}
@@ -144,7 +143,7 @@ - (void)locationManager:(CLLocationManager *)manager
NSData *data = [self dataFromLocation:newLocation];
NSLog(@"Sending location data: %@", data);
- [asyncSocket sendData:data toHost:LQ_SOCKET_HOST port:LQ_SOCKET_PORT withTimeout:10.0 tag:TAG_DEVICE_ID_SENT];
+ [asyncSocket sendData:data toHost:LQ_WRITE_SOCKET_HOST port:LQ_WRITE_SOCKET_PORT withTimeout:10.0 tag:TAG_DEVICE_ID_SENT];
//Look for ack back
[asyncSocket receiveWithTimeout:30.0 tag:TAG_DEVICE_ID_SENT];
@@ -203,7 +202,8 @@ - (NSData *)dataFromLocation:(CLLocation *)location {
//battery percent
update.f.batteryPercent = (uint16_t)(round(MAX(0.0f, [UIDevice currentDevice].batteryLevel) * 100.0));
- memset(update.f.uuid, 0x0, sizeof(update.f.uuid));
+ // memset(update.f.uuid, 0x0, sizeof(update.f.uuid));
+ memcpy(update.f.uuid, [uuid bytes], 16);
// NSLog(@"Size of packet: %lu", sizeof(LQUpdatePacket));
// NSLog(@"Offset of command: %lu", offsetof(LQUpdatePacket, f.command));
View
30 Classes/LQClient.h
@@ -0,0 +1,30 @@
+//
+// LQClient.h
+// MapAttack
+//
+// Created by Aaron Parecki on 2011-08-31.
+// Copyright 2011 Geoloqi.com. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "ASIHTTPRequest.h"
+
+static NSString *const LQAuthenticationSucceededNotification = @"LQAuthenticationSucceededNotification";
+static NSString *const LQAuthenticationFailedNotification = @"LQAuthenticationFailedNotification";
+static NSString *const LQRefreshTokenKey = @"LQRefreshToken";
+
+typedef void (^LQHTTPRequestCallback)(NSError *error, NSDictionary *response);
+
+@interface LQClient : NSObject {
+
+}
+
+@property (nonatomic, retain) NSString *accessToken;
+
++ (LQClient *)single;
+- (BOOL)isLoggedIn;
+- (void)sendPushToken:(NSString *)token;
+- (void)getNearbyLayers:(LQHTTPRequestCallback)callback;
+- (void)createNewAccountWithEmail:(NSString *)email initials:(NSString *)initials callback:(LQHTTPRequestCallback)callback;
+
+@end
View
80 Classes/LQClient.m
@@ -0,0 +1,80 @@
+//
+// LQClient.m
+// MapAttack
+//
+// Created by Aaron Parecki on 2011-08-31.
+// Copyright 2011 Geoloqi.com. All rights reserved.
+//
+
+#import "LQClient.h"
+#import "LQConfig.h"
+#import "CJSONDeserializer.h"
+
+static LQClient *singleton = nil;
+
+@implementation LQClient
+
+@synthesize accessToken;
+
++ (LQClient *)single {
+ if(!singleton) {
+ singleton = [[self alloc] init];
+ }
+ return singleton;
+}
+
+- (ASIHTTPRequest *)appRequestWithURL:(NSURL *)url {
+ ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
+ [request setAuthenticationScheme:(NSString *)kCFHTTPAuthenticationSchemeBasic];
+ [request setUsername:LQ_OAUTH_CLIENT_ID];
+ [request setPassword:LQ_OAUTH_SECRET];
+ return request;
+}
+
+- (ASIHTTPRequest *)userRequestWithURL:(NSURL *)url {
+ ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
+ [request addRequestHeader:@"Authorization" value:[NSString stringWithFormat:@"OAuth %@"]];
+ return request;
+}
+
+- (NSDictionary *)dictionaryFromResponse:(NSString *)response {
+ NSError *err = nil;
+ NSDictionary *res = [[CJSONDeserializer deserializer] deserializeAsDictionary:[response dataUsingEncoding:NSUTF8StringEncoding]
+ error:&err];
+ return res;
+}
+
+#pragma mark public methods
+
+- (BOOL)isLoggedIn {
+ return [[NSUserDefaults standardUserDefaults] stringForKey:LQRefreshTokenKey] != nil;
+}
+
+- (void)sendPushToken:(NSString *)token {
+ // TODO: Send this device token to the Geoloqi API
+}
+
+- (void)createNewAccountWithEmail:(NSString *)email initials:(NSString *)initials callback:(LQHTTPRequestCallback)callback {
+ NSURL *url = [NSURL URLWithString:@"https://api.geoloqi.com/1/account/create_anon"];
+ __block ASIHTTPRequest *request = [self appRequestWithURL:url];
+ [request setCompletionBlock:^{
+ callback(nil, [self dictionaryFromResponse:[request responseString]]);
+ }];
+ [request startAsynchronous];
+}
+
+- (void)getNearbyLayers:(LQHTTPRequestCallback)callback {
+ NSURL *url = [NSURL URLWithString:@"https://api.geoloqi.com/1/layer/nearby?latitude=45.5246&longitude=-122.6843"];
+ __block ASIHTTPRequest *request = [self userRequestWithURL:url];
+ [request setCompletionBlock:^{
+ callback(nil, [self dictionaryFromResponse:[request responseString]]);
+ }];
+ [request startAsynchronous];
+}
+
+- (void)dealloc {
+ [accessToken release];
+ [super dealloc];
+}
+
+@end
View
20 Classes/LQConfig.h
@@ -0,0 +1,20 @@
+//
+// LQConfig.h
+// MapAttack
+//
+// Created by Aaron Parecki on 2011-09-01.
+// Copyright 2011 Geoloqi.com. All rights reserved.
+//
+
+#define PERMANENT_ACCESS_TOKEN @"517-721f909edfc33426c0276b22241b7e795856da23"
+
+#define LQ_OAUTH_CLIENT_ID @"7bcd478f26bd14b1fed18e9fe59e506f"
+#define LQ_OAUTH_SECRET @"8bf6952f46f325311a67d5a3ed90c9a0"
+#define LQ_USER_AGENT @"mapattack-11.244"
+
+#define LQ_WRITE_SOCKET_HOST @"loki.geoloqi.com"
+#define LQ_WRITE_SOCKET_PORT 40000
+
+#define LQ_READ_SOCKET_HOST @"localhost"
+#define LQ_READ_SOCKET_PORT 40001
+
View
9 Classes/LQConstants.h
@@ -1,9 +0,0 @@
-//
-// LQConstants.h
-// MapAttack
-//
-// Created by Aaron Parecki on 2011-08-11.
-// Copyright 2011 Geoloqi.com. All rights reserved.
-//
-
-#define PERMANENT_ACCESS_TOKEN @"517-721f909edfc33426c0276b22241b7e795856da23"
View
1  Classes/MapAttack.h
@@ -7,7 +7,6 @@
//
#define LQMapAttackWebURL @"http://localhost/index2.html"
-
// @"http://geoloqi.com/test-js.php"
static NSString *const LQMapAttackDataNotification = @"LQMapAttackDataNotification";
View
7 Classes/MapAttackAppDelegate.h
@@ -9,16 +9,21 @@
#import <UIKit/UIKit.h>
#import "GeoloqiSocketClient.h"
#import "MapAttack.h"
+#import "LQClient.h"
+#import "AuthView.h"
@interface MapAttackAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
UIWindow *window;
UITabBarController *tabBarController;
- GeoloqiSocketClient *geoloqi;
+ GeoloqiSocketClient *socketClient;
+ LQClient *geoloqi;
NSString *deviceToken;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) IBOutlet AuthView *authViewController;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
+@property (nonatomic, retain) LQClient *geoloqi;
+(NSString *)getUUID;
View
116 Classes/MapAttackAppDelegate.m
@@ -12,12 +12,10 @@
@implementation MapAttackAppDelegate
@synthesize window;
-@synthesize tabBarController;
-
-
-#pragma mark -
-#pragma mark Application lifecycle
+@synthesize tabBarController, authViewController;
+@synthesize geoloqi;
+#pragma mark Application launched
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
@@ -28,7 +26,22 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[MapAttackAppDelegate getUUID];
- // geoloqi = [[GeoloqiSocketClient alloc] init];
+ socketClient = [[GeoloqiSocketClient alloc] init];
+ self.geoloqi = [[LQClient alloc] init];
+
+ // Creates a new anonymous account or sets the authentication for the current account
+ if(![[LQClient single] isLoggedIn])
+ {
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(authenticationDidSucceed:)
+ name:LQAuthenticationSucceededNotification
+ object:nil];
+
+ [tabBarController presentModalViewController:authViewController animated:YES];
+ } else {
+ // Start sending location updates
+ [socketClient startMonitoringLocation];
+ }
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
@@ -38,6 +51,48 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return YES;
}
+#pragma mark Logged in Successfully
+- (void)authenticationDidSucceed:(NSNotificationCenter *)notification
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:LQAuthenticationSucceededNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:LQAuthenticationFailedNotification
+ object:nil];
+
+ if (tabBarController.modalViewController && [tabBarController.modalViewController isKindOfClass:[authViewController class]])
+ [tabBarController dismissModalViewControllerAnimated:YES];
+
+ // Register for push notifications after logging in successfully
+ [[UIApplication sharedApplication]
+ registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
+ UIRemoteNotificationTypeSound |
+ UIRemoteNotificationTypeAlert)];
+
+ // Start sending location updates
+ [socketClient startMonitoringLocation];
+}
+
+#pragma mark Push token registered
+- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)_deviceToken {
+ // Get a hex string from the device token with no spaces or < >
+ deviceToken = [[[[_deviceToken description]
+ stringByReplacingOccurrencesOfString: @"<" withString: @""]
+ stringByReplacingOccurrencesOfString: @">" withString: @""]
+ stringByReplacingOccurrencesOfString: @" " withString: @""];
+
+ NSLog(@"Device Token: %@", deviceToken);
+
+ [[LQClient single] sendPushToken:deviceToken];
+
+ if ([application enabledRemoteNotificationTypes] == UIRemoteNotificationTypeNone) {
+ NSLog(@"Notifications are disabled for this application. Not registering.");
+ return;
+ }
+}
+
+#pragma mark Received push notification
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSLog(@"Received Push! %@", userInfo);
@@ -60,35 +115,8 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:(N
}
-- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)_deviceToken {
- // Get a hex string from the device token with no spaces or < >
- deviceToken = [[[[_deviceToken description]
- stringByReplacingOccurrencesOfString: @"<" withString: @""]
- stringByReplacingOccurrencesOfString: @">" withString: @""]
- stringByReplacingOccurrencesOfString: @" " withString: @""];
-
- NSLog(@"Device Token: %@", deviceToken);
-
- if ([application enabledRemoteNotificationTypes] == UIRemoteNotificationTypeNone) {
- NSLog(@"Notifications are disabled for this application. Not registering.");
- return;
- }
-}
-
-+ (NSString *)getUUID {
- if([[NSUserDefaults standardUserDefaults] stringForKey:@"uuid"] == nil) {
- CFUUIDRef theUUID = CFUUIDCreate(NULL);
- CFStringRef string = CFUUIDCreateString(NULL, theUUID);
- CFRelease(theUUID);
- [[NSUserDefaults standardUserDefaults] setObject:(NSString *)string forKey:@"uuid"];
- [[NSUserDefaults standardUserDefaults] synchronize];
- NSLog(@"Generating new UUID: %@", string);
- return [(NSString *)string autorelease];
- } else {
- NSLog(@"Returning existing UUID: %@", [[NSUserDefaults standardUserDefaults] stringForKey:@"uuid"]);
- return [[NSUserDefaults standardUserDefaults] stringForKey:@"uuid"];
- }
-}
+#pragma mark -
+#pragma mark Application lifecycle
- (void)applicationWillResignActive:(UIApplication *)application {
/*
@@ -153,9 +181,27 @@ Free up as much memory as possible by purging cached data objects that can be re
*/
}
+#pragma mark -
+
+
++ (NSString *)getUUID {
+ if([[NSUserDefaults standardUserDefaults] stringForKey:@"uuid"] == nil) {
+ CFUUIDRef theUUID = CFUUIDCreate(NULL);
+ CFStringRef string = CFUUIDCreateString(NULL, theUUID);
+ CFRelease(theUUID);
+ [[NSUserDefaults standardUserDefaults] setObject:(NSString *)string forKey:@"uuid"];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ NSLog(@"Generating new UUID: %@", string);
+ return [(NSString *)string autorelease];
+ } else {
+ NSLog(@"Returning existing UUID: %@", [[NSUserDefaults standardUserDefaults] stringForKey:@"uuid"]);
+ return [[NSUserDefaults standardUserDefaults] stringForKey:@"uuid"];
+ }
+}
- (void)dealloc {
[geoloqi release];
+ [socketClient release];
[tabBarController release];
[window release];
[super dealloc];
View
104 SecondView.xib → GameList.xib
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1024</int>
- <string key="IBDocument.SystemVersion">10D571</string>
- <string key="IBDocument.InterfaceBuilderVersion">785</string>
- <string key="IBDocument.AppKitVersion">1038.29</string>
- <string key="IBDocument.HIToolboxVersion">460.00</string>
+ <int key="IBDocument.SystemTarget">1056</int>
+ <string key="IBDocument.SystemVersion">10J567</string>
+ <string key="IBDocument.InterfaceBuilderVersion">823</string>
+ <string key="IBDocument.AppKitVersion">1038.35</string>
+ <string key="IBDocument.HIToolboxVersion">462.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">110</string>
+ <string key="NS.object.0">132</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -45,7 +45,7 @@
<object class="IBUILabel" id="483052203">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">306</int>
- <string key="NSFrame">{{54, 138}, {211, 43}}</string>
+ <string key="NSFrame">{{37, 14}, {244, 43}}</string>
<reference key="NSSuperview" ref="191373211"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
@@ -58,7 +58,7 @@
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <string key="IBUIText">Second View</string>
+ <string key="IBUIText">Nearby Games</string>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">36</double>
@@ -73,28 +73,21 @@
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">1</int>
</object>
- <object class="IBUITextView" id="255779567">
+ <object class="IBUITextView" id="186346258">
<reference key="NSNextResponder" ref="191373211"/>
- <int key="NSvFlags">306</int>
- <string key="NSFrame">{{22, 236}, {275, 121}}</string>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{37, 110}, {240, 128}}</string>
<reference key="NSSuperview" ref="191373211"/>
- <bool key="IBUIOpaque">NO</bool>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MSAxIDEAA</bytes>
+ </object>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
- <bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <bool key="IBUIShowsHorizontalScrollIndicator">NO</bool>
- <bool key="IBUIDelaysContentTouches">NO</bool>
- <bool key="IBUICanCancelContentTouches">NO</bool>
- <float key="IBUIMinimumZoomScale">0.0</float>
- <float key="IBUIMaximumZoomScale">0.0</float>
- <bool key="IBUIBouncesZoom">NO</bool>
- <bool key="IBUIEditable">NO</bool>
- <string type="base64-UTF8" key="IBUIText">TG9hZGVkIGJ5IHRoZSBzZWNvbmQgdmlldwpjb250cm9sbGVyIOKAlCBhbiBpbnN0YW5jZSBvZiBVSVZp
-ZXdDb250cm9sbGVyIOKAlCBzcGVjaWZpZWQgaW4gdGhlIFZpZXcgQ29udHJvbGxlciBBdHRyaWJ1dGVz
-IGluIHRoZSBNYWluIFdpbmRvdyBuaWIgZmlsZS4</string>
- <int key="IBUITextAlignment">1</int>
+ <string key="IBUIText">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
+ <int key="IBUIAutocapitalizationType">2</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
@@ -121,6 +114,14 @@ IGluIHRoZSBNYWluIFdpbmRvdyBuaWIgZmlsZS4</string>
</object>
<int key="connectionID">3</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">text</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="186346258"/>
+ </object>
+ <int key="connectionID">9</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -137,7 +138,7 @@ IGluIHRoZSBNYWluIFdpbmRvdyBuaWIgZmlsZS4</string>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="483052203"/>
- <reference ref="255779567"/>
+ <reference ref="186346258"/>
</object>
<reference key="parent" ref="0"/>
</object>
@@ -158,8 +159,8 @@ IGluIHRoZSBNYWluIFdpbmRvdyBuaWIgZmlsZS4</string>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">7</int>
- <reference key="object" ref="255779567"/>
+ <int key="objectID">8</int>
+ <reference key="object" ref="186346258"/>
<reference key="parent" ref="191373211"/>
</object>
</object>
@@ -173,16 +174,24 @@ IGluIHRoZSBNYWluIFdpbmRvdyBuaWIgZmlsZS4</string>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
- <string>7.IBPluginDependency</string>
+ <string>5.IBViewBoundsToFrameTransform</string>
+ <string>8.IBPluginDependency</string>
+ <string>8.IBViewBoundsToFrameTransform</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>UIViewController</string>
+ <string>GameListViewController</string>
<string>UIResponder</string>
- <string>{{187, 376}, {320, 480}}</string>
+ <string>{{315, 239}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <object class="NSAffineTransform">
+ <bytes key="NSTransformStruct">P4AAAL+AAABCWAAAwlwAAA</bytes>
+ </object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <object class="NSAffineTransform">
+ <bytes key="NSTransformStruct">P4AAAL+AAABCFAAAw4SAAA</bytes>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -201,9 +210,31 @@ IGluIHRoZSBNYWluIFdpbmRvdyBuaWIgZmlsZS4</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">7</int>
+ <int key="maxID">9</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">GameListViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">text</string>
+ <string key="NS.object.0">UITextView</string>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <string key="NS.key.0">text</string>
+ <object class="IBToOneOutletInfo" key="NS.object.0">
+ <string key="name">text</string>
+ <string key="candidateClassName">UITextView</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Classes/GameListViewController.h</string>
+ </object>
+ </object>
+ </object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
@@ -346,6 +377,13 @@ IGluIHRoZSBNYWluIFdpbmRvdyBuaWIgZmlsZS4</string>
<string key="className">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIPrintFormatter.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
</object>
</object>
@@ -399,7 +437,7 @@ IGluIHRoZSBNYWluIFdpbmRvdyBuaWIgZmlsZS4</string>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
- <integer value="1024" key="NS.object.0"/>
+ <integer value="1056" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
@@ -408,6 +446,6 @@ IGluIHRoZSBNYWluIFdpbmRvdyBuaWIgZmlsZS4</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">MapAttack.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">110</string>
+ <string key="IBCocoaTouchPluginVersion">132</string>
</data>
</archive>
View
BIN  Icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Icon@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
134 MainWindow.xib
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1024</int>
- <string key="IBDocument.SystemVersion">10D571</string>
- <string key="IBDocument.InterfaceBuilderVersion">786</string>
- <string key="IBDocument.AppKitVersion">1038.29</string>
- <string key="IBDocument.HIToolboxVersion">460.00</string>
+ <int key="IBDocument.SystemTarget">1056</int>
+ <string key="IBDocument.SystemVersion">10J567</string>
+ <string key="IBDocument.InterfaceBuilderVersion">823</string>
+ <string key="IBDocument.AppKitVersion">1038.35</string>
+ <string key="IBDocument.HIToolboxVersion">462.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string key="NS.object.0">112</string>
+ <string key="NS.object.0">132</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="106"/>
+ <integer value="125"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -87,7 +88,7 @@
<reference key="IBUITabBar"/>
</object>
<reference key="IBUIParentViewController" ref="1034742383"/>
- <string key="IBUINibName">SecondView</string>
+ <string key="IBUINibName">GameList</string>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="interfaceOrientation">1</int>
</object>
@@ -107,6 +108,14 @@
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
+ <object class="IBUIViewController" id="208291676">
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
+ <int key="interfaceOrientation">1</int>
+ </object>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBUIHorizontal">NO</bool>
+ </object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
@@ -135,6 +144,14 @@
</object>
<int key="connectionID">113</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">authViewController</string>
+ <reference key="source" ref="664661524"/>
+ <reference key="destination" ref="208291676"/>
+ </object>
+ <int key="connectionID">126</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -213,6 +230,11 @@
<reference key="object" ref="532797962"/>
<reference key="parent" ref="0"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">125</int>
+ <reference key="object" ref="208291676"/>
+ <reference key="parent" ref="0"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -226,9 +248,13 @@
<string>107.IBPluginDependency</string>
<string>108.CustomClassName</string>
<string>108.IBPluginDependency</string>
+ <string>109.CustomClassName</string>
<string>109.IBPluginDependency</string>
<string>110.IBPluginDependency</string>
<string>111.IBPluginDependency</string>
+ <string>125.CustomClassName</string>
+ <string>125.IBEditorWindowLastContentRect</string>
+ <string>125.IBPluginDependency</string>
<string>2.IBAttributePlaceholdersKey</string>
<string>2.IBEditorWindowLastContentRect</string>
<string>2.IBPluginDependency</string>
@@ -244,8 +270,12 @@
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>FirstViewController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>GameListViewController</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>AuthView</string>
+ <string>{{329, 222}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSMutableDictionary">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -276,25 +306,55 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">124</int>
+ <int key="maxID">126</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
+ <string key="className">AuthView</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Classes/AuthView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">FirstViewController</string>
<string key="superclassName">UIViewController</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">webView</string>
+ <string key="NS.object.0">UIWebView</string>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <string key="NS.key.0">webView</string>
+ <object class="IBToOneOutletInfo" key="NS.object.0">
+ <string key="name">webView</string>
+ <string key="candidateClassName">UIWebView</string>
+ </object>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">Classes/FirstViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">UIWindow</string>
- <string key="superclassName">UIView</string>
+ <string key="className">GameListViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">text</string>
+ <string key="NS.object.0">UITextView</string>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <string key="NS.key.0">text</string>
+ <object class="IBToOneOutletInfo" key="NS.object.0">
+ <string key="name">text</string>
+ <string key="candidateClassName">UITextView</string>
+ </object>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBUserSource</string>
- <string key="minorKey"/>
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Classes/GameListViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
@@ -304,11 +364,13 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>authViewController</string>
<string>tabBarController</string>
<string>window</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>AuthView</string>
<string>UITabBarController</string>
<string>UIWindow</string>
</object>
@@ -317,12 +379,17 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <string>authViewController</string>
<string>tabBarController</string>
<string>window</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
+ <string key="name">authViewController</string>
+ <string key="candidateClassName">AuthView</string>
+ </object>
+ <object class="IBToOneOutletInfo">
<string key="name">tabBarController</string>
<string key="candidateClassName">UITabBarController</string>
</object>
@@ -337,6 +404,14 @@
<string key="minorKey">Classes/MapAttackAppDelegate.h</string>
</object>
</object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIWindow</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
+ </object>
+ </object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -453,6 +528,14 @@
<reference key="sourceIdentifier" ref="533197847"/>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">UIScrollView</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIScrollView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">UISearchBar</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -493,6 +576,21 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">UITextView</string>
+ <string key="superclassName">UIScrollView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UITextView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIPrintFormatter.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
@@ -541,6 +639,14 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">UIWebView</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIWebView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">UIWindow</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -554,7 +660,7 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
- <integer value="1024" key="NS.object.0"/>
+ <integer value="1056" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
@@ -563,6 +669,6 @@
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">MapAttack.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <string key="IBCocoaTouchPluginVersion">112</string>
+ <string key="IBCocoaTouchPluginVersion">132</string>
</data>
</archive>
View
160 MapAttack.xcodeproj/project.pbxproj
@@ -27,12 +27,32 @@
0F12916613F4C809007AAB66 /* fakeLocations.kml in Resources */ = {isa = PBXBuildFile; fileRef = 0F12916013F4C809007AAB66 /* fakeLocations.kml */; };
0F12916713F4C809007AAB66 /* FTLocationSimulator.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F12916213F4C809007AAB66 /* FTLocationSimulator.m */; };
0F12916813F4C809007AAB66 /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F12916513F4C809007AAB66 /* RegexKitLite.m */; };
+ 0FFD5EBA140C25D6008BC18B /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 0FFD5EB8140C25D6008BC18B /* Icon.png */; };
+ 0FFD5EBB140C25D6008BC18B /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0FFD5EB9140C25D6008BC18B /* Icon@2x.png */; };
+ 0FFD5ECA140F218D008BC18B /* LQClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5EC9140F218D008BC18B /* LQClient.m */; };
+ 0FFD5F1F140F38B3008BC18B /* ASIAuthenticationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5F09140F38B3008BC18B /* ASIAuthenticationDialog.m */; };
+ 0FFD5F20140F38B3008BC18B /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5F0C140F38B3008BC18B /* ASIDataCompressor.m */; };
+ 0FFD5F21140F38B3008BC18B /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5F0E140F38B3008BC18B /* ASIDataDecompressor.m */; };
+ 0FFD5F22140F38B3008BC18B /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5F10140F38B3008BC18B /* ASIDownloadCache.m */; };
+ 0FFD5F23140F38B3008BC18B /* ASIFormDataRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5F12140F38B3008BC18B /* ASIFormDataRequest.m */; };
+ 0FFD5F24140F38B3008BC18B /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5F14140F38B3008BC18B /* ASIHTTPRequest.m */; };
+ 0FFD5F25140F38B3008BC18B /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5F18140F38B3008BC18B /* ASIInputStream.m */; };
+ 0FFD5F26140F38B3008BC18B /* ASINetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5F1A140F38B3008BC18B /* ASINetworkQueue.m */; };
+ 0FFD5F27140F38B3008BC18B /* ASIWebPageRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5F1E140F38B3008BC18B /* ASIWebPageRequest.m */; };
+ 0FFD5F2B140F3903008BC18B /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5F2A140F3903008BC18B /* Reachability.m */; };
+ 0FFD5F39140F392C008BC18B /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0FFD5F38140F392C008BC18B /* MobileCoreServices.framework */; };
+ 0FFD5F41140F395F008BC18B /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0FFD5F40140F395F008BC18B /* libz.1.2.3.dylib */; };
+ 0FFD5F78140F3B77008BC18B /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0FFD5F77140F3B77008BC18B /* libxml2.dylib */; };
+ 0FFD5F7C140F3B95008BC18B /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0FFD5F7B140F3B95008BC18B /* SystemConfiguration.framework */; };
+ 0FFD5FA4140F4396008BC18B /* GameListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD5FA3140F4396008BC18B /* GameListViewController.m */; };
+ 0FFD6083140FF95B008BC18B /* AuthView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD6081140FF95B008BC18B /* AuthView.m */; };
+ 0FFD6084140FF95B008BC18B /* AuthView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0FFD6082140FF95B008BC18B /* AuthView.xib */; };
1D3623260D0F684500981E51 /* MapAttackAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* MapAttackAppDelegate.m */; };
1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
28216C970DB411BC00E5133A /* FirstViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28216C960DB411BC00E5133A /* FirstViewController.m */; };
- 282CCBFE0DB6C98000C4EA27 /* SecondView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 282CCBFD0DB6C98000C4EA27 /* SecondView.xib */; };
+ 282CCBFE0DB6C98000C4EA27 /* GameList.xib in Resources */ = {isa = PBXBuildFile; fileRef = 282CCBFD0DB6C98000C4EA27 /* GameList.xib */; };
2840D7CE1179279E00D7F93C /* FirstView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2840D7CD1179279E00D7F93C /* FirstView.xib */; };
288765080DF74369002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765070DF74369002DB57D /* CoreGraphics.framework */; };
28AD73880D9D96C1002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD73870D9D96C1002E5188 /* MainWindow.xib */; };
@@ -69,7 +89,6 @@
0F128FC413F4A9C1007AAB66 /* CJSONSerializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CJSONSerializer.m; sourceTree = "<group>"; };
0F128FC513F4A9C1007AAB66 /* CSerializedJSONData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSerializedJSONData.h; sourceTree = "<group>"; };
0F128FC613F4A9C1007AAB66 /* CSerializedJSONData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSerializedJSONData.m; sourceTree = "<group>"; };
- 0F128FD913F4AA03007AAB66 /* LQConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LQConstants.h; sourceTree = "<group>"; };
0F1290E013F4C2EB007AAB66 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
0F12915113F4C664007AAB66 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; };
0F12916013F4C809007AAB66 /* fakeLocations.kml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = fakeLocations.kml; sourceTree = "<group>"; };
@@ -78,6 +97,44 @@
0F12916313F4C809007AAB66 /* FTSynthesizeSingleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTSynthesizeSingleton.h; sourceTree = "<group>"; };
0F12916413F4C809007AAB66 /* RegexKitLite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegexKitLite.h; sourceTree = "<group>"; };
0F12916513F4C809007AAB66 /* RegexKitLite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RegexKitLite.m; sourceTree = "<group>"; };
+ 0FFD5EB8140C25D6008BC18B /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
+ 0FFD5EB9140C25D6008BC18B /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = "<group>"; };
+ 0FFD5EC8140F218D008BC18B /* LQClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LQClient.h; sourceTree = "<group>"; };
+ 0FFD5EC9140F218D008BC18B /* LQClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LQClient.m; sourceTree = "<group>"; };
+ 0FFD5F08140F38B3008BC18B /* ASIAuthenticationDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIAuthenticationDialog.h; sourceTree = "<group>"; };
+ 0FFD5F09140F38B3008BC18B /* ASIAuthenticationDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIAuthenticationDialog.m; sourceTree = "<group>"; };
+ 0FFD5F0A140F38B3008BC18B /* ASICacheDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASICacheDelegate.h; sourceTree = "<group>"; };
+ 0FFD5F0B140F38B3008BC18B /* ASIDataCompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIDataCompressor.h; sourceTree = "<group>"; };
+ 0FFD5F0C140F38B3008BC18B /* ASIDataCompressor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIDataCompressor.m; sourceTree = "<group>"; };
+ 0FFD5F0D140F38B3008BC18B /* ASIDataDecompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIDataDecompressor.h; sourceTree = "<group>"; };
+ 0FFD5F0E140F38B3008BC18B /* ASIDataDecompressor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIDataDecompressor.m; sourceTree = "<group>"; };
+ 0FFD5F0F140F38B3008BC18B /* ASIDownloadCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIDownloadCache.h; sourceTree = "<group>"; };
+ 0FFD5F10140F38B3008BC18B /* ASIDownloadCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIDownloadCache.m; sourceTree = "<group>"; };
+ 0FFD5F11140F38B3008BC18B /* ASIFormDataRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIFormDataRequest.h; sourceTree = "<group>"; };
+ 0FFD5F12140F38B3008BC18B /* ASIFormDataRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIFormDataRequest.m; sourceTree = "<group>"; };
+ 0FFD5F13140F38B3008BC18B /* ASIHTTPRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIHTTPRequest.h; sourceTree = "<group>"; };
+ 0FFD5F14140F38B3008BC18B /* ASIHTTPRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIHTTPRequest.m; sourceTree = "<group>"; };
+ 0FFD5F15140F38B3008BC18B /* ASIHTTPRequestConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIHTTPRequestConfig.h; sourceTree = "<group>"; };
+ 0FFD5F16140F38B3008BC18B /* ASIHTTPRequestDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIHTTPRequestDelegate.h; sourceTree = "<group>"; };
+ 0FFD5F17140F38B3008BC18B /* ASIInputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIInputStream.h; sourceTree = "<group>"; };
+ 0FFD5F18140F38B3008BC18B /* ASIInputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIInputStream.m; sourceTree = "<group>"; };
+ 0FFD5F19140F38B3008BC18B /* ASINetworkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASINetworkQueue.h; sourceTree = "<group>"; };
+ 0FFD5F1A140F38B3008BC18B /* ASINetworkQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASINetworkQueue.m; sourceTree = "<group>"; };
+ 0FFD5F1B140F38B3008BC18B /* ASIProgressDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIProgressDelegate.h; sourceTree = "<group>"; };
+ 0FFD5F1D140F38B3008BC18B /* ASIWebPageRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIWebPageRequest.h; sourceTree = "<group>"; };
+ 0FFD5F1E140F38B3008BC18B /* ASIWebPageRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIWebPageRequest.m; sourceTree = "<group>"; };
+ 0FFD5F29140F3903008BC18B /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = "<group>"; };
+ 0FFD5F2A140F3903008BC18B /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = "<group>"; };
+ 0FFD5F38140F392C008BC18B /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
+ 0FFD5F40140F395F008BC18B /* libz.1.2.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.2.3.dylib; path = usr/lib/libz.1.2.3.dylib; sourceTree = SDKROOT; };
+ 0FFD5F77140F3B77008BC18B /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; };
+ 0FFD5F7B140F3B95008BC18B /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
+ 0FFD5FA2140F4396008BC18B /* GameListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameListViewController.h; sourceTree = "<group>"; };
+ 0FFD5FA3140F4396008BC18B /* GameListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameListViewController.m; sourceTree = "<group>"; };
+ 0FFD6028140FDAC2008BC18B /* LQConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LQConfig.h; sourceTree = "<group>"; };
+ 0FFD6080140FF95B008BC18B /* AuthView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthView.h; sourceTree = "<group>"; };
+ 0FFD6081140FF95B008BC18B /* AuthView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthView.m; sourceTree = "<group>"; };
+ 0FFD6082140FF95B008BC18B /* AuthView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = AuthView.xib; path = Classes/AuthView.xib; sourceTree = "<group>"; };
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D3623240D0F684500981E51 /* MapAttackAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapAttackAppDelegate.h; sourceTree = "<group>"; };
1D3623250D0F684500981E51 /* MapAttackAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MapAttackAppDelegate.m; sourceTree = "<group>"; };
@@ -85,7 +142,7 @@
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
28216C950DB411BC00E5133A /* FirstViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FirstViewController.h; sourceTree = "<group>"; };
28216C960DB411BC00E5133A /* FirstViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FirstViewController.m; sourceTree = "<group>"; };
- 282CCBFD0DB6C98000C4EA27 /* SecondView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SecondView.xib; sourceTree = "<group>"; };
+ 282CCBFD0DB6C98000C4EA27 /* GameList.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GameList.xib; sourceTree = "<group>"; };
2840D7CD1179279E00D7F93C /* FirstView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FirstView.xib; sourceTree = "<group>"; };
288765070DF74369002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
28A0AB4B0D9B1048005BE974 /* MapAttack_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapAttack_Prefix.pch; sourceTree = "<group>"; };
@@ -105,6 +162,10 @@
0F128EFE13F4A2BB007AAB66 /* CFNetwork.framework in Frameworks */,
0F1290E113F4C2EB007AAB66 /* CoreLocation.framework in Frameworks */,
0F12915213F4C664007AAB66 /* MapKit.framework in Frameworks */,
+ 0FFD5F39140F392C008BC18B /* MobileCoreServices.framework in Frameworks */,
+ 0FFD5F41140F395F008BC18B /* libz.1.2.3.dylib in Frameworks */,
+ 0FFD5F78140F3B77008BC18B /* libxml2.dylib in Frameworks */,
+ 0FFD5F7C140F3B95008BC18B /* SystemConfiguration.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -114,16 +175,22 @@
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
+ 0F007B2913FEED6B00057C53 /* MapAttack.h */,
+ 0FFD6028140FDAC2008BC18B /* LQConfig.h */,
+ 0FFD5EC8140F218D008BC18B /* LQClient.h */,
+ 0FFD5EC9140F218D008BC18B /* LQClient.m */,
+ 1D3623240D0F684500981E51 /* MapAttackAppDelegate.h */,
+ 1D3623250D0F684500981E51 /* MapAttackAppDelegate.m */,
0F007B821401666E00057C53 /* GeoloqiReadClient.h */,
0F007B831401666E00057C53 /* GeoloqiReadClient.m */,
0F128FAB13F4A92E007AAB66 /* GeoloqiSocketClient.h */,
0F128FAC13F4A92E007AAB66 /* GeoloqiSocketClient.m */,
28216C950DB411BC00E5133A /* FirstViewController.h */,
28216C960DB411BC00E5133A /* FirstViewController.m */,
- 1D3623240D0F684500981E51 /* MapAttackAppDelegate.h */,
- 1D3623250D0F684500981E51 /* MapAttackAppDelegate.m */,
- 0F128FD913F4AA03007AAB66 /* LQConstants.h */,
- 0F007B2913FEED6B00057C53 /* MapAttack.h */,
+ 0FFD5FA2140F4396008BC18B /* GameListViewController.h */,
+ 0FFD5FA3140F4396008BC18B /* GameListViewController.m */,
+ 0FFD6080140FF95B008BC18B /* AuthView.h */,
+ 0FFD6081140FF95B008BC18B /* AuthView.m */,
);
path = Classes;
sourceTree = "<group>";
@@ -131,6 +198,8 @@
0F128D4E13F4A207007AAB66 /* Externals */ = {
isa = PBXGroup;
children = (
+ 0FFD5F28140F3903008BC18B /* Reachability */,
+ 0FFD5F07140F38B3008BC18B /* ASIHTTPRequest */,
0F12915F13F4C809007AAB66 /* FTLocationSimulator */,
0F128FB013F4A9C1007AAB66 /* TouchJSON */,
0F128EF613F4A29D007AAB66 /* AsyncSocket.h */,
@@ -197,6 +266,52 @@
path = FTLocationSimulator;
sourceTree = "<group>";
};
+ 0FFD5F07140F38B3008BC18B /* ASIHTTPRequest */ = {
+ isa = PBXGroup;
+ children = (
+ 0FFD5F08140F38B3008BC18B /* ASIAuthenticationDialog.h */,
+ 0FFD5F09140F38B3008BC18B /* ASIAuthenticationDialog.m */,
+ 0FFD5F0A140F38B3008BC18B /* ASICacheDelegate.h */,
+ 0FFD5F0B140F38B3008BC18B /* ASIDataCompressor.h */,
+ 0FFD5F0C140F38B3008BC18B /* ASIDataCompressor.m */,
+ 0FFD5F0D140F38B3008BC18B /* ASIDataDecompressor.h */,
+ 0FFD5F0E140F38B3008BC18B /* ASIDataDecompressor.m */,
+ 0FFD5F0F140F38B3008BC18B /* ASIDownloadCache.h */,
+ 0FFD5F10140F38B3008BC18B /* ASIDownloadCache.m */,
+ 0FFD5F11140F38B3008BC18B /* ASIFormDataRequest.h */,
+ 0FFD5F12140F38B3008BC18B /* ASIFormDataRequest.m */,
+ 0FFD5F13140F38B3008BC18B /* ASIHTTPRequest.h */,
+ 0FFD5F14140F38B3008BC18B /* ASIHTTPRequest.m */,
+ 0FFD5F15140F38B3008BC18B /* ASIHTTPRequestConfig.h */,
+ 0FFD5F16140F38B3008BC18B /* ASIHTTPRequestDelegate.h */,
+ 0FFD5F17140F38B3008BC18B /* ASIInputStream.h */,
+ 0FFD5F18140F38B3008BC18B /* ASIInputStream.m */,
+ 0FFD5F19140F38B3008BC18B /* ASINetworkQueue.h */,
+ 0FFD5F1A140F38B3008BC18B /* ASINetworkQueue.m */,
+ 0FFD5F1B140F38B3008BC18B /* ASIProgressDelegate.h */,
+ 0FFD5F1C140F38B3008BC18B /* ASIWebPageRequest */,
+ );
+ path = ASIHTTPRequest;
+ sourceTree = "<group>";
+ };
+ 0FFD5F1C140F38B3008BC18B /* ASIWebPageRequest */ = {
+ isa = PBXGroup;
+ children = (
+ 0FFD5F1D140F38B3008BC18B /* ASIWebPageRequest.h */,
+ 0FFD5F1E140F38B3008BC18B /* ASIWebPageRequest.m */,
+ );
+ path = ASIWebPageRequest;
+ sourceTree = "<group>";
+ };
+ 0FFD5F28140F3903008BC18B /* Reachability */ = {
+ isa = PBXGroup;
+ children = (
+ 0FFD5F29140F3903008BC18B /* Reachability.h */,
+ 0FFD5F2A140F3903008BC18B /* Reachability.m */,
+ );
+ path = Reachability;
+ sourceTree = "<group>";
+ };
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
@@ -214,6 +329,8 @@
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
+ 0FFD5F77140F3B77008BC18B /* libxml2.dylib */,
+ 0FFD5F7B140F3B95008BC18B /* SystemConfiguration.framework */,
);
name = MapAttack;
sourceTree = "<group>";
@@ -230,8 +347,11 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
+ 0FFD5EB8140C25D6008BC18B /* Icon.png */,
+ 0FFD5EB9140C25D6008BC18B /* Icon@2x.png */,
+ 0FFD6082140FF95B008BC18B /* AuthView.xib */,
2840D7CD1179279E00D7F93C /* FirstView.xib */,
- 282CCBFD0DB6C98000C4EA27 /* SecondView.xib */,
+ 282CCBFD0DB6C98000C4EA27 /* GameList.xib */,
28AD73870D9D96C1002E5188 /* MainWindow.xib */,
8D1107310486CEB800E47090 /* MapAttack-Info.plist */,
);
@@ -247,6 +367,8 @@
0F128EFD13F4A2BB007AAB66 /* CFNetwork.framework */,
0F1290E013F4C2EB007AAB66 /* CoreLocation.framework */,
0F12915113F4C664007AAB66 /* MapKit.framework */,
+ 0FFD5F38140F392C008BC18B /* MobileCoreServices.framework */,
+ 0FFD5F40140F395F008BC18B /* libz.1.2.3.dylib */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -302,9 +424,12 @@
buildActionMask = 2147483647;
files = (
28AD73880D9D96C1002E5188 /* MainWindow.xib in Resources */,
- 282CCBFE0DB6C98000C4EA27 /* SecondView.xib in Resources */,
+ 282CCBFE0DB6C98000C4EA27 /* GameList.xib in Resources */,
2840D7CE1179279E00D7F93C /* FirstView.xib in Resources */,
0F12916613F4C809007AAB66 /* fakeLocations.kml in Resources */,
+ 0FFD5EBA140C25D6008BC18B /* Icon.png in Resources */,
+ 0FFD5EBB140C25D6008BC18B /* Icon@2x.png in Resources */,
+ 0FFD6084140FF95B008BC18B /* AuthView.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -334,6 +459,19 @@
0F12916813F4C809007AAB66 /* RegexKitLite.m in Sources */,
0F007A6313F9A8DA00057C53 /* AsyncUdpSocket.m in Sources */,
0F007B841401666E00057C53 /* GeoloqiReadClient.m in Sources */,
+ 0FFD5ECA140F218D008BC18B /* LQClient.m in Sources */,
+ 0FFD5F1F140F38B3008BC18B /* ASIAuthenticationDialog.m in Sources */,
+ 0FFD5F20140F38B3008BC18B /* ASIDataCompressor.m in Sources */,
+ 0FFD5F21140F38B3008BC18B /* ASIDataDecompressor.m in Sources */,
+ 0FFD5F22140F38B3008BC18B /* ASIDownloadCache.m in Sources */,
+ 0FFD5F23140F38B3008BC18B /* ASIFormDataRequest.m in Sources */,
+ 0FFD5F24140F38B3008BC18B /* ASIHTTPRequest.m in Sources */,
+ 0FFD5F25140F38B3008BC18B /* ASIInputStream.m in Sources */,
+ 0FFD5F26140F38B3008BC18B /* ASINetworkQueue.m in Sources */,
+ 0FFD5F27140F38B3008BC18B /* ASIWebPageRequest.m in Sources */,
+ 0FFD5F2B140F3903008BC18B /* Reachability.m in Sources */,
+ 0FFD5FA4140F4396008BC18B /* GameListViewController.m in Sources */,
+ 0FFD6083140FF95B008BC18B /* AuthView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -376,6 +514,8 @@
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = /usr/include/libxml2;
+ OTHER_LDFLAGS = "-lxml2";
PREBINDING = NO;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "CF7AE5F7-6348-4BEE-B4CD-499DC0FB6C89";
SDKROOT = iphoneos;
@@ -390,7 +530,9 @@
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = /usr/include/libxml2;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ OTHER_LDFLAGS = "-lxml2";
PREBINDING = NO;
SDKROOT = iphoneos;
};
View
194 Reachability/Reachability.h
@@ -0,0 +1,194 @@
+/*
+
+ File: Reachability.h
+ Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
+
+ Version: 2.0.4ddg
+ */
+
+/*
+ Significant additions made by Andrew W. Donoho, August 11, 2009.
+ This is a derived work of Apple's Reachability v2.0 class.
+
+ The below license is the new BSD license with the OSI recommended personalizations.
+ <http://www.opensource.org/licenses/bsd-license.php>
+
+ Extensions Copyright (C) 2009 Donoho Design Group, LLC. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Andrew W. Donoho nor Donoho Design Group, L.L.C.
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY DONOHO DESIGN GROUP, L.L.C. "AS IS" AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+
+
+/*
+
+ Apple's Original License on Reachability v2.0
+
+ Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
+ ("Apple") in consideration of your agreement to the following terms, and your
+ use, installation, modification or redistribution of this Apple software
+ constitutes acceptance of these terms. If you do not agree with these terms,
+ please do not use, install, modify or redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject
+ to these terms, Apple grants you a personal, non-exclusive license, under
+ Apple's copyrights in this original Apple software (the "Apple Software"), to
+ use, reproduce, modify and redistribute the Apple Software, with or without
+ modifications, in source and/or binary forms; provided that if you redistribute
+ the Apple Software in its entirety and without modifications, you must retain
+ this notice and the following text and disclaimers in all such redistributions
+ of the Apple Software.
+
+ Neither the name, trademarks, service marks or logos of Apple Inc. may be used
+ to endorse or promote products derived from the Apple Software without specific
+ prior written permission from Apple. Except as expressly stated in this notice,
+ no other rights or licenses, express or implied, are granted by Apple herein,
+ including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be
+ incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
+ WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+ WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+ COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
+ DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
+ CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+ APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ Copyright (C) 2009 Apple Inc. All Rights Reserved.
+
+ */
+
+
+/*
+ DDG extensions include:
+ Each reachability object now has a copy of the key used to store it in a
+ dictionary. This allows each observer to quickly determine if the event is
+ important to them.
+
+ -currentReachabilityStatus also has a significantly different decision criteria than
+ Apple's code.
+
+ A multiple convenience test methods have been added.
+ */
+
+#import <Foundation/Foundation.h>
+#import <SystemConfiguration/SystemConfiguration.h>
+#import <netinet/in.h>
+
+#define USE_DDG_EXTENSIONS 1 // Use DDG's Extensions to test network criteria.
+// Since NSAssert and NSCAssert are used in this code,
+// I recommend you set NS_BLOCK_ASSERTIONS=1 in the release versions of your projects.
+
+enum {
+
+ // DDG NetworkStatus Constant Names.
+ kNotReachable = 0, // Apple's code depends upon 'NotReachable' being the same value as 'NO'.
+ kReachableViaWWAN, // Switched order from Apple's enum. WWAN is active before WiFi.
+ kReachableViaWiFi
+
+};
+typedef uint32_t NetworkStatus;
+
+enum {
+
+ // Apple NetworkStatus Constant Names.
+ NotReachable = kNotReachable,
+ ReachableViaWiFi = kReachableViaWiFi,
+ ReachableViaWWAN = kReachableViaWWAN
+
+};
+
+
+extern NSString *const kInternetConnection;
+extern NSString *const kLocalWiFiConnection;
+extern NSString *const kReachabilityChangedNotification;
+
+@interface Reachability: NSObject {
+
+@private
+ NSString *key_;
+ SCNetworkReachabilityRef reachabilityRef;
+
+}
+
+@property (copy) NSString *key; // Atomic because network operations are asynchronous.
+
+// Designated Initializer.
+- (Reachability *) initWithReachabilityRef: (SCNetworkReachabilityRef) ref;
+
+// Use to check the reachability of a particular host name.
++ (Reachability *) reachabilityWithHostName: (NSString*) hostName;
+
+// Use to check the reachability of a particular IP address.
++ (Reachability *) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
+
+// Use to check whether the default route is available.
+// Should be used to, at minimum, establish network connectivity.
++ (Reachability *) reachabilityForInternetConnection;
+
+// Use to check whether a local wifi connection is available.
++ (Reachability *) reachabilityForLocalWiFi;
+
+//Start listening for reachability notifications on the current run loop.
+- (BOOL) startNotifier;
+- (void) stopNotifier;
+
+// Comparison routines to enable choosing actions in a notification.
+- (BOOL) isEqual: (Reachability *) r;
+
+// These are the status tests.
+- (NetworkStatus) currentReachabilityStatus;
+
+// The main direct test of reachability.
+- (BOOL) isReachable;
+
+// WWAN may be available, but not active until a connection has been established.
+// WiFi may require a connection for VPN on Demand.
+- (BOOL) isConnectionRequired; // Identical DDG variant.
+- (BOOL) connectionRequired; // Apple's routine.
+
+// Dynamic, on demand connection?
+- (BOOL) isConnectionOnDemand;
+
+// Is user intervention required?
+- (BOOL) isInterventionRequired;
+
+// Routines for specific connection testing by your app.
+- (BOOL) isReachableViaWWAN;
+- (BOOL) isReachableViaWiFi;
+
+- (SCNetworkReachabilityFlags) reachabilityFlags;
+
+@end
View
814 Reachability/Reachability.m
@@ -0,0 +1,814 @@
+/*
+
+ File: Reachability.m
+ Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
+
+ Version: 2.0.4ddg
+ */
+
+/*
+ Significant additions made by Andrew W. Donoho, August 11, 2009.
+ This is a derived work of Apple's Reachability v2.0 class.
+
+ The below license is the new BSD license with the OSI recommended personalizations.
+ <http://www.opensource.org/licenses/bsd-license.php>
+
+ Extensions Copyright (C) 2009 Donoho Design Group, LLC. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of Andrew W. Donoho nor Donoho Design Group, L.L.C.
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY DONOHO DESIGN GROUP, L.L.C. "AS IS" AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+
+
+/*
+
+ Apple's Original License on Reachability v2.0
+
+ Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
+ ("Apple") in consideration of your agreement to the following terms, and your
+ use, installation, modification or redistribution of this Apple software
+ constitutes acceptance of these terms. If you do not agree with these terms,
+ please do not use, install, modify or redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject
+ to these terms, Apple grants you a personal, non-exclusive license, under
+ Apple's copyrights in this original Apple software (the "Apple Software"), to
+ use, reproduce, modify and redistribute the Apple Software, with or without
+ modifications, in source and/or binary forms; provided that if you redistribute
+ the Apple Software in its entirety and without modifications, you must retain
+ this notice and the following text and disclaimers in all such redistributions
+ of the Apple Software.
+
+ Neither the name, trademarks, service marks or logos of Apple Inc. may be used
+ to endorse or promote products derived from the Apple Software without specific
+ prior written permission from Apple. Except as expressly stated in this notice,
+ no other rights or licenses, express or implied, are granted by Apple herein,
+ including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be
+ incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
+ WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+ WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+ COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
+ DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
+ CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+ APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ Copyright (C) 2009 Apple Inc. All Rights Reserved.
+
+*/
+
+/*
+ Each reachability object now has a copy of the key used to store it in a dictionary.
+ This allows each observer to quickly determine if the event is important to them.
+*/
+
+#import <sys/socket.h>
+#import <netinet/in.h>
+#import <netinet6/in6.h>
+#import <arpa/inet.h>
+#import <ifaddrs.h>
+#import <netdb.h>
+
+#import <CoreFoundation/CoreFoundation.h>
+
+#import "Reachability.h"
+
+NSString *const kInternetConnection = @"InternetConnection";
+NSString *const kLocalWiFiConnection = @"LocalWiFiConnection";
+NSString *const kReachabilityChangedNotification = @"NetworkReachabilityChangedNotification";
+
+#define CLASS_DEBUG 1 // Turn on logReachabilityFlags. Must also have a project wide defined DEBUG.
+
+#if (defined DEBUG && defined CLASS_DEBUG)
+#define logReachabilityFlags(flags) (logReachabilityFlags_(__PRETTY_FUNCTION__, __LINE__, flags))
+
+static NSString *reachabilityFlags_(SCNetworkReachabilityFlags flags) {
+
+#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000) // Apple advises you to use the magic number instead of a symbol.
+ return [NSString stringWithFormat:@"Reachability Flags: %c%c %c%c%c%c%c%c%c",
+ (flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
+ (flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
+
+ (flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
+ (flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
+ (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
+ (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
+ (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
+ (flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
+ (flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-'];
+#else
+ // Compile out the v3.0 features for v2.2.1 deployment.
+ return [NSString stringWithFormat:@"Reachability Flags: %c%c %c%c%c%c%c%c",
+ (flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
+ (flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
+
+ (flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
+ (flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
+ (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
+ // v3 kSCNetworkReachabilityFlagsConnectionOnTraffic == v2 kSCNetworkReachabilityFlagsConnectionAutomatic
+ (flags & kSCNetworkReachabilityFlagsConnectionAutomatic) ? 'C' : '-',
+ // (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-', // No v2 equivalent.
+ (flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
+ (flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-'];
+#endif
+
+} // reachabilityFlags_()
+
+static void logReachabilityFlags_(const char *name, int line, SCNetworkReachabilityFlags flags) {
+
+ NSLog(@"%s (%d) \n\t%@", name, line, reachabilityFlags_(flags));
+
+} // logReachabilityFlags_()
+
+#define logNetworkStatus(status) (logNetworkStatus_(__PRETTY_FUNCTION__, __LINE__, status))
+
+static void logNetworkStatus_(const char *name, int line, NetworkStatus status) {
+
+ NSString *statusString = nil;
+
+ switch (status) {
+ case kNotReachable:
+ statusString = [NSString stringWithString: @"Not Reachable"];
+ break;
+ case kReachableViaWWAN:
+ statusString = [NSString stringWithString: @"Reachable via WWAN"];
+ break;
+ case kReachableViaWiFi:
+ statusString = [NSString stringWithString: @"Reachable via WiFi"];
+ break;
+ }
+
+ NSLog(@"%s (%d) \n\tNetwork Status: %@", name, line, statusString);
+
+} // logNetworkStatus_()
+
+#else
+#define logReachabilityFlags(flags)
+#define logNetworkStatus(status)
+#endif
+
+@interface Reachability (private)
+
+- (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags;
+
+@end
+
+@implementation Reachability
+
+@synthesize key = key_;
+
+// Preclude direct access to ivars.
++ (BOOL) accessInstanceVariablesDirectly {
+
+ return NO;
+
+} // accessInstanceVariablesDirectly
+
+
+- (void) dealloc {
+
+ [self stopNotifier];
+ if(reachabilityRef) {
+
+ CFRelease(reachabilityRef); reachabilityRef = NULL;
+
+ }
+
+ self.key = nil;
+
+ [super dealloc];
+
+} // dealloc
+
+
+- (Reachability *) initWithReachabilityRef: (SCNetworkReachabilityRef) ref
+{
+ self = [super init];
+ if (self != nil)
+ {
+ reachabilityRef = ref;
+ }
+
+ return self;
+
+} // initWithReachabilityRef:
+
+
+#if (defined DEBUG && defined CLASS_DEBUG)
+- (NSString *) description {
+
+ NSAssert(reachabilityRef, @"-description called with NULL reachabilityRef");
+
+ SCNetworkReachabilityFlags flags = 0;
+
+ SCNetworkReachabilityGetFlags(reachabilityRef, &flags);
+
+ return [NSString stringWithFormat: @"%@\n\t%@", self.key, reachabilityFlags_(flags)];
+
+} // description
+#endif
+
+
+#pragma mark -
+#pragma mark Notification Management Methods
+
+
+//Start listening for reachability notifications on the current run loop
+static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info) {
+
+ #pragma unused (target, flags)
+ NSCAssert(info, @"info was NULL in ReachabilityCallback");
+ NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was the wrong class in ReachabilityCallback");
+
+ //We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
+ // in case someone uses the Reachablity object in a different thread.
+ NSAutoreleasePool* pool = [NSAutoreleasePool new];
+
+ // Post a notification to notify the client that the network reachability changed.
+ [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification
+ object: (Reachability *) info];
+
+ [pool release];
+
+} // ReachabilityCallback()
+
+
+- (BOOL) startNotifier {
+
+ SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL};
+
+ if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context)) {
+
+ if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
+
+ return YES;
+
+ }
+
+ }
+
+ return NO;
+
+} // startNotifier
+
+
+- (void) stopNotifier {
+
+ if(reachabilityRef) {
+
+ SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+
+ }
+
+} // stopNotifier
+
+
+- (BOOL) isEqual: (Reachability *) r {
+
+ return [r.key isEqualToString: self.key];
+
+} // isEqual:
+
+
+#pragma mark -
+#pragma mark Reachability Allocation Methods
+
+
++ (Reachability *) reachabilityWithHostName: (NSString *) hostName {
+
+ SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
+
+ if (ref) {
+
+ Reachability *r = [[[self alloc] initWithReachabilityRef: ref] autorelease];
+
+ r.key = hostName;
+
+ return r;
+
+ }
+
+ return nil;
+
+} // reachabilityWithHostName
+
+
++ (NSString *) makeAddressKey: (in_addr_t) addr {
+ // addr is assumed to be in network byte order.
+