[iOS] validate subscription on startup only when allowed to use network

This commit is contained in:
Aleksey Belouosv 2018-10-22 17:59:21 +03:00 committed by Roman Kuznetsov
parent 17db573531
commit 9d30a10099
3 changed files with 13 additions and 1 deletions

View file

@ -390,7 +390,9 @@ using namespace osm_auth_ios;
if (@available(iOS 10, *))
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
[[SubscriptionManager shared] validate];
if ([MWMFrameworkHelper canUseNetwork])
[[SubscriptionManager shared] validate];
return YES;
}

View file

@ -10,4 +10,6 @@
+ (void)createFramework;
+ (BOOL)canUseNetwork;
@end

View file

@ -5,6 +5,7 @@
#include "Framework.h"
#include "base/sunrise_sunset.hpp"
#include "platform/network_policy.hpp"
@implementation MWMFrameworkHelper
@ -66,4 +67,11 @@
}
+ (void)createFramework { UNUSED_VALUE(GetFramework()); }
+ (BOOL)canUseNetwork
{
return platform::GetCurrentNetworkPolicy().CanUse() ||
GetPlatform().ConnectionStatus() != Platform::EConnectionType::CONNECTION_WWAN;
}
@end