Created
January 31, 2013 19:18
-
-
Save Veraticus/4685566 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppDelegate | |
attr_accessor :moviesViewController, :notificationsViewController, :tabBar | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
... | |
# Reachability | |
ServerClient.sharedInstance.setupReachability | |
AFNetworkActivityIndicatorManager.sharedManager.enabled = true | |
... | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Motion::Project::App.setup do |app| | |
... | |
app.pods do | |
pod 'Reachability' | |
end | |
... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ServerClient < AFHTTPClient | |
def setupReachability | |
self.operationQueue.maxConcurrentOperationCount = 1 | |
self.operationQueue.suspended = true | |
@reachability = Reachability.reachabilityWithHostname(ServerClient.hostname) | |
@reachability.reachableBlock = lambda {|reachable| ServerClient.sharedInstance.operationQueue.suspended = false} | |
@reachability.unreachableBlock = lambda {|reachable| ServerClient.sharedInstance.operationQueue.suspended = true} | |
@reachability.startNotifier | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment