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
4a44766c
Commit
4a44766c
authored
May 26, 2021
by
Dmitriy Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished all "Low" priority issues
parent
615d2924
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
95 additions
and
11 deletions
+95
-11
1Weather.xcworkspace/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
+22
-1
1Weather/Coordinators/SettingsDetailsCoordinator.swift
+4
-0
1Weather/Resources/en.lproj/Localizable.strings
+1
-0
1Weather/UI/Helpers/ForecastTimePeriod/Buttons/ForecastDetailPeriodButton.swift
+1
-1
1Weather/UI/Helpers/ForecastTimePeriod/ForecastTimePeriodView.swift
+1
-1
1Weather/UI/Helpers/ForecastTimePeriod/GraphLine.swift
+3
-2
1Weather/UI/Helpers/ForecastTimePeriod/GraphView.swift
+18
-4
1Weather/UI/View controllers/Forecast/ForecastViewController.swift
+2
-2
1Weather/UI/View controllers/Settings/SettingsDetailsViewController.swift
+1
-0
OneWeatherCore/OneWeatherCore.xcodeproj/project.pbxproj
+6
-0
OneWeatherCore/OneWeatherCore/Extensions/String+NewLine.swift
+16
-0
OneWeatherCore/OneWeatherCore/HelperTypes.swift
+13
-0
OneWeatherCorePlayground.playground/Contents.swift
+2
-0
OneWeatherCorePlayground.playground/contents.xcplayground
+5
-0
No files found.
1Weather.xcworkspace/xcuserdata/dstepanets.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
4a44766c
...
...
@@ -4,6 +4,27 @@
<
d
i
c
t
>
<
k
e
y
>
SchemeUserState
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
OneWeatherCorePlayground
(
Playground
)
1.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
58
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
OneWeatherCorePlayground
(
Playground
)
2.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
59
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
OneWeatherCorePlayground
(
Playground
)
.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
57
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
k
e
y
>
PG
(
Playground
)
1.xcscheme
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
isShown
<
/k
e
y
>
...
...
@@ -51,7 +72,7 @@
<
k
e
y
>
isShown
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
orderHint
<
/k
e
y
>
<
int
e
g
e
r
>
5
4
<
/int
e
g
e
r
>
<
int
e
g
e
r
>
5
6
<
/int
e
g
e
r
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
...
...
1Weather/Coordinators/SettingsDetailsCoordinator.swift
View file @
4a44766c
...
...
@@ -28,6 +28,10 @@ class SettingsDetailsCoordinator:Coordinator {
}
}
func
back
()
{
self
.
navigationController
.
popViewController
(
animated
:
true
)
}
func
viewControllerDidEnd
(
controller
:
UIViewController
)
{
parentCoordinator
?
.
childDidFinish
(
child
:
self
)
}
...
...
1Weather/Resources/en.lproj/Localizable.strings
View file @
4a44766c
...
...
@@ -52,6 +52,7 @@
"forecast.clearNight" = "Clear";
"forecast.partlyCloudyNight" = "Partly Cloudy";
"forecast.thunderstorm" = "Thunderstorm";
"forecast.thunderstorm.newLineIndex" = "7";
"forecast.heavySnow" = "Heavy Snow";
"forecast.lightSnow" = "Light Snow";
"forecast.freezingRain" = "Freezing Rain";
...
...
1Weather/UI/Helpers/ForecastTimePeriod/Buttons/ForecastDetailPeriodButton.swift
View file @
4a44766c
...
...
@@ -110,7 +110,7 @@ class ForecastDetailPeriodButton: UIControl, PeriodButtonProtocol {
}
weatherImageView
.
image
=
dailyWeather
.
type
.
image
(
isDay
:
true
)
weatherTypeLabel
.
text
=
dailyWeather
.
type
.
localized
(
isDay
:
true
)
weatherTypeLabel
.
text
=
dailyWeather
.
type
.
localized
WithNewLine
(
isDay
:
true
)
maxTempLabel
.
text
=
dailyWeather
.
maxTemp
?
.
settingsConverted
.
shortString
minTempLabel
.
text
=
dailyWeather
.
minTemp
?
.
settingsConverted
.
shortString
...
...
1Weather/UI/Helpers/ForecastTimePeriod/ForecastTimePeriodView.swift
View file @
4a44766c
...
...
@@ -32,7 +32,7 @@ class ForecastTimePeriodView: UIView {
//Private
private
let
scrollView
=
UIScrollView
()
private
let
stackView
=
UIStackView
()
private
let
graphView
=
GraphView
()
private
let
graphView
=
GraphView
(
graphInsets
:
.
init
(
top
:
0
,
left
:
8
,
bottom
:
0
,
right
:
8
)
)
private
var
graphRect
:
CGRect
=
.
zero
private
var
currentForecastType
=
ForecastType
.
daily
private
var
dailyGraphPoints
=
DailyGraphPoints
(
maxTempPoints
:
[
CGPoint
](),
minTempPoints
:
[
CGPoint
]())
...
...
1Weather/UI/Helpers/ForecastTimePeriod/GraphLine.swift
View file @
4a44766c
...
...
@@ -56,8 +56,9 @@ struct GraphLine {
private
mutating
func
linePath
(
from
points
:[
CGPoint
])
->
UIBezierPath
{
let
path
=
UIBezierPath
()
let
startPoint
=
CGPoint
(
x
:
0
,
y
:
points
.
first
?
.
y
??
0
)
let
endPoint
=
CGPoint
(
x
:
self
.
onGetGraphRect
()
.
width
,
y
:
points
.
last
?
.
y
??
0
)
let
graphRect
=
self
.
onGetGraphRect
()
let
startPoint
=
CGPoint
(
x
:
graphRect
.
origin
.
x
,
y
:
points
.
first
?
.
y
??
0
)
let
endPoint
=
CGPoint
(
x
:
graphRect
.
width
,
y
:
points
.
last
?
.
y
??
0
)
var
pointsToAdd
=
[
CGPoint
]()
pointsToAdd
.
append
(
startPoint
)
...
...
1Weather/UI/Helpers/ForecastTimePeriod/GraphView.swift
View file @
4a44766c
...
...
@@ -10,6 +10,7 @@ import BezierKit
class
GraphView
:
UIView
{
//Private
private
let
graphInsets
:
UIEdgeInsets
private
let
mainLineSettings
=
GraphLineSettings
(
lineWidth
:
3
,
dotRadius
:
2.5
,
dotLineWidth
:
2
,
...
...
@@ -31,28 +32,41 @@ class GraphView: UIView {
private
lazy
var
mainLine
:
GraphLine
=
{
let
line
=
GraphLine
(
settings
:
mainLineSettings
,
onGetGraphRect
:
{
return
self
.
frame
let
graphFrame
=
CGRect
(
x
:
self
.
frame
.
origin
.
x
+
self
.
graphInsets
.
left
,
y
:
self
.
frame
.
origin
.
y
+
self
.
graphInsets
.
top
,
width
:
self
.
frame
.
width
-
self
.
graphInsets
.
right
,
height
:
self
.
frame
.
height
-
self
.
graphInsets
.
bottom
)
return
graphFrame
})
return
line
}()
private
lazy
var
additionalLine
:
GraphLine
=
{
let
line
=
GraphLine
(
settings
:
additionalLineSettings
,
onGetGraphRect
:
{
return
self
.
frame
let
graphFrame
=
CGRect
(
x
:
self
.
frame
.
origin
.
x
+
self
.
graphInsets
.
left
,
y
:
self
.
frame
.
origin
.
y
+
self
.
graphInsets
.
top
,
width
:
self
.
frame
.
width
-
self
.
graphInsets
.
right
,
height
:
self
.
frame
.
height
-
self
.
graphInsets
.
bottom
)
return
graphFrame
})
return
line
}()
private
lazy
var
windLine
:
GraphLine
=
{
let
line
=
GraphLine
(
settings
:
windLineSettings
,
onGetGraphRect
:
{
return
self
.
frame
let
graphFrame
=
CGRect
(
x
:
self
.
frame
.
origin
.
x
+
self
.
graphInsets
.
left
,
y
:
self
.
frame
.
origin
.
y
+
self
.
graphInsets
.
top
,
width
:
self
.
frame
.
width
-
self
.
graphInsets
.
right
,
height
:
self
.
frame
.
height
-
self
.
graphInsets
.
bottom
)
return
graphFrame
})
return
line
}()
//MARK:- View life cycle
init
()
{
init
(
graphInsets
:
UIEdgeInsets
=
.
zero
)
{
self
.
graphInsets
=
graphInsets
super
.
init
(
frame
:
.
zero
)
self
.
isUserInteractionEnabled
=
false
...
...
1Weather/UI/View controllers/Forecast/ForecastViewController.swift
View file @
4a44766c
...
...
@@ -202,7 +202,7 @@ extension ForecastViewController: UITableViewDelegate {
timePeriodCellFrame
=
tableView
.
cellForRow
(
at
:
[
0
,
0
])?
.
frame
??
.
zero
}
let
startPointY
=
timePeriodCellFrame
.
origin
.
y
+
timePeriodCellFrame
.
height
-
self
.
daysControlView
.
frame
.
height
let
startPointY
:
CGFloat
=
100
//
timePeriodCellFrame.origin.y + timePeriodCellFrame.height - self.daysControlView.frame.height
let
animationDuration
=
TimeInterval
(
UINavigationController
.
hideShowBarDuration
)
if
scrollView
.
contentOffset
.
y
>=
startPointY
{
...
...
@@ -225,7 +225,7 @@ extension ForecastViewController: UITableViewDelegate {
self
.
navigationBarStateBeingChanged
=
false
}
navVC
.
setNavigationBarHidden
(
false
,
animated
:
true
)
UIView
.
animate
(
withDuration
:
0.35
)
{
UIView
.
animate
(
withDuration
:
animationDuration
)
{
self
.
daysControlView
.
alpha
=
0
}
}
...
...
1Weather/UI/View controllers/Settings/SettingsDetailsViewController.swift
View file @
4a44766c
...
...
@@ -83,6 +83,7 @@ extension SettingsDetailsViewController: UITableViewDataSource {
extension
SettingsDetailsViewController
:
UITableViewDelegate
{
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
viewModel
.
selectUnitAtIndex
(
index
:
indexPath
.
row
)
coordinator
.
back
()
}
}
...
...
OneWeatherCore/OneWeatherCore.xcodeproj/project.pbxproj
View file @
4a44766c
...
...
@@ -56,6 +56,7 @@
CD615FC72655295C00B717DB
/* UITabBarController+Hide.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD615FB42655293100B717DB
/* UITabBarController+Hide.swift */
;
};
CD615FC82655295C00B717DB
/* CACornerMask+All.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD615FB52655293100B717DB
/* CACornerMask+All.swift */
;
};
CD615FC92655295C00B717DB
/* UIDevice+Convenience.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD615FB62655293100B717DB
/* UIDevice+Convenience.swift */
;
};
CD71B9C6265E629D00803DBB
/* String+NewLine.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD71B9C5265E629D00803DBB
/* String+NewLine.swift */
;
};
CD91685726552FAE00EC04EF
/* MulticastDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD91685626552FAE00EC04EF
/* MulticastDelegate.swift */
;
};
CD91685826552FD000EC04EF
/* DefaultSettingsFactory.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD615FCE265529DE00B717DB
/* DefaultSettingsFactory.swift */
;
};
CD91685926552FD000EC04EF
/* DefaultSettings.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD615FCF265529DE00B717DB
/* DefaultSettings.swift */
;
};
...
...
@@ -139,6 +140,8 @@
CD615FCF265529DE00B717DB
/* DefaultSettings.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DefaultSettings.swift
;
sourceTree
=
"<group>"
;
};
CD615FD0265529DE00B717DB
/* DefaultSettingsImperial.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DefaultSettingsImperial.swift
;
sourceTree
=
"<group>"
;
};
CD615FD1265529DE00B717DB
/* DefaultSettingsMetric.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DefaultSettingsMetric.swift
;
sourceTree
=
"<group>"
;
};
CD71B9C4265E5F7300803DBB
/* OneWeatherCorePlayground.playground */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.playground
;
name
=
OneWeatherCorePlayground.playground
;
path
=
../OneWeatherCorePlayground.playground
;
sourceTree
=
"<group>"
;
xcLanguageSpecificationIdentifier
=
xcode.lang.swift
;
};
CD71B9C5265E629D00803DBB
/* String+NewLine.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"String+NewLine.swift"
;
sourceTree
=
"<group>"
;
};
CD91685626552FAE00EC04EF
/* MulticastDelegate.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MulticastDelegate.swift
;
sourceTree
=
"<group>"
;
};
CD91685C26552FEB00EC04EF
/* Logger.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Logger.swift
;
sourceTree
=
"<group>"
;
};
CD91685D26552FEC00EC04EF
/* Global.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Global.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -210,6 +213,7 @@
CD615F59265523A400B717DB
=
{
isa
=
PBXGroup
;
children
=
(
CD71B9C4265E5F7300803DBB
/* OneWeatherCorePlayground.playground */
,
CD615F65265523A400B717DB
/* OneWeatherCore */
,
CD615F70265523A400B717DB
/* OneWeatherCoreTests */
,
CD615F64265523A400B717DB
/* Products */
,
...
...
@@ -332,6 +336,7 @@
CD615FB42655293100B717DB
/* UITabBarController+Hide.swift */
,
CD615FB52655293100B717DB
/* CACornerMask+All.swift */
,
CD615FB62655293100B717DB
/* UIDevice+Convenience.swift */
,
CD71B9C5265E629D00803DBB
/* String+NewLine.swift */
,
);
path
=
Extensions
;
sourceTree
=
"<group>"
;
...
...
@@ -551,6 +556,7 @@
CD615FBB2655295C00B717DB
/* UITabBarController+Append.swift in Sources */
,
CD615FBD2655295C00B717DB
/* Measurement+String.swift in Sources */
,
CD615FBE2655295C00B717DB
/* Calendar+TimeZone.swift in Sources */
,
CD71B9C6265E629D00803DBB
/* String+NewLine.swift in Sources */
,
CD91685F26552FEC00EC04EF
/* Global.swift in Sources */
,
CD615FBF2655295C00B717DB
/* UIStackView+RemoveAll.swift in Sources */
,
CD615FC02655295C00B717DB
/* UITableView+HeaderSize.swift in Sources */
,
...
...
OneWeatherCore/OneWeatherCore/Extensions/String+NewLine.swift
0 → 100644
View file @
4a44766c
//
// String+NewLine.swift
// OneWeatherCore
//
// Created by Dmitry Stepanets on 26.05.2021.
//
import
Foundation
extension
String
{
func
addNewLineCharacter
(
at
index
:
Int
)
->
String
{
var
originalString
=
self
originalString
.
insert
(
"
\n
"
,
at
:
originalString
.
index
(
originalString
.
startIndex
,
offsetBy
:
index
))
return
originalString
}
}
OneWeatherCore/OneWeatherCore/HelperTypes.swift
View file @
4a44766c
...
...
@@ -31,6 +31,19 @@ public enum WeatherType: String, CaseIterable {
public
func
localized
(
isDay
:
Bool
)
->
String
{
return
"forecast.
\(
self
.
stringId
(
isDay
:
isDay
)
)
"
.
localized
()
}
public
func
localizedWithNewLine
(
isDay
:
Bool
)
->
String
{
let
localizeId
=
"forecast.
\(
self
.
stringId
(
isDay
:
isDay
)
)
"
let
newLineIndexString
=
"
\(
localizeId
)
.newLineIndex"
.
localized
()
if
let
newLineIndex
=
Int
(
newLineIndexString
)
{
let
localizedString
=
localizeId
.
localized
()
return
localizedString
.
addNewLineCharacter
(
at
:
newLineIndex
)
}
else
{
return
localizeId
.
localized
()
}
}
public
func
image
(
isDay
:
Bool
)
->
UIImage
{
guard
let
result
=
UIImage
(
named
:
self
.
stringId
(
isDay
:
isDay
))
else
{
...
...
OneWeatherCorePlayground.playground/Contents.swift
0 → 100644
View file @
4a44766c
import
UIKit
OneWeatherCorePlayground.playground/contents.xcplayground
0 → 100644
View file @
4a44766c
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground
version=
'5.0'
target-platform=
'ios'
buildActiveScheme=
'true'
importAppTypes=
'true'
>
<timeline
fileName=
'timeline.xctimeline'
/>
</playground>
\ No newline at end of file
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