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
101c4b9f
Commit
101c4b9f
authored
May 04, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IOS-61: different default measurements for US / non-US.
parent
5d73acf9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
7 deletions
+112
-7
1Weather.xcodeproj/project.pbxproj
+33
-1
1Weather/Model/Settings/DefaultSettings/DefaultSettings.swift
+17
-0
1Weather/Model/Settings/DefaultSettings/DefaultSettingsFactory.swift
+22
-0
1Weather/Model/Settings/DefaultSettings/DefaultSettingsImperial.swift
+17
-0
1Weather/Model/Settings/DefaultSettings/DefaultSettingsMetric.swift
+17
-0
1Weather/Model/Settings/Settings.swift
+6
-6
No files found.
1Weather.xcodeproj/project.pbxproj
View file @
101c4b9f
...
...
@@ -196,6 +196,10 @@
CE13B97C2626FB11007CBD4D
/* PSMLocationSDK.xcframework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE13B7DC262478E7007CBD4D
/* PSMLocationSDK.xcframework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
CE13B98726273236007CBD4D
/* NWSAlert.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE13B98626273236007CBD4D
/* NWSAlert.swift */
;
};
CE14445F2638B6CF008E2162
/* StoreKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE14445E2638B6CF008E2162
/* StoreKit.framework */
;
};
CE1842CB264164900001D8E4
/* DefaultSettings.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE1842CA264164900001D8E4
/* DefaultSettings.swift */
;
};
CE1842CE264164C50001D8E4
/* DefaultSettingsImperial.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE1842CD264164C50001D8E4
/* DefaultSettingsImperial.swift */
;
};
CE1842D1264164D90001D8E4
/* DefaultSettingsFactory.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE1842D0264164D90001D8E4
/* DefaultSettingsFactory.swift */
;
};
CE1842D4264164E90001D8E4
/* DefaultSettingsMetric.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE1842D3264164E90001D8E4
/* DefaultSettingsMetric.swift */
;
};
CE28474F26159857006C8DC5
/* HealthSource.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE28474E26159857006C8DC5
/* HealthSource.swift */
;
};
CE28475226159A32006C8DC5
/* BlendHealthModels.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE28475126159A32006C8DC5
/* BlendHealthModels.swift */
;
};
CE28475D2615A5B3006C8DC5
/* Health.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CE28475C2615A5B3006C8DC5
/* Health.swift */
;
};
...
...
@@ -524,6 +528,10 @@
CE13B98626273236007CBD4D
/* NWSAlert.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NWSAlert.swift
;
sourceTree
=
"<group>"
;
};
CE14445D2638B6A8008E2162
/* 1Weather.entitlements */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.entitlements
;
path
=
1Weather.entitlements
;
sourceTree
=
"<group>"
;
};
CE14445E2638B6CF008E2162
/* StoreKit.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
StoreKit.framework
;
path
=
System/Library/Frameworks/StoreKit.framework
;
sourceTree
=
SDKROOT
;
};
CE1842CA264164900001D8E4
/* DefaultSettings.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DefaultSettings.swift
;
sourceTree
=
"<group>"
;
};
CE1842CD264164C50001D8E4
/* DefaultSettingsImperial.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DefaultSettingsImperial.swift
;
sourceTree
=
"<group>"
;
};
CE1842D0264164D90001D8E4
/* DefaultSettingsFactory.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DefaultSettingsFactory.swift
;
sourceTree
=
"<group>"
;
};
CE1842D3264164E90001D8E4
/* DefaultSettingsMetric.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DefaultSettingsMetric.swift
;
sourceTree
=
"<group>"
;
};
CE28474E26159857006C8DC5
/* HealthSource.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
HealthSource.swift
;
sourceTree
=
"<group>"
;
};
CE28475126159A32006C8DC5
/* BlendHealthModels.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BlendHealthModels.swift
;
sourceTree
=
"<group>"
;
};
CE28475C2615A5B3006C8DC5
/* Health.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Health.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1340,6 +1348,26 @@
path
=
Notifications
;
sourceTree
=
"<group>"
;
};
CE1842A12641647E0001D8E4
/* Settings */
=
{
isa
=
PBXGroup
;
children
=
(
CD37D3EA260DD30F002669D6
/* Settings.swift */
,
CE1842D6264165130001D8E4
/* DefaultSettings */
,
);
path
=
Settings
;
sourceTree
=
"<group>"
;
};
CE1842D6264165130001D8E4
/* DefaultSettings */
=
{
isa
=
PBXGroup
;
children
=
(
CE1842D0264164D90001D8E4
/* DefaultSettingsFactory.swift */
,
CE1842CA264164900001D8E4
/* DefaultSettings.swift */
,
CE1842CD264164C50001D8E4
/* DefaultSettingsImperial.swift */
,
CE1842D3264164E90001D8E4
/* DefaultSettingsMetric.swift */
,
);
path
=
DefaultSettings
;
sourceTree
=
"<group>"
;
};
CE28474C261597EB006C8DC5
/* Health */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -1477,7 +1505,7 @@
CEAFF0A025E0FEF100DF4EBF
/* ModelObjects */
,
CEAFF0A225E0FF0800DF4EBF
/* LocationManager.swift */
,
CEF959A526035A2600975FAA
/* DeviceLocationMonitor.swift */
,
C
D37D3EA260DD30F002669D6
/* Settings.swift
*/
,
C
E1842A12641647E0001D8E4
/* Settings
*/
,
CE6BE4932634170800626822
/* USStateCode.swift */
,
CE895F0E26393FD800214175
/* WeatherImageProvider.swift */
,
CE6F5F0B263C8B3C00973137
/* SmartTextProvider.swift */
,
...
...
@@ -1919,6 +1947,7 @@
87C171F425FF7A4000DA3464
/* PopularCitiesManager.swift in Sources */
,
87C1724925FF94F400DA3464
/* ConfigManager.swift in Sources */
,
CE9D181925ECB9A70028D9D7
/* Logger.swift in Sources */
,
CE1842D1264164D90001D8E4
/* DefaultSettingsFactory.swift in Sources */
,
CE8962AE26175DF500CA274A
/* CoreLocation.swift in Sources */
,
CD67616A262575CD0079D273
/* MapLegendGradientView.swift in Sources */
,
CE578FD325F7E89400E8B85D
/* DayTimeWeather.swift in Sources */
,
...
...
@@ -1932,6 +1961,7 @@
CE13B80F262480B3007CBD4D
/* BRNativeBannerContainerView.swift in Sources */
,
CD6761842625B6A10079D273
/* RadarLayersCellFactory.swift in Sources */
,
CD67617C2625A60B0079D273
/* MapLayersDismissAnimator.swift in Sources */
,
CE1842CB264164900001D8E4
/* DefaultSettings.swift in Sources */
,
CEAFF08C25DFC6BD00DF4EBF
/* DailyWeather.swift in Sources */
,
CEDE4F0B25EFA3A7007457E9
/* UpdatableModelObject.swift in Sources */
,
CE3A36C72638A77E002CACC3
/* BlendFIPSSource.swift in Sources */
,
...
...
@@ -2042,6 +2072,7 @@
CE9F01C1261B3776009BA500
/* CoreDataUtils.swift in Sources */
,
CD67616D262587D30079D273
/* UITabBarController+Hide.swift in Sources */
,
CDC6126225E8DAB800188DA7
/* MoonPhaseCell.swift in Sources */
,
CE1842CE264164C50001D8E4
/* DefaultSettingsImperial.swift in Sources */
,
CEBAC2122638968D00A89681
/* FIPSSource.swift in Sources */
,
CD37D3D6260C93B3002669D6
/* MenuCellFactory.swift in Sources */
,
CD8B60AD263819400055CB3F
/* NWSAlertInfoBlockTableViewCell.swift in Sources */
,
...
...
@@ -2145,6 +2176,7 @@
CD86246C25E6826A0097F3FB
/* InnerShadowLayer.swift in Sources */
,
CE578FE525FB415F00E8B85D
/* CityCell.swift in Sources */
,
87D81582262EFC9B0015A6D1
/* Notifications.swift in Sources */
,
CE1842D4264164E90001D8E4
/* DefaultSettingsMetric.swift in Sources */
,
CEAFF0A325E0FF0800DF4EBF
/* LocationManager.swift in Sources */
,
CE13B7E226247BF9007CBD4D
/* UserDefaultsValue.swift in Sources */
,
CEAD00A12577B2D5003596AD
/* StuffThatIsPresentInTheMainProject.swift in Sources */
,
...
...
1Weather/Model/Settings/DefaultSettings/DefaultSettings.swift
0 → 100644
View file @
101c4b9f
//
// DefaultSettings.swift
// 1Weather
//
// Created by Demid Merzlyakov on 04.05.2021.
//
import
Foundation
public
protocol
DefaultSettings
{
var
temperatureType
:
UnitTemperature
{
get
}
var
windSpeedType
:
UnitSpeed
{
get
}
var
pressureType
:
UnitPressure
{
get
}
var
distanceType
:
UnitLength
{
get
}
var
pinnedLayerIds
:
[
String
]
{
get
}
var
selectedLayerId
:
String
{
get
}
}
1Weather/Model/Settings/DefaultSettings/DefaultSettingsFactory.swift
0 → 100644
View file @
101c4b9f
//
// DefaultSettingsFactory.swift
// 1Weather
//
// Created by Demid Merzlyakov on 04.05.2021.
//
import
Foundation
public
class
DefaultSettingsFactory
{
public
func
getSettings
()
->
DefaultSettings
{
let
log
=
Logger
(
componentName
:
"Settings"
)
let
isLocaleMetric
=
Locale
.
current
.
usesMetricSystem
log
.
info
(
"Use
\(
isLocaleMetric
?
"Metric"
:
"Imperial (USA)"
)
default values"
)
if
isLocaleMetric
{
return
DefaultSettingsMetric
()
}
else
{
return
DefaultSettingsImperial
()
}
}
}
1Weather/Model/Settings/DefaultSettings/DefaultSettingsImperial.swift
0 → 100644
View file @
101c4b9f
//
// DefaultSettingsImperial.swift
// 1Weather
//
// Created by Demid Merzlyakov on 04.05.2021.
//
import
Foundation
struct
DefaultSettingsImperial
:
DefaultSettings
{
let
temperatureType
:
UnitTemperature
=
.
fahrenheit
let
windSpeedType
:
UnitSpeed
=
.
milesPerHour
let
pressureType
:
UnitPressure
=
.
inchesOfMercury
let
distanceType
:
UnitLength
=
.
miles
let
pinnedLayerIds
:
[
String
]
=
[]
let
selectedLayerId
:
String
=
WeatherLayerType
.
radar
.
rawValue
}
1Weather/Model/Settings/DefaultSettings/DefaultSettingsMetric.swift
0 → 100644
View file @
101c4b9f
//
// DefaultSettingsMetric.swift
// 1Weather
//
// Created by Demid Merzlyakov on 04.05.2021.
//
import
Foundation
struct
DefaultSettingsMetric
:
DefaultSettings
{
let
temperatureType
:
UnitTemperature
=
.
celsius
let
windSpeedType
:
UnitSpeed
=
.
metersPerSecond
let
pressureType
:
UnitPressure
=
.
millimetersOfMercury
let
distanceType
:
UnitLength
=
.
kilometers
let
pinnedLayerIds
:
[
String
]
=
[]
let
selectedLayerId
:
String
=
WeatherLayerType
.
radar
.
rawValue
}
1Weather/Model/Settings.swift
→
1Weather/Model/Settings
/Settings
.swift
View file @
101c4b9f
...
...
@@ -45,26 +45,26 @@ class Settings {
}
@UserDefaultsUnitValue(key: "temperature_type")
public
var
temperatureType
=
UnitTemperature
.
celsius
public
var
temperatureType
=
DefaultSettingsFactory
()
.
getSettings
()
.
temperatureType
@UserDefaultsUnitValue(key: "wind_speed_type")
public
var
windSpeedType
=
UnitSpeed
.
milesPerHour
public
var
windSpeedType
=
DefaultSettingsFactory
()
.
getSettings
()
.
windSpeedType
@UserDefaultsUnitValue(key: "pressure_type")
public
var
pressureType
=
UnitPressure
.
millibars
public
var
pressureType
=
DefaultSettingsFactory
()
.
getSettings
()
.
pressureType
@UserDefaultsUnitValue(key: "distance_type")
public
var
distanceType
=
UnitLength
.
miles
public
var
distanceType
=
DefaultSettingsFactory
()
.
getSettings
()
.
distanceType
public
var
locale
:
Locale
{
return
Locale
(
identifier
:
Localize
.
currentLanguage
())
}
@UserDefaultsBasicValue(key: "pinnedLayers")
public
var
pinnedLayerIds
:[
String
]
=
[]
public
var
pinnedLayerIds
:[
String
]
=
DefaultSettingsFactory
()
.
getSettings
()
.
pinnedLayerIds
@UserDefaultsBasicValue(key: "selectedLayer")
public
var
selectedLayerId
:
String
=
WeatherLayerType
.
radar
.
rawValue
public
var
selectedLayerId
:
String
=
DefaultSettingsFactory
()
.
getSettings
()
.
selectedLayerId
#warning("Not implemented!")
//TODO: implement store in UserDefaults and configure via UI in debug builds.
...
...
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