diff --git a/iphone/Maps/Classes/DownloadIndicatorProtocol.h b/iphone/Maps/Classes/DownloadIndicatorProtocol.h new file mode 100644 index 0000000000..e68cd2c255 --- /dev/null +++ b/iphone/Maps/Classes/DownloadIndicatorProtocol.h @@ -0,0 +1,11 @@ +#import + +@protocol DownloadIndicatorProtocol + +- (void)disableStandby; +- (void)enableStandby; + +- (void)disableDownloadIndicator; +- (void)enableDownloadIndicator; + +@end diff --git a/platform/http_thread_apple.h b/platform/http_thread_apple.h index 50e2e7a391..657c80ecc1 100644 --- a/platform/http_thread_apple.h +++ b/platform/http_thread_apple.h @@ -6,6 +6,10 @@ namespace downloader { class IHttpThreadCallback; } +#ifdef OMIM_OS_IPHONE +#import "../iphone/Maps/Classes/DownloadIndicatorProtocol.h" +#endif + @interface HttpThread : NSObject { downloader::IHttpThreadCallback * m_callback; @@ -19,4 +23,9 @@ namespace downloader { class IHttpThreadCallback; } endRange:(int64_t)end expectedSize:(int64_t)size postBody:(string const &)pb; - (void) cancel; + +#ifdef OMIM_OS_IPHONE ++ (void)setDownloadIndicatorProtocol:(id)indicator; +#endif + @end diff --git a/platform/http_thread_apple.mm b/platform/http_thread_apple.mm index 0688e8d06e..a3ed5e102c 100644 --- a/platform/http_thread_apple.mm +++ b/platform/http_thread_apple.mm @@ -6,22 +6,27 @@ #include "base/logging.hpp" #include "base/macros.hpp" -#ifdef OMIM_OS_IPHONE - #include "../iphone/Maps/Classes/MapsAppDelegate.h" -#endif - #define TIMEOUT_IN_SECONDS 60.0 @implementation HttpThread +#ifdef OMIM_OS_IPHONE +static id downloadIndicator = nil; + ++ (void)setDownloadIndicatorProtocol:(id)indicator +{ + downloadIndicator = indicator; +} +#endif + - (void) dealloc { LOG(LDEBUG, ("ID:", [self hash], "Connection is destroyed")); [m_connection cancel]; [m_connection release]; #ifdef OMIM_OS_IPHONE - [[MapsAppDelegate theApp] enableStandby]; - [[MapsAppDelegate theApp] disableDownloadIndicator]; + [downloadIndicator enableStandby]; + [downloadIndicator disableDownloadIndicator]; #endif [super dealloc]; } @@ -79,8 +84,8 @@ } #ifdef OMIM_OS_IPHONE - [[MapsAppDelegate theApp] disableStandby]; - [[MapsAppDelegate theApp] enableDownloadIndicator]; + [downloadIndicator disableStandby]; + [downloadIndicator enableDownloadIndicator]; #endif // create the connection with the request and start loading the data