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 @@
<key>OneWeatherNotificationServiceExtension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>38</integer>
<integer>37</integer>
</dict>
<key>PG (Playground) 1.xcscheme</key>
<dict>
......
......@@ -269,7 +269,53 @@ public enum MoonPhase: String, Codable {
case .waningCrescentMoon:
return "moon.phase.wanningCrescent".localized()
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 @@
"version" : 1
},
"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 @@
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
......@@ -170,6 +170,11 @@
"radar.severeLayer.wind" = "Wind";
"radar.severeLayer.winter" = "Winter";
"radar.mapType" = "Map Type";
"radar.mapType.standard" = "Standard";
"radar.mapType.satellite" = "Satellite";
"radar.mapType.hybrid" = "Hybrid";
//Menu
"menu.goPremium" = "Go premium";
......
......@@ -135,6 +135,8 @@ class MoonPhaseCell: UITableViewCell {
MoonPhaseCell.dateFormatter.timeZone = today?.timeZone
MoonPhaseCell.nowDateFormatter.timeZone = today?.timeZone
moonTypeLabel.text = today?.moonPhase?.localized
moonTypeImageView.image = today?.moonPhase?.image
moonImageView.image = today?.moonPhase?.pathImage
guard
let moonrise = today?.moonrise ?? today?.approximateMoonrise,
......@@ -196,6 +198,8 @@ private extension MoonPhaseCell {
}
//Arrow button
//TODO: Hide button for now
headingButton.isHidden = true
headingButton.addTarget(self, action: #selector(handleHeadingButton), for: .touchUpInside)
contentView.addSubview(headingButton)
......@@ -214,14 +218,16 @@ private extension MoonPhaseCell {
make.left.right.equalToSuperview().inset(18)
make.top.equalTo(headingLabel.snp.bottom).offset(18)
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() {
infoLabel.numberOfLines = 0
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)
container.addSubview(infoLabel)
......@@ -266,7 +272,6 @@ private extension MoonPhaseCell {
//Type
moonTypeImageView.contentMode = .scaleAspectFit
moonTypeImageView.image = UIImage(named: "moon_waxingGibbous")
container.addSubview(moonTypeImageView)
moonTypeImageView.snp.makeConstraints { (make) in
......@@ -312,7 +317,6 @@ private extension MoonPhaseCell {
circleGradientLayer.endPoint = .init(x: 0.5, y: 1)
container.layer.addSublayer(circleGradientLayer)
moonImageView.image = UIImage(named: "moon_path_waxingGibbous")
moonImageView.contentMode = .scaleAspectFit
moonImageView.frame = .init(x: 0, y: 0, width: 28, height: 28)
container.addSubview(moonImageView)
......
......@@ -33,7 +33,8 @@ class PrecipitationCell: UITableViewCell {
public func configure(with dayily:[DailyWeather]) {
self.stackView.removeAll()
self.headingButton.isHidden = false
//TODO: Hide button for now
headingButton.isHidden = true
for index in 0..<dayily.count {
let precipButton = PrecipButton()
precipButton.isSelected = index == 1
......@@ -134,13 +135,17 @@ private extension PrecipitationCell {
}
func prepareSummaryView() {
//TODO: Hide the description for now
descriptionView.isHidden = true
descriptionView.set(image: UIImage(named: "humidity"))
descriptionView.set(text: "Possible light shower between 1 PM - 2 PM")
contentView.addSubview(descriptionView)
descriptionView.snp.makeConstraints { (make) in
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.bottom.equalToSuperview().inset(15)
}
......
......@@ -229,6 +229,8 @@ private extension SunPhaseCell {
}
//Arrow button
//TODO: Hide button for now
arrowButton.isHidden = true
arrowButton.addTarget(self, action: #selector(handleArrowButton), for: .touchUpInside)
contentView.addSubview(arrowButton)
......@@ -247,14 +249,16 @@ private extension SunPhaseCell {
infographicContainer.snp.makeConstraints { (make) in
make.left.right.equalToSuperview().inset(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
infographicLabel.lineBreakMode = .byWordWrapping
infographicLabel.numberOfLines = 0
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)
infographicLabel.snp.makeConstraints { (make) in
......
......@@ -76,13 +76,17 @@ private extension ForecastHourlyCell {
}
func prepareDescriptionView() {
//TODO: Hide the description for now
descriptionView.isHidden = true
descriptionView.set(image: UIImage(named: "hot_indicator"))
descriptionView.set(text: "Hottest part of the day 12 AM - 1 PM")
contentView.addSubview(descriptionView)
descriptionView.snp.makeConstraints { (make) in
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.bottom.equalToSuperview().inset(15)
}
......
......@@ -76,13 +76,17 @@ private extension ForecastWindSpeedCell {
}
func prepareDescriptionView() {
//TODO: Hide the description for now
descriptionView.isHidden = true
descriptionView.set(image: UIImage(named: "blowingDust"))
descriptionView.set(text: "Strongest winds between 12 AM - 1 PM")
contentView.addSubview(descriptionView)
descriptionView.snp.makeConstraints { (make) in
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.bottom.equalToSuperview().inset(15)
}
......
......@@ -38,8 +38,7 @@ class ForecastViewController: UIViewController {
super.viewDidLoad()
viewModel.delegate = self
viewModel.offsetHolder.delegate = self
prepareViewController()
prepareNavigationBar()
prepareTableView()
......@@ -250,9 +249,3 @@ extension ForecastViewController: DaysControlViewDelegate {
viewModel.offsetHolder.update(offset: offset)
}
}
//MARK:- TimePeriodOffset Delegate
extension ForecastViewController: TimePeriodOffsetDelegate {
func offsetDidChange(newOffset: CGFloat) {
}
}
......@@ -39,7 +39,7 @@ class CityCell: UITableViewCell {
self.cellLocation = location
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
self.contentView.accessibilityLabel = "\(location.nameForDisplay), \(temp)"
}
......@@ -64,6 +64,13 @@ class CityCell: UITableViewCell {
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?) {
super.traitCollectionDidChange(previousTraitCollection)
updateUI()
......@@ -119,12 +126,12 @@ private extension CityCell {
temperatureContainer.backgroundColor = ThemeManager.Colors.temperatureLabelBG
temperatureContainer.clipsToBounds = true
temperatureContainer.layer.cornerRadius = 5
temperatureContainer.setContentHuggingPriority(.init(1000), for: .horizontal)
temperatureContainer.setContentHuggingPriority(.init(950), for: .horizontal)
temperatureLabel.text = "27°"
temperatureLabel.font = AppFont.SFPro.regular(size: 16)
temperatureLabel.setContentHuggingPriority(.init(1000), for: .horizontal)
temperatureLabel.setContentCompressionResistancePriority(.init(1000), for: .horizontal)
temperatureLabel.setContentHuggingPriority(.init(950), for: .horizontal)
temperatureLabel.setContentCompressionResistancePriority(.init(950), for: .horizontal)
temperatureContainer.addSubview(temperatureLabel)
temperatureLabel.snp.makeConstraints { (make) in
......@@ -162,6 +169,7 @@ private extension CityCell {
contentView.addSubview(addButton)
addButton.snp.makeConstraints { (make) in
make.height.equalTo(24)
make.width.greaterThanOrEqualTo(54)
make.right.equalToSuperview().inset(24)
make.centerY.equalToSuperview()
}
......
......@@ -321,12 +321,7 @@ extension LocationViewController: UITableViewDelegate {
self?.locationsViewModel.delete(city: city)
completion(true)
}
let edit = UIContextualAction(style: .normal, title: "Edit".localized) { [weak self] (_, _, completion) in
self?.showEditLocationViewController(for: city)
completion(true)
}
return UISwipeActionsConfiguration(actions: [delete, edit])
return UISwipeActionsConfiguration(actions: [delete])
}
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
......
......@@ -176,9 +176,11 @@ public class LocationsViewModel {
strongSelf.fetchedCities = filteredPlaces
}
break
case .failure(let error):
case .failure:
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
}
......
......@@ -9,8 +9,11 @@ import UIKit
protocol MapPinnedLayersViewDelegate:class {
func didSelectLayer(layerId:String)
func didSelectAddButton()
}
private let kAddButtonId = "add"
class MapPinnedLayersView: UIView {
//Private
private let pinContainer = UIView()
......@@ -75,7 +78,12 @@ class MapPinnedLayersView: UIView {
}
@objc private func handleLayerButton(button:PinnedlLayerButton) {
delegate?.didSelectLayer(layerId: button.layerId)
if button.layerId == kAddButtonId {
delegate?.didSelectAddButton()
}
else {
delegate?.didSelectLayer(layerId: button.layerId)
}
}
}
......@@ -142,7 +150,7 @@ private class PinnedlLayerButton: UIControl {
private var configuredForAdd = false
//Public
let layerId:String
private(set) var layerId:String
init(radarLayer:RadarLayer? = nil) {
self.layerId = radarLayer?.layer.id ?? ""
......@@ -200,6 +208,7 @@ private class PinnedlLayerButton: UIControl {
func configureForAdd() {
self.layer.shadowOpacity = 0
self.layer.borderWidth = 1
self.layerId = kAddButtonId
self.nameLabel.textColor = ThemeManager.currentTheme.graphTintColor
self.nameLabel.text = "general.add".localized().capitalized + " +"
self.isSelected = false
......
......@@ -226,7 +226,24 @@ class RadarViewController: UIViewController {
}
@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() {
......@@ -405,6 +422,10 @@ extension RadarViewController: MapPinnedLayersViewDelegate {
func didSelectLayer(layerId: String) {
radarViewModel.select(layerId: layerId)
}
func didSelectAddButton() {
self.handleLayersButton()
}
}
//MARK:- MapTimeControleView Delegate
......
......@@ -206,6 +206,10 @@ class TodayCellFactory: CellFactoryProtocol {
rowsToHide.insert(.airQuality)
}
if location?.today?.moonset == nil && (location?.today?.moonrise == nil || location?.today?.approximateMoonrise == nil) {
rowsToHide.insert(.moon)
}
todaySection.hiddenRows = rowsToHide
}
}
......@@ -92,6 +92,8 @@ private extension TodayDayTimesCell {
}
//Arrow button
//TODO: Hide button for now
headingButton.isHidden = true
headingButton.addTarget(self, action: #selector(handleArrowButton), for: .touchUpInside)
contentView.addSubview(headingButton)
......
......@@ -78,13 +78,17 @@ private extension TodayForecastTimePeriodCell {
}
func prepareDescriptionView() {
//TODO: Hide the description for now
descriptionView.isHidden = true
descriptionView.set(image: UIImage(named: "hot_indicator"))
descriptionView.set(text: "Hottest part of the day 12 AM - 1 PM")
contentView.addSubview(descriptionView)
descriptionView.snp.makeConstraints { (make) in
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.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