[ios] local/traveler screen

This commit is contained in:
o.bolovintseva 2018-11-16 21:12:20 +03:00 committed by Aleksey Belousov
parent 8d8578cb70
commit e6cd7324bf
5 changed files with 185 additions and 9 deletions

View file

@ -240,7 +240,7 @@
<outlet property="getDirectLinkCell" destination="90b-ef-VUJ" id="L7h-0r-eSe"/>
<outlet property="licenseAgreementTextView" destination="dsV-Vs-oCo" id="TtB-Uw-WGR"/>
<outlet property="uploadAndPublishCell" destination="YW0-jq-Isw" id="84h-vp-JdM"/>
<segue destination="xf5-2c-0zi" kind="show" identifier="chooseTags" id="up0-G8-BIG"/>
<segue destination="fDN-IN-IEc" kind="show" identifier="chooseProperties" id="I88-nm-PsT"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ylv-YU-ujs" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -251,7 +251,7 @@
<!--Sharing Tags View Controller-->
<scene sceneID="fwI-5y-8lb">
<objects>
<viewController id="xf5-2c-0zi" customClass="SharingTagsViewController" customModule="maps_me" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="tags" id="xf5-2c-0zi" customClass="SharingTagsViewController" customModule="maps_me" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="2YU-O5-UMg">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@ -444,7 +444,114 @@
</connections>
</barButtonItem>
</objects>
<point key="canvasLocation" x="607" y="-27"/>
<point key="canvasLocation" x="1534" y="-27"/>
</scene>
<!--Sharing Properties View Controller-->
<scene sceneID="zug-ko-B9e">
<objects>
<tableViewController storyboardIdentifier="chooseTags" id="fDN-IN-IEc" customClass="SharingPropertiesViewController" customModule="maps_me" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="ibV-nf-9aS">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<sections>
<tableViewSection headerTitle="LOCAL OR TRAVELLER" id="M1K-Vf-5wl">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" rowHeight="115" id="BxX-r9-FhR">
<rect key="frame" x="0.0" y="55.5" width="375" height="115"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="BxX-r9-FhR" id="2z2-uI-iUF">
<rect key="frame" x="0.0" y="0.0" width="375" height="114.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" text="You have visited places in this guide as" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RD2-dA-33d">
<rect key="frame" x="0.0" y="16" width="375" height="19.5"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular16"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="custom_props_desc"/>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4Aq-yf-HLJ" customClass="MWMButton">
<rect key="frame" x="16" y="66.5" width="161.5" height="32"/>
<color key="backgroundColor" red="0.11764705882352941" green="0.58823529411764708" blue="0.94117647058823528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="32" id="qqI-Vk-fJA"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/>
<state key="normal" title="LOCAL">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="bold14"/>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundHighlightedColorName" value="linkBlueHighlighted"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="6"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="string" keyPath="tintColorName" value="white"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="localButtonWasPressed:" destination="fDN-IN-IEc" eventType="touchUpInside" id="eY9-Ds-2Yj"/>
</connections>
</button>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="D7h-er-9Kx" customClass="MWMButton">
<rect key="frame" x="197.5" y="66.5" width="161.5" height="32"/>
<color key="backgroundColor" red="0.11764705882352941" green="0.58823529411764708" blue="0.94117647058823528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="32" id="nKF-9s-YhE"/>
<constraint firstAttribute="height" constant="32" id="rC4-He-W4d"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/>
<state key="normal" title="TRAVELER">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="bold14"/>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundHighlightedColorName" value="linkBlueHighlighted"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="6"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="string" keyPath="tintColorName" value="white"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="travelerButtonPressed:" destination="fDN-IN-IEc" eventType="touchUpInside" id="GcO-Mh-UZT"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="D7h-er-9Kx" firstAttribute="leading" secondItem="4Aq-yf-HLJ" secondAttribute="trailing" constant="20" id="8ys-06-LkB"/>
<constraint firstAttribute="trailing" secondItem="D7h-er-9Kx" secondAttribute="trailing" constant="16" id="BMq-ox-1qi"/>
<constraint firstItem="RD2-dA-33d" firstAttribute="leading" secondItem="2z2-uI-iUF" secondAttribute="leading" id="McD-Kk-xcf"/>
<constraint firstItem="RD2-dA-33d" firstAttribute="top" secondItem="2z2-uI-iUF" secondAttribute="top" constant="16" id="S5t-1W-Nyy"/>
<constraint firstItem="D7h-er-9Kx" firstAttribute="width" secondItem="4Aq-yf-HLJ" secondAttribute="width" id="inZ-7F-w2d"/>
<constraint firstAttribute="trailing" secondItem="RD2-dA-33d" secondAttribute="trailing" id="jTo-Jl-WHC"/>
<constraint firstItem="4Aq-yf-HLJ" firstAttribute="leading" secondItem="2z2-uI-iUF" secondAttribute="leading" constant="16" id="k2s-WP-pgR"/>
<constraint firstAttribute="bottom" secondItem="4Aq-yf-HLJ" secondAttribute="bottom" constant="16" id="kwq-HJ-VlI"/>
<constraint firstAttribute="bottom" secondItem="D7h-er-9Kx" secondAttribute="bottom" constant="16" id="t3c-76-Wzi"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="fDN-IN-IEc" id="BZY-UX-7N1"/>
<outlet property="delegate" destination="fDN-IN-IEc" id="fEa-Wx-EL2"/>
</connections>
</tableView>
<connections>
<outlet property="localButton" destination="4Aq-yf-HLJ" id="1Mf-1y-gyv"/>
<outlet property="travelerButton" destination="D7h-er-9Kx" id="16g-nm-YdV"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="WLW-hZ-FOD" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="640.79999999999995" y="-27.436281859070466"/>
</scene>
</scenes>
<resources>

View file

@ -14,7 +14,8 @@ final class BookmarksSharingViewController: MWMTableViewController {
@IBOutlet weak var uploadAndPublishCell: UploadActionCell!
@IBOutlet weak var getDirectLinkCell: UploadActionCell!
let kTagsSegueIdentifier = "chooseTags"
let kPropertiesSegueIdentifier = "chooseProperties"
let kTagsControllerIdentifier = "tags"
@IBOutlet private weak var licenseAgreementTextView: UITextView! {
didSet {
@ -83,13 +84,13 @@ final class BookmarksSharingViewController: MWMTableViewController {
func uploadAndPublish() {
performAfterValidation { [weak self] in
self?.performSegue(withIdentifier: "chooseTags", sender: self)
self?.performSegue(withIdentifier: "chooseProperties", sender: self)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == kTagsSegueIdentifier {
if let vc = segue.destination as? SharingTagsViewController {
if segue.identifier == kPropertiesSegueIdentifier {
if let vc = segue.destination as? SharingPropertiesViewController {
vc.delegate = self
}
}
@ -151,10 +152,31 @@ extension BookmarksSharingViewController: UploadActionCellDelegate {
extension BookmarksSharingViewController: SharingTagsViewControllerDelegate {
func sharingTagsViewController(_ viewController: SharingTagsViewController, didSelect tags: [MWMTag]) {
navigationController?.popViewController(animated: true)
//proceed with selected tags
// TODO: proceed with selected tags
}
func sharingTagsViewControllerDidCancel(_ viewController: SharingTagsViewController) {
navigationController?.popViewController(animated: true)
}
}
extension BookmarksSharingViewController: SharingPropertiesViewControllerDelegate {
func sharingPropertiesViewController(_ viewController: SharingPropertiesViewController,
didSelect userStatus: SharingPropertyUserStatus) {
// TODO: proceed with chosen user status
let storyboard = UIStoryboard.instance(.sharing)
let tagsController = storyboard.instantiateViewController(withIdentifier: kTagsControllerIdentifier)
as! SharingTagsViewController
tagsController.delegate = self
guard var viewControllers = navigationController?.viewControllers else {
assert(false)
return
}
viewControllers.removeLast()
viewControllers.append(tagsController)
navigationController?.setViewControllers(viewControllers, animated: true)
}
}

View file

@ -0,0 +1,44 @@
enum SharingPropertyUserStatus {
case local
case traveler
}
protocol SharingPropertiesViewControllerDelegate: AnyObject {
func sharingPropertiesViewController(_ viewController: SharingPropertiesViewController,
didSelect userStatus: SharingPropertyUserStatus)
}
final class SharingPropertiesViewController: MWMTableViewController {
weak var delegate: SharingPropertiesViewControllerDelegate?
@IBOutlet weak var localButton: MWMButton! {
didSet {
localButton.setTitle(L("custom_props_local").uppercased(), for: .normal)
}
}
@IBOutlet weak var travelerButton: MWMButton! {
didSet {
travelerButton.setTitle(L("custom_props_traveler").uppercased(), for: .normal)
}
}
override func viewDidLoad() {
super.viewDidLoad()
title = L("select_properties")
}
override func tableView(_ tableView: UITableView,
titleForHeaderInSection section: Int) -> String? {
return section == 0 ? L("custom_props_title") : nil
}
@IBAction func localButtonWasPressed(_ sender: Any) {
delegate?.sharingPropertiesViewController(self, didSelect: .local)
}
@IBAction func travelerButtonPressed(_ sender: Any) {
delegate?.sharingPropertiesViewController(self, didSelect: .traveler)
}
}

View file

@ -2,7 +2,6 @@ final class TagsCollectionViewLayout: UICollectionViewLayout {
private var headersCache: [IndexPath : UICollectionViewLayoutAttributes] = [:]
private var cellsCache: [IndexPath : UICollectionViewLayoutAttributes] = [:]
fileprivate var contentHeight: CGFloat = 0
fileprivate var contentWidth: CGFloat {

View file

@ -13,6 +13,7 @@
33046836219C5A4E0041F3A8 /* CategorySettings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 33046835219C5A4E0041F3A8 /* CategorySettings.storyboard */; };
331630D12191D74B00BB91A9 /* TagSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331630D02191D74B00BB91A9 /* TagSectionHeaderView.swift */; };
3358607E217632A2006D11F2 /* BookmarksSharingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3358607D217632A2006D11F2 /* BookmarksSharingViewController.swift */; };
33603C85219F0F6300B11FFE /* SharingPropertiesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33603C84219F0F6300B11FFE /* SharingPropertiesViewController.swift */; };
33B19C65218B46C100B323A7 /* SharingTagsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33B19C64218B46C100B323A7 /* SharingTagsViewController.swift */; };
33B19C67218B481700B323A7 /* TagCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33B19C66218B481700B323A7 /* TagCollectionViewCell.swift */; };
33BCD61621777A7400CA30B4 /* BookmarksSharingFlow.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 33BCD61521777A7400CA30B4 /* BookmarksSharingFlow.storyboard */; };
@ -799,6 +800,7 @@
33046835219C5A4E0041F3A8 /* CategorySettings.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CategorySettings.storyboard; sourceTree = "<group>"; };
331630D02191D74B00BB91A9 /* TagSectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagSectionHeaderView.swift; sourceTree = "<group>"; };
3358607D217632A2006D11F2 /* BookmarksSharingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksSharingViewController.swift; sourceTree = "<group>"; };
33603C84219F0F6300B11FFE /* SharingPropertiesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingPropertiesViewController.swift; sourceTree = "<group>"; };
33B19C64218B46C100B323A7 /* SharingTagsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingTagsViewController.swift; sourceTree = "<group>"; };
33B19C66218B481700B323A7 /* TagCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagCollectionViewCell.swift; sourceTree = "<group>"; };
33BCD61521777A7400CA30B4 /* BookmarksSharingFlow.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = BookmarksSharingFlow.storyboard; sourceTree = "<group>"; };
@ -2197,6 +2199,7 @@
3358607D217632A2006D11F2 /* BookmarksSharingViewController.swift */,
33BCD61521777A7400CA30B4 /* BookmarksSharingFlow.storyboard */,
33C558E2217F6CF100299E70 /* UploadActionCell.swift */,
33603C84219F0F6300B11FFE /* SharingPropertiesViewController.swift */,
33F8BA3B2199858B00ECA8EE /* Tags */,
);
path = Sharing;
@ -5262,6 +5265,7 @@
3454D7E31E07F045004AF2AD /* UITextView+RuntimeAttributes.mm in Sources */,
F6A2184A1CA3F26800BE2CC6 /* MWMEditorViralActivityItem.mm in Sources */,
F6E2FED61E097BA00083EBEC /* MWMSearchChangeModeView.mm in Sources */,
33603C85219F0F6300B11FFE /* SharingPropertiesViewController.swift in Sources */,
34845DB31E165E24003D55B9 /* SearchNoResultsViewController.swift in Sources */,
34AB660B1FC5AA320078E451 /* MWMNavigationDashboardEntity.mm in Sources */,
F5BD29FF26AD58255766C51A /* DiscoverySpinnerCell.swift in Sources */,