diff --git a/iphone/Maps/Classes/Widgets/MWMBookmarksBannerViewController.h b/iphone/Maps/Classes/Widgets/MWMBookmarksBannerViewController.h
new file mode 100644
index 0000000000..6a4ee9fb94
--- /dev/null
+++ b/iphone/Maps/Classes/Widgets/MWMBookmarksBannerViewController.h
@@ -0,0 +1,9 @@
+#import "MWMDownloadBannerViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface MWMBookmarksBannerViewController : MWMDownloadBannerViewController
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/iphone/Maps/Classes/Widgets/MWMBookmarksBannerViewController.m b/iphone/Maps/Classes/Widgets/MWMBookmarksBannerViewController.m
new file mode 100644
index 0000000000..5da72d0a73
--- /dev/null
+++ b/iphone/Maps/Classes/Widgets/MWMBookmarksBannerViewController.m
@@ -0,0 +1,5 @@
+#import "MWMBookmarksBannerViewController.h"
+
+@implementation MWMBookmarksBannerViewController
+
+@end
diff --git a/iphone/Maps/Classes/Widgets/MWMBookmarksBannerViewController.xib b/iphone/Maps/Classes/Widgets/MWMBookmarksBannerViewController.xib
new file mode 100644
index 0000000000..5eaea209c0
--- /dev/null
+++ b/iphone/Maps/Classes/Widgets/MWMBookmarksBannerViewController.xib
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/iphone/Maps/Classes/Widgets/MWMDownloadBannerViewController.h b/iphone/Maps/Classes/Widgets/MWMDownloadBannerViewController.h
new file mode 100644
index 0000000000..8df8e6cabc
--- /dev/null
+++ b/iphone/Maps/Classes/Widgets/MWMDownloadBannerViewController.h
@@ -0,0 +1,9 @@
+NS_ASSUME_NONNULL_BEGIN
+
+@interface MWMDownloadBannerViewController : UIViewController
+
+- (instancetype)initWithTapHandler:(MWMVoidBlock)tapHandler;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/iphone/Maps/Classes/Widgets/MWMDownloadBannerViewController.m b/iphone/Maps/Classes/Widgets/MWMDownloadBannerViewController.m
new file mode 100644
index 0000000000..4239b3f173
--- /dev/null
+++ b/iphone/Maps/Classes/Widgets/MWMDownloadBannerViewController.m
@@ -0,0 +1,25 @@
+#import "MWMDownloadBannerViewController.h"
+
+@interface MWMDownloadBannerViewController ()
+
+@property(copy, nonatomic) MWMVoidBlock tapHandler;
+
+@end
+
+@implementation MWMDownloadBannerViewController
+
+- (instancetype)initWithTapHandler:(MWMVoidBlock)tapHandler {
+ self = [super init];
+ if (self) {
+ _tapHandler = tapHandler;
+ }
+ return self;
+}
+
+- (IBAction)onButtonTap:(UIButton *)sender {
+ if (self.tapHandler) {
+ self.tapHandler();
+ }
+}
+
+@end
diff --git a/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm b/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm
index 1769986866..854d9e67cd 100644
--- a/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm
+++ b/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.mm
@@ -1,19 +1,15 @@
-#import
#import "MWMMapDownloadDialog.h"
+#import
#import "CLLocation+Mercator.h"
-#import "MWMAlertViewController.h"
-#import "MWMBottomMenuViewController.h"
-#import "SwiftBridge.h"
+#import "MWMBookmarksBannerViewController.h"
#import "MWMCircularProgress.h"
#import "MWMCommon.h"
#import "MWMFrameworkListener.h"
-#import "MWMFrameworkObservers.h"
-#import "MWMLocationManager.h"
-#import "MWMRouter.h"
-#import "MWMSettings.h"
+#import "MWMMegafonBannerViewController.h"
#import "MWMStorage.h"
#import "MapViewController.h"
#import "Statistics.h"
+#import "SwiftBridge.h"
#include "Framework.h"
@@ -27,33 +23,30 @@
#include "base/assert.hpp"
-namespace
-{
+namespace {
CGSize constexpr kInitialDialogSize = {200, 200};
-BOOL canAutoDownload(storage::CountryId const & countryId)
-{
+BOOL canAutoDownload(storage::CountryId const &countryId) {
if (![MWMSettings autoDownloadEnabled])
return NO;
if (GetPlatform().ConnectionStatus() != Platform::EConnectionType::CONNECTION_WIFI)
return NO;
- CLLocation * lastLocation = [MWMLocationManager lastLocation];
+ CLLocation *lastLocation = [MWMLocationManager lastLocation];
if (!lastLocation)
return NO;
- auto const & countryInfoGetter = GetFramework().GetCountryInfoGetter();
+ auto const &countryInfoGetter = GetFramework().GetCountryInfoGetter();
if (countryId != countryInfoGetter.GetRegionCountryId(lastLocation.mercator))
return NO;
return !platform::migrate::NeedMigrate();
}
-promo::DownloaderPromo::Banner getPromoBanner(std::string const & mwmId)
-{
- auto const & purchase = GetFramework().GetPurchase();
+promo::DownloaderPromo::Banner getPromoBanner(std::string const &mwmId) {
+ auto const &purchase = GetFramework().GetPurchase();
bool const hasRemoveAdsSubscription = purchase && purchase->IsSubscriptionActive(SubscriptionType::RemoveAds);
auto const policy = platform::GetCurrentNetworkPolicy();
if (!policy.CanUse())
return {};
- auto const * promoApi = GetFramework().GetPromoApi(policy);
+ auto const *promoApi = GetFramework().GetPromoApi(policy);
CHECK(promoApi != nullptr, ());
return promo::DownloaderPromo::GetBanner(GetFramework().GetStorage(), *promoApi, mwmId, languages::GetCurrentNorm(),
hasRemoveAdsSubscription);
@@ -62,74 +55,66 @@ promo::DownloaderPromo::Banner getPromoBanner(std::string const & mwmId)
using namespace storage;
-@interface MWMMapDownloadDialog ()
-@property(weak, nonatomic) IBOutlet UILabel * parentNode;
-@property(weak, nonatomic) IBOutlet UILabel * node;
-@property(weak, nonatomic) IBOutlet UILabel * nodeSize;
-@property(weak, nonatomic) IBOutlet NSLayoutConstraint * nodeTopOffset;
-@property(weak, nonatomic) IBOutlet UIButton * downloadButton;
-@property(weak, nonatomic) IBOutlet UIView * progressWrapper;
-@property(weak, nonatomic) IBOutlet UIView * bannerView;
-@property(weak, nonatomic) IBOutlet NSLayoutConstraint * bannerHiddenConstraint;
-@property(weak, nonatomic) IBOutlet NSLayoutConstraint * bannerVisibleConstraint;
-
-@property(weak, nonatomic) MapViewController * controller;
-
-@property(nonatomic) MWMCircularProgress * progress;
-
-@property(nonatomic) NSMutableArray * skipDownloadTimes;
+@interface MWMMapDownloadDialog ()
+@property(strong, nonatomic) IBOutlet UILabel *parentNode;
+@property(strong, nonatomic) IBOutlet UILabel *node;
+@property(strong, nonatomic) IBOutlet UILabel *nodeSize;
+@property(strong, nonatomic) IBOutlet NSLayoutConstraint *nodeTopOffset;
+@property(strong, nonatomic) IBOutlet UIButton *downloadButton;
+@property(strong, nonatomic) IBOutlet UIView *progressWrapper;
+@property(strong, nonatomic) IBOutlet UIView *bannerView;
+@property(strong, nonatomic) IBOutlet UIView *bannerContentView;
+@property(strong, nonatomic) IBOutlet NSLayoutConstraint *bannerVisibleConstraintV;
+@property(strong, nonatomic) IBOutlet NSLayoutConstraint *bannerVisibleConstraintH;
+@property(weak, nonatomic) MapViewController *controller;
+@property(nonatomic) MWMCircularProgress *progress;
+@property(nonatomic) NSMutableArray *skipDownloadTimes;
@property(nonatomic) BOOL isAutoDownloadCancelled;
+@property(strong, nonatomic) MWMDownloadBannerViewController *bannerViewController;
@end
-@implementation MWMMapDownloadDialog
-{
+@implementation MWMMapDownloadDialog {
CountryId m_countryId;
CountryId m_autoDownloadCountryId;
promo::DownloaderPromo::Banner m_promoBanner;
}
-+ (instancetype)dialogForController:(MapViewController *)controller
-{
- MWMMapDownloadDialog * dialog =
- [NSBundle.mainBundle loadNibNamed:[self className] owner:nil options:nil].firstObject;
++ (instancetype)dialogForController:(MapViewController *)controller {
+ MWMMapDownloadDialog *dialog = [NSBundle.mainBundle loadNibNamed:[self className] owner:nil options:nil].firstObject;
dialog.autoresizingMask = UIViewAutoresizingFlexibleHeight;
dialog.controller = controller;
dialog.size = kInitialDialogSize;
return dialog;
}
-- (void)layoutSubviews
-{
- UIView * superview = self.superview;
+- (void)layoutSubviews {
+ UIView *superview = self.superview;
self.center = {superview.midX, superview.midY};
CGSize const newSize = [self systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
- if (CGSizeEqualToSize(newSize, self.size)) return;
+ if (CGSizeEqualToSize(newSize, self.size))
+ return;
self.size = newSize;
self.center = {superview.midX, superview.midY};
[super layoutSubviews];
}
-- (void)configDialog
-{
- auto & f = GetFramework();
- auto const & s = f.GetStorage();
- auto const & p = f.GetDownloadingPolicy();
+- (void)configDialog {
+ auto &f = GetFramework();
+ auto const &s = f.GetStorage();
+ auto const &p = f.GetDownloadingPolicy();
NodeAttrs nodeAttrs;
s.GetNodeAttrs(m_countryId, nodeAttrs);
- if (!nodeAttrs.m_present && ![MWMRouter isRoutingActive])
- {
+ if (!nodeAttrs.m_present && ![MWMRouter isRoutingActive]) {
BOOL const isMultiParent = nodeAttrs.m_parentInfo.size() > 1;
BOOL const noParrent = (nodeAttrs.m_parentInfo[0].m_id == s.GetRootId());
BOOL const hideParent = (noParrent || isMultiParent);
self.parentNode.hidden = hideParent;
- self.nodeTopOffset.priority =
- hideParent ? UILayoutPriorityDefaultHigh : UILayoutPriorityDefaultLow;
- if (!hideParent)
- {
+ self.nodeTopOffset.priority = hideParent ? UILayoutPriorityDefaultHigh : UILayoutPriorityDefaultLow;
+ if (!hideParent) {
self.parentNode.text = @(nodeAttrs.m_topmostParentInfo[0].m_localName.c_str());
self.parentNode.textColor = [UIColor blackSecondaryText];
}
@@ -139,58 +124,55 @@ using namespace storage;
self.nodeSize.textColor = [UIColor blackSecondaryText];
self.nodeSize.text = formattedSize(nodeAttrs.m_mwmSize);
- switch (nodeAttrs.m_status)
- {
- case NodeStatus::NotDownloaded:
- case NodeStatus::Partly:
- {
- MapViewController * controller = self.controller;
- BOOL const isMapVisible =
- [controller.navigationController.topViewController isEqual:controller];
- if (isMapVisible && !self.isAutoDownloadCancelled && canAutoDownload(m_countryId))
- {
- [Statistics logEvent:kStatDownloaderMapAction
- withParameters:@{
- kStatAction: kStatDownload,
- kStatIsAuto: kStatYes,
- kStatFrom: kStatMap,
- kStatScenario: kStatDownload
- }];
- m_autoDownloadCountryId = m_countryId;
- [MWMStorage downloadNode:m_countryId
- onSuccess:^{
- [self showInQueue];
- } onCancel:nil];
- }
- else
- {
- m_autoDownloadCountryId = kInvalidCountryId;
- [self showDownloadRequest];
- }
- if (@available(iOS 12.0, *)) {
- [[MWMCarPlayService shared] showNoMapAlert];
- }
- break;
+ switch (nodeAttrs.m_status) {
+ case NodeStatus::NotDownloaded:
+ case NodeStatus::Partly: {
+ MapViewController *controller = self.controller;
+ BOOL const isMapVisible = [controller.navigationController.topViewController isEqual:controller];
+ if (isMapVisible && !self.isAutoDownloadCancelled && canAutoDownload(m_countryId)) {
+ [Statistics logEvent:kStatDownloaderMapAction
+ withParameters:@{
+ kStatAction: kStatDownload,
+ kStatIsAuto: kStatYes,
+ kStatFrom: kStatMap,
+ kStatScenario: kStatDownload
+ }];
+ m_autoDownloadCountryId = m_countryId;
+ [MWMStorage downloadNode:m_countryId
+ onSuccess:^{
+ [self showInQueue];
+ }
+ onCancel:nil];
+ } else {
+ m_autoDownloadCountryId = kInvalidCountryId;
+ [self showDownloadRequest];
+ }
+ if (@available(iOS 12.0, *)) {
+ [[MWMCarPlayService shared] showNoMapAlert];
+ }
+ break;
}
case NodeStatus::Downloading:
if (nodeAttrs.m_downloadingProgress.second != 0)
- [self showDownloading:static_cast(nodeAttrs.m_downloadingProgress.first) /
+ [self showDownloading:(CGFloat)nodeAttrs.m_downloadingProgress.first /
nodeAttrs.m_downloadingProgress.second];
[self showBannerIfNeeded];
break;
case NodeStatus::Applying:
- case NodeStatus::InQueue: [self showInQueue]; break;
+ case NodeStatus::InQueue:
+ [self showInQueue];
+ break;
case NodeStatus::Undefined:
case NodeStatus::Error:
if (p.IsAutoRetryDownloadFailed())
[self showError:nodeAttrs.m_error];
break;
case NodeStatus::OnDisk:
- case NodeStatus::OnDiskOutOfDate: [self removeFromSuperview]; break;
+ case NodeStatus::OnDiskOutOfDate:
+ [self removeFromSuperview];
+ break;
}
- }
- else
- {
+ } else {
[self removeFromSuperview];
}
@@ -198,8 +180,7 @@ using namespace storage;
[self setNeedsLayout];
}
-- (void)addToSuperview
-{
+- (void)addToSuperview {
if (self.superview)
return;
auto superview = self.controller.view;
@@ -211,8 +192,7 @@ using namespace storage;
[MWMFrameworkListener addObserver:self];
}
-- (void)removeFromSuperview
-{
+- (void)removeFromSuperview {
if (@available(iOS 12.0, *)) {
[[MWMCarPlayService shared] hideNoMapAlert];
}
@@ -221,8 +201,7 @@ using namespace storage;
[super removeFromSuperview];
}
-- (void)showError:(NodeErrorCode)errorCode
-{
+- (void)showError:(NodeErrorCode)errorCode {
if (errorCode == NodeErrorCode::NoError)
return;
self.nodeSize.textColor = [UIColor red];
@@ -230,7 +209,7 @@ using namespace storage;
self.downloadButton.hidden = YES;
self.progressWrapper.hidden = NO;
self.progress.state = MWMCircularProgressStateFailed;
- MWMAlertViewController * avc = self.controller.alertController;
+ MWMAlertViewController *avc = self.controller.alertController;
[self addToSuperview];
auto const retryBlock = ^{
[Statistics logEvent:kStatDownloaderMapAction
@@ -244,43 +223,42 @@ using namespace storage;
[MWMStorage retryDownloadNode:self->m_countryId];
};
auto const cancelBlock = ^{
- [Statistics logEvent:kStatDownloaderDownloadCancel withParameters:@{kStatFrom : kStatMap}];
+ [Statistics logEvent:kStatDownloaderDownloadCancel withParameters:@{kStatFrom: kStatMap}];
[MWMStorage cancelDownloadNode:self->m_countryId];
};
- switch (errorCode)
- {
- case NodeErrorCode::NoError: break;
- case NodeErrorCode::UnknownError:
- [avc presentDownloaderInternalErrorAlertWithOkBlock:retryBlock cancelBlock:cancelBlock];
- break;
- case NodeErrorCode::OutOfMemFailed: [avc presentDownloaderNotEnoughSpaceAlert]; break;
- case NodeErrorCode::NoInetConnection:
- [avc presentDownloaderNoConnectionAlertWithOkBlock:retryBlock cancelBlock:cancelBlock];
- break;
+ switch (errorCode) {
+ case NodeErrorCode::NoError:
+ break;
+ case NodeErrorCode::UnknownError:
+ [avc presentDownloaderInternalErrorAlertWithOkBlock:retryBlock cancelBlock:cancelBlock];
+ break;
+ case NodeErrorCode::OutOfMemFailed:
+ [avc presentDownloaderNotEnoughSpaceAlert];
+ break;
+ case NodeErrorCode::NoInetConnection:
+ [avc presentDownloaderNoConnectionAlertWithOkBlock:retryBlock cancelBlock:cancelBlock];
+ break;
}
}
-- (void)showDownloadRequest
-{
+- (void)showDownloadRequest {
[self hideBanner];
self.downloadButton.hidden = NO;
self.progressWrapper.hidden = YES;
[self addToSuperview];
}
-- (void)showDownloading:(CGFloat)progress
-{
+- (void)showDownloading:(CGFloat)progress {
self.nodeSize.textColor = [UIColor blackSecondaryText];
- self.nodeSize.text = [NSString stringWithFormat:@"%@ %@%%", L(@"downloader_downloading"),
- @(static_cast(progress * 100))];
+ self.nodeSize.text =
+ [NSString stringWithFormat:@"%@ %@%%", L(@"downloader_downloading"), @((NSInteger)progress * 100)];
self.downloadButton.hidden = YES;
self.progressWrapper.hidden = NO;
self.progress.progress = progress;
[self addToSuperview];
}
-- (void)showInQueue
-{
+- (void)showInQueue {
[self showBannerIfNeeded];
self.nodeSize.textColor = [UIColor blackSecondaryText];
self.nodeSize.text = L(@"downloader_queued");
@@ -290,8 +268,7 @@ using namespace storage;
[self addToSuperview];
}
-- (void)processViewportCountryEvent:(CountryId const &)countryId
-{
+- (void)processViewportCountryEvent:(CountryId const &)countryId {
m_countryId = countryId;
if (countryId == kInvalidCountryId)
[self removeFromSuperview];
@@ -299,35 +276,78 @@ using namespace storage;
[self configDialog];
}
-- (void)showBannerIfNeeded
-{
+- (void)showBannerIfNeeded {
m_promoBanner = getPromoBanner(m_countryId);
- // TODO: implement other banner types.
- if (m_promoBanner.m_type == promo::DownloaderPromo::Type::Megafon && self.bannerView.hidden)
- {
- [self layoutIfNeeded];
- self.bannerVisibleConstraint.priority = UILayoutPriorityDefaultHigh;
- self.bannerView.hidden = NO;
- [UIView animateWithDuration:kDefaultAnimationDuration animations:^{
- [self layoutIfNeeded];
- }];
+ [self layoutIfNeeded];
+ if (self.bannerView.hidden) {
+ switch (m_promoBanner.m_type) {
+ case promo::DownloaderPromo::Type::Megafon: {
+ __weak __typeof(self) ws = self;
+ self.bannerViewController = [[MWMMegafonBannerViewController alloc] initWithTapHandler:^{
+ [ws bannerAction];
+ }];
+ break;
+ }
+ case promo::DownloaderPromo::Type::BookmarkCatalog: {
+ __weak __typeof(self) ws = self;
+ self.bannerViewController = [[MWMBookmarksBannerViewController alloc] initWithTapHandler:^{
+ __strong __typeof(self) self = ws;
+ NSString *urlString = @(self->m_promoBanner.m_url.c_str());
+ if (urlString.length == 0) {
+ return;
+ }
+ NSURL *url = [NSURL URLWithString:urlString];
+ [self.controller openCatalogDeeplink:url animated:YES];
+ }];
+ break;
+ }
+ case promo::DownloaderPromo::Type::NoPromo:
+ self.bannerViewController = nil;
+ break;
+ }
+
+ if (self.bannerViewController) {
+ UIView *bannerView = self.bannerViewController.view;
+ [self.bannerContentView addSubview:bannerView];
+ bannerView.translatesAutoresizingMaskIntoConstraints = NO;
+ [NSLayoutConstraint activateConstraints:@[
+ [bannerView.topAnchor constraintEqualToAnchor:self.bannerContentView.topAnchor],
+ [bannerView.leftAnchor constraintEqualToAnchor:self.bannerContentView.leftAnchor],
+ [bannerView.bottomAnchor constraintEqualToAnchor:self.bannerContentView.bottomAnchor],
+ [bannerView.rightAnchor constraintEqualToAnchor:self.bannerContentView.rightAnchor]
+ ]];
+ self.bannerVisibleConstraintV.priority = UILayoutPriorityDefaultHigh;
+ self.bannerVisibleConstraintH.priority = UILayoutPriorityDefaultHigh;
+ self.bannerView.hidden = NO;
+ self.bannerView.alpha = 0;
+ [UIView animateWithDuration:kDefaultAnimationDuration
+ animations:^{
+ self.bannerView.alpha = 1;
+ [self layoutIfNeeded];
+ }];
+ }
}
}
-- (void)hideBanner
-{
+- (void)hideBanner {
[self layoutIfNeeded];
- self.bannerVisibleConstraint.priority = UILayoutPriorityDefaultLow;
- self.bannerView.hidden = YES;
- [UIView animateWithDuration:kDefaultAnimationDuration animations:^{
- [self layoutIfNeeded];
- }];
+ self.bannerVisibleConstraintV.priority = UILayoutPriorityDefaultLow;
+ self.bannerVisibleConstraintH.priority = UILayoutPriorityDefaultLow;
+ [UIView animateWithDuration:kDefaultAnimationDuration
+ animations:^{
+ [self layoutIfNeeded];
+ self.bannerView.alpha = 0;
+ }
+ completion:^(BOOL finished) {
+ [self.bannerViewController.view removeFromSuperview];
+ self.bannerViewController = nil;
+ self.bannerView.hidden = YES;
+ }];
}
#pragma mark - MWMFrameworkStorageObserver
-- (void)processCountryEvent:(CountryId const &)countryId
-{
+- (void)processCountryEvent:(CountryId const &)countryId {
if (m_countryId != countryId)
return;
if (self.superview)
@@ -336,19 +356,15 @@ using namespace storage;
[self removeFromSuperview];
}
-- (void)processCountry:(CountryId const &)countryId
- progress:(MapFilesDownloader::Progress const &)progress
-{
+- (void)processCountry:(CountryId const &)countryId progress:(MapFilesDownloader::Progress const &)progress {
if (self.superview && m_countryId == countryId)
- [self showDownloading:static_cast(progress.first) / progress.second];
+ [self showDownloading:(CGFloat)progress.first / progress.second];
}
#pragma mark - MWMCircularProgressDelegate
-- (void)progressButtonPressed:(nonnull MWMCircularProgress *)progress
-{
- if (progress.state == MWMCircularProgressStateFailed)
- {
+- (void)progressButtonPressed:(nonnull MWMCircularProgress *)progress {
+ if (progress.state == MWMCircularProgressStateFailed) {
[Statistics logEvent:kStatDownloaderMapAction
withParameters:@{
kStatAction: kStatRetry,
@@ -358,10 +374,8 @@ using namespace storage;
}];
[self showInQueue];
[MWMStorage retryDownloadNode:m_countryId];
- }
- else
- {
- [Statistics logEvent:kStatDownloaderDownloadCancel withParameters:@{kStatFrom : kStatMap}];
+ } else {
+ [Statistics logEvent:kStatDownloaderDownloadCancel withParameters:@{kStatFrom: kStatMap}];
if (m_autoDownloadCountryId == m_countryId)
self.isAutoDownloadCancelled = YES;
[MWMStorage cancelDownloadNode:m_countryId];
@@ -370,26 +384,21 @@ using namespace storage;
#pragma mark - Actions
-- (IBAction)bannerAction
-{
+- (IBAction)bannerAction {
if (m_promoBanner.m_url.empty())
return;
-
- NSURL * bannerURL = [NSURL URLWithString:@(m_promoBanner.m_url.c_str())];
- SFSafariViewController * safari = [[SFSafariViewController alloc] initWithURL:bannerURL];
+
+ NSURL *bannerURL = [NSURL URLWithString:@(m_promoBanner.m_url.c_str())];
+ SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:bannerURL];
[self.controller presentViewController:safari animated:YES completion:nil];
}
-- (IBAction)downloadAction
-{
- MapViewController * controller = self.controller;
- if (platform::migrate::NeedMigrate())
- {
- [Statistics logEvent:kStatDownloaderMigrationDialogue withParameters:@{kStatFrom : kStatMap}];
+- (IBAction)downloadAction {
+ MapViewController *controller = self.controller;
+ if (platform::migrate::NeedMigrate()) {
+ [Statistics logEvent:kStatDownloaderMigrationDialogue withParameters:@{kStatFrom: kStatMap}];
[controller openMigration];
- }
- else
- {
+ } else {
[Statistics logEvent:kStatDownloaderMapAction
withParameters:@{
kStatAction: kStatDownload,
@@ -400,24 +409,22 @@ using namespace storage;
[MWMStorage downloadNode:m_countryId
onSuccess:^{
[self showInQueue];
- } onCancel:nil];
+ }
+ onCancel:nil];
}
}
#pragma mark - Properties
-- (MWMCircularProgress *)progress
-{
- if (!_progress)
- {
+- (MWMCircularProgress *)progress {
+ if (!_progress) {
_progress = [MWMCircularProgress downloaderProgressForParentView:self.progressWrapper];
_progress.delegate = self;
}
return _progress;
}
-- (NSMutableArray *)skipDownloadTimes
-{
+- (NSMutableArray *)skipDownloadTimes {
if (!_skipDownloadTimes)
_skipDownloadTimes = [@[] mutableCopy];
return _skipDownloadTimes;
diff --git a/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.xib b/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.xib
index 42f58e99b7..eca25eed08 100644
--- a/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.xib
+++ b/iphone/Maps/Classes/Widgets/MWMMapDownloadDialog.xib
@@ -1,11 +1,11 @@
-
-
+
+
-
+
@@ -13,11 +13,11 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
-
+
-
-
-
+
+
+
+
+
-
@@ -187,10 +210,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
@@ -198,10 +247,7 @@
-
+
-
-
-
diff --git a/iphone/Maps/Classes/Widgets/MWMMegafonBannerViewController.h b/iphone/Maps/Classes/Widgets/MWMMegafonBannerViewController.h
new file mode 100644
index 0000000000..5afa1d6244
--- /dev/null
+++ b/iphone/Maps/Classes/Widgets/MWMMegafonBannerViewController.h
@@ -0,0 +1,9 @@
+#import "MWMDownloadBannerViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface MWMMegafonBannerViewController : MWMDownloadBannerViewController
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/iphone/Maps/Classes/Widgets/MWMMegafonBannerViewController.m b/iphone/Maps/Classes/Widgets/MWMMegafonBannerViewController.m
new file mode 100644
index 0000000000..045cfd4b38
--- /dev/null
+++ b/iphone/Maps/Classes/Widgets/MWMMegafonBannerViewController.m
@@ -0,0 +1,5 @@
+#import "MWMMegafonBannerViewController.h"
+
+@implementation MWMMegafonBannerViewController
+
+@end
diff --git a/iphone/Maps/Classes/Widgets/MWMMegafonBannerViewController.xib b/iphone/Maps/Classes/Widgets/MWMMegafonBannerViewController.xib
new file mode 100644
index 0000000000..ec91168a9b
--- /dev/null
+++ b/iphone/Maps/Classes/Widgets/MWMMegafonBannerViewController.xib
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj
index e9b7827a8a..a11a650037 100644
--- a/iphone/Maps/Maps.xcodeproj/project.pbxproj
+++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj
@@ -408,6 +408,11 @@
4788739220EE326500F6826B /* VerticallyAlignedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4788739120EE326400F6826B /* VerticallyAlignedButton.swift */; };
4797A4DC226F4B2900D3A984 /* DeepLinkHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4797A4DB226F4B2900D3A984 /* DeepLinkHandler.swift */; };
4797A4E22270997E00D3A984 /* DeepLinkHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4797A4E12270997E00D3A984 /* DeepLinkHelper.mm */; };
+ 479D305722C627CB00D18278 /* MWMMegafonBannerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 479D305522C627CB00D18278 /* MWMMegafonBannerViewController.xib */; };
+ 479D305B22C62F4000D18278 /* MWMBookmarksBannerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 479D305922C62F4000D18278 /* MWMBookmarksBannerViewController.xib */; };
+ 479D306122C6634900D18278 /* MWMMegafonBannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 479D305F22C6634900D18278 /* MWMMegafonBannerViewController.m */; };
+ 479D306522C664CE00D18278 /* MWMDownloadBannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 479D306422C664CE00D18278 /* MWMDownloadBannerViewController.m */; };
+ 479D306822C66C8F00D18278 /* MWMBookmarksBannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 479D306722C66C8F00D18278 /* MWMBookmarksBannerViewController.m */; };
479EE94A2292FB03009DEBA6 /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 479EE9492292FB03009DEBA6 /* ActivityIndicator.swift */; };
47AEF8402231249E00D20538 /* categories_brands.txt in Resources */ = {isa = PBXBuildFile; fileRef = 47AEF83F2231249E00D20538 /* categories_brands.txt */; };
47B06DED21B696C20094CCAD /* GeoTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47B06DEC21B696C20094CCAD /* GeoTracker.swift */; };
@@ -1487,6 +1492,14 @@
4797A4DB226F4B2900D3A984 /* DeepLinkHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeepLinkHandler.swift; sourceTree = ""; };
4797A4E02270997E00D3A984 /* DeepLinkHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeepLinkHelper.h; sourceTree = ""; };
4797A4E12270997E00D3A984 /* DeepLinkHelper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DeepLinkHelper.mm; sourceTree = ""; };
+ 479D305522C627CB00D18278 /* MWMMegafonBannerViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MWMMegafonBannerViewController.xib; sourceTree = ""; };
+ 479D305922C62F4000D18278 /* MWMBookmarksBannerViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MWMBookmarksBannerViewController.xib; sourceTree = ""; };
+ 479D305E22C6634900D18278 /* MWMMegafonBannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMMegafonBannerViewController.h; sourceTree = ""; };
+ 479D305F22C6634900D18278 /* MWMMegafonBannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MWMMegafonBannerViewController.m; sourceTree = ""; };
+ 479D306322C664CE00D18278 /* MWMDownloadBannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMDownloadBannerViewController.h; sourceTree = ""; };
+ 479D306422C664CE00D18278 /* MWMDownloadBannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MWMDownloadBannerViewController.m; sourceTree = ""; };
+ 479D306622C66C8F00D18278 /* MWMBookmarksBannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMBookmarksBannerViewController.h; sourceTree = ""; };
+ 479D306722C66C8F00D18278 /* MWMBookmarksBannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MWMBookmarksBannerViewController.m; sourceTree = ""; };
479EE9492292FB03009DEBA6 /* ActivityIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ActivityIndicator.swift; path = CustomViews/ActivityIndicator.swift; sourceTree = ""; };
47AEF83F2231249E00D20538 /* categories_brands.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = categories_brands.txt; path = ../../data/categories_brands.txt; sourceTree = ""; };
47B06DEC21B696C20094CCAD /* GeoTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeoTracker.swift; sourceTree = ""; };
@@ -3420,6 +3433,14 @@
3406FA171C6E0D8F00E9FAD2 /* MWMMapDownloadDialog.xib */,
3444DFCF1F17620C00E73099 /* MWMMapWidgetsHelper.h */,
3444DFD01F17620C00E73099 /* MWMMapWidgetsHelper.mm */,
+ 479D306622C66C8F00D18278 /* MWMBookmarksBannerViewController.h */,
+ 479D306722C66C8F00D18278 /* MWMBookmarksBannerViewController.m */,
+ 479D305922C62F4000D18278 /* MWMBookmarksBannerViewController.xib */,
+ 479D305E22C6634900D18278 /* MWMMegafonBannerViewController.h */,
+ 479D305F22C6634900D18278 /* MWMMegafonBannerViewController.m */,
+ 479D305522C627CB00D18278 /* MWMMegafonBannerViewController.xib */,
+ 479D306322C664CE00D18278 /* MWMDownloadBannerViewController.h */,
+ 479D306422C664CE00D18278 /* MWMDownloadBannerViewController.m */,
);
path = Widgets;
sourceTree = "";
@@ -4807,6 +4828,7 @@
3495433D1EB22D9600F08F73 /* MPAdBrowserController.xib in Resources */,
6741A9531BF340DE002C974C /* 01_dejavusans.ttf in Resources */,
6741A9541BF340DE002C974C /* 02_droidsans-fallback.ttf in Resources */,
+ 479D305B22C62F4000D18278 /* MWMBookmarksBannerViewController.xib in Resources */,
6741A9571BF340DE002C974C /* 03_jomolhari-id-a3d.ttf in Resources */,
3404F49A2028A20D0090E401 /* BMCCategoryCell.xib in Resources */,
6741A9581BF340DE002C974C /* 04_padauk.ttf in Resources */,
@@ -4924,6 +4946,7 @@
F6E2FDFB1E097BA00083EBEC /* MWMOpeningHoursAllDayTableViewCell.xib in Resources */,
342639361EA0E60A0025EB89 /* local_ads_symbols.txt in Resources */,
4554B6EC1E55F0EF0084017F /* drules_proto_vehicle_clear.bin in Resources */,
+ 479D305722C627CB00D18278 /* MWMMegafonBannerViewController.xib in Resources */,
337F98A321D37B5800C8AC27 /* SearchHistoryViewController.xib in Resources */,
F6E2FE761E097BA00083EBEC /* MWMOpeningHoursCell.xib in Resources */,
34AB66351FC5AA330078E451 /* RouteManagerCell.xib in Resources */,
@@ -5242,6 +5265,7 @@
CD6E8677226774C700D1EDF7 /* CPConstants.swift in Sources */,
474C9F632141896800369009 /* MWMEye.mm in Sources */,
F6791B141C43DF0B007A8A6E /* MWMStartButton.mm in Sources */,
+ 479D306522C664CE00D18278 /* MWMDownloadBannerViewController.m in Sources */,
33F8BA4421998BFA00ECA8EE /* MWMTagGroup.m in Sources */,
F6E2FEDF1E097BA00083EBEC /* MWMSearchManager+Layout.mm in Sources */,
F64D9CA01C899C350063FA30 /* MWMEditorViralAlert.mm in Sources */,
@@ -5313,6 +5337,7 @@
3DD1A20B22D8D93500B158F4 /* MWMPromoAfterBooking.mm in Sources */,
F6E2FD771E097BA00083EBEC /* MWMMapDownloaderDataSource.mm in Sources */,
6741A9E01BF340DE002C974C /* MWMDownloaderDialogHeader.mm in Sources */,
+ 479D306822C66C8F00D18278 /* MWMBookmarksBannerViewController.m in Sources */,
CDCA2748223FD24600167D87 /* MWMCarPlaySearchResultObject.mm in Sources */,
349D1AD81E2E325C004A2006 /* MWMBottomMenuLayout.mm in Sources */,
F6E2FEBE1E097BA00083EBEC /* MWMPPPreviewLayoutHelper.mm in Sources */,
@@ -5442,6 +5467,7 @@
3454D7C81E07F045004AF2AD /* UIButton+RuntimeAttributes.mm in Sources */,
337F98A621D37B7400C8AC27 /* SearchTabViewController.swift in Sources */,
33F8BA4A2199AA1300ECA8EE /* MWMTagGroup+Convenience.mm in Sources */,
+ 479D306122C6634900D18278 /* MWMMegafonBannerViewController.m in Sources */,
3488B0131E9D0AEC0068AFD8 /* AdBanner.swift in Sources */,
3404755F1E081A4600C92850 /* MWMLocationPredictor.mm in Sources */,
F6E2FE041E097BA00083EBEC /* MWMOpeningHoursDaysSelectorTableViewCell.mm in Sources */,