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
ce7fd2d1
Commit
ce7fd2d1
authored
Apr 01, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Health model improvements.
parent
ca3c2cd5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
4 deletions
+65
-4
1Weather/Model/ModelObjects/Health/Health.swift
+57
-4
1Weather/Resources/en.lproj/Localizable.strings
+8
-0
No files found.
1Weather/Model/ModelObjects/Health/Health.swift
View file @
ce7fd2d1
...
@@ -16,13 +16,66 @@ public struct Health: Equatable, Hashable {
...
@@ -16,13 +16,66 @@ public struct Health: Equatable, Hashable {
public
struct
AirQuality
:
Equatable
,
Hashable
{
public
struct
AirQuality
:
Equatable
,
Hashable
{
public
let
index
:
Double
public
let
index
:
Double
public
let
airQualityDescription
:
String
?
// long name to differentiate from Swift's .description
public
let
advice
:
String
//TODO: support for localization
public
let
color
:
UIColor
public
var
status
:
HealthStatus
{
get
{
HealthStatus
(
value
:
index
)
}
}
}
public
enum
HealthStatus
:
String
{
case
good
=
"health.airquality.status.good"
case
moderate
=
"health.airquality.status.moderate"
case
unhealthyForSensitiveGroups
=
"health.airquality.status.unhealthyForSensitiveGroups"
case
unhealthy
=
"health.airquality.status.unhealthy"
case
veryUnhealthy
=
"health.airquality.status.veryUnhealthy"
case
hazardous
=
"health.airquality.status.hazardous"
public
init
(
value
:
Double
)
{
switch
value
{
case
0
...
50
:
self
=
.
good
case
51
...
100
:
self
=
.
moderate
case
101
...
150
:
self
=
.
unhealthyForSensitiveGroups
case
151
...
200
:
self
=
.
unhealthy
case
201
...
300
:
self
=
.
veryUnhealthy
default
:
self
=
.
hazardous
}
}
public
var
localized
:
String
{
return
self
.
rawValue
.
localized
()
}
public
var
gradientColorStart
:
UIColor
{
get
{
#warning("Not implemented!")
//TODO: Implement!
return
UIColor
.
green
}
}
public
var
gradientColorEnd
:
UIColor
{
get
{
#warning("Not implemented!")
//TODO: Implement!
return
UIColor
.
red
}
}
}
}
public
struct
Pollutant
:
Equatable
,
Hashable
{
public
struct
Pollutant
:
Equatable
,
Hashable
{
public
let
name
:
String
public
let
name
:
String
public
let
value
:
Double
public
let
value
:
Double
public
let
color
:
UIColor
public
var
status
:
HealthStatus
{
public
let
status
:
String
get
{
HealthStatus
(
value
:
value
)
}
}
}
}
1Weather/Resources/en.lproj/Localizable.strings
View file @
ce7fd2d1
...
@@ -141,3 +141,11 @@
...
@@ -141,3 +141,11 @@
"settings.language" = "Language";
"settings.language" = "Language";
"settings.manageNotifications" = "Manage Notifications";
"settings.manageNotifications" = "Manage Notifications";
"settings.locationAccess" = "Locations Access";
"settings.locationAccess" = "Locations Access";
// Health
"health.airquality.status.good" = "Good";
"health.airquality.status.moderate" = "Moderate";
"health.airquality.status.unhealthyForSensitiveGroups" = "Unhealthy For Sensitive Groups";
"health.airquality.status.unhealthy" = "Unhealthy";
"health.airquality.status.veryUnhealthy" = "Very Unhealthy";
"health.airquality.status.hazardous" = "Hazardous";
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