[iOS] fix catalog styles and missing translations

This commit is contained in:
Aleksey Belouosv 2018-07-08 22:21:53 +03:00 committed by Vlad Mihaylenko
parent 1262b5130c
commit fb148b4515
8 changed files with 72 additions and 26 deletions

View file

@ -37,7 +37,9 @@ final class CatalogCategoryCell: MWMTableViewCell {
func update(with category: MWMCatalogCategory, delegate: CatalogCategoryCellDelegate?) {
titleLabel.text = category.title
subtitleLabel.text = "\(category.bookmarksCount) places • by \(category.author ?? "")"
let placesString = String(format: L("bookmarks_places"), category.bookmarksCount)
let authorString = String(coreFormat: L("author_name_by_prefix"), arguments: [category.author])
subtitleLabel.text = "\(placesString)\(authorString)"
visibleCheckmark.isChecked = category.visible
self.delegate = delegate
}

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<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>
@ -21,7 +21,7 @@
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TYb-q4-3hJ" customClass="Checkmark" customModule="maps_me" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="56" height="60"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="56" id="gNZ-kZ-bfY"/>
</constraints>

View file

@ -107,13 +107,12 @@ final class CatalogWebViewController: WebViewController {
}
}
if MWMBookmarksManager.isCategoryDownloading(id) {
//TODO: add alert
return
}
if MWMBookmarksManager.hasCategoryDownloaded(id) {
//TODO: add alert
if MWMBookmarksManager.isCategoryDownloading(id) || MWMBookmarksManager.hasCategoryDownloaded(id) {
MWMAlertViewController.activeAlert().presentDefaultAlert(withTitle: L("error_already_downloaded"),
message: nil,
rightButtonTitle: L("ok"),
leftButtonTitle: nil,
rightButtonAction: nil)
return
}

View file

@ -3,11 +3,30 @@ class DownloadedBookmarksViewController: MWMViewController {
@IBOutlet var bottomView: UIView!
@IBOutlet weak var noDataView: UIView!
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var bottomViewTitleLabel: UILabel! {
didSet {
bottomViewTitleLabel.text = L("cached_bookmarks_placeholder_title").uppercased()
}
}
@IBOutlet weak var bottomViewDownloadButton: UIButton! {
didSet {
bottomViewDownloadButton.setTitle(L("downloader_download_routers").uppercased(), for: .normal)
}
}
@IBOutlet weak var noDataViewDownloadButton: UIButton! {
didSet {
noDataViewDownloadButton.setTitle(L("downloader_download_routers").uppercased(), for: .normal)
}
}
let dataSource = DownloadedBookmarksDataSource()
override func viewDidLoad() {
super.viewDidLoad()
tableView.backgroundColor = UIColor.pressBackground()
tableView.separatorColor = UIColor.blackDividers()
tableView.tableFooterView = bottomView
tableView.registerNib(cell: CatalogCategoryCell.self)
tableView.registerNibForHeaderFooterView(BMCCategoriesHeader.self)
@ -20,6 +39,16 @@ class DownloadedBookmarksViewController: MWMViewController {
tableView.reloadData()
}
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
var f = bottomView.frame
let s = bottomView.systemLayoutSizeFitting(CGSize(width: tableView.width, height: 1),
withHorizontalFittingPriority: .required,
verticalFittingPriority: .defaultLow)
f.size = s
bottomView.frame = f
}
@IBAction func onDownloadBookmarks(_ sender: Any) {
if MWMPlatform.networkConnectionType() == .none {
MWMAlertViewController.activeAlert().presentNoConnectionAlert();

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<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>
@ -13,7 +13,10 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="DownloadedBookmarksViewController" customModule="maps_me" customModuleProvider="target">
<connections>
<outlet property="bottomView" destination="A19-bw-qEr" id="kih-zB-eh4"/>
<outlet property="bottomViewDownloadButton" destination="Yjf-3F-Ewf" id="ELj-ol-N9n"/>
<outlet property="bottomViewTitleLabel" destination="TnJ-F3-v3h" id="SBv-GJ-PFU"/>
<outlet property="noDataView" destination="EF0-Bq-c6F" id="Zna-hA-2r3"/>
<outlet property="noDataViewDownloadButton" destination="kER-re-108" id="kEz-1f-Vx4"/>
<outlet property="tableView" destination="i5M-Pr-FkT" id="hZS-jj-xH4"/>
<outlet property="view" destination="Q8q-x4-Mvv" id="Ch1-sh-by5"/>
</connections>
@ -23,7 +26,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="161"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Yjf-3F-Ewf" userLabel="NotNow">
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Yjf-3F-Ewf" userLabel="Download Bookmarks">
<rect key="frame" x="16" y="107.5" width="343" height="37.5"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
@ -35,12 +38,12 @@
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="textColorHighlightedName" value="white"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorHighlightedName" value="whitePrimaryTextHighlighted"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium14"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="white"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="whitePrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundHighlightedColorName" value="linkBlueHighlighted"/>
</userDefinedRuntimeAttributes>
@ -53,6 +56,10 @@
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
<color key="textColor" white="0.0" alpha="0.5586472602739726" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium14"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lZi-fE-uf3">
<rect key="frame" x="16" y="41" width="343" height="50.5"/>
@ -60,6 +67,11 @@
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.0" alpha="0.54010595034246578" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="cached_bookmarks_placeholder_subtitle"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular14"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@ -98,42 +110,46 @@
<rect key="frame" x="88" y="40" width="200" height="200"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Download new places" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="13b-uj-bGK">
<rect key="frame" x="16" y="256" width="343" height="24"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<rect key="frame" x="16" y="256" width="343" height="21.5"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" white="0.0" alpha="0.87371575342465757" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="cached_bookmarks_placeholder_title"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular18"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="TopLeft" horizontalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1gY-vv-QfN">
<rect key="frame" x="16" y="288" width="343" height="50.5"/>
<rect key="frame" x="16" y="285.5" width="343" height="50.5"/>
<string key="text">Press the button to download thousands of intresting places and routes created by MAPS.ME users. You will need the internet connection.</string>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.0" alpha="0.53735017123287676" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="cached_bookmarks_placeholder_subtitle"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular14"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackSecondaryText"/>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kER-re-108" userLabel="NotNow">
<rect key="frame" x="16" y="364.5" width="343" height="44"/>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kER-re-108" userLabel="Download Bookmarks">
<rect key="frame" x="16" y="362" width="343" height="44"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" priority="750" constant="44" id="GMD-2V-uPA"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
<state key="normal" title="DOWNLOAD BOOKMARKS">
<color key="titleColor" red="0.01176470588" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="textColorHighlightedName" value="white"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorHighlightedName" value="whitePrimaryTextHighlighted"/>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="medium14"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="white"/>
<userDefinedRuntimeAttribute type="string" keyPath="textColorName" value="whitePrimaryText"/>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="linkBlue"/>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundHighlightedColorName" value="linkBlueHighlighted"/>
</userDefinedRuntimeAttributes>

View file

@ -5,7 +5,7 @@ protocol BMCCategoriesHeaderDelegate {
final class BMCCategoriesHeader: UITableViewHeaderFooterView {
@IBOutlet private weak var label: UILabel! {
didSet {
label.font = .bold14()
label.font = .medium14()
label.textColor = .blackSecondaryText()
label.text = L("bookmarks_groups").uppercased()
}

View file

@ -1,7 +1,7 @@
final class BMCNotificationsHeader: UIView {
@IBOutlet private weak var label: UILabel! {
didSet {
label.font = .bold14()
label.font = .medium14()
label.textColor = .blackSecondaryText()
label.text = L("bookmarks_groups").uppercased()
}

View file

@ -7,7 +7,7 @@ final class BMCPermissionsHeader: UIView {
@IBOutlet private weak var label: UILabel! {
didSet {
label.font = .bold14()
label.font = .medium14()
label.textColor = .blackSecondaryText()
label.text = L("settings_backup_bookmarks").uppercased()
}