 //
 //  LocationDataSource.swift
-//  toot
+//  TurboApi
 //
 //  Created by Shahan Khan on 11/6/14.
 //  Copyright (c) 2014 Shahan Khan. All rights reserved.

		locationManager.delegate = self

		// Get Location Permissions if Needed
		// ios7 doesn't support requestAlwaysAuthorization
		if CLLocationManager.authorizationStatus() == .NotDetermined && !ios7() {
			locationManager.requestAlwaysAuthorization()
		}
	}
	
	func refresh() {
		delegate?.dataRefreshing()
		
		// start updating location if authorized
		if CLLocationManager.authorizationStatus() != .NotDetermined && CLLocationManager.authorizationStatus() != .Restricted && CLLocationManager.authorizationStatus() != .Denied {
			locationManager.startUpdatingLocation()
		} else {
			delegate?.dataError()
		}
	}
	
	// MARK: Location Services
	func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
		locationManager.stopUpdatingLocation()
		delegate?.dataUpdated()
		location = locations[0] as? CLLocation
	}
	
	

class LocationDataSource: DataSource, CLLocationManagerDelegate {
	var locationManager :CLLocationManager
	var location :CLLocation?
	private var refreshing = false
	private var timer: NSTimer?
	
	override init() {
		// setup CLLocationManager to get location
