diff options
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/ios7/ios7_osys_main.h | 2 | ||||
-rw-r--r-- | backends/platform/ios7/ios7_osys_misc.mm | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h index aa67a556b4..994a67dddb 100644 --- a/backends/platform/ios7/ios7_osys_main.h +++ b/backends/platform/ios7/ios7_osys_main.h @@ -214,6 +214,8 @@ public: virtual Common::String getSystemLanguage() const; + virtual bool isConnectionLimited(); + protected: void initVideoContext(); void updateOutputSurface(); diff --git a/backends/platform/ios7/ios7_osys_misc.mm b/backends/platform/ios7/ios7_osys_misc.mm index 53f11ab156..d7743f8466 100644 --- a/backends/platform/ios7/ios7_osys_misc.mm +++ b/backends/platform/ios7/ios7_osys_misc.mm @@ -26,6 +26,7 @@ #include "backends/platform/ios7/ios7_osys_main.h" #include <UIKit/UIKit.h> +#include <SystemConfiguration/SCNetworkReachability.h> #include "common/translation.h" Common::String OSystem_iOS7::getSystemLanguage() const { @@ -84,3 +85,14 @@ bool OSystem_iOS7::openUrl(const Common::String &url) { return [application openURL:nsurl]; } } + +bool OSystem_iOS7::isConnectionLimited() { + // If we are connected to the internet through a cellular network, return true + SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(CFAllocatorGetDefault(), [@"www.google.com" UTF8String]); + if (!ref) + return false; + SCNetworkReachabilityFlags flags = 0; + SCNetworkReachabilityGetFlags(ref, &flags); + CFRelease(ref); + return (flags & kSCNetworkReachabilityFlagsIsWWAN); +} |