[ios] Added more button to local experts && added lat lon to local experts url

This commit is contained in:
VladiMihaylenko 2018-04-23 18:59:03 +03:00 committed by Aleksandr Zatsepin
parent 0b71876515
commit bed91e9d0c
5 changed files with 67 additions and 34 deletions

View file

@ -24,6 +24,7 @@ final class DiscoveryLocalExpertCollectionHolderCell: DiscoveryCollectionHolder
@objc func config() {
header.text = L("discovery_button_subtitle_local_guides").uppercased()
collectionView.register(cellClass: DiscoveryLocalExpertCell.self)
collectionView.register(cellClass: DiscoveryMoreCell.self)
}
}

View file

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" 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="13772"/>
<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>
@ -19,39 +19,49 @@
<rect key="frame" x="0.0" y="0.0" width="160" height="138"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S1v-vC-wOE">
<rect key="frame" x="0.0" y="97" width="160" height="20.5"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Iic-WY-mjk">
<rect key="frame" x="0.0" y="27" width="160" height="84"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="SoX-YY-fuz">
<rect key="frame" x="52" y="0.0" width="56" height="56"/>
<constraints>
<constraint firstAttribute="width" constant="56" id="2GW-YQ-wcF"/>
<constraint firstAttribute="height" constant="56" id="aJg-fF-VSP"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="mwm_name" value="btn_float_more"/>
<userDefinedRuntimeAttribute type="string" keyPath="coloring" value="MWMOther"/>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S1v-vC-wOE">
<rect key="frame" x="0.0" y="64" width="160" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="placepage_more_button"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium14"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="linkBlue"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="20.5" id="zYP-Q5-QIY"/>
<constraint firstItem="SoX-YY-fuz" firstAttribute="centerX" secondItem="Iic-WY-mjk" secondAttribute="centerX" id="0nF-Zt-2P0"/>
<constraint firstItem="S1v-vC-wOE" firstAttribute="top" secondItem="SoX-YY-fuz" secondAttribute="bottom" constant="8" id="aPO-OD-6gR"/>
<constraint firstItem="S1v-vC-wOE" firstAttribute="leading" secondItem="Iic-WY-mjk" secondAttribute="leading" id="enE-aE-jmQ"/>
<constraint firstAttribute="trailing" secondItem="S1v-vC-wOE" secondAttribute="trailing" id="ikx-qj-T1l"/>
<constraint firstAttribute="height" constant="84" id="mn6-pO-XLu"/>
<constraint firstAttribute="bottom" secondItem="S1v-vC-wOE" secondAttribute="bottom" id="qsg-3t-57E"/>
<constraint firstItem="SoX-YY-fuz" firstAttribute="top" secondItem="Iic-WY-mjk" secondAttribute="top" id="r4R-JE-2oH"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="placepage_more_button"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium14"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="linkBlue"/>
</userDefinedRuntimeAttributes>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="SoX-YY-fuz">
<rect key="frame" x="52" y="33" width="56" height="56"/>
<constraints>
<constraint firstAttribute="width" constant="56" id="fVZ-rg-GIZ"/>
<constraint firstAttribute="height" constant="56" id="w3v-o8-VyI"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="mwm_name" value="btn_float_more"/>
<userDefinedRuntimeAttribute type="string" keyPath="coloring" value="MWMOther"/>
</userDefinedRuntimeAttributes>
</imageView>
</view>
</subviews>
</view>
<constraints>
<constraint firstItem="S1v-vC-wOE" firstAttribute="top" secondItem="SoX-YY-fuz" secondAttribute="bottom" constant="8" id="4i8-k5-kHt"/>
<constraint firstAttribute="trailing" secondItem="S1v-vC-wOE" secondAttribute="trailing" id="AdW-u1-cwj"/>
<constraint firstItem="SoX-YY-fuz" firstAttribute="centerX" secondItem="3BH-nt-huS" secondAttribute="centerX" id="E2n-ue-xxt"/>
<constraint firstItem="S1v-vC-wOE" firstAttribute="leading" secondItem="lQ9-Eh-5bK" secondAttribute="leading" id="xdL-Uf-e7n"/>
<constraint firstItem="SoX-YY-fuz" firstAttribute="top" secondItem="lQ9-Eh-5bK" secondAttribute="top" constant="33" id="ych-jM-rdc"/>
<constraint firstItem="Iic-WY-mjk" firstAttribute="centerY" secondItem="3BH-nt-huS" secondAttribute="centerY" id="Cyu-Tf-n9d"/>
<constraint firstItem="Iic-WY-mjk" firstAttribute="centerX" secondItem="3BH-nt-huS" secondAttribute="centerX" id="dn7-v7-zcq"/>
<constraint firstItem="Iic-WY-mjk" firstAttribute="width" secondItem="lQ9-Eh-5bK" secondAttribute="width" id="kVT-jQ-x0R"/>
</constraints>
<viewLayoutGuide key="safeArea" id="3BH-nt-huS"/>
<userDefinedRuntimeAttributes>

View file

@ -156,7 +156,15 @@ struct Callback
dest = kStatExternal;
break;
case ItemType::LocalExperts:
[self openUrl:[NSURL URLWithString:@(m_model.GetExpertAt(index).m_pageUrl.c_str())]];
if (index == m_model.GetItemsCount(type))
{
[self openURLForItem:type];
event = kStatPlacepageSponsoredMoreSelected;
}
else
{
[self openUrl:[NSURL URLWithString:@(m_model.GetExpertAt(index).m_pageUrl.c_str())]];
}
dest = kStatExternal;
break;
case ItemType::Attractions:

View file

@ -342,7 +342,8 @@ string GetDistance(m2::PointD const & from, m2::PointD const & to)
numberOfItemsInSection:(NSInteger)section
{
auto const count = self.model().GetItemsCount(collectionView.itemType);
if (collectionView.itemType == ItemType::Hotels)
auto type = collectionView.itemType;
if (type == ItemType::Hotels || type == ItemType::LocalExperts)
return count > 0 ? count + 1 : 0;
return count;
@ -399,6 +400,15 @@ string GetDistance(m2::PointD const & from, m2::PointD const & to)
}
case ItemType::LocalExperts:
{
if (indexPath.row == model.GetItemsCount(type))
{
Class cls = [MWMDiscoveryMoreCell class];
auto cell = static_cast<MWMDiscoveryMoreCell *>([collectionView
dequeueReusableCellWithCellClass:cls
indexPath:indexPath]);
return cell;
}
Class cls = [MWMDiscoveryLocalExpertCell class];
auto cell = static_cast<MWMDiscoveryLocalExpertCell *>(
[collectionView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);

View file

@ -1,5 +1,7 @@
#include "map/discovery/discovery_manager.hpp"
#include <sstream>
namespace
{
std::string GetQuery(discovery::ItemType const type)
@ -50,8 +52,10 @@ std::string Manager::GetViatorUrl(m2::PointD const & point) const
std::string Manager::GetLocalExpertsUrl(m2::PointD const & point) const
{
UNUSED_VALUE(point);
return locals::Api::GetLocalsPageUrl();
ms::LatLon const ll(MercatorBounds::ToLatLon(point));
std::ostringstream os;
os << locals::Api::GetLocalsPageUrl() << "?lat=" << ll.lat << "&lon=" << ll.lon;
return os.str();
}
std::string Manager::GetCityViatorId(m2::PointD const & point) const