mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-04-24 00:00:04 +08:00
Allow to build and run GDWebServer in app extensions.
This commit is contained in:
@@ -198,7 +198,7 @@ static void _ExecuteMainThreadRunLoopSources() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION
|
||||||
|
|
||||||
// Always called on main thread
|
// Always called on main thread
|
||||||
- (void)_startBackgroundTask {
|
- (void)_startBackgroundTask {
|
||||||
@@ -223,7 +223,7 @@ static void _ExecuteMainThreadRunLoopSources() {
|
|||||||
_connected = YES;
|
_connected = YES;
|
||||||
GWS_LOG_DEBUG(@"Did connect");
|
GWS_LOG_DEBUG(@"Did connect");
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION
|
||||||
if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground) {
|
if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground) {
|
||||||
[self _startBackgroundTask];
|
[self _startBackgroundTask];
|
||||||
}
|
}
|
||||||
@@ -253,7 +253,7 @@ static void _ExecuteMainThreadRunLoopSources() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION
|
||||||
|
|
||||||
// Always called on main thread
|
// Always called on main thread
|
||||||
- (void)_endBackgroundTask {
|
- (void)_endBackgroundTask {
|
||||||
@@ -277,7 +277,7 @@ static void _ExecuteMainThreadRunLoopSources() {
|
|||||||
_connected = NO;
|
_connected = NO;
|
||||||
GWS_LOG_DEBUG(@"Did disconnect");
|
GWS_LOG_DEBUG(@"Did disconnect");
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION
|
||||||
[self _endBackgroundTask];
|
[self _endBackgroundTask];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -726,7 +726,7 @@ static inline NSString* _EncodeBase64(NSString* string) {
|
|||||||
- (BOOL)startWithOptions:(NSDictionary<NSString*, id>*)options error:(NSError**)error {
|
- (BOOL)startWithOptions:(NSDictionary<NSString*, id>*)options error:(NSError**)error {
|
||||||
if (_options == nil) {
|
if (_options == nil) {
|
||||||
_options = options ? [options copy] : @{};
|
_options = options ? [options copy] : @{};
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE && !defined TARGET_OS_IPHONE_EXTENSION
|
||||||
_suspendInBackground = [(NSNumber*)_GetOption(_options, GCDWebServerOption_AutomaticallySuspendInBackground, @YES) boolValue];
|
_suspendInBackground = [(NSNumber*)_GetOption(_options, GCDWebServerOption_AutomaticallySuspendInBackground, @YES) boolValue];
|
||||||
if (((_suspendInBackground == NO) || ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground)) && ![self _start:error])
|
if (((_suspendInBackground == NO) || ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground)) && ![self _start:error])
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user