Merge branch 'github-domain-redirect'

This commit is contained in:
Davide De Rosa 2018-12-06 10:48:49 +01:00
commit 6b5590c331
4 changed files with 23 additions and 3 deletions

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- Infrastructures not refreshed. [#29](https://github.com/passepartoutvpn/passepartout-ios/issues/29)
## 1.0 RC4 1271 (2018-12-04)
### Changed

File diff suppressed because one or more lines are too long

View File

@ -154,7 +154,7 @@ class AppConstants {
class Repos {
private static let githubRoot = URL(string: "https://github.com/passepartoutvpn/")!
private static let githubRawRoot = URL(string: "https://passepartoutvpn.github.io/")!
private static let githubRawRoot = URL(string: "https://\(Domain.name)/")!
private static func github(repo: String) -> URL {
return githubRoot.appendingPathComponent(repo)

View File

@ -136,7 +136,21 @@ class InfrastructureFactory {
self.lastUpdate[name] = Date()
}
guard let response = response, let infra = response.value, let lastModified = response.lastModified else {
guard let response = response else {
log.error("No response from web service")
DispatchQueue.main.async {
completionHandler(nil, error)
}
return
}
if response.isCached {
log.debug("Cache is up to date")
DispatchQueue.main.async {
completionHandler(nil, error)
}
return
}
guard let infra = response.value, let lastModified = response.lastModified else {
log.error("No response from web service or missing Last-Modified")
DispatchQueue.main.async {
completionHandler(nil, error)