forked from organicmaps/organicmaps
[ios] Proposal to download guide after map has been removed.
This commit is contained in:
parent
5268b434ca
commit
c527ba8517
1 changed files with 0 additions and 35 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue