Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/iphone
diff options
context:
space:
mode:
authorKirill Zhdanovich <kzhdanovich@gmail.com>2013-01-16 19:27:28 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:48:48 +0300
commitcd534d4b52c3f1ac4d61bc06f5b055d7198a4184 (patch)
treef068b24f3c641c1a879ae4abc806ed737f8e9d86 /iphone
parent5b9c941d98748f63f52e29a7744103d960ef6188 (diff)
If we have maps to download, we continue downloading in background.
Diffstat (limited to 'iphone')
-rw-r--r--iphone/Maps/Classes/MapsAppDelegate.h1
-rw-r--r--iphone/Maps/Classes/MapsAppDelegate.mm12
2 files changed, 13 insertions, 0 deletions
diff --git a/iphone/Maps/Classes/MapsAppDelegate.h b/iphone/Maps/Classes/MapsAppDelegate.h
index 4e6b73ea84..508f1e4036 100644
--- a/iphone/Maps/Classes/MapsAppDelegate.h
+++ b/iphone/Maps/Classes/MapsAppDelegate.h
@@ -9,6 +9,7 @@
SettingsManager * m_settingsManager;
NSInteger m_standbyCounter;
NSInteger m_activeDownloadsCounter;
+ UIBackgroundTaskIdentifier m_backgroundTask;
UINavigationController * m_navController;
UIWindow * m_window;
UIAlertView * m_loadingAlertView;
diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm
index d00b16d9dd..76686d6123 100644
--- a/iphone/Maps/Classes/MapsAppDelegate.mm
+++ b/iphone/Maps/Classes/MapsAppDelegate.mm
@@ -44,6 +44,13 @@ void InitLocalizedStrings()
- (void) applicationDidEnterBackground: (UIApplication *) application
{
[m_mapViewController OnEnterBackground];
+ if(m_activeDownloadsCounter)
+ {
+ m_backgroundTask = [application beginBackgroundTaskWithExpirationHandler:^{
+ [application endBackgroundTask:m_backgroundTask];
+ m_backgroundTask = UIBackgroundTaskInvalid;
+ }];
+ }
}
- (void) applicationWillEnterForeground: (UIApplication *) application
@@ -94,6 +101,11 @@ void InitLocalizedStrings()
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
m_activeDownloadsCounter = 0;
+ if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground)
+ {
+ [[UIApplication sharedApplication] endBackgroundTask:m_backgroundTask];
+ m_backgroundTask = UIBackgroundTaskInvalid;
+ }
}
}