Commit f7d5fc31 by Dmitriy Stepanets

• IOS-44: removed the Edit button.

• IOS-52: temperature unit on search screen is correct.
• IOS-54: moonrise / moonset fix
• IOS-56: click on vertical bars on Forecat/Daily works.
• Removed some of the smart texts.
• Minor Search layout fixes.
• Hide a few inactive UI elements.
• Radar: selecting a map type now works.
• Radar: The “Add+” button works.
parent e4981120
No preview for this file type
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<key>OneWeatherNotificationServiceExtension.xcscheme_^#shared#^_</key> <key>OneWeatherNotificationServiceExtension.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>38</integer> <integer>37</integer>
</dict> </dict>
<key>PG (Playground) 1.xcscheme</key> <key>PG (Playground) 1.xcscheme</key>
<dict> <dict>
......
...@@ -269,7 +269,53 @@ public enum MoonPhase: String, Codable { ...@@ -269,7 +269,53 @@ public enum MoonPhase: String, Codable {
case .waningCrescentMoon: case .waningCrescentMoon:
return "moon.phase.wanningCrescent".localized() return "moon.phase.wanningCrescent".localized()
case .unknown: case .unknown:
return "unknown" return "--"
}
}
var image:UIImage? {
switch self {
case .newMoon:
return UIImage(named: "moon_new")
case .waxingCrescentMoon:
return UIImage(named: "moon_waxingCrescent")
case .quarterMoon:
return UIImage(named: "moon_firstQuarter")
case .waxingGibbousMoon:
return UIImage(named: "moon_waxingGibbous")
case .fullMoon:
return UIImage(named: "moon_full")
case .waningGibbousMoon:
return UIImage(named: "moon_waningGibbous")
case .lastQuarterMoon:
return UIImage(named: "moon_thirdQuarter")
case .waningCrescentMoon:
return UIImage(named: "moon_waningCrescent")
case .unknown:
return nil
}
}
var pathImage:UIImage? {
switch self {
case .newMoon:
return UIImage(named: "moon_path_new")
case .waxingCrescentMoon:
return UIImage(named: "moon_path_waxingCrescent")
case .quarterMoon:
return UIImage(named: "moon_path_firstQuarter")
case .waxingGibbousMoon:
return UIImage(named: "moon_path_waxingGibbous")
case .fullMoon:
return UIImage(named: "moon_path_full")
case .waningGibbousMoon:
return UIImage(named: "moon_path_waningGibbous")
case .lastQuarterMoon:
return UIImage(named: "moon_path_thirdQuarter")
case .waningCrescentMoon:
return UIImage(named: "moon_path_waningCrescent")
case .unknown:
return nil
} }
} }
} }
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "moon_firstQuarter.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_full.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_new.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_path_firstQuarter.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_path_full.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_path_new.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_path_thirdQuarter.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_path_waningCrescent.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_path_waningGibbous.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_path_waxingCrescent.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"version" : 1 "version" : 1
}, },
"properties" : { "properties" : {
"preserves-vector-representation" : true "preserves-vector-representation" : true,
"template-rendering-intent" : "original"
} }
} }
{
"images" : [
{
"filename" : "moon_thirdQuarter.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_waningCrescent.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_waningGibbous.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
{
"images" : [
{
"filename" : "moon_waxingCrescent.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"version" : 1 "version" : 1
}, },
"properties" : { "properties" : {
"preserves-vector-representation" : true "preserves-vector-representation" : true,
"template-rendering-intent" : "original"
} }
} }
...@@ -170,6 +170,11 @@ ...@@ -170,6 +170,11 @@
"radar.severeLayer.wind" = "Wind"; "radar.severeLayer.wind" = "Wind";
"radar.severeLayer.winter" = "Winter"; "radar.severeLayer.winter" = "Winter";
"radar.mapType" = "Map Type";
"radar.mapType.standard" = "Standard";
"radar.mapType.satellite" = "Satellite";
"radar.mapType.hybrid" = "Hybrid";
//Menu //Menu
"menu.goPremium" = "Go premium"; "menu.goPremium" = "Go premium";
......
...@@ -135,6 +135,8 @@ class MoonPhaseCell: UITableViewCell { ...@@ -135,6 +135,8 @@ class MoonPhaseCell: UITableViewCell {
MoonPhaseCell.dateFormatter.timeZone = today?.timeZone MoonPhaseCell.dateFormatter.timeZone = today?.timeZone
MoonPhaseCell.nowDateFormatter.timeZone = today?.timeZone MoonPhaseCell.nowDateFormatter.timeZone = today?.timeZone
moonTypeLabel.text = today?.moonPhase?.localized moonTypeLabel.text = today?.moonPhase?.localized
moonTypeImageView.image = today?.moonPhase?.image
moonImageView.image = today?.moonPhase?.pathImage
guard guard
let moonrise = today?.moonrise ?? today?.approximateMoonrise, let moonrise = today?.moonrise ?? today?.approximateMoonrise,
...@@ -196,6 +198,8 @@ private extension MoonPhaseCell { ...@@ -196,6 +198,8 @@ private extension MoonPhaseCell {
} }
//Arrow button //Arrow button
//TODO: Hide button for now
headingButton.isHidden = true
headingButton.addTarget(self, action: #selector(handleHeadingButton), for: .touchUpInside) headingButton.addTarget(self, action: #selector(handleHeadingButton), for: .touchUpInside)
contentView.addSubview(headingButton) contentView.addSubview(headingButton)
...@@ -214,14 +218,16 @@ private extension MoonPhaseCell { ...@@ -214,14 +218,16 @@ private extension MoonPhaseCell {
make.left.right.equalToSuperview().inset(18) make.left.right.equalToSuperview().inset(18)
make.top.equalTo(headingLabel.snp.bottom).offset(18) make.top.equalTo(headingLabel.snp.bottom).offset(18)
make.bottom.equalToSuperview().inset(15) make.bottom.equalToSuperview().inset(15)
make.height.equalTo(290) //TODO: Hide description label for now
// make.height.equalTo(290)
make.height.equalTo(270)
} }
} }
func prepareInfoLabel() { func prepareInfoLabel() {
infoLabel.numberOfLines = 0 infoLabel.numberOfLines = 0
infoLabel.lineBreakMode = .byWordWrapping infoLabel.lineBreakMode = .byWordWrapping
infoLabel.text = "Tides are higher than usual due to new moon" infoLabel.text = nil//"Tides are higher than usual due to new moon"
infoLabel.font = AppFont.SFPro.regular(size: 16) infoLabel.font = AppFont.SFPro.regular(size: 16)
container.addSubview(infoLabel) container.addSubview(infoLabel)
...@@ -266,7 +272,6 @@ private extension MoonPhaseCell { ...@@ -266,7 +272,6 @@ private extension MoonPhaseCell {
//Type //Type
moonTypeImageView.contentMode = .scaleAspectFit moonTypeImageView.contentMode = .scaleAspectFit
moonTypeImageView.image = UIImage(named: "moon_waxingGibbous")
container.addSubview(moonTypeImageView) container.addSubview(moonTypeImageView)
moonTypeImageView.snp.makeConstraints { (make) in moonTypeImageView.snp.makeConstraints { (make) in
...@@ -312,7 +317,6 @@ private extension MoonPhaseCell { ...@@ -312,7 +317,6 @@ private extension MoonPhaseCell {
circleGradientLayer.endPoint = .init(x: 0.5, y: 1) circleGradientLayer.endPoint = .init(x: 0.5, y: 1)
container.layer.addSublayer(circleGradientLayer) container.layer.addSublayer(circleGradientLayer)
moonImageView.image = UIImage(named: "moon_path_waxingGibbous")
moonImageView.contentMode = .scaleAspectFit moonImageView.contentMode = .scaleAspectFit
moonImageView.frame = .init(x: 0, y: 0, width: 28, height: 28) moonImageView.frame = .init(x: 0, y: 0, width: 28, height: 28)
container.addSubview(moonImageView) container.addSubview(moonImageView)
......
...@@ -33,7 +33,8 @@ class PrecipitationCell: UITableViewCell { ...@@ -33,7 +33,8 @@ class PrecipitationCell: UITableViewCell {
public func configure(with dayily:[DailyWeather]) { public func configure(with dayily:[DailyWeather]) {
self.stackView.removeAll() self.stackView.removeAll()
self.headingButton.isHidden = false //TODO: Hide button for now
headingButton.isHidden = true
for index in 0..<dayily.count { for index in 0..<dayily.count {
let precipButton = PrecipButton() let precipButton = PrecipButton()
precipButton.isSelected = index == 1 precipButton.isSelected = index == 1
...@@ -134,13 +135,17 @@ private extension PrecipitationCell { ...@@ -134,13 +135,17 @@ private extension PrecipitationCell {
} }
func prepareSummaryView() { func prepareSummaryView() {
//TODO: Hide the description for now
descriptionView.isHidden = true
descriptionView.set(image: UIImage(named: "humidity")) descriptionView.set(image: UIImage(named: "humidity"))
descriptionView.set(text: "Possible light shower between 1 PM - 2 PM") descriptionView.set(text: "Possible light shower between 1 PM - 2 PM")
contentView.addSubview(descriptionView) contentView.addSubview(descriptionView)
descriptionView.snp.makeConstraints { (make) in descriptionView.snp.makeConstraints { (make) in
make.left.right.equalToSuperview().inset(18) make.left.right.equalToSuperview().inset(18)
make.height.equalTo(40) //TODO: Hide the description for now
make.height.equalTo(0)
// make.height.equalTo(40)
make.top.equalTo(scrollView.snp.bottom).offset(26).priority(.medium) make.top.equalTo(scrollView.snp.bottom).offset(26).priority(.medium)
make.bottom.equalToSuperview().inset(15) make.bottom.equalToSuperview().inset(15)
} }
......
...@@ -229,6 +229,8 @@ private extension SunPhaseCell { ...@@ -229,6 +229,8 @@ private extension SunPhaseCell {
} }
//Arrow button //Arrow button
//TODO: Hide button for now
arrowButton.isHidden = true
arrowButton.addTarget(self, action: #selector(handleArrowButton), for: .touchUpInside) arrowButton.addTarget(self, action: #selector(handleArrowButton), for: .touchUpInside)
contentView.addSubview(arrowButton) contentView.addSubview(arrowButton)
...@@ -247,14 +249,16 @@ private extension SunPhaseCell { ...@@ -247,14 +249,16 @@ private extension SunPhaseCell {
infographicContainer.snp.makeConstraints { (make) in infographicContainer.snp.makeConstraints { (make) in
make.left.right.equalToSuperview().inset(18) make.left.right.equalToSuperview().inset(18)
make.top.equalTo(headingLabel.snp.bottom).offset(18) make.top.equalTo(headingLabel.snp.bottom).offset(18)
make.height.equalTo(212) //TODO: Hide description label for now
// make.height.equalTo(212)
make.height.equalTo(180)
} }
//Label //Label
infographicLabel.lineBreakMode = .byWordWrapping infographicLabel.lineBreakMode = .byWordWrapping
infographicLabel.numberOfLines = 0 infographicLabel.numberOfLines = 0
infographicLabel.font = AppFont.SFPro.regular(size: 16) infographicLabel.font = AppFont.SFPro.regular(size: 16)
infographicLabel.text = "Reduce time in the sun between 10 a.m and 4 p.m" infographicLabel.text = nil//"Reduce time in the sun between 10 a.m and 4 p.m"
infographicContainer.addSubview(infographicLabel) infographicContainer.addSubview(infographicLabel)
infographicLabel.snp.makeConstraints { (make) in infographicLabel.snp.makeConstraints { (make) in
......
...@@ -76,13 +76,17 @@ private extension ForecastHourlyCell { ...@@ -76,13 +76,17 @@ private extension ForecastHourlyCell {
} }
func prepareDescriptionView() { func prepareDescriptionView() {
//TODO: Hide the description for now
descriptionView.isHidden = true
descriptionView.set(image: UIImage(named: "hot_indicator")) descriptionView.set(image: UIImage(named: "hot_indicator"))
descriptionView.set(text: "Hottest part of the day 12 AM - 1 PM") descriptionView.set(text: "Hottest part of the day 12 AM - 1 PM")
contentView.addSubview(descriptionView) contentView.addSubview(descriptionView)
descriptionView.snp.makeConstraints { (make) in descriptionView.snp.makeConstraints { (make) in
make.left.right.equalToSuperview().inset(18) make.left.right.equalToSuperview().inset(18)
make.height.equalTo(40) //TODO: Hide the description for now
make.height.equalTo(0)
// make.height.equalTo(40)
make.top.equalTo(forecastTimePeriodView.snp.bottom).offset(20) make.top.equalTo(forecastTimePeriodView.snp.bottom).offset(20)
make.bottom.equalToSuperview().inset(15) make.bottom.equalToSuperview().inset(15)
} }
......
...@@ -76,13 +76,17 @@ private extension ForecastWindSpeedCell { ...@@ -76,13 +76,17 @@ private extension ForecastWindSpeedCell {
} }
func prepareDescriptionView() { func prepareDescriptionView() {
//TODO: Hide the description for now
descriptionView.isHidden = true
descriptionView.set(image: UIImage(named: "blowingDust")) descriptionView.set(image: UIImage(named: "blowingDust"))
descriptionView.set(text: "Strongest winds between 12 AM - 1 PM") descriptionView.set(text: "Strongest winds between 12 AM - 1 PM")
contentView.addSubview(descriptionView) contentView.addSubview(descriptionView)
descriptionView.snp.makeConstraints { (make) in descriptionView.snp.makeConstraints { (make) in
make.left.right.equalToSuperview().inset(18) make.left.right.equalToSuperview().inset(18)
make.height.equalTo(40) //TODO: Hide the description for now
make.height.equalTo(0)
// make.height.equalTo(40)
make.top.equalTo(timePeriodView.snp.bottom).offset(20) make.top.equalTo(timePeriodView.snp.bottom).offset(20)
make.bottom.equalToSuperview().inset(15) make.bottom.equalToSuperview().inset(15)
} }
......
...@@ -38,7 +38,6 @@ class ForecastViewController: UIViewController { ...@@ -38,7 +38,6 @@ class ForecastViewController: UIViewController {
super.viewDidLoad() super.viewDidLoad()
viewModel.delegate = self viewModel.delegate = self
viewModel.offsetHolder.delegate = self
prepareViewController() prepareViewController()
prepareNavigationBar() prepareNavigationBar()
...@@ -250,9 +249,3 @@ extension ForecastViewController: DaysControlViewDelegate { ...@@ -250,9 +249,3 @@ extension ForecastViewController: DaysControlViewDelegate {
viewModel.offsetHolder.update(offset: offset) viewModel.offsetHolder.update(offset: offset)
} }
} }
//MARK:- TimePeriodOffset Delegate
extension ForecastViewController: TimePeriodOffsetDelegate {
func offsetDidChange(newOffset: CGFloat) {
}
}
...@@ -39,7 +39,7 @@ class CityCell: UITableViewCell { ...@@ -39,7 +39,7 @@ class CityCell: UITableViewCell {
self.cellLocation = location self.cellLocation = location
cityLabel.text = location.nameForDisplay cityLabel.text = location.nameForDisplay
if let temp = (location as? Location)?.today?.temp?.shortString { if let temp = (location as? Location)?.today?.temp?.settingsConverted.shortString {
temperatureLabel.text = temp temperatureLabel.text = temp
self.contentView.accessibilityLabel = "\(location.nameForDisplay), \(temp)" self.contentView.accessibilityLabel = "\(location.nameForDisplay), \(temp)"
} }
...@@ -64,6 +64,13 @@ class CityCell: UITableViewCell { ...@@ -64,6 +64,13 @@ class CityCell: UITableViewCell {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
override func layoutSubviews() {
super.layoutSubviews()
let path = UIBezierPath(roundedRect: addButton.bounds, cornerRadius: addButton.layer.cornerRadius)
addButton.layer.shadowPath = path.cgPath
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection) super.traitCollectionDidChange(previousTraitCollection)
updateUI() updateUI()
...@@ -119,12 +126,12 @@ private extension CityCell { ...@@ -119,12 +126,12 @@ private extension CityCell {
temperatureContainer.backgroundColor = ThemeManager.Colors.temperatureLabelBG temperatureContainer.backgroundColor = ThemeManager.Colors.temperatureLabelBG
temperatureContainer.clipsToBounds = true temperatureContainer.clipsToBounds = true
temperatureContainer.layer.cornerRadius = 5 temperatureContainer.layer.cornerRadius = 5
temperatureContainer.setContentHuggingPriority(.init(1000), for: .horizontal) temperatureContainer.setContentHuggingPriority(.init(950), for: .horizontal)
temperatureLabel.text = "27°" temperatureLabel.text = "27°"
temperatureLabel.font = AppFont.SFPro.regular(size: 16) temperatureLabel.font = AppFont.SFPro.regular(size: 16)
temperatureLabel.setContentHuggingPriority(.init(1000), for: .horizontal) temperatureLabel.setContentHuggingPriority(.init(950), for: .horizontal)
temperatureLabel.setContentCompressionResistancePriority(.init(1000), for: .horizontal) temperatureLabel.setContentCompressionResistancePriority(.init(950), for: .horizontal)
temperatureContainer.addSubview(temperatureLabel) temperatureContainer.addSubview(temperatureLabel)
temperatureLabel.snp.makeConstraints { (make) in temperatureLabel.snp.makeConstraints { (make) in
...@@ -162,6 +169,7 @@ private extension CityCell { ...@@ -162,6 +169,7 @@ private extension CityCell {
contentView.addSubview(addButton) contentView.addSubview(addButton)
addButton.snp.makeConstraints { (make) in addButton.snp.makeConstraints { (make) in
make.height.equalTo(24) make.height.equalTo(24)
make.width.greaterThanOrEqualTo(54)
make.right.equalToSuperview().inset(24) make.right.equalToSuperview().inset(24)
make.centerY.equalToSuperview() make.centerY.equalToSuperview()
} }
......
...@@ -321,12 +321,7 @@ extension LocationViewController: UITableViewDelegate { ...@@ -321,12 +321,7 @@ extension LocationViewController: UITableViewDelegate {
self?.locationsViewModel.delete(city: city) self?.locationsViewModel.delete(city: city)
completion(true) completion(true)
} }
return UISwipeActionsConfiguration(actions: [delete])
let edit = UIContextualAction(style: .normal, title: "Edit".localized) { [weak self] (_, _, completion) in
self?.showEditLocationViewController(for: city)
completion(true)
}
return UISwipeActionsConfiguration(actions: [delete, edit])
} }
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? { func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
......
...@@ -176,9 +176,11 @@ public class LocationsViewModel { ...@@ -176,9 +176,11 @@ public class LocationsViewModel {
strongSelf.fetchedCities = filteredPlaces strongSelf.fetchedCities = filteredPlaces
} }
break break
case .failure(let error): case .failure:
DispatchQueue.main.async { DispatchQueue.main.async {
strongSelf.delegate?.viewModelError(model: strongSelf, title: "Error", message: error.localizedDescription) strongSelf.delegate?.viewModelError(model: strongSelf,
title: "Error",
message:"An error occured during search. Please, try again later.")
} }
break break
} }
......
...@@ -9,8 +9,11 @@ import UIKit ...@@ -9,8 +9,11 @@ import UIKit
protocol MapPinnedLayersViewDelegate:class { protocol MapPinnedLayersViewDelegate:class {
func didSelectLayer(layerId:String) func didSelectLayer(layerId:String)
func didSelectAddButton()
} }
private let kAddButtonId = "add"
class MapPinnedLayersView: UIView { class MapPinnedLayersView: UIView {
//Private //Private
private let pinContainer = UIView() private let pinContainer = UIView()
...@@ -75,8 +78,13 @@ class MapPinnedLayersView: UIView { ...@@ -75,8 +78,13 @@ class MapPinnedLayersView: UIView {
} }
@objc private func handleLayerButton(button:PinnedlLayerButton) { @objc private func handleLayerButton(button:PinnedlLayerButton) {
if button.layerId == kAddButtonId {
delegate?.didSelectAddButton()
}
else {
delegate?.didSelectLayer(layerId: button.layerId) delegate?.didSelectLayer(layerId: button.layerId)
} }
}
} }
//MARK:- Prepare Pinned Layers //MARK:- Prepare Pinned Layers
...@@ -142,7 +150,7 @@ private class PinnedlLayerButton: UIControl { ...@@ -142,7 +150,7 @@ private class PinnedlLayerButton: UIControl {
private var configuredForAdd = false private var configuredForAdd = false
//Public //Public
let layerId:String private(set) var layerId:String
init(radarLayer:RadarLayer? = nil) { init(radarLayer:RadarLayer? = nil) {
self.layerId = radarLayer?.layer.id ?? "" self.layerId = radarLayer?.layer.id ?? ""
...@@ -200,6 +208,7 @@ private class PinnedlLayerButton: UIControl { ...@@ -200,6 +208,7 @@ private class PinnedlLayerButton: UIControl {
func configureForAdd() { func configureForAdd() {
self.layer.shadowOpacity = 0 self.layer.shadowOpacity = 0
self.layer.borderWidth = 1 self.layer.borderWidth = 1
self.layerId = kAddButtonId
self.nameLabel.textColor = ThemeManager.currentTheme.graphTintColor self.nameLabel.textColor = ThemeManager.currentTheme.graphTintColor
self.nameLabel.text = "general.add".localized().capitalized + " +" self.nameLabel.text = "general.add".localized().capitalized + " +"
self.isSelected = false self.isSelected = false
......
...@@ -226,7 +226,24 @@ class RadarViewController: UIViewController { ...@@ -226,7 +226,24 @@ class RadarViewController: UIViewController {
} }
@objc private func handleRadarButton() { @objc private func handleRadarButton() {
let alert = UIAlertController(title: "radar.mapType".localized(), message: nil, preferredStyle: .actionSheet)
let stadard = UIAlertAction(title: "radar.mapType.standard".localized(), style: .default) { (_) in
self.mapView.mapType = .standard
}
let satellite = UIAlertAction(title: "radar.mapType.satellite".localized(), style: .default) { (_) in
self.mapView.mapType = .satellite
}
let hybrid = UIAlertAction(title: "radar.mapType.hybrid".localized(), style: .default) { (_) in
self.mapView.mapType = .hybrid
}
let cancel = UIAlertAction(title: "general.cancel".localized(), style: .cancel)
alert.addAction(stadard)
alert.addAction(satellite)
alert.addAction(hybrid)
alert.addAction(cancel)
self.present(alert, animated: true)
} }
@objc private func handleLocationButton() { @objc private func handleLocationButton() {
...@@ -405,6 +422,10 @@ extension RadarViewController: MapPinnedLayersViewDelegate { ...@@ -405,6 +422,10 @@ extension RadarViewController: MapPinnedLayersViewDelegate {
func didSelectLayer(layerId: String) { func didSelectLayer(layerId: String) {
radarViewModel.select(layerId: layerId) radarViewModel.select(layerId: layerId)
} }
func didSelectAddButton() {
self.handleLayersButton()
}
} }
//MARK:- MapTimeControleView Delegate //MARK:- MapTimeControleView Delegate
......
...@@ -206,6 +206,10 @@ class TodayCellFactory: CellFactoryProtocol { ...@@ -206,6 +206,10 @@ class TodayCellFactory: CellFactoryProtocol {
rowsToHide.insert(.airQuality) rowsToHide.insert(.airQuality)
} }
if location?.today?.moonset == nil && (location?.today?.moonrise == nil || location?.today?.approximateMoonrise == nil) {
rowsToHide.insert(.moon)
}
todaySection.hiddenRows = rowsToHide todaySection.hiddenRows = rowsToHide
} }
} }
...@@ -92,6 +92,8 @@ private extension TodayDayTimesCell { ...@@ -92,6 +92,8 @@ private extension TodayDayTimesCell {
} }
//Arrow button //Arrow button
//TODO: Hide button for now
headingButton.isHidden = true
headingButton.addTarget(self, action: #selector(handleArrowButton), for: .touchUpInside) headingButton.addTarget(self, action: #selector(handleArrowButton), for: .touchUpInside)
contentView.addSubview(headingButton) contentView.addSubview(headingButton)
......
...@@ -78,13 +78,17 @@ private extension TodayForecastTimePeriodCell { ...@@ -78,13 +78,17 @@ private extension TodayForecastTimePeriodCell {
} }
func prepareDescriptionView() { func prepareDescriptionView() {
//TODO: Hide the description for now
descriptionView.isHidden = true
descriptionView.set(image: UIImage(named: "hot_indicator")) descriptionView.set(image: UIImage(named: "hot_indicator"))
descriptionView.set(text: "Hottest part of the day 12 AM - 1 PM") descriptionView.set(text: "Hottest part of the day 12 AM - 1 PM")
contentView.addSubview(descriptionView) contentView.addSubview(descriptionView)
descriptionView.snp.makeConstraints { (make) in descriptionView.snp.makeConstraints { (make) in
make.left.right.equalToSuperview().inset(18) make.left.right.equalToSuperview().inset(18)
make.height.equalTo(40) //TODO: Hide the description for now
make.height.equalTo(0)
//make.height.equalTo(40)
make.top.equalTo(forecastTimePeriodView.snp.bottom).offset(20) make.top.equalTo(forecastTimePeriodView.snp.bottom).offset(20)
make.bottom.equalToSuperview().inset(15) make.bottom.equalToSuperview().inset(15)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment