Skip to content

Commit

Permalink
Merge pull request #31 from fassko/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
fassko authored Apr 18, 2020
2 parents 3899207 + 9b3ee34 commit e5df541
Show file tree
Hide file tree
Showing 51 changed files with 937 additions and 171 deletions.
4 changes: 4 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ included:
- MeteoLVUITests
excluded:
- Pods

identifier_name:
excluded:
- id

disabled_rules:
- trailing_whitespace
Expand Down
Binary file modified Assets.sketch
Binary file not shown.
289 changes: 266 additions & 23 deletions MeteoLV.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>MeteoLVTodayNotification.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
Expand Down
7 changes: 0 additions & 7 deletions MeteoLV.xcworkspace/contents.xcworkspacedata

This file was deleted.

25 changes: 0 additions & 25 deletions MeteoLV.xcworkspace/xcshareddata/swiftpm/Package.resolved

This file was deleted.

12 changes: 12 additions & 0 deletions MeteoLV/Assets.xcassets/favorites-full.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "favorites-full.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
12 changes: 12 additions & 0 deletions MeteoLV/Assets.xcassets/favorites.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "favorites.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
12 changes: 12 additions & 0 deletions MeteoLV/Assets.xcassets/home-full.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "home-full.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
12 changes: 12 additions & 0 deletions MeteoLV/Assets.xcassets/home.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "home.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file added MeteoLV/Assets.xcassets/home.imageset/home.pdf
Binary file not shown.
22 changes: 22 additions & 0 deletions MeteoLV/Assets.xcassets/temperature.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "temperature.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "temperature-dark.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Binary file not shown.
22 changes: 22 additions & 0 deletions MeteoLV/Assets.xcassets/wind.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "wind.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "wind-dark.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Binary file added MeteoLV/Assets.xcassets/wind.imageset/wind.pdf
Binary file not shown.
22 changes: 16 additions & 6 deletions MeteoLV/Core/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,38 @@ import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?
var mapCoordinator: MainCoordinator?
var listCoordinatopr: ListCoordinator?
var mapCoordinator: MapViewCooordinator?
var favoritesCoordinator: FavoritesViewCoordinator?
var listCoordinator: ListCoordinator?

func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

let mapNavigationController = UINavigationController()
mapCoordinator = MainCoordinator(navigationController: mapNavigationController)
mapCoordinator = MapViewCooordinator(navigationController: mapNavigationController)
mapCoordinator?.start()
let mapTabBarItem = UITabBarItem(title: "Map".localized, image: UIImage(named: "map"), tag: 0)
mapTabBarItem.accessibilityLabel = "Map"
mapNavigationController.tabBarItem = mapTabBarItem

let favoritesNavigationController = UINavigationController()
favoritesCoordinator = FavoritesViewCoordinator(navigationController: favoritesNavigationController)
favoritesCoordinator?.start()
let favoritesTabBarItem = UITabBarItem(title: "Favorites".localized, image: UIImage(named: "favorites"), tag: 0)
favoritesTabBarItem.accessibilityLabel = "Favorites"
favoritesNavigationController.tabBarItem = favoritesTabBarItem

let listNavigationController = UINavigationController()
listCoordinatopr = ListCoordinator(navigationController: listNavigationController)
listCoordinatopr?.start()
listCoordinator = ListCoordinator(navigationController: listNavigationController)
listCoordinator?.start()
let listTabBarItem = UITabBarItem(title: "List".localized, image: UIImage(named: "list"), tag: 0)
listTabBarItem.accessibilityLabel = "List"
listNavigationController.tabBarItem = listTabBarItem

let tabBarController = UITabBarController()
tabBarController.viewControllers = [mapNavigationController, listNavigationController]
tabBarController.viewControllers = [mapNavigationController,
favoritesNavigationController,
listNavigationController]

window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = tabBarController
Expand Down
16 changes: 16 additions & 0 deletions MeteoLV/Core/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,20 @@ import UIKit
enum Constants {
static var meteoLVTintColor = UIColor(red: 0.05, green: 0.29, blue: 0.53, alpha: 1.0)
static var roadsTintColor = UIColor.lightGray
static let favoritesKey = "favorites"
}

public let defaults = UserDefaults.standard

public extension UserDefaults {
var favorites: [String] {
stringArray(forKey: Constants.favoritesKey) ?? []
}
}

extension UIImage {
static let favoritesFull = UIImage(named: "favorites-full")
static let favorites = UIImage(named: "favorites")
static let homeFull = UIImage(named: "home-full")
static let home = UIImage(named: "home")
}
32 changes: 32 additions & 0 deletions MeteoLV/Core/FavoritesViewCoordinator.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// FavoritesViewCoordinator.swift
// MeteoLV
//
// Created by Kristaps Grinbergs on 06/04/2020.
// Copyright © 2020 fassko. All rights reserved.
//

import Foundation
import UIKit

import MeteoLVProvider

class FavoritesViewCoordinator: ListCoordinatorProtocol {
var navigationController: UINavigationController

init(navigationController: UINavigationController) {
self.navigationController = navigationController
}

func start() {
let favoritesTableViewController = FavoritesTableViewController.instantiate()
favoritesTableViewController.coordinator = self
navigationController.pushViewController(favoritesTableViewController, animated: false)
}

func showObservationStation(_ station: ObservationStation) {
let stationViewController = StationViewController.instantiate()
stationViewController.station = station
navigationController.pushViewController(stationViewController, animated: true)
}
}
5 changes: 3 additions & 2 deletions MeteoLV/Core/ListCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import Foundation
import UIKit

class ListCoordinator: Coordinator {
import MeteoLVProvider

class ListCoordinator: ListCoordinatorProtocol {
var navigationController: UINavigationController

init(navigationController: UINavigationController) {
Expand All @@ -27,5 +29,4 @@ class ListCoordinator: Coordinator {
stationViewController.station = station
navigationController.pushViewController(stationViewController, animated: true)
}

}
15 changes: 15 additions & 0 deletions MeteoLV/Core/ListCoordinatorProtocol.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// ListCoordinatorProtocol.swift
// MeteoLV
//
// Created by Kristaps Grinbergs on 06/04/2020.
// Copyright © 2020 fassko. All rights reserved.
//

import Foundation

import MeteoLVProvider

protocol ListCoordinatorProtocol: Coordinator {
func showObservationStation(_ station: ObservationStation)
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
//
// MainCoordinator.swift
// MapViewCooordinator.swift
// MeteoLV
//
// Created by Kristaps Grinbergs on 28/10/2018.
// Copyright © 2018 fassko. All rights reserved.
//

import Foundation

import UIKit

class MainCoordinator: Coordinator {
import MeteoLVProvider

class MapViewCooordinator: Coordinator {
var navigationController: UINavigationController

init(navigationController: UINavigationController) {
Expand Down
35 changes: 35 additions & 0 deletions MeteoLV/Favorites/FavoritesTableViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// FavoritesTableViewController.swift
// MeteoLV
//
// Created by Kristaps Grinbergs on 18/04/2020.
// Copyright © 2020 fassko. All rights reserved.
//

import Foundation
import os.log

class FavoritesTableViewController: ListingTableViewController, Storyboarded {
override func viewDidLoad() {
super.viewDidLoad()

title = "Favorites".localized
}

override func loadData() {
meteoDataProvider.observations { [weak self] result in
switch result {
case .success(let observationStations):
self?.stations.removeAll()
let stations = observationStations.filter { $0.isFavorited }.sorted(by: ==)
self?.stations.append(contentsOf: stations)

DispatchQueue.main.async {
self?.tableView.reloadData()
}
case let .failure(error):
os_log("%s", log: OSLog.standard, type: OSLogType.error, error.localizedDescription)
}
}
}
}
2 changes: 1 addition & 1 deletion MeteoLV/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<string>1.8</string>
<key>CFBundleVersion</key>
<string>1.7.200405.2256</string>
<key>Fabric</key>
Expand Down
6 changes: 1 addition & 5 deletions MeteoLV/InfoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ class InfoViewController: UIViewController, Storyboarded {
super.viewDidLoad()

//swiftlint:disable line_length
infoTextView.text = """
Weather Latvia shows current weather observations in Latvia. Data comes from Latvian Environment, Geology and Meteorology Centre and Latvian State Roads.
App is maintained by Kristaps Grinbergs and open sourced at https://github.com/fassko/MeteoLV
"""
infoTextView.text = "Weather Latvia shows current weather observations in Latvia. Data comes from Latvian Environment, Geology and Meteorology Centre and Latvian State Roads.\n\nApp is maintained by Kristaps Grinbergs and open sourced at https://github.com/fassko/MeteoLV".localized
infoTextView.accessibilityLabel = "Description"
}
}
Loading

0 comments on commit e5df541

Please sign in to comment.