diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 5ed362051b..2e4b632691 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -31,6 +31,10 @@ CB252D6E16FF82C9001E41E9 /* libFlurry.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CB252D6A16FF82C8001E41E9 /* libFlurry.a */; }; CB252D6F16FF82C9001E41E9 /* Statistics.m in Sources */ = {isa = PBXBuildFile; fileRef = CB252D6C16FF82C8001E41E9 /* Statistics.m */; }; CB252D7016FF82C9001E41E9 /* Statistics.m in Sources */ = {isa = PBXBuildFile; fileRef = CB252D6C16FF82C8001E41E9 /* Statistics.m */; }; + ED2F9BEF17CE76490008C549 /* guide_bag@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = ED2F9BED17CE76490008C549 /* guide_bag@2x.png */; }; + ED2F9BF017CE76490008C549 /* guide_bag@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = ED2F9BED17CE76490008C549 /* guide_bag@2x.png */; }; + ED2F9BF117CE76490008C549 /* guide_bag.png in Resources */ = {isa = PBXBuildFile; fileRef = ED2F9BEE17CE76490008C549 /* guide_bag.png */; }; + ED2F9BF217CE76490008C549 /* guide_bag.png in Resources */ = {isa = PBXBuildFile; fileRef = ED2F9BEE17CE76490008C549 /* guide_bag.png */; }; ED48BBB117BE6EA8003E7E92 /* MWMApi.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED48BBB017BE6EA8003E7E92 /* MWMApi.mm */; }; ED48BBB217BE6EA8003E7E92 /* MWMApi.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED48BBB017BE6EA8003E7E92 /* MWMApi.mm */; }; ED48BBB517C267F5003E7E92 /* ColorPickerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED48BBB417C267F5003E7E92 /* ColorPickerView.mm */; }; @@ -1348,6 +1352,8 @@ CB252D6A16FF82C8001E41E9 /* libFlurry.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libFlurry.a; sourceTree = ""; }; CB252D6B16FF82C8001E41E9 /* Statistics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Statistics.h; sourceTree = ""; }; CB252D6C16FF82C8001E41E9 /* Statistics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Statistics.m; sourceTree = ""; }; + ED2F9BED17CE76490008C549 /* guide_bag@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "guide_bag@2x.png"; sourceTree = ""; }; + ED2F9BEE17CE76490008C549 /* guide_bag.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = guide_bag.png; sourceTree = ""; }; ED48BBAF17BE6EA8003E7E92 /* MWMApi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMApi.h; sourceTree = ""; }; ED48BBB017BE6EA8003E7E92 /* MWMApi.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMApi.mm; sourceTree = ""; }; ED48BBB317C267F5003E7E92 /* ColorPickerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorPickerView.h; sourceTree = ""; }; @@ -2212,6 +2218,8 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + ED2F9BED17CE76490008C549 /* guide_bag@2x.png */, + ED2F9BEE17CE76490008C549 /* guide_bag.png */, ED9CC5EE17CA18770051642E /* ios-guides.json */, FA765AAF1737BC6D00279CFF /* 22x29-lite.png */, FA765AB01737BC6D00279CFF /* 44x58-lite.png */, @@ -3687,6 +3695,8 @@ 5797B6D716C931EE00FFE6D2 /* resources-xhdpi in Resources */, FAF30A95173AB23900818BF6 /* 00_roboto_regular.ttf in Resources */, ED9CC5EF17CA18770051642E /* ios-guides.json in Resources */, + ED2F9BEF17CE76490008C549 /* guide_bag@2x.png in Resources */, + ED2F9BF117CE76490008C549 /* guide_bag.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4271,6 +4281,8 @@ FA765AB61737BC6D00279CFF /* 320-lite.png in Resources */, FAF30A96173AB23900818BF6 /* 00_roboto_regular.ttf in Resources */, ED9CC5F017CA18770051642E /* ios-guides.json in Resources */, + ED2F9BF017CE76490008C549 /* guide_bag@2x.png in Resources */, + ED2F9BF217CE76490008C549 /* guide_bag.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/iphone/Maps/Settings/CountriesViewController.mm b/iphone/Maps/Settings/CountriesViewController.mm index 9edd9da929..f0ea52b007 100644 --- a/iphone/Maps/Settings/CountriesViewController.mm +++ b/iphone/Maps/Settings/CountriesViewController.mm @@ -156,8 +156,22 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours) Storage & s = frm.Storage(); string const & flag = s.CountryFlag(countryIndex); - if (!flag.empty()) + guides::GuideInfo info; + if ((s.CountriesCount(countryIndex) == 0) && frm.GetGuideInfo(countryIndex, info)) + { + cell.imageView.image = [UIImage imageNamed:@"guide_bag"]; + [cell layoutSubviews]; + UIButton * bt = [[[UIButton alloc] initWithFrame:cell.imageView.frame] autorelease]; + bt.backgroundColor = [UIColor clearColor]; + [bt addTarget:self action:@selector(showGuideAdvertise:) forControlEvents:UIControlEventTouchUpInside]; + [cell.contentView addSubview:bt]; + } + else if (!flag.empty()) + { + for (UIButton * v in cell.contentView.subviews) + [v removeFromSuperview]; cell.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%s.png", flag.c_str()]]; + } // do not show status for parent categories if (![cell.reuseIdentifier isEqual: @"ParentCell"]) @@ -480,4 +494,21 @@ static bool IsOurIndex(TIndex const & theirs, TIndex const & ours) } } +-(void)showGuideAdvertise:(UIButton *)bt +{ + UITableViewCell * cell = (UITableViewCell *)(bt.superview.superview); + UITableView * v = (UITableView *)self.view; + NSIndexPath * indexPath = [v indexPathForCell:cell]; + TIndex const index = CalculateIndex(m_index, indexPath); + guides::GuideInfo info; + if (!GetFramework().GetGuideInfo(index, info)); + return; + NSURL * guideUrl = [NSURL URLWithString:[NSString stringWithUTF8String:info.GetAppID().c_str()]]; + UIApplication * app = [UIApplication sharedApplication]; + if ([app canOpenURL:guideUrl]) + [app openURL:guideUrl]; + else + [app openURL:[NSURL URLWithString:[NSString stringWithUTF8String:info.GetURL().c_str()]]]; +} + @end diff --git a/iphone/Maps/guide_bag.png b/iphone/Maps/guide_bag.png new file mode 100644 index 0000000000..c8b6ca616a Binary files /dev/null and b/iphone/Maps/guide_bag.png differ diff --git a/iphone/Maps/guide_bag@2x.png b/iphone/Maps/guide_bag@2x.png new file mode 100644 index 0000000000..2d0894c809 Binary files /dev/null and b/iphone/Maps/guide_bag@2x.png differ