Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
1
1weather
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
1weather
Commits
c65cc864
Commit
c65cc864
authored
Oct 08, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IOS-184: navigate to forecast from today.
parent
a79fbc1a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
4 deletions
+20
-4
1Weather/UI/Buttons/ArrowButton.swift
+1
-0
1Weather/UI/SharedCells/PrecipCell/PrecipitationCell.swift
+6
-4
1Weather/UI/View controllers/Today/Cells/TodayCellFactory.swift
+9
-0
1Weather/ViewModels/TodayViewModel.swift
+4
-0
No files found.
1Weather/UI/Buttons/ArrowButton.swift
View file @
c65cc864
...
...
@@ -59,6 +59,7 @@ private extension ArrowButton {
}
func
prepareBackground
()
{
gradientBackground
.
isUserInteractionEnabled
=
false
gradientBackground
.
layer
.
cornerRadius
=
9
insertSubview
(
gradientBackground
,
belowSubview
:
imageView
!
)
...
...
1Weather/UI/SharedCells/PrecipCell/PrecipitationCell.swift
View file @
c65cc864
...
...
@@ -9,8 +9,13 @@ import UIKit
import
OneWeatherCore
import
OneWeatherAnalytics
protocol
PrecipitationCellDelegate
:
AnyObject
{
func
precipitationCtaClicked
()
}
class
PrecipitationCell
:
UITableViewCell
{
//Private
public
var
delegate
:
PrecipitationCellDelegate
?
private
let
headingLabel
=
UILabel
()
private
let
headingButton
=
ArrowButton
()
private
let
minutelyForecastView
=
MinutelyForecastView
()
...
...
@@ -39,8 +44,6 @@ class PrecipitationCell: UITableViewCell {
}
public
func
configure
(
with
dayily
:[
DailyWeather
],
location
:
Location
)
{
//TODO: Hide button for now
headingButton
.
isHidden
=
true
minutelyForecastView
.
configure
(
with
:
location
,
forecastType
:
.
precipitation
)
...
...
@@ -98,7 +101,6 @@ class PrecipitationCell: UITableViewCell {
public
func
configure
(
with
hourly
:[
HourlyWeather
],
location
:
Location
)
{
self
.
headingLabel
.
font
=
AppFont
.
SFPro
.
bold
(
size
:
18
)
self
.
headingButton
.
isHidden
=
true
self
.
headingLabel
.
text
=
"precipitation.title"
.
localized
()
.
capitalized
self
.
headingLabel
.
textColor
=
ThemeManager
.
currentTheme
.
primaryTextColor
...
...
@@ -158,7 +160,7 @@ class PrecipitationCell: UITableViewCell {
//Private
@objc
private
func
handleArrowButton
()
{
self
.
delegate
?
.
precipitationCtaClicked
()
}
@objc
private
func
handlePrecipButton
(
button
:
PrecipButton
)
{
...
...
1Weather/UI/View controllers/Today/Cells/TodayCellFactory.swift
View file @
c65cc864
...
...
@@ -160,6 +160,7 @@ class TodayCellFactory: CellFactory {
return
cell
case
.
precipitation
:
let
cell
=
dequeueReusableCell
(
type
:
PrecipitationCell
.
self
,
tableView
:
tableView
,
indexPath
:
indexPath
)
cell
.
delegate
=
self
if
cellsToUpdate
.
contains
(
.
precipitation
)
{
if
let
location
=
todayViewModel
.
location
{
cell
.
configure
(
with
:
loc
.
daily
,
location
:
location
)
...
...
@@ -284,3 +285,11 @@ extension TodayCellFactory: AdViewDelegate {
}
}
}
extension
TodayCellFactory
:
PrecipitationCellDelegate
{
func
precipitationCtaClicked
()
{
onMain
{
self
.
todayViewModel
.
openForecast
(
timePeriod
:
.
minutely
)
}
}
}
1Weather/ViewModels/TodayViewModel.swift
View file @
c65cc864
...
...
@@ -177,6 +177,10 @@ class TodayViewModel: ViewModelProtocol {
public
func
openShorts
(
atIndex
index
:
Int
)
{
AppCoordinator
.
instance
.
openShorts
(
atIndex
:
index
)
}
public
func
openForecast
(
timePeriod
:
TimePeriod
)
{
AppCoordinator
.
instance
.
openForecast
(
timePeriod
:
timePeriod
)
}
}
//MARK:- LocationManager Delegate
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment