From 30f952d5993f26bc787a40a5e1a175e5c6897605 Mon Sep 17 00:00:00 2001 From: Ilya Grechuhin Date: Mon, 13 Jul 2015 15:55:49 +0300 Subject: [ios] Added download on search. --- iphone/Maps/Classes/Common.h | 11 ++ .../DownloadMapRequest/MWMDownloadMapRequest.h | 38 +++++ .../DownloadMapRequest/MWMDownloadMapRequest.m | 163 +++++++++++++++++++++ .../DownloadMapRequest/MWMDownloadMapRequest.xib | 160 ++++++++++++++++++++ .../DownloadMapRequest/MWMDownloadMapRequestView.h | 17 +++ .../DownloadMapRequest/MWMDownloadMapRequestView.m | 82 +++++++++++ .../MapViewControls/SideMenu/MWMSideMenuManager.mm | 5 +- .../MWMSearchDownloadMapRequest.h | 25 ++++ .../MWMSearchDownloadMapRequest.m | 112 ++++++++++++++ .../MWMSearchDownloadMapRequest.xib | 78 ++++++++++ .../MWMSearchDownloadMapRequestView.h | 19 +++ .../MWMSearchDownloadMapRequestView.m | 58 ++++++++ iphone/Maps/Classes/MWMNavigationDelegate.h | 13 ++ iphone/Maps/Classes/MapViewController.h | 9 +- iphone/Maps/Classes/MapViewController.mm | 107 +++++++++++++- iphone/Maps/Classes/SearchView.h | 20 ++- iphone/Maps/Classes/SearchView.mm | 120 ++++++++++++++- .../radioBtnOff.imageset/Contents.json | 23 +++ .../radioBtnOff.imageset/radioBtnOff@1x.png | Bin 0 -> 444 bytes .../radioBtnOff.imageset/radioBtnOff@2x.png | Bin 0 -> 907 bytes .../radioBtnOff.imageset/radioBtnOff@3x.png | Bin 0 -> 1599 bytes .../radioBtnOn.imageset/Contents.json | 23 +++ .../radioBtnOn.imageset/radioBtnOn@1x.png | Bin 0 -> 703 bytes .../radioBtnOn.imageset/radioBtnOn@2x.png | Bin 0 -> 1424 bytes .../radioBtnOn.imageset/radioBtnOn@3x.png | Bin 0 -> 2292 bytes iphone/Maps/Maps.xcodeproj/project.pbxproj | 50 +++++++ 26 files changed, 1116 insertions(+), 17 deletions(-) create mode 100644 iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.h create mode 100644 iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.m create mode 100644 iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.xib create mode 100644 iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequestView.h create mode 100644 iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequestView.m create mode 100644 iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.h create mode 100644 iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.m create mode 100644 iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.xib create mode 100644 iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.h create mode 100644 iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.m create mode 100644 iphone/Maps/Classes/MWMNavigationDelegate.h create mode 100644 iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/Contents.json create mode 100644 iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@1x.png create mode 100644 iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@2x.png create mode 100644 iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@3x.png create mode 100644 iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/Contents.json create mode 100644 iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@1x.png create mode 100644 iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@2x.png create mode 100644 iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@3x.png diff --git a/iphone/Maps/Classes/Common.h b/iphone/Maps/Classes/Common.h index eee722dc78..294388c15e 100644 --- a/iphone/Maps/Classes/Common.h +++ b/iphone/Maps/Classes/Common.h @@ -58,3 +58,14 @@ static inline BOOL isIOSVersionLessThan(NSUInteger version) { return isIOSVersionLessThan([NSString stringWithFormat:@"%@", @(version)]); } + +static inline NSString * formattedSize(uint64_t size) +{ + uint64_t const mb = 1024 * 1024; + NSString * sizeString; + if (size > mb) + sizeString = [NSString stringWithFormat:@"%llu %@", (size + 512 * 1024) / mb, NSLocalizedString(@"mb", nil)]; + else + sizeString = [NSString stringWithFormat:@"%llu %@", (size + 1023) / 1024, NSLocalizedString(@"kb", nil)]; + return [sizeString uppercaseString]; +} diff --git a/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.h b/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.h new file mode 100644 index 0000000000..bcfc175856 --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.h @@ -0,0 +1,38 @@ +// +// MWMDownloadMapRequest.h +// Maps +// +// Created by Ilya Grechuhin on 10.07.15. +// Copyright (c) 2015 MapsWithMe. All rights reserved. +// + +#import +#import "MWMCircularProgress.h" + +typedef void (^MWMDownloadMapRequestDownloadCallback)(BOOL); +typedef void (^MWMDownloadMapRequestSelectCallback)(); + +NS_ENUM(NSUInteger, MWMDownloadMapRequestState) +{ + MWMDownloadMapRequestHidden, + MWMDownloadMapRequestLocation, + MWMDownloadMapRequestUnknownLocation, + MWMDownloadMapRequestProgress +}; + +@interface MWMDownloadMapRequest : NSObject + +@property (nonatomic, readonly) enum MWMDownloadMapRequestState state; + +- (nonnull instancetype)init __attribute__((unavailable("init is not available"))); +- (nonnull instancetype)initWithParentView:(nonnull UIView *)parentView delegate:(nonnull id )delegate; + +- (void)showForLocationWithName:(nonnull NSString *)countryName mapSize:(nonnull NSString *)mapSize mapAndRouteSize:(nonnull NSString *)mapAndRouteSize download:(nonnull MWMDownloadMapRequestDownloadCallback)download select:(nonnull MWMDownloadMapRequestSelectCallback)select; +- (void)showForUnknownLocation:(nonnull MWMDownloadMapRequestSelectCallback)select; + +- (void)startDownload; +- (void)stopDownload; +- (void)downloadProgress:(CGFloat)progress countryName:(nonnull NSString *)countryName; +- (void)setDownloadFailed; + +@end diff --git a/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.m b/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.m new file mode 100644 index 0000000000..30f5f89806 --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.m @@ -0,0 +1,163 @@ +// +// MWMDownloadMapRequest.m +// Maps +// +// Created by Ilya Grechuhin on 10.07.15. +// Copyright (c) 2015 MapsWithMe. All rights reserved. +// + +#import "Macros.h" +#import "MWMDownloadMapRequest.h" +#import "MWMDownloadMapRequestView.h" +#import "MWMCircularProgress.h" +#import "UIButton+RuntimeAttributes.h" +#import "UIColor+MapsMeColor.h" + +@interface MWMDownloadMapRequest () + +@property (nonatomic) IBOutlet MWMDownloadMapRequestView * rootView; +@property (nonatomic) IBOutlet UILabel * mapTitleLabel; +@property (nonatomic) IBOutlet UIButton * downloadMapButton; +@property (nonatomic) IBOutlet UIButton * downloadRoutesButton; +@property (nonatomic) IBOutlet UILabel * undefinedLocationLabel; +@property (nonatomic) IBOutlet UIButton * selectAnotherMapButton; +@property (nonatomic) IBOutlet UIView * progressViewWrapper; + +@property (nonatomic) MWMCircularProgress * progressView; + +@property (copy, nonatomic) MWMDownloadMapRequestDownloadCallback downloadBlock; +@property (copy, nonatomic) MWMDownloadMapRequestSelectCallback selectBlock; + +@property (copy, nonatomic) NSString * mapSize; +@property (copy, nonatomic) NSString * mapAndRouteSize; + +@property (nonatomic) enum MWMDownloadMapRequestState state; + +@property (nonnull, weak, nonatomic) id delegate; + +@end + +@implementation MWMDownloadMapRequest + +- (nonnull instancetype)initWithParentView:(nonnull UIView *)parentView delegate:(nonnull id )delegate +{ + self = [super init]; + if (self) + { + [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self.class) owner:self options:nil]; + [parentView addSubview:self.rootView]; + self.rootView.hidden = YES; + self.downloadRoutesButton.selected = YES; + self.delegate = delegate; + } + return self; +} + +- (void)dealloc +{ + [self.rootView removeFromSuperview]; +} + +- (void)showForLocationWithName:(nonnull NSString *)countryName mapSize:(nonnull NSString *)mapSize mapAndRouteSize:(nonnull NSString *)mapAndRouteSize download:(nonnull MWMDownloadMapRequestDownloadCallback)download select:(nonnull MWMDownloadMapRequestSelectCallback)select +{ + [self stopDownload]; + self.mapTitleLabel.text = countryName; + [self.downloadMapButton setTitle:[NSString stringWithFormat:@"%@ (%@)", L(@"downloader_download_map"), mapAndRouteSize] forState:UIControlStateNormal]; + [self.downloadRoutesButton setTitle:L(@"search_vehicle_routes") forState:UIControlStateNormal]; + + [self.selectAnotherMapButton setTitle:L(@"search_select_other_map") forState:UIControlStateNormal]; + [self.selectAnotherMapButton setTitleColor:[UIColor primary] forState:UIControlStateNormal]; + [self.selectAnotherMapButton setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted]; + [self.selectAnotherMapButton setBackgroundColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [self.selectAnotherMapButton setBackgroundColor:[UIColor primary] forState:UIControlStateHighlighted]; + + self.mapSize = mapSize; + self.mapAndRouteSize = mapAndRouteSize; + self.downloadBlock = download; + self.selectBlock = select; +} + +- (void)showForUnknownLocation:(nonnull MWMDownloadMapRequestSelectCallback)select +{ + self.rootView.hidden = NO; + self.progressViewWrapper.hidden = YES; + self.mapTitleLabel.hidden = YES; + self.downloadMapButton.hidden = YES; + self.downloadRoutesButton.hidden = YES; + self.undefinedLocationLabel.hidden = NO; + [self.selectAnotherMapButton setTitle:L(@"search_select_map") forState:UIControlStateNormal]; + + [self.selectAnotherMapButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [self.selectAnotherMapButton setBackgroundColor:[UIColor primary] forState:UIControlStateNormal]; + [self.selectAnotherMapButton setBackgroundColor:[UIColor primaryDark] forState:UIControlStateHighlighted]; + + self.selectBlock = select; + self.state = MWMDownloadMapRequestUnknownLocation; +} + +#pragma mark - Process control + +- (void)startDownload +{ + self.progressView = [[MWMCircularProgress alloc] initWithParentView:self.progressViewWrapper delegate:self.delegate]; + self.rootView.hidden = NO; + self.progressViewWrapper.hidden = NO; + self.mapTitleLabel.hidden = NO; + self.downloadMapButton.hidden = YES; + self.downloadRoutesButton.hidden = YES; + self.undefinedLocationLabel.hidden = YES; + self.selectAnotherMapButton.hidden = YES; + self.state = MWMDownloadMapRequestProgress; +} + +- (void)stopDownload +{ + self.rootView.hidden = NO; + self.progressViewWrapper.hidden = YES; + self.mapTitleLabel.hidden = NO; + self.downloadMapButton.hidden = NO; + self.downloadRoutesButton.hidden = NO; + self.undefinedLocationLabel.hidden = YES; + self.selectAnotherMapButton.hidden = NO; + self.state = MWMDownloadMapRequestLocation; +} + +- (void)downloadProgress:(CGFloat)progress countryName:(nonnull NSString *)countryName +{ + self.progressView.failed = NO; + self.progressView.progress = progress; + self.mapTitleLabel.text = countryName; +} + +- (void)setDownloadFailed +{ + self.progressView.failed = YES; +} + +#pragma mark - Actions + +- (IBAction)downloadMapTouchUpInside:(nonnull UIButton *)sender +{ + self.downloadBlock(self.downloadRoutesButton.selected); +} + +- (IBAction)downloadRoutesTouchUpInside:(nonnull UIButton *)sender +{ + sender.selected = !sender.selected; + [self.downloadMapButton setTitle:[NSString stringWithFormat:@"%@ (%@)", L(@"downloader_download_map"), sender.selected ? self.mapAndRouteSize : self.mapSize] forState:UIControlStateNormal]; +} + +- (IBAction)selectMapTouchUpInside:(nonnull UIButton *)sender +{ + self.selectBlock(); +} + +#pragma mark - Properties + +- (void)setState:(enum MWMDownloadMapRequestState)state +{ + _state = state; + [self.rootView layoutSubviews]; +} + +@end diff --git a/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.xib b/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.xib new file mode 100644 index 0000000000..7795927db9 --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequest.xib @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequestView.h b/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequestView.h new file mode 100644 index 0000000000..ef20a750f9 --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequestView.h @@ -0,0 +1,17 @@ +// +// MWMDownloadMapRequestView.h +// Maps +// +// Created by Ilya Grechuhin on 10.07.15. +// Copyright (c) 2015 MapsWithMe. All rights reserved. +// + +#import +#import "UIKitCategories.h" + +@interface MWMDownloadMapRequestView : SolidTouchView + +- (instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("initWithFrame is not available"))); +- (instancetype)init __attribute__((unavailable("init is not available"))); + +@end diff --git a/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequestView.m b/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequestView.m new file mode 100644 index 0000000000..23c19a0e03 --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/DownloadMapRequest/MWMDownloadMapRequestView.m @@ -0,0 +1,82 @@ +// +// MWMDownloadMapRequestView.m +// Maps +// +// Created by Ilya Grechuhin on 10.07.15. +// Copyright (c) 2015 MapsWithMe. All rights reserved. +// + +#import "MWMDownloadMapRequest.h" +#import "MWMDownloadMapRequestView.h" +#import "UIKitCategories.h" + +@interface MWMDownloadMapRequestView () + +@property (weak, nonatomic) IBOutlet UILabel * mapTitleLabel; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint * verticalFreeSpace; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint * bottomSpacing; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint * unknownPositionLabelBottomOffset; +@property (weak, nonatomic) IBOutlet MWMDownloadMapRequest * owner; + +@end + +@implementation MWMDownloadMapRequestView + +- (void)layoutSubviews +{ + [super layoutSubviews]; + UIView * superview = self.superview; + BOOL const isLandscape = superview.height > superview.width; + if (IPAD || isLandscape) + { + self.verticalFreeSpace.constant = 44.0; + self.bottomSpacing.constant = 24.0; + self.unknownPositionLabelBottomOffset.constant = 22.0; + } + else + { + self.verticalFreeSpace.constant = 20.0; + self.bottomSpacing.constant = 8.0; + self.unknownPositionLabelBottomOffset.constant = 18.0; + CGFloat const iPhone6LandscapeHeight = 375.0; + if (self.width < iPhone6LandscapeHeight) + { + self.mapTitleLabel.lineBreakMode = NSLineBreakByTruncatingTail; + self.mapTitleLabel.numberOfLines = 1; + } + else + { + self.mapTitleLabel.lineBreakMode = NSLineBreakByWordWrapping; + self.mapTitleLabel.numberOfLines = 0; + } + } + self.width = superview.width; + self.minX = 0.0; + if (self.minY > 0.0) + { + [UIView animateWithDuration:0.3 animations:^ + { + [self move]; + }]; + } + else + { + [self move]; + } +} + +- (void)move +{ + if (self.owner.state == MWMDownloadMapRequestProgress) + { + UIView * superview = self.superview; + BOOL const isLandscape = superview.height > superview.width; + self.minY = (IPAD || isLandscape) ? 0.3 * self.superview.height : 0.0; + } + else + { + self.maxY = self.superview.height; + } +} + +@end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/SideMenu/MWMSideMenuManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/SideMenu/MWMSideMenuManager.mm index 2c2c4b2f8b..ff5e2d2f25 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/SideMenu/MWMSideMenuManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/SideMenu/MWMSideMenuManager.mm @@ -7,7 +7,6 @@ // #import "BookmarksRootVC.h" -#import "CountryTreeVC.h" #import "Framework.h" #import "LocationManager.h" #import "MapsAppDelegate.h" @@ -76,9 +75,7 @@ extern NSString * const kAlohalyticsTapEventKey; - (IBAction)menuActionDownloadMaps { self.state = MWMSideMenuStateInactive; - [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"downloader"]; - CountryTreeVC * const vc = [[CountryTreeVC alloc] initWithNodePosition:-1]; - [self.controller.navigationController pushViewController:vc animated:YES]; + [self.controller pushDownloadMaps]; } - (IBAction)menuActionOpenSettings diff --git a/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.h b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.h new file mode 100644 index 0000000000..f375059dd5 --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.h @@ -0,0 +1,25 @@ +// +// MWMSearchDownloadMapRequest.h +// Maps +// +// Created by Ilya Grechuhin on 10.07.15. +// Copyright (c) 2015 MapsWithMe. All rights reserved. +// + +#import +#import "MWMDownloadMapRequest.h" + +@interface MWMSearchDownloadMapRequest : NSObject + +- (nonnull instancetype)init __attribute__((unavailable("init is not available"))); +- (nonnull instancetype)initWithParentView:(nonnull UIView *)parentView delegate:(nonnull id )delegate; + +- (void)showForLocationWithName:(nonnull NSString *)locationName mapSize:(nonnull NSString *)mapSize mapAndRouteSize:(nonnull NSString *)mapAndRouteSize download:(nonnull MWMDownloadMapRequestDownloadCallback)download select:(nonnull MWMDownloadMapRequestSelectCallback)select; +- (void)showForUnknownLocation:(nonnull MWMDownloadMapRequestSelectCallback)select; + +- (void)startDownload; +- (void)stopDownload; +- (void)downloadProgress:(CGFloat)progress countryName:(nonnull NSString *)countryName; +- (void)setDownloadFailed; + +@end diff --git a/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.m b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.m new file mode 100644 index 0000000000..c1855fb2ea --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.m @@ -0,0 +1,112 @@ +// +// MWMSearchDownloadMapRequest.m +// Maps +// +// Created by Ilya Grechuhin on 10.07.15. +// Copyright (c) 2015 MapsWithMe. All rights reserved. +// + +#import "MWMSearchDownloadMapRequest.h" +#import "MWMSearchDownloadMapRequestView.h" + +@interface MWMSearchDownloadMapRequest () + +@property (nonatomic) IBOutlet MWMSearchDownloadMapRequestView * rootView; +@property (nonatomic) IBOutlet UIView * downloadRequestHolder; + +@property (nonatomic) MWMDownloadMapRequest * downloadRequest; +@property (strong, nonatomic) IBOutlet UIButton * dimButton; + +@end + +@implementation MWMSearchDownloadMapRequest + +- (nonnull instancetype)initWithParentView:(nonnull UIView *)parentView delegate:(nonnull id )delegate +{ + self = [super init]; + if (self) + { + [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self.class) owner:self options:nil]; + [parentView addSubview:self.rootView]; + self.downloadRequest = [[MWMDownloadMapRequest alloc] initWithParentView:self.downloadRequestHolder delegate:delegate]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillhide:) name:UIKeyboardWillHideNotification object:nil]; + } + return self; +} + +- (void)showForLocationWithName:(nonnull NSString *)locationName mapSize:(nonnull NSString *)mapSize mapAndRouteSize:(nonnull NSString *)mapAndRouteSize download:(nonnull MWMDownloadMapRequestDownloadCallback)download select:(nonnull MWMDownloadMapRequestSelectCallback)select; +{ + [self.downloadRequest showForLocationWithName:locationName mapSize:mapSize mapAndRouteSize:mapAndRouteSize download:download select:select]; +} + +- (void)showForUnknownLocation:(nonnull MWMDownloadMapRequestSelectCallback)select +{ + [self.downloadRequest showForUnknownLocation:select]; +} + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [self.rootView removeFromSuperview]; +} + +- (void)keyboardWillShow:(nonnull NSNotification *)aNotification +{ + UIButton * dim = self.dimButton; + dim.hidden = NO; + dim.alpha = 0.0; + NSNumber * duration = aNotification.userInfo[UIKeyboardAnimationDurationUserInfoKey]; + [UIView animateWithDuration:duration.floatValue animations:^ + { + dim.alpha = 1.0; + }]; +} + +- (void)keyboardWillhide:(nonnull NSNotification *)aNotification +{ + UIButton * dim = self.dimButton; + dim.alpha = 1.0; + NSNumber * duration = aNotification.userInfo[UIKeyboardAnimationDurationUserInfoKey]; + [UIView animateWithDuration:duration.floatValue animations:^ + { + dim.alpha = 0.0; + } + completion:^(BOOL finished) + { + dim.hidden = YES; + }]; +} + +#pragma mark - Process control + +- (void)startDownload +{ + self.rootView.hintHidden = YES; + [self.downloadRequest startDownload]; +} + +- (void)stopDownload +{ + self.rootView.hintHidden = NO; + [self.downloadRequest stopDownload]; +} + +- (void)downloadProgress:(CGFloat)progress countryName:(nonnull NSString *)countryName +{ + [self.downloadRequest downloadProgress:progress countryName:countryName]; +} + +- (void)setDownloadFailed +{ + [self.downloadRequest setDownloadFailed]; +} + +#pragma mark - Actions + +- (IBAction)dimTouchUpInside:(nonnull UIButton *)sender +{ + [[UIApplication sharedApplication].keyWindow endEditing:YES]; +} + +@end diff --git a/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.xib b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.xib new file mode 100644 index 0000000000..a2f5efafba --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequest.xib @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.h b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.h new file mode 100644 index 0000000000..bc23c0ffe7 --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.h @@ -0,0 +1,19 @@ +// +// MWMSearchDownloadMapRequestView.h +// Maps +// +// Created by Ilya Grechuhin on 09.07.15. +// Copyright (c) 2015 MapsWithMe. All rights reserved. +// + +#import +#import "UIKitCategories.h" + +@interface MWMSearchDownloadMapRequestView : SolidTouchView + +@property (nonatomic) BOOL hintHidden; + +- (instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("initWithFrame is not available"))); +- (instancetype)init __attribute__((unavailable("init is not available"))); + +@end diff --git a/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.m b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.m new file mode 100644 index 0000000000..626cd5e193 --- /dev/null +++ b/iphone/Maps/Classes/CustomViews/SearchDownloadMapRequest/MWMSearchDownloadMapRequestView.m @@ -0,0 +1,58 @@ +// +// MWMSearchDownloadMapRequestView.m +// Maps +// +// Created by Ilya Grechuhin on 09.07.15. +// Copyright (c) 2015 MapsWithMe. All rights reserved. +// + +#import "Macros.h" +#import "MWMDownloadMapRequestView.h" +#import "MWMSearchDownloadMapRequestView.h" +#import "UIKitCategories.h" + +@interface MWMSearchDownloadMapRequestView () + +@property (weak, nonatomic) IBOutlet UILabel * hint; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint * hintTopOffset; + +@end + +@implementation MWMSearchDownloadMapRequestView + +- (void)layoutSubviews +{ + [super layoutSubviews]; + UIView * superview = self.superview; + self.frame = superview.bounds; + // @TODO Remove on new search! + CGFloat const someCrazyTopOfsetForCurrentSearchViewImplementation = 64.0; + CGFloat const topOffset = (IPAD || superview.height > superview.width ? 40.0 : 12.0); + self.hintTopOffset.constant = someCrazyTopOfsetForCurrentSearchViewImplementation + topOffset; +} + +#pragma mark - Properties + +- (void)setHintHidden:(BOOL)hintHidden +{ + if (self.hint.hidden == hintHidden) + return; + if (!hintHidden) + self.hint.hidden = hintHidden; + [UIView animateWithDuration:0.3 animations:^ + { + self.hint.alpha = hintHidden ? 0.0 : 1.0; + } + completion:^(BOOL finished) + { + if (hintHidden) + self.hint.hidden = hintHidden; + }]; +} + +- (BOOL)hintHidden +{ + return self.hint.hidden; +} + +@end diff --git a/iphone/Maps/Classes/MWMNavigationDelegate.h b/iphone/Maps/Classes/MWMNavigationDelegate.h new file mode 100644 index 0000000000..883be0dc08 --- /dev/null +++ b/iphone/Maps/Classes/MWMNavigationDelegate.h @@ -0,0 +1,13 @@ +// +// MWMNavigationDelegate.h +// Maps +// +// Created by Ilya Grechuhin on 11.07.15. +// Copyright (c) 2015 MapsWithMe. All rights reserved. +// + +@protocol MWMNavigationDelegate + +- (void)pushDownloadMaps; + +@end diff --git a/iphone/Maps/Classes/MapViewController.h b/iphone/Maps/Classes/MapViewController.h index 247ee3afb0..666a744928 100644 --- a/iphone/Maps/Classes/MapViewController.h +++ b/iphone/Maps/Classes/MapViewController.h @@ -1,9 +1,10 @@ -#import -#import "ViewController.h" #import "LocationManager.h" -#import "SearchView.h" #import "LocationPredictor.h" +#import "MWMNavigationDelegate.h" +#import "SearchView.h" +#import "ViewController.h" +#import #include "geometry/point2d.hpp" #include "geometry/rect2d.hpp" @@ -14,7 +15,7 @@ namespace search { struct AddressInfo; } @class MWMMapViewControlsManager, MWMPlacePageViewManager; @class ShareActionSheet; -@interface MapViewController : ViewController +@interface MapViewController : ViewController { bool m_isSticking; size_t m_StickyThreshold; diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index d4a82506ac..64e070cbf8 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -1,7 +1,9 @@ #import "AppInfo.h" #import "Common.h" +#import "CountryTreeVC.h" #import "EAGLView.h" #import "MapsAppDelegate.h" +#import "MapsObservers.h" #import "MapViewController.h" #import "MWMAlertViewController.h" #import "MWMMapViewControlsManager.h" @@ -84,7 +86,7 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView) @end -@interface MapViewController () +@interface MapViewController () @property (nonatomic) UIView * routeViewWrapper; @property (nonatomic) RouteView * routeView; @@ -103,9 +105,15 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView) @property (nonatomic) MapInfoView mapInfoView; +@property (nonatomic) BOOL haveCurrentMap; + @end @implementation MapViewController +{ + ActiveMapsObserver * m_mapsObserver; + int m_mapsObserverSlotId; +} #pragma mark - LocationManager Callbacks @@ -553,6 +561,10 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView) [super viewWillAppear:animated]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]; [self invalidate]; + + m_mapsObserverSlotId = GetFramework().GetCountryTree().GetActiveMapLayout().AddListener(m_mapsObserver); + if (self.searchView.state == SearchViewStateFullscreen) + [self.searchView setState:SearchViewStateFullscreen animated:NO]; } - (void)viewDidLoad @@ -563,6 +575,9 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView) self.placePageManager = [[MWMPlacePageViewManager alloc] initWithViewController:self]; self.controlsManager = [[MWMMapViewControlsManager alloc] initWithParentController:self]; [self.view addSubview:self.searchView]; + + __weak MapViewController * weakSelf = self; + m_mapsObserver = new ActiveMapsObserver(weakSelf); } - (void)viewDidAppear:(BOOL)animated @@ -578,10 +593,13 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView) - (void)viewWillDisappear:(BOOL)animated { - GetFramework().SetUpdatesEnabled(false); + [super viewWillDisappear:animated]; + + Framework & f = GetFramework(); + f.SetUpdatesEnabled(false); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; - [super viewWillDisappear:animated]; + f.GetCountryTree().GetActiveMapLayout().RemoveListener(m_mapsObserverSlotId); } - (void)orientationChanged:(NSNotification *)notification @@ -891,6 +909,56 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView) [RouteState remove]; } +#pragma mark - Map state + +- (void)checkCurrentLocationMap +{ + Framework & f = GetFramework(); + ActiveMapsLayout & activeMapLayout = f.GetCountryTree().GetActiveMapLayout(); + int const mapsCount = activeMapLayout.GetCountInGroup(ActiveMapsLayout::TGroup::EOutOfDate) + activeMapLayout.GetCountInGroup(ActiveMapsLayout::TGroup::EUpToDate); + if (mapsCount == 0) + { + self.haveCurrentMap = NO; + } + else + { + double lat, lon; + if ([[MapsAppDelegate theApp].m_locationManager getLat:lat Lon:lon]) + { + m2::PointD const mercatorLocation = MercatorBounds::FromLatLon(lat, lon); + storage::TIndex const countryIndex = f.GetCountryIndex(mercatorLocation); + if (countryIndex == storage::TIndex()) + { + self.haveCurrentMap = f.IsCountryLoaded(mercatorLocation); + } + else + { + storage::TStatus const countryStatus = activeMapLayout.GetCountryStatus(countryIndex); + self.haveCurrentMap = (countryStatus == storage::TStatus::EOnDisk || countryStatus == storage::TStatus::EOnDiskOutOfDate); + } + } + else + { + self.haveCurrentMap = YES; + } + } +} + +- (void)startMapDownload:(storage::TIndex const &)index type:(TMapOptions)type +{ + GetFramework().GetCountryTree().GetActiveMapLayout().DownloadMap(index, type); +} + +- (void)stopMapsDownload +{ + GetFramework().GetCountryTree().GetActiveMapLayout().CancelAll(); +} + +- (void)restartMapDownload:(storage::TIndex const &)index +{ + GetFramework().GetCountryTree().GetActiveMapLayout().RetryDownloading(index); +} + #pragma mark - RouteViewDelegate - (void)routeViewDidStartFollowing:(RouteView *)routeView @@ -925,6 +993,7 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView) - (void)searchViewWillEnterState:(SearchViewState)state { + [self checkCurrentLocationMap]; switch (state) { case SearchViewStateHidden: @@ -961,6 +1030,15 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView) [self updateStatusBarStyle]; } +#pragma mark - MWMNavigationDelegate + +- (void)pushDownloadMaps +{ + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"downloader"]; + CountryTreeVC * vc = [[CountryTreeVC alloc] initWithNodePosition:-1]; + [self.navigationController pushViewController:vc animated:YES]; +} + #pragma mark - Layout - (void)moveRouteViewAnimatedtoOffset:(CGFloat)offset @@ -991,6 +1069,29 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView) }]; } +#pragma mark - ActiveMapsObserverProtocol + +- (void)countryStatusChangedAtPosition:(int)position inGroup:(ActiveMapsLayout::TGroup const &)group +{ + if (self.searchView.state != SearchViewStateFullscreen) + return; + TStatus const status = GetFramework().GetCountryTree().GetActiveMapLayout().GetCountryStatus(group, position); + if (status == TStatus::EDownloadFailed) + [self.searchView downloadFailed]; + else if (status == TStatus::EOnDisk) + [self.searchView downloadComplete]; +} + +- (void)countryDownloadingProgressChanged:(LocalAndRemoteSizeT const &)progress atPosition:(int)position inGroup:(ActiveMapsLayout::TGroup const &)group +{ + if (self.searchView.state != SearchViewStateFullscreen) + return; + CGFloat const normProgress = (CGFloat)progress.first / (CGFloat)progress.second; + ActiveMapsLayout & activeMapLayout = GetFramework().GetCountryTree().GetActiveMapLayout(); + NSString * countryName = [NSString stringWithUTF8String:activeMapLayout.GetFormatedCountryName(activeMapLayout.GetCoreIndex(group, position)).c_str()]; + [self.searchView downloadProgress:normProgress countryName:countryName]; +} + #pragma mark - Public methods - (void)setApiMode:(BOOL)apiMode animated:(BOOL)animated diff --git a/iphone/Maps/Classes/SearchView.h b/iphone/Maps/Classes/SearchView.h index 7911bd5431..19edef9b1e 100644 --- a/iphone/Maps/Classes/SearchView.h +++ b/iphone/Maps/Classes/SearchView.h @@ -1,6 +1,10 @@ -#import +#import "MWMNavigationDelegate.h" #import "SearchBar.h" +#import + +#include "platform/country_defines.hpp" +#include "storage/index.hpp" typedef NS_ENUM(NSUInteger, SearchViewState) { SearchViewStateHidden, @@ -13,21 +17,31 @@ typedef NS_ENUM(NSUInteger, SearchViewState) { @protocol SearchViewDelegate +@property (nonatomic, readonly) BOOL haveCurrentMap; + - (void)searchViewWillEnterState:(SearchViewState)state; - (void)searchViewDidEnterState:(SearchViewState)state; +- (void)startMapDownload:(storage::TIndex const &)index type:(TMapOptions)type; +- (void)stopMapsDownload; +- (void)restartMapDownload:(storage::TIndex const &)index; + @end @interface SearchView : UIView -@property (nonatomic) SearchBar * searchBar; +@property (nonnull, nonatomic) SearchBar * searchBar; - (void)setState:(SearchViewState)state animated:(BOOL)animated; - (CGFloat)defaultSearchBarMinY; -@property (weak, nonatomic) id delegate; +@property (nonnull, weak, nonatomic) id delegate; @property (nonatomic, readonly) SearchViewState state; @property (nonatomic, readonly) CGRect infoRect; +- (void)downloadProgress:(CGFloat)progress countryName:(nonnull NSString *)countryName; +- (void)downloadComplete; +- (void)downloadFailed; + @end diff --git a/iphone/Maps/Classes/SearchView.mm b/iphone/Maps/Classes/SearchView.mm index 25f8c4963e..71b0aea817 100644 --- a/iphone/Maps/Classes/SearchView.mm +++ b/iphone/Maps/Classes/SearchView.mm @@ -5,6 +5,7 @@ #import "MapsAppDelegate.h" #import "MapViewController.h" #import "MWMMapViewControlsManager.h" +#import "MWMSearchDownloadMapRequest.h" #import "SearchCategoryCell.h" #import "SearchResultCell.h" #import "SearchShowOnMapCell.h" @@ -104,12 +105,14 @@ typedef NS_ENUM(NSUInteger, CellType) }; -@interface SearchView () +@interface SearchView () @property (nonatomic) UITableView * tableView; @property (nonatomic) SolidTouchView * topBackgroundView; @property (nonatomic) UILabel * emptyResultLabel; +@property (nonatomic) MWMSearchDownloadMapRequest * downloadRequest; + @property (nonatomic) SearchResultsWrapper * wrapper; @property (nonatomic) NSArray * categoriesNames; @@ -170,7 +173,8 @@ static BOOL keyboardLoaded = NO; GetFramework().PrepareSearch(); - if (keyboardLoaded) + [self showDownloadMapRequestIfRequired]; + if (keyboardLoaded && !self.downloadRequest) [self.searchBar.textField becomeFirstResponder]; [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.tableView.alpha = 1; @@ -185,7 +189,7 @@ static BOOL keyboardLoaded = NO; self.searchBar.textField.width = textFieldWidth; [self.searchBar.clearButton setImage:[UIImage imageNamed:@"SearchBarClearButton"] forState:UIControlStateNormal]; } completion:^(BOOL) { - if (!keyboardLoaded) + if (!keyboardLoaded && !self.downloadRequest) { keyboardLoaded = YES; [self.searchBar.textField becomeFirstResponder]; @@ -418,10 +422,13 @@ static BOOL keyboardLoaded = NO; if ([currentText length]) { + [self hideDownloadMapRequest]; [self search:currentText]; } else { + if (sender) + [self showDownloadMapRequestIfRequired]; // nil wrapper means "Display Categories" mode self.wrapper = nil; [self.searchBar setSearching:NO]; @@ -508,6 +515,7 @@ static BOOL keyboardLoaded = NO; - (void)layoutSubviews { + [super layoutSubviews]; if (self.state == SearchViewStateFullscreen) self.searchBar.minY = [self defaultSearchBarMinY]; self.tableView.contentInset = UIEdgeInsetsMake(self.topBackgroundView.height, 0, 0, 0); @@ -808,8 +816,114 @@ static BOOL keyboardLoaded = NO; // [super touchesBegan:touches withEvent:event]; } +#pragma mark - Download request + +- (void)showDownloadMapRequestIfRequired +{ + if (self.delegate.haveCurrentMap) + return; + self.downloadRequest = [[MWMSearchDownloadMapRequest alloc] initWithParentView:self.tableView delegate:self]; + Framework & f = GetFramework(); + ActiveMapsLayout & activeMapLayout = f.GetCountryTree().GetActiveMapLayout(); + if (activeMapLayout.IsDownloadingActive()) + { + [self.downloadRequest startDownload]; + } + else + { + double lat, lon; + if ([[MapsAppDelegate theApp].m_locationManager getLat:lat Lon:lon]) + { + + m2::PointD const mercatorLocation = MercatorBounds::FromLatLon(lat, lon); + storage::TIndex const countryIndex = f.GetCountryIndex(mercatorLocation); + + NSString * countryName = [NSString stringWithUTF8String:activeMapLayout.GetFormatedCountryName(countryIndex).c_str()]; + LocalAndRemoteSizeT const sizes = activeMapLayout.GetRemoteCountrySizes(countryIndex); + NSString * mapSize = formattedSize(sizes.first); + NSString * mapAndRouteSize = formattedSize(sizes.first + sizes.second); + + __weak SearchView * weakSelf = self; + [self.downloadRequest showForLocationWithName:countryName mapSize:mapSize mapAndRouteSize:mapAndRouteSize download:^(BOOL needRoute) + { + __strong SearchView * self = weakSelf; + [self.downloadRequest startDownload]; + [self.delegate startMapDownload:countryIndex type:needRoute ? TMapOptions::EMapWithCarRouting : TMapOptions::EMap]; + } + select:^ + { + [self selectMapsAction]; + }]; + } + else + { + [self.downloadRequest showForUnknownLocation:^ + { + [self selectMapsAction]; + }]; + } + } +} + +- (void)hideDownloadMapRequest +{ + self.downloadRequest = nil; +} + +#pragma mark - Download callbacks + +- (void)downloadProgress:(CGFloat)progress countryName:(NSString *)countryName +{ + [self.downloadRequest downloadProgress:progress countryName:countryName]; +} + +- (void)downloadComplete +{ + [self hideDownloadMapRequest]; +} + +- (void)downloadFailed +{ + [self.downloadRequest setDownloadFailed]; +} + +#pragma mark - MWMCircularProgressDelegate + +- (void)progressButtonPressed:(nonnull MWMCircularProgress *)progress +{ + if (progress.failed) + { + double lat, lon; + if ([[MapsAppDelegate theApp].m_locationManager getLat:lat Lon:lon]) + { + Framework & f = GetFramework(); + m2::PointD const mercatorLocation = MercatorBounds::FromLatLon(lat, lon); + storage::TIndex const countryIndex = f.GetCountryIndex(mercatorLocation); + [self.delegate restartMapDownload:countryIndex]; + } + } + else + { + [self.downloadRequest stopDownload]; + [self.delegate stopMapsDownload]; + } +} + +#pragma mark - MWMNavigationDelegate + +- (void)selectMapsAction +{ + [self.delegate pushDownloadMaps]; +} + #pragma mark - Properties +- (void)setDownloadRequest:(MWMSearchDownloadMapRequest *)downloadRequest +{ + _downloadRequest = downloadRequest; + self.tableView.scrollEnabled = (downloadRequest == nil); +} + - (CGRect)infoRect { return [self convertRect:self.topBackgroundView.frame toView:self.superview]; diff --git a/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/Contents.json b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/Contents.json new file mode 100644 index 0000000000..0560a762ac --- /dev/null +++ b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "radioBtnOff@1x.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "radioBtnOff@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "radioBtnOff@3x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@1x.png b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@1x.png new file mode 100644 index 0000000000..aa26bfe0ac Binary files /dev/null and b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@1x.png differ diff --git a/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@2x.png b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@2x.png new file mode 100644 index 0000000000..e838efd549 Binary files /dev/null and b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@2x.png differ diff --git a/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@3x.png b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@3x.png new file mode 100644 index 0000000000..1b90824262 Binary files /dev/null and b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOff.imageset/radioBtnOff@3x.png differ diff --git a/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/Contents.json b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/Contents.json new file mode 100644 index 0000000000..4ea1f8b4fe --- /dev/null +++ b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "radioBtnOn@1x.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "radioBtnOn@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "radioBtnOn@3x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@1x.png b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@1x.png new file mode 100644 index 0000000000..3ff2408e4f Binary files /dev/null and b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@1x.png differ diff --git a/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@2x.png b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@2x.png new file mode 100644 index 0000000000..2eb70f17c0 Binary files /dev/null and b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@2x.png differ diff --git a/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@3x.png b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@3x.png new file mode 100644 index 0000000000..26a85917e7 Binary files /dev/null and b/iphone/Maps/Images.xcassets/DownloadMapRequest/radioBtnOn.imageset/radioBtnOn@3x.png differ diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index b359ea26a2..a3e6a43980 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -41,6 +41,12 @@ 349A357A1B53D4C9009677EE /* MWMCircularProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = 349A35761B53D4C9009677EE /* MWMCircularProgress.m */; }; 349A357B1B53D4C9009677EE /* MWMCircularProgress.xib in Resources */ = {isa = PBXBuildFile; fileRef = 349A35771B53D4C9009677EE /* MWMCircularProgress.xib */; }; 349A357C1B53D4C9009677EE /* MWMCircularProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 349A35791B53D4C9009677EE /* MWMCircularProgressView.m */; }; + 349A35831B53E967009677EE /* MWMDownloadMapRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 349A357F1B53E967009677EE /* MWMDownloadMapRequest.m */; }; + 349A35841B53E967009677EE /* MWMDownloadMapRequest.xib in Resources */ = {isa = PBXBuildFile; fileRef = 349A35801B53E967009677EE /* MWMDownloadMapRequest.xib */; }; + 349A35851B53E967009677EE /* MWMDownloadMapRequestView.m in Sources */ = {isa = PBXBuildFile; fileRef = 349A35821B53E967009677EE /* MWMDownloadMapRequestView.m */; }; + 349A358C1B53EABC009677EE /* MWMSearchDownloadMapRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 349A35881B53EABC009677EE /* MWMSearchDownloadMapRequest.m */; }; + 349A358D1B53EABC009677EE /* MWMSearchDownloadMapRequest.xib in Resources */ = {isa = PBXBuildFile; fileRef = 349A35891B53EABC009677EE /* MWMSearchDownloadMapRequest.xib */; }; + 349A358E1B53EABC009677EE /* MWMSearchDownloadMapRequestView.m in Sources */ = {isa = PBXBuildFile; fileRef = 349A358B1B53EABC009677EE /* MWMSearchDownloadMapRequestView.m */; }; 34A742FE1AE5461A00CE15EB /* index.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34A742FD1AE5461A00CE15EB /* index.cpp */; }; 34A743001AE5468200CE15EB /* storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34A742FF1AE5468200CE15EB /* storage.cpp */; }; 34BC72211B0DECAE0012A34B /* MWMLocationButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34BC720C1B0DECAE0012A34B /* MWMLocationButton.mm */; }; @@ -388,6 +394,16 @@ 349A35771B53D4C9009677EE /* MWMCircularProgress.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMCircularProgress.xib; sourceTree = ""; }; 349A35781B53D4C9009677EE /* MWMCircularProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMCircularProgressView.h; sourceTree = ""; }; 349A35791B53D4C9009677EE /* MWMCircularProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMCircularProgressView.m; sourceTree = ""; }; + 349A357E1B53E967009677EE /* MWMDownloadMapRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMDownloadMapRequest.h; sourceTree = ""; }; + 349A357F1B53E967009677EE /* MWMDownloadMapRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMDownloadMapRequest.m; sourceTree = ""; }; + 349A35801B53E967009677EE /* MWMDownloadMapRequest.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMDownloadMapRequest.xib; sourceTree = ""; }; + 349A35811B53E967009677EE /* MWMDownloadMapRequestView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMDownloadMapRequestView.h; sourceTree = ""; }; + 349A35821B53E967009677EE /* MWMDownloadMapRequestView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMDownloadMapRequestView.m; sourceTree = ""; }; + 349A35871B53EABC009677EE /* MWMSearchDownloadMapRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSearchDownloadMapRequest.h; sourceTree = ""; }; + 349A35881B53EABC009677EE /* MWMSearchDownloadMapRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMSearchDownloadMapRequest.m; sourceTree = ""; }; + 349A35891B53EABC009677EE /* MWMSearchDownloadMapRequest.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMSearchDownloadMapRequest.xib; sourceTree = ""; }; + 349A358A1B53EABC009677EE /* MWMSearchDownloadMapRequestView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSearchDownloadMapRequestView.h; sourceTree = ""; }; + 349A358B1B53EABC009677EE /* MWMSearchDownloadMapRequestView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWMSearchDownloadMapRequestView.m; sourceTree = ""; }; 34A742FD1AE5461A00CE15EB /* index.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = index.cpp; path = ../../../storage/index.cpp; sourceTree = ""; }; 34A742FF1AE5468200CE15EB /* storage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = storage.cpp; path = ../../../storage/storage.cpp; sourceTree = ""; }; 34BC720B1B0DECAE0012A34B /* MWMLocationButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMLocationButton.h; sourceTree = ""; }; @@ -1080,6 +1096,32 @@ path = CustomViews/CircularProgress; sourceTree = ""; }; + 349A357D1B53E967009677EE /* DownloadMapRequest */ = { + isa = PBXGroup; + children = ( + 349A357E1B53E967009677EE /* MWMDownloadMapRequest.h */, + 349A357F1B53E967009677EE /* MWMDownloadMapRequest.m */, + 349A35801B53E967009677EE /* MWMDownloadMapRequest.xib */, + 349A35811B53E967009677EE /* MWMDownloadMapRequestView.h */, + 349A35821B53E967009677EE /* MWMDownloadMapRequestView.m */, + ); + name = DownloadMapRequest; + path = CustomViews/DownloadMapRequest; + sourceTree = ""; + }; + 349A35861B53EABC009677EE /* SearchDownloadMapRequest */ = { + isa = PBXGroup; + children = ( + 349A35871B53EABC009677EE /* MWMSearchDownloadMapRequest.h */, + 349A35881B53EABC009677EE /* MWMSearchDownloadMapRequest.m */, + 349A35891B53EABC009677EE /* MWMSearchDownloadMapRequest.xib */, + 349A358A1B53EABC009677EE /* MWMSearchDownloadMapRequestView.h */, + 349A358B1B53EABC009677EE /* MWMSearchDownloadMapRequestView.m */, + ); + name = SearchDownloadMapRequest; + path = CustomViews/SearchDownloadMapRequest; + sourceTree = ""; + }; 34BC72091B0DECAE0012A34B /* MapViewControls */ = { isa = PBXGroup; children = ( @@ -1244,6 +1286,8 @@ 97B4E9271851DAB300BEC5D7 /* Custom Views */ = { isa = PBXGroup; children = ( + 349A35861B53EABC009677EE /* SearchDownloadMapRequest */, + 349A357D1B53E967009677EE /* DownloadMapRequest */, 349A35741B53D4C9009677EE /* CircularProgress */, 34BC72091B0DECAE0012A34B /* MapViewControls */, B0E1FCD61A23386D00A8E08B /* Route */, @@ -2009,10 +2053,12 @@ F7E7BA231672328F00B4492E /* atm@2x.png in Resources */, F7E7BA241672328F00B4492E /* bank.png in Resources */, 34BC72231B0DECAE0012A34B /* MWMLocationButton.xib in Resources */, + 349A358D1B53EABC009677EE /* MWMSearchDownloadMapRequest.xib in Resources */, F7E7BA251672328F00B4492E /* bank@2x.png in Resources */, 349A357B1B53D4C9009677EE /* MWMCircularProgress.xib in Resources */, F7E7BA261672328F00B4492E /* entertainment.png in Resources */, F6CB21621AEE902B00FB8963 /* PlacePageLinkCell.xib in Resources */, + 349A35841B53E967009677EE /* MWMDownloadMapRequest.xib in Resources */, F7E7BA271672328F00B4492E /* entertainment@2x.png in Resources */, F7E7BA281672328F00B4492E /* food.png in Resources */, F7E7BA291672328F00B4492E /* food@2x.png in Resources */, @@ -2145,6 +2191,7 @@ B08AA8CE1A24C7BC00810B1C /* LocalNotificationInfoProvider.m in Sources */, 1D3623260D0F684500981E51 /* MapsAppDelegate.mm in Sources */, F67BBB571AC54A7800D162C7 /* MWMFeedbackAlert.mm in Sources */, + 349A35831B53E967009677EE /* MWMDownloadMapRequest.m in Sources */, A32B6D4C1A14980500E54A65 /* iosOGLContext.mm in Sources */, B0E1FCDF1A2343BC00A8E08B /* NextTurnPhoneView.m in Sources */, 46F26CD810F623BA00ECCA39 /* EAGLView.mm in Sources */, @@ -2168,6 +2215,7 @@ EE7F29821219ECA300EB67A9 /* RenderContext.mm in Sources */, 34BC72251B0DECAE0012A34B /* MWMSideMenuButton.mm in Sources */, F6ED13911B1EF96B0095C6DE /* MWMBookmarkDescriptionViewController.mm in Sources */, + 349A35851B53E967009677EE /* MWMDownloadMapRequestView.m in Sources */, F64F19991AB81A00006EAF7E /* MWMAlertViewController.mm in Sources */, FAFCB63613366E78001A5C59 /* WebViewController.mm in Sources */, F6FE2C0F1B03A006009814AA /* MWMPlacePageNavigationBar.mm in Sources */, @@ -2201,6 +2249,7 @@ FA36B80D15403A4F004560CC /* BookmarksVC.mm in Sources */, F6ED135B1B18AA930095C6DE /* MWMExtendedPlacePageView.m in Sources */, F6588E2F1B15D2BC00EE1E58 /* MWMBookmarkColorViewController.mm in Sources */, + 349A358E1B53EABC009677EE /* MWMSearchDownloadMapRequestView.m in Sources */, A32B6D4D1A14980500E54A65 /* iosOGLContextFactory.mm in Sources */, FAF457E715597D4600DCCC49 /* Framework.cpp in Sources */, 97CC93BB19599F4700369B42 /* SearchSuggestCell.m in Sources */, @@ -2230,6 +2279,7 @@ B0FBFA271A515AFD0086819E /* ViewController.m in Sources */, 3472EC051B4D44BE0085CB79 /* UIFont+MapsMeFonts.mm in Sources */, 342AD76F1B53D30C00E0B997 /* UIButton+RuntimeAttributes.m in Sources */, + 349A358C1B53EABC009677EE /* MWMSearchDownloadMapRequest.m in Sources */, F63732961AE9431E00A03764 /* MWMBasePlacePageView.mm in Sources */, 97A8001018B21395000C07A2 /* SearchBar.mm in Sources */, EDC5C543175F2CA600420E92 /* ShareActionSheet.mm in Sources */, -- cgit v1.2.3