[ios] Proposal to download guide after map has been removed.

This commit is contained in:
Timur Bernikowich 2014-12-27 21:10:35 +03:00 committed by Alex Zolotarev
parent 5268b434ca
commit c527ba8517

View file

@ -479,11 +479,6 @@ void InitLocalizedStrings()
- (void)countryStatusChangedAtPosition:(int)position inGroup:(storage::ActiveMapsLayout::TGroup const &)group
{
ActiveMapsLayout & l = GetFramework().GetCountryTree().GetActiveMapLayout();
TStatus const & status = l.GetCountryStatus(group, position);
guides::GuideInfo info;
if (status == storage::TStatus::EOnDisk && l.GetGuideInfo(group, position, info))
[self showNotificationWithGuideInfo:info];
int const outOfDateCount = l.GetOutOfDateCount();
[[NSNotificationCenter defaultCenter] postNotificationName:MapsStatusChangedNotification object:nil userInfo:@{@"OutOfDate" : @(outOfDateCount)}];
}
@ -493,34 +488,4 @@ void InitLocalizedStrings()
[UIApplication sharedApplication].applicationIconBadgeNumber = [[notification userInfo][@"OutOfDate"] integerValue];
}
- (void)showNotificationWithGuideInfo:(guides::GuideInfo const &)guide
{
guides::GuidesManager & guidesManager = GetFramework().GetGuidesManager();
string const appID = guide.GetAppID();
if (guidesManager.WasAdvertised(appID) ||
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:[NSString stringWithUTF8String:appID.c_str()]]])
return;
UILocalNotification * notification = [[UILocalNotification alloc] init];
notification.fireDate = [NSDate dateWithTimeIntervalSinceNow:0];
notification.repeatInterval = 0;
notification.timeZone = [NSTimeZone defaultTimeZone];
notification.soundName = UILocalNotificationDefaultSoundName;
string const lang = languages::GetCurrentNorm();
NSString * message = [NSString stringWithUTF8String:guide.GetAdMessage(lang).c_str()];
notification.alertBody = message;
notification.userInfo = @{
@"Proposal" : @"OpenGuides",
@"GuideUrl" : [NSString stringWithUTF8String:guide.GetURL().c_str()],
@"GuideTitle" : [NSString stringWithUTF8String:guide.GetAdTitle(lang).c_str()],
@"GuideMessage" : message
};
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
guidesManager.SetWasAdvertised(appID);
}
@end