IOS7: Implement isConnectionLimited

This commit is contained in:
Thierry Crozat 2019-08-04 17:41:53 +01:00
parent cd7bf2b09f
commit 468c0f0743
5 changed files with 18 additions and 2 deletions

View file

@ -214,6 +214,8 @@ public:
virtual Common::String getSystemLanguage() const;
virtual bool isConnectionLimited();
protected:
void initVideoContext();
void updateOutputSurface();

View file

@ -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);
}

2
configure vendored
View file

@ -3553,7 +3553,7 @@ case $_backend in
ios7)
append_var LIBS "-lobjc -framework UIKit -framework CoreGraphics -framework OpenGLES"
append_var LIBS "-framework QuartzCore -framework CoreFoundation -framework Foundation"
append_var LIBS "-framework AudioToolbox -framework CoreAudio"
append_var LIBS "-framework AudioToolbox -framework CoreAudio -framework SystemConfiguration "
append_var LDFLAGS "-miphoneos-version-min=7.1 -arch armv7"
append_var CFLAGS "-miphoneos-version-min=7.1 -arch armv7"
append_var CXXFLAGS "-miphoneos-version-min=7.1 -arch armv7"

View file

@ -445,6 +445,7 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
DEF_SYSFRAMEWORK("OpenGLES");
DEF_SYSFRAMEWORK("QuartzCore");
DEF_SYSFRAMEWORK("UIKit");
DEF_SYSFRAMEWORK("SystemConfiguration");
DEF_SYSTBD("libiconv");
// Local libraries
@ -524,6 +525,7 @@ void XcodeProvider::setupFrameworksBuildPhase(const BuildSetup &setup) {
frameworks_iOS.push_back("CoreFoundation.framework");
frameworks_iOS.push_back("Foundation.framework");
frameworks_iOS.push_back("UIKit.framework");
frameworks_iOS.push_back("SystemConfiguration.framework");
frameworks_iOS.push_back("AudioToolbox.framework");
frameworks_iOS.push_back("QuartzCore.framework");
frameworks_iOS.push_back("OpenGLES.framework");

View file

@ -402,7 +402,7 @@ iphone: $(OBJS)
$(OSX_STATIC_LIBS) \
-framework UIKit -framework CoreGraphics -framework OpenGLES \
-framework CoreFoundation -framework QuartzCore -framework Foundation \
-framework AudioToolbox -framework CoreAudio -lobjc -lz
-framework AudioToolbox -framework CoreAudio -framework SystemConfiguration -lobjc -lz
# Special target to create a snapshot disk image for Mac OS X
# TODO: Replace AUTHORS by Credits.rtf