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
d6a371ca
Commit
d6a371ca
authored
Oct 04, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IOS-183: SmartTextProvider: support for custom smart text configuration.
parent
4ae087ec
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
6 deletions
+8
-6
1Weather/UI/View controllers/Today/Cells/TodayForecastCell.swift
+1
-1
OneWeatherCore/OneWeatherCore/Managers/WidgetManager.swift
+1
-1
OneWeatherCore/OneWeatherCore/Model/SmartTexts/SmartTextProvider.swift
+5
-3
OneWeatherWidget/ViewModels/ForecastWidgetViewModel.swift
+1
-1
No files found.
1Weather/UI/View controllers/Today/Cells/TodayForecastCell.swift
View file @
d6a371ca
...
...
@@ -17,7 +17,7 @@ class TodayForecastCell: UITableViewCell {
private
let
forecastDescriptionLabel
=
UILabel
()
private
let
smartTextLabel
=
UILabel
()
private
let
forecastImageView
=
UIImageView
()
private
let
smartTextProvider
=
SmartTextProvider
()
private
let
smartTextProvider
=
SmartTextProvider
(
prioritizedSmartTexts
:
SmartTextProvider
.
defaultSmartTexts
)
override
init
(
style
:
UITableViewCell
.
CellStyle
,
reuseIdentifier
:
String
?)
{
super
.
init
(
style
:
style
,
reuseIdentifier
:
reuseIdentifier
)
...
...
OneWeatherCore/OneWeatherCore/Managers/WidgetManager.swift
View file @
d6a371ca
...
...
@@ -108,7 +108,7 @@ public class WidgetManager {
self
.
widgetOptions
=
WidgetOptions
(
rawValue
:
storedWidgetsOptions
)
}
private
let
log
=
Logger
(
componentName
:
"WidgetManager"
)
private
let
smartTextProvider
=
SmartTextProvider
()
private
let
smartTextProvider
=
SmartTextProvider
(
prioritizedSmartTexts
:
SmartTextProvider
.
defaultSmartTexts
)
private
var
widgetOptions
:
WidgetOptions
=
[]
public
func
refreshAnalytics
()
{
...
...
OneWeatherCore/OneWeatherCore/Model/SmartTexts/SmartTextProvider.swift
View file @
d6a371ca
...
...
@@ -8,7 +8,7 @@
import
Foundation
public
class
SmartTextProvider
{
p
rivate
var
prioritized
SmartTexts
:
[
SmartText
]
=
[
p
ublic
static
let
default
SmartTexts
:
[
SmartText
]
=
[
OngoingPrecipitationSmartText
(),
ApproachingPrecipitationSmartText
(),
WindSmartText
(
minAllowedWindSpeed
:
WindSpeed
(
value
:
75
,
unit
:
.
kilometersPerHour
)),
...
...
@@ -17,8 +17,10 @@ public class SmartTextProvider {
DefaultSmartText
()]
public
init
()
{
private
let
prioritizedSmartTexts
:
[
SmartText
]
public
init
(
prioritizedSmartTexts
:
[
SmartText
])
{
self
.
prioritizedSmartTexts
=
prioritizedSmartTexts
}
public
func
smartText
(
for
location
:
Location
)
->
String
{
...
...
OneWeatherWidget/ViewModels/ForecastWidgetViewModel.swift
View file @
d6a371ca
...
...
@@ -121,7 +121,7 @@ struct ForecastWidgetViewModel: WidgetViewModel {
self
.
showLastTimeUpdated
=
false
lastTimeUpdatedText
=
""
}
let
smartTextProvider
=
SmartTextProvider
()
let
smartTextProvider
=
SmartTextProvider
(
prioritizedSmartTexts
:
SmartTextProvider
.
defaultSmartTexts
)
self
.
smartText
=
smartTextProvider
.
smartText
(
for
:
location
)
self
.
hourlyWeather
=
convertToWidgetHourly
(
modelHourly
:
location
.
hourly
)
...
...
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