forked from organicmaps/organicmaps
[iOS] add tips'n'tricks related events, refactoring, cleanup
This commit is contained in:
parent
bc962b27d9
commit
e353183b68
13 changed files with 174 additions and 227 deletions
|
@ -107,6 +107,7 @@ final class CatalogWebViewController: WebViewController {
|
|||
if !statSent {
|
||||
Statistics.logEvent("Bookmarks_Downloaded_Catalogue_open")
|
||||
statSent = true
|
||||
MWMEye.boomarksCatalogShown()
|
||||
}
|
||||
loadingIndicator.stopAnimating()
|
||||
backButton.isEnabled = webView.canGoBack
|
||||
|
|
|
@ -76,3 +76,4 @@
|
|||
#import "WebViewController.h"
|
||||
#import "MWMCatalogCategory.h"
|
||||
#import "MWMCatalogCommon.h"
|
||||
#import "MWMEye.h"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "storage/storage_helpers.hpp"
|
||||
|
||||
#include "map/place_page_info.hpp"
|
||||
#include "metrics/eye.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -41,7 +40,7 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
@property(weak, nonatomic) MapViewController * ownerController;
|
||||
|
||||
@property(nonatomic) BOOL disableStandbyOnRouteFollowing;
|
||||
@property(nonatomic) eye::Tip::Type tutorialType;
|
||||
@property(nonatomic) MWMTip tutorialType;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -372,50 +371,56 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
#pragma mark - MWMBookingInfoHolder
|
||||
- (id<MWMBookingInfoHolder>)bookingInfoHolder { return self.placePageManager; }
|
||||
|
||||
- (MWMTutorialViewController *)tutorialWithType:(eye::Tip::Type)tutorialType {
|
||||
- (MWMTutorialViewController *)tutorialWithType:(MWMTip)tutorialType
|
||||
{
|
||||
MWMTutorialViewController * tutorial;
|
||||
switch (tutorialType) {
|
||||
case eye::Tip::Type::BookingHotels:
|
||||
tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeSearch
|
||||
target:self.menuController.searchButton
|
||||
delegate:self];
|
||||
break;
|
||||
case eye::Tip::Type::DiscoverButton:
|
||||
tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeDiscovery
|
||||
target:self.menuController.discoveryButton
|
||||
delegate:self];
|
||||
break;
|
||||
case eye::Tip::Type::BookmarksCatalog:
|
||||
tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeBookmarks
|
||||
target:self.menuController.bookmarksButton
|
||||
delegate:self];
|
||||
break;
|
||||
case eye::Tip::Type::MapsLayers:
|
||||
tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeSubway
|
||||
target:(UIControl *)self.trafficButton.view
|
||||
delegate:self];
|
||||
break;
|
||||
case eye::Tip::Type::Count:
|
||||
break;
|
||||
switch (tutorialType)
|
||||
{
|
||||
case MWMTipSearch:
|
||||
tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeSearch
|
||||
target:self.menuController.searchButton
|
||||
delegate:self];
|
||||
break;
|
||||
case MWMTipDiscovery:
|
||||
tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeDiscovery
|
||||
target:self.menuController.discoveryButton
|
||||
delegate:self];
|
||||
break;
|
||||
case MWMTipBookmarks:
|
||||
tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeBookmarks
|
||||
target:self.menuController.bookmarksButton
|
||||
delegate:self];
|
||||
break;
|
||||
case MWMTipSubway:
|
||||
tutorial = [MWMTutorialViewController tutorial:MWMTutorialTypeSubway
|
||||
target:(UIControl *)self.trafficButton.view
|
||||
delegate:self];
|
||||
break;
|
||||
case MWMTipNone:
|
||||
break;
|
||||
}
|
||||
|
||||
return tutorial;
|
||||
}
|
||||
|
||||
- (void)showTutorialIfNeeded {
|
||||
auto tutorialType = GetFramework().GetTipsApi().GetTip();
|
||||
if (!tutorialType.is_initialized()) return;
|
||||
- (void)showTutorialIfNeeded
|
||||
{
|
||||
self.tutorialType = [MWMEye getTipType];
|
||||
auto tutorial = [self tutorialWithType:self.tutorialType];
|
||||
if (!tutorial)
|
||||
return;
|
||||
|
||||
self.tutorialType = tutorialType.get();
|
||||
auto tutorial = [self tutorialWithType:tutorialType.get()];
|
||||
[self.ownerController addChildViewController:tutorial];
|
||||
tutorial.view.frame = self.ownerController.view.bounds;
|
||||
auto ownerController = self.ownerController;
|
||||
[ownerController addChildViewController:tutorial];
|
||||
tutorial.view.frame = ownerController.view.bounds;
|
||||
tutorial.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
[self.ownerController.view addSubview:tutorial.view];
|
||||
[tutorial didMoveToParentViewController:self.ownerController];
|
||||
[ownerController.view addSubview:tutorial.view];
|
||||
[tutorial didMoveToParentViewController:ownerController];
|
||||
}
|
||||
|
||||
- (void)didPressCancel:(MWMTutorialViewController *)viewController {
|
||||
eye::Eye::Event::TipShown(self.tutorialType, eye::Tip::Event::GotitClicked);
|
||||
- (void)didPressCancel:(MWMTutorialViewController *)viewController
|
||||
{
|
||||
[MWMEye tipShownWithType:self.tutorialType event:MWMTipEventGotIt];
|
||||
[viewController fadeOutWithCompletion:^{
|
||||
[viewController willMoveToParentViewController:nil];
|
||||
[viewController.view removeFromSuperview];
|
||||
|
@ -423,8 +428,9 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
}];
|
||||
}
|
||||
|
||||
- (void)didPressTarget:(MWMTutorialViewController *)viewController {
|
||||
eye::Eye::Event::TipShown(self.tutorialType, eye::Tip::Event::ActionClicked);
|
||||
- (void)didPressTarget:(MWMTutorialViewController *)viewController
|
||||
{
|
||||
[MWMEye tipShownWithType:self.tutorialType event:MWMTipEventAction];
|
||||
[viewController fadeOutWithCompletion:^{
|
||||
[viewController willMoveToParentViewController:nil];
|
||||
[viewController.view removeFromSuperview];
|
||||
|
|
|
@ -238,9 +238,6 @@ BOOL gIsFirstMyPositionMode = YES;
|
|||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
if ([MWMNavigationDashboardManager manager].state == MWMNavigationDashboardStateHidden)
|
||||
self.controlsManager.menuState = self.controlsManager.menuRestoreState;
|
||||
|
||||
[self updateStatusBarStyle];
|
||||
GetFramework().InvalidateRendering();
|
||||
[self.welcomePageController show];
|
||||
|
@ -255,6 +252,9 @@ BOOL gIsFirstMyPositionMode = YES;
|
|||
[self processMyPositionStateModeEvent:MWMMyPositionModePendingPosition];
|
||||
[MWMKeyboard addObserver:self];
|
||||
self.welcomePageController = [MWMWelcomePageController controllerWithParent:self];
|
||||
if ([MWMNavigationDashboardManager manager].state == MWMNavigationDashboardStateHidden)
|
||||
self.controlsManager.menuState = self.controlsManager.menuRestoreState;
|
||||
|
||||
if (!self.welcomePageController)
|
||||
[self.controlsManager showTutorialIfNeeded];
|
||||
|
||||
|
@ -478,7 +478,8 @@ BOOL gIsFirstMyPositionMode = YES;
|
|||
[self.navigationController setViewControllers:controllers animated:animated];
|
||||
}
|
||||
|
||||
- (void)searchText:(NSString *)text {
|
||||
- (void)searchText:(NSString *)text
|
||||
{
|
||||
[self.controlsManager searchText:text forInputLocale:[[AppInfo sharedInfo] languageId]];
|
||||
}
|
||||
|
||||
|
|
37
iphone/Maps/Core/Metrics/MWMEye.h
Normal file
37
iphone/Maps/Core/Metrics/MWMEye.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
typedef NS_ENUM(NSUInteger, MWMTip)
|
||||
{
|
||||
MWMTipBookmarks,
|
||||
MWMTipSearch,
|
||||
MWMTipDiscovery,
|
||||
MWMTipSubway,
|
||||
MWMTipNone
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MWMTipEvent)
|
||||
{
|
||||
MWMTipEventAction,
|
||||
MWMTipEventGotIt
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MWMEyeDiscoveryEvent)
|
||||
{
|
||||
MWMEyeDiscoveryEventHotels,
|
||||
MWMEyeDiscoveryEventAttractions,
|
||||
MWMEyeDiscoveryEventCafes,
|
||||
MWMEyeDiscoveryEventLocals,
|
||||
MWMEyeDiscoveryEventMoreHotels,
|
||||
MWMEyeDiscoveryEventMoreAttractions,
|
||||
MWMEyeDiscoveryEventMoreCafes,
|
||||
MWMEyeDiscoveryEventMoreLocals
|
||||
};
|
||||
|
||||
@interface MWMEye : NSObject
|
||||
|
||||
+ (MWMTip)getTipType;
|
||||
+ (void)tipShownWithType:(MWMTip)type event:(MWMTipEvent)event;
|
||||
+ (void)bookingFilterUsed;
|
||||
+ (void)boomarksCatalogShown;
|
||||
+ (void)discoveryShown;
|
||||
+ (void)discoveryItemClickedWithEvent:(MWMEyeDiscoveryEvent)event;
|
||||
|
||||
@end
|
39
iphone/Maps/Core/Metrics/MWMEye.mm
Normal file
39
iphone/Maps/Core/Metrics/MWMEye.mm
Normal file
|
@ -0,0 +1,39 @@
|
|||
#import "MWMEye.h"
|
||||
|
||||
#include "Framework.h"
|
||||
#include "metrics/eye.hpp"
|
||||
|
||||
@implementation MWMEye
|
||||
|
||||
+ (MWMTip)getTipType
|
||||
{
|
||||
auto tutorialType = GetFramework().GetTipsApi().GetTip();
|
||||
return tutorialType ? (MWMTip)*tutorialType : MWMTipNone;
|
||||
}
|
||||
|
||||
+ (void)tipShownWithType:(MWMTip)type event:(MWMTipEvent)event
|
||||
{
|
||||
eye::Eye::Event::TipShown((eye::Tip::Type)type, (eye::Tip::Event)event);
|
||||
}
|
||||
|
||||
+ (void)bookingFilterUsed
|
||||
{
|
||||
eye::Eye::Event::BookingFilterUsed();
|
||||
}
|
||||
|
||||
+ (void)boomarksCatalogShown
|
||||
{
|
||||
eye::Eye::Event::BoomarksCatalogShown();
|
||||
}
|
||||
|
||||
+ (void)discoveryShown
|
||||
{
|
||||
eye::Eye::Event::DiscoveryShown();
|
||||
}
|
||||
|
||||
+ (void)discoveryItemClickedWithEvent:(MWMEyeDiscoveryEvent)event
|
||||
{
|
||||
eye::Eye::Event::DiscoveryItemClicked((eye::Discovery::Event)event);
|
||||
}
|
||||
|
||||
@end
|
|
@ -348,8 +348,7 @@
|
|||
470A89FF2134517600D72FBF /* BookmarksTutorialBlur.xib in Resources */ = {isa = PBXBuildFile; fileRef = 470A89FE2134517600D72FBF /* BookmarksTutorialBlur.xib */; };
|
||||
470A8A012136097000D72FBF /* SubwayTutorialBlur.xib in Resources */ = {isa = PBXBuildFile; fileRef = 470A8A002136073000D72FBF /* SubwayTutorialBlur.xib */; };
|
||||
471BBD942130390F00EB17C9 /* TutorialViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471BBD932130390F00EB17C9 /* TutorialViewController.swift */; };
|
||||
471BBD962130392E00EB17C9 /* TutorialView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 471BBD952130392E00EB17C9 /* TutorialView.swift */; };
|
||||
471BBD9821303A5200EB17C9 /* BookmarksTutorial.xib in Resources */ = {isa = PBXBuildFile; fileRef = 471BBD9721303A5200EB17C9 /* BookmarksTutorial.xib */; };
|
||||
474C9F632141896800369009 /* MWMEye.mm in Sources */ = {isa = PBXBuildFile; fileRef = 474C9F622141896800369009 /* MWMEye.mm */; };
|
||||
4767CD9F20AAD48A00BD8166 /* Checkmark.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4767CD9E20AAD48A00BD8166 /* Checkmark.swift */; };
|
||||
4767CDA420AAF66B00BD8166 /* NSAttributedString+HTML.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4767CDA320AAF66B00BD8166 /* NSAttributedString+HTML.swift */; };
|
||||
4767CDA620AB1F6200BD8166 /* LeftAlignedIconButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4767CDA520AB1F6200BD8166 /* LeftAlignedIconButton.swift */; };
|
||||
|
@ -1318,8 +1317,8 @@
|
|||
470A89FE2134517600D72FBF /* BookmarksTutorialBlur.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BookmarksTutorialBlur.xib; sourceTree = "<group>"; };
|
||||
470A8A002136073000D72FBF /* SubwayTutorialBlur.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SubwayTutorialBlur.xib; sourceTree = "<group>"; };
|
||||
471BBD932130390F00EB17C9 /* TutorialViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TutorialViewController.swift; sourceTree = "<group>"; };
|
||||
471BBD952130392E00EB17C9 /* TutorialView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TutorialView.swift; sourceTree = "<group>"; };
|
||||
471BBD9721303A5200EB17C9 /* BookmarksTutorial.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BookmarksTutorial.xib; sourceTree = "<group>"; };
|
||||
474C9F612141896800369009 /* MWMEye.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMEye.h; sourceTree = "<group>"; };
|
||||
474C9F622141896800369009 /* MWMEye.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMEye.mm; sourceTree = "<group>"; };
|
||||
4767CD9E20AAD48A00BD8166 /* Checkmark.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Checkmark.swift; sourceTree = "<group>"; };
|
||||
4767CDA320AAF66B00BD8166 /* NSAttributedString+HTML.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+HTML.swift"; sourceTree = "<group>"; };
|
||||
4767CDA520AB1F6200BD8166 /* LeftAlignedIconButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftAlignedIconButton.swift; sourceTree = "<group>"; };
|
||||
|
@ -2184,6 +2183,7 @@
|
|||
340475281E081A4600C92850 /* Core */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
474C9F602141894300369009 /* Metrics */,
|
||||
3472B5E7200F8CEB00DC6CD5 /* UGC */,
|
||||
3472B5DD200F868E00DC6CD5 /* Editor */,
|
||||
3472B5C8200F436700DC6CD5 /* BackgroundFetchScheduler */,
|
||||
|
@ -3151,8 +3151,6 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
471BBD932130390F00EB17C9 /* TutorialViewController.swift */,
|
||||
471BBD952130392E00EB17C9 /* TutorialView.swift */,
|
||||
471BBD9721303A5200EB17C9 /* BookmarksTutorial.xib */,
|
||||
470A89FC21342A9D00D72FBF /* TutorialBlurView.swift */,
|
||||
47B505522136AB41009CBB55 /* DiscoveryTutorialBlur.xib */,
|
||||
47B505532136AD69009CBB55 /* SearchTutorialBlur.xib */,
|
||||
|
@ -3171,6 +3169,15 @@
|
|||
path = Layers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
474C9F602141894300369009 /* Metrics */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
474C9F612141896800369009 /* MWMEye.h */,
|
||||
474C9F622141896800369009 /* MWMEye.mm */,
|
||||
);
|
||||
path = Metrics;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
47E3C7232111E2F8008B3B27 /* Modal */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -4442,7 +4449,6 @@
|
|||
34AB665C1FC5AA330078E451 /* TransportTransitIntermediatePoint.xib in Resources */,
|
||||
F6E2FF151E097BA00083EBEC /* MWMSearchHistoryRequestCell.xib in Resources */,
|
||||
F6E2FEE81E097BA00083EBEC /* MWMSearchNoResults.xib in Resources */,
|
||||
471BBD9821303A5200EB17C9 /* BookmarksTutorial.xib in Resources */,
|
||||
346225921DDC5FBA001E8752 /* MWMSearchNoResultsAlert.xib in Resources */,
|
||||
34AB660E1FC5AA320078E451 /* NavigationControlView.xib in Resources */,
|
||||
408645FC21495EB1000A4A1D /* categories_cuisines.txt in Resources */,
|
||||
|
@ -4670,6 +4676,7 @@
|
|||
B33D21AC20DA515800BAD749 /* MWMCategoryInfoCell.mm in Sources */,
|
||||
47E3C72D2111E6A2008B3B27 /* AlertTransitioning.swift in Sources */,
|
||||
34845DAF1E1649F6003D55B9 /* DownloaderNoResultsEmbedViewController.swift in Sources */,
|
||||
474C9F632141896800369009 /* MWMEye.mm in Sources */,
|
||||
F6791B141C43DF0B007A8A6E /* MWMStartButton.mm in Sources */,
|
||||
F6E2FEDF1E097BA00083EBEC /* MWMSearchManager+Layout.mm in Sources */,
|
||||
F64D9CA01C899C350063FA30 /* MWMEditorViralAlert.mm in Sources */,
|
||||
|
@ -4679,7 +4686,6 @@
|
|||
F6E2FDA11E097BA00083EBEC /* MWMEditorAdditionalNamesTableViewController.mm in Sources */,
|
||||
4767CDA620AB1F6200BD8166 /* LeftAlignedIconButton.swift in Sources */,
|
||||
3454D7D41E07F045004AF2AD /* UIImageView+Coloring.mm in Sources */,
|
||||
471BBD962130392E00EB17C9 /* TutorialView.swift in Sources */,
|
||||
3463BA671DE81DB90082417F /* MWMTrafficButtonViewController.mm in Sources */,
|
||||
F6E2FE551E097BA00083EBEC /* MWMPlacePageActionBar.mm in Sources */,
|
||||
34AB66051FC5AA320078E451 /* MWMNavigationDashboardManager+Entity.mm in Sources */,
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MWMTutorialViewController">
|
||||
<connections>
|
||||
<outlet property="view" destination="NKX-HM-ocV" id="48y-M2-AOX"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="NKX-HM-ocV" customClass="MWMTutorialView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bkE-Vd-KIG">
|
||||
<rect key="frame" x="40" y="521" width="88" height="36"/>
|
||||
<color key="backgroundColor" white="1" alpha="0.20344606160000001" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="88" id="Ddj-kC-2wc"/>
|
||||
<constraint firstAttribute="height" constant="36" id="sef-4X-cWo"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
|
||||
<state key="normal" title="Понятно"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="white"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="statusBarBackground"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="6"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="clipsToBounds" value="YES"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="onCancel:" destination="-1" eventType="touchUpInside" id="3Xc-3F-kxH"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Скачайте и постройте туристические маршруты по интересным местам в разных городах мира." textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gYC-Tz-PO0">
|
||||
<rect key="frame" x="40" y="446.5" width="295" height="50.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" white="1" alpha="0.70269691779999999" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="whiteSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Сложно придумать маршрут по интересным местам?" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="no2-Lc-0nV">
|
||||
<rect key="frame" x="40" y="386.5" width="295" height="48"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="white"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.71642230308219179" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="gYC-Tz-PO0" firstAttribute="top" secondItem="no2-Lc-0nV" secondAttribute="bottom" constant="12" id="3SP-oS-yEe"/>
|
||||
<constraint firstItem="no2-Lc-0nV" firstAttribute="leading" secondItem="q48-yh-Kzh" secondAttribute="leading" constant="40" id="BOH-qV-bgP"/>
|
||||
<constraint firstItem="q48-yh-Kzh" firstAttribute="bottom" secondItem="bkE-Vd-KIG" secondAttribute="bottom" constant="110" id="Blv-HC-beZ"/>
|
||||
<constraint firstItem="bkE-Vd-KIG" firstAttribute="top" secondItem="gYC-Tz-PO0" secondAttribute="bottom" constant="24" id="Nbo-Bu-LKI"/>
|
||||
<constraint firstItem="q48-yh-Kzh" firstAttribute="trailing" secondItem="no2-Lc-0nV" secondAttribute="trailing" constant="40" id="RHv-P3-l9R"/>
|
||||
<constraint firstItem="bkE-Vd-KIG" firstAttribute="leading" secondItem="q48-yh-Kzh" secondAttribute="leading" constant="40" id="RO0-Lt-gQl"/>
|
||||
<constraint firstItem="q48-yh-Kzh" firstAttribute="trailing" secondItem="gYC-Tz-PO0" secondAttribute="trailing" constant="40" id="s2w-rU-OfI"/>
|
||||
<constraint firstItem="gYC-Tz-PO0" firstAttribute="leading" secondItem="q48-yh-Kzh" secondAttribute="leading" constant="40" id="vUK-2o-Gd2"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="q48-yh-Kzh"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="blackPrimaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
|
@ -1,5 +1,5 @@
|
|||
@objc(MWMTutorialBlurView)
|
||||
class TutorialBlurView: UIVisualEffectView, ITutorialView {
|
||||
class TutorialBlurView: UIVisualEffectView {
|
||||
var targetView: UIView?
|
||||
private var maskPath: UIBezierPath?
|
||||
private var maskLayer = CAShapeLayer()
|
||||
|
@ -24,7 +24,10 @@ class TutorialBlurView: UIVisualEffectView, ITutorialView {
|
|||
}
|
||||
|
||||
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
return maskPath?.contains(point) ?? super.point(inside: point, with: event)
|
||||
guard let pointInView = targetView?.bounds.contains(convert(point, to: targetView)) else {
|
||||
return super.point(inside: point, with: event)
|
||||
}
|
||||
return !pointInView
|
||||
}
|
||||
|
||||
override func didMoveToSuperview() {
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
protocol ITutorialView: AnyObject {
|
||||
var targetView: UIView? { get set }
|
||||
func animateSizeChange(_ duration: TimeInterval)
|
||||
func animateAppearance(_ duration: TimeInterval)
|
||||
func animateFadeOut(_ duration: TimeInterval, completion: @escaping () -> Void)
|
||||
}
|
||||
|
||||
@objc(MWMTutorialView)
|
||||
class TutorialView: UIView, ITutorialView {
|
||||
func animateFadeOut(_ duration: TimeInterval, completion: @escaping () -> Void) {
|
||||
|
||||
}
|
||||
|
||||
func animateAppearance(_ duration: TimeInterval) {
|
||||
|
||||
}
|
||||
|
||||
var targetView: UIView?
|
||||
var maskPath: UIBezierPath?
|
||||
var maskLayer: CAShapeLayer!
|
||||
let layoutView = UIView()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
setup()
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
setup()
|
||||
}
|
||||
|
||||
private func setup() {
|
||||
maskLayer = CAShapeLayer()
|
||||
maskLayer.fillRule = kCAFillRuleEvenOdd
|
||||
layer.mask = maskLayer
|
||||
layoutView.translatesAutoresizingMaskIntoConstraints = false
|
||||
layoutView.isUserInteractionEnabled = false
|
||||
layoutView.alpha = 0
|
||||
addSubview(layoutView)
|
||||
}
|
||||
|
||||
override func didMoveToSuperview() {
|
||||
super.didMoveToSuperview()
|
||||
if (superview != nil) {
|
||||
targetView?.centerXAnchor.constraint(equalTo: layoutView.centerXAnchor).isActive = true
|
||||
targetView?.centerYAnchor.constraint(equalTo: layoutView.centerYAnchor).isActive = true
|
||||
// targetView?.leftAnchor.constraint(equalTo: layoutView.leftAnchor).isActive = true
|
||||
// targetView?.leftAnchor.constraint(equalTo: layoutView.leftAnchor).isActive = true
|
||||
}
|
||||
}
|
||||
|
||||
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
|
||||
return maskPath?.contains(point) ?? super.point(inside: point, with: event)
|
||||
}
|
||||
|
||||
private var animate = false
|
||||
private var ad: TimeInterval = 0
|
||||
|
||||
func animateSizeChange(_ duration: TimeInterval) {
|
||||
animate = true
|
||||
ad = duration
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
// guard let point = targetView?.center else { return }
|
||||
// let targetCenter = convert(point, from: targetView?.superview)
|
||||
let targetCenter = layoutView.center
|
||||
let r: CGFloat = 40
|
||||
let targetRect = CGRect(x: targetCenter.x - r, y: targetCenter.y - r, width: r * 2, height: r * 2)
|
||||
maskPath = UIBezierPath(rect: bounds)
|
||||
maskPath!.append(UIBezierPath(ovalIn: targetRect))
|
||||
maskPath!.usesEvenOddFillRule = true
|
||||
|
||||
if (animate) {
|
||||
animatePathChange(for: maskLayer, fromPath: maskLayer.path)
|
||||
animate = false
|
||||
}
|
||||
|
||||
maskLayer.path = maskPath!.cgPath
|
||||
}
|
||||
|
||||
private func animatePathChange(for layer: CAShapeLayer, fromPath: CGPath?) {
|
||||
let animation = CABasicAnimation(keyPath: "path")
|
||||
animation.duration = ad
|
||||
animation.fromValue = fromPath
|
||||
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
|
||||
layer.add(animation, forKey: "path")
|
||||
}
|
||||
}
|
|
@ -25,8 +25,8 @@ class TutorialViewController: UIViewController {
|
|||
weak var delegate: TutorialViewControllerDelegate?
|
||||
private var targetViewActions: [TargetAction] = []
|
||||
|
||||
var tutorialView: ITutorialView {
|
||||
return view as! ITutorialView
|
||||
var tutorialView: TutorialBlurView {
|
||||
return view as! TutorialBlurView
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#import "Framework.h"
|
||||
#import "MWMDiscoveryTableManager.h"
|
||||
#import "MWMDiscoveryTapDelegate.h"
|
||||
#import "MWMEye.h"
|
||||
#import "MWMMapViewControlsManager.h"
|
||||
#import "MWMRoutePoint+CPP.h"
|
||||
#import "MWMRouter.h"
|
||||
|
@ -138,6 +139,7 @@ struct Callback
|
|||
[self](uint32_t const requestId, ItemType const type) {
|
||||
[self.tableManager errorAtItem:type];
|
||||
});
|
||||
[MWMEye discoveryShown];
|
||||
}
|
||||
|
||||
#pragma mark - MWMDiscoveryTapDelegate
|
||||
|
@ -152,38 +154,55 @@ struct Callback
|
|||
{
|
||||
NSString * dest = @"";
|
||||
NSString * event = kStatPlacepageSponsoredItemSelected;
|
||||
MWMEyeDiscoveryEvent eyeEvent;
|
||||
switch (type)
|
||||
{
|
||||
case ItemType::Viator:
|
||||
[self openUrl:[NSURL URLWithString:@(m_model.GetViatorAt(index).m_pageUrl.c_str())]];
|
||||
dest = kStatExternal;
|
||||
CHECK(false, ("Not reachable"));
|
||||
return;
|
||||
break;
|
||||
case ItemType::LocalExperts:
|
||||
if (index == m_model.GetItemsCount(type))
|
||||
{
|
||||
[self openURLForItem:type];
|
||||
event = kStatPlacepageSponsoredMoreSelected;
|
||||
eyeEvent = MWMEyeDiscoveryEventMoreLocals;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self openUrl:[NSURL URLWithString:@(m_model.GetExpertAt(index).m_pageUrl.c_str())]];
|
||||
eyeEvent = MWMEyeDiscoveryEventLocals;
|
||||
}
|
||||
dest = kStatExternal;
|
||||
break;
|
||||
case ItemType::Attractions:
|
||||
if (index == m_model.GetItemsCount(type))
|
||||
{
|
||||
[self searchTourism];
|
||||
eyeEvent = MWMEyeDiscoveryEventMoreAttractions;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self showSearchResult:m_model.GetAttractionAt(index)];
|
||||
eyeEvent = MWMEyeDiscoveryEventAttractions;
|
||||
}
|
||||
|
||||
dest = kStatPlacePage;
|
||||
break;
|
||||
case ItemType::Cafes:
|
||||
if (index == m_model.GetItemsCount(type))
|
||||
{
|
||||
[self searchFood];
|
||||
eyeEvent = MWMEyeDiscoveryEventMoreCafes;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self showSearchResult:m_model.GetCafeAt(index)];
|
||||
|
||||
eyeEvent = MWMEyeDiscoveryEventCafes;
|
||||
}
|
||||
|
||||
dest = kStatPlacePage;
|
||||
break;
|
||||
case ItemType::Hotels:
|
||||
|
@ -192,11 +211,13 @@ struct Callback
|
|||
[self openFilters];
|
||||
event = kStatPlacepageSponsoredMoreSelected;
|
||||
dest = kStatSearchFilterOpen;
|
||||
eyeEvent = MWMEyeDiscoveryEventMoreHotels;
|
||||
}
|
||||
else
|
||||
{
|
||||
[self showSearchResult:m_model.GetHotelAt(index)];
|
||||
dest = kStatPlacePage;
|
||||
eyeEvent = MWMEyeDiscoveryEventHotels;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -209,6 +230,7 @@ struct Callback
|
|||
kStatItem: @(index + 1),
|
||||
kStatDestination: dest
|
||||
}];
|
||||
[MWMEye discoveryItemClickedWithEvent:eyeEvent];
|
||||
}
|
||||
|
||||
- (void)openFilters
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#import "MWMSearchHotelsFilterViewController.h"
|
||||
#import <CoreActionSheetPicker/ActionSheetPicker.h>
|
||||
#import "MWMEye.h"
|
||||
#import "MWMSearch.h"
|
||||
#import "MWMSearchFilterViewController_Protected.h"
|
||||
#import "Statistics.h"
|
||||
|
@ -233,6 +234,7 @@ void configButton(UIButton * button, NSString * primaryText, NSString * secondar
|
|||
- (IBAction)applyAction
|
||||
{
|
||||
[Statistics logEvent:kStatSearchFilterApply withParameters:@{kStatCategory: kStatHotel}];
|
||||
[MWMEye bookingFilterUsed];
|
||||
[MWMSearch update];
|
||||
[self dismissViewControllerAnimated:YES completion:self.onFinishCallback];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue