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
3e506463
Commit
3e506463
authored
Apr 24, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Search is closed properly.
parent
b1d774af
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
9 deletions
+3
-9
1Weather/UI/View controllers/Locations/LocationViewController.swift
+1
-3
1Weather/UI/View controllers/Locations/LocationsViewModel.swift
+2
-6
No files found.
1Weather/UI/View controllers/Locations/LocationViewController.swift
View file @
3e506463
...
...
@@ -202,7 +202,7 @@ extension LocationViewController: LocationsViewModelDelegate {
self
.
showAlert
(
withTitle
:
title
,
message
:
message
)
}
func
viewModelDidSelectCity
(
model
:
LocationsViewModel
,
city
:
Location
)
{
func
viewModelDidSelectCity
(
model
:
LocationsViewModel
)
{
close
()
}
}
...
...
@@ -353,8 +353,6 @@ extension LocationViewController: UITableViewDelegate {
// analytics(log: .ANALYTICS_FTUE_SEARCH_POPULAR)
// }
}
self
.
close
()
//TODO: should be done from ViewModel?
}
}
...
...
1Weather/UI/View controllers/Locations/LocationsViewModel.swift
View file @
3e506463
...
...
@@ -12,7 +12,7 @@ public protocol LocationsViewModelDelegate:class {
func
viewModelDidChange
(
model
:
LocationsViewModel
)
func
viewModelDisplayModeDidChange
(
model
:
LocationsViewModel
)
func
viewModelError
(
model
:
LocationsViewModel
,
title
:
String
?,
message
:
String
?)
func
viewModelDidSelectCity
(
model
:
LocationsViewModel
,
city
:
Location
)
func
viewModelDidSelectCity
(
model
:
LocationsViewModel
)
}
public
enum
LocationsViewModelDisplayMode
{
...
...
@@ -192,8 +192,7 @@ public class LocationsViewModel {
return
}
locationManager
.
addIfNeeded
(
partialLocation
:
city
,
selectLocation
:
true
)
// TODO: close View Controller here, otherwise we can't choose already selected city.
// Currently it's done in the didSelectRow method in the VC.
self
.
delegate
?
.
viewModelDidSelectCity
(
model
:
self
)
}
func
delete
(
city
:
PartialLocation
)
{
...
...
@@ -232,9 +231,6 @@ extension LocationsViewModel: LocationManagerDelegate {
public
func
locationManager
(
_
locationManager
:
LocationManager
,
changedSelectedLocation
newLocation
:
Location
?)
{
DispatchQueue
.
main
.
async
{
self
.
delegate
?
.
viewModelDidChange
(
model
:
self
)
if
let
location
=
newLocation
{
self
.
delegate
?
.
viewModelDidSelectCity
(
model
:
self
,
city
:
location
)
}
}
}
...
...
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