Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit c527846

Browse files
romanklBasThomas
authored andcommitted
switch from the now deprecated to the new status page (#2547)
* switch from the now deprecated to the new statuspage the "old" status page https://status.github.com is no deprecated and GitHub switched to a statuspage.io implementation with https://githubstatus.com. The page mentions the deprecation. This PR switches the url to the new status page and changes the status API model for the new REST-response. The new API replaced the `good` state with the state `none`. And has more fields, that are probably not relevant for the App. * Only set the status' text once * Introduce a dark red for the critical API status * Add a space * Add "www."-prefix to prevent redirects
1 parent 4986fd7 commit c527846

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

Classes/Settings/SettingsViewController.swift

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,13 @@ GitHubSessionListener {
8484
strongSelf.apiStatusView.isHidden = true
8585
strongSelf.apiStatusLabel.text = NSLocalizedString("error", comment: "")
8686
case .success(let response):
87-
let text: String
87+
let text = response.data.status.description
8888
let color: UIColor
89-
switch response.data.status {
90-
case .good:
91-
text = NSLocalizedString("Good", comment: "")
92-
color = Styles.Colors.Green.medium.color
93-
case .minor:
94-
text = NSLocalizedString("Minor", comment: "")
95-
color = Styles.Colors.Yellow.medium.color
96-
case .major:
97-
text = NSLocalizedString("Major", comment: "")
98-
color = Styles.Colors.Red.medium.color
89+
switch response.data.status.indicator {
90+
case .none: color = Styles.Colors.Green.medium.color
91+
case .minor: color = Styles.Colors.Yellow.medium.color
92+
case .major: color = Styles.Colors.Red.medium.color
93+
case .critical: color = Styles.Colors.Red.dark.color
9994
}
10095
strongSelf.apiStatusView.isHidden = false
10196
strongSelf.apiStatusView.backgroundColor = color
@@ -146,7 +141,7 @@ GitHubSessionListener {
146141
}
147142

148143
private func onGitHubStatus() {
149-
guard let url = URLBuilder(host: "status.github.com").add(path: "messages").url
144+
guard let url = URLBuilder(host: "www.githubstatus.com").url
150145
else { return }
151146
presentSafari(url: url)
152147
}

Classes/Views/Styles.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ enum Styles {
9191
static let splitViewBackground = UIColor(red: 0.556863, green: 0.556863, blue: 0.576471, alpha: 1)
9292

9393
enum Red {
94+
static let dark = "75151d"
9495
static let medium = "cb2431"
9596
static let light = "ffeef0"
9697
}

Local Pods/GitHubAPI/GitHubAPI/GitHubAPIStatusRequest.swift

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@
99
import Foundation
1010

1111
public struct APIStatus: Codable {
12-
public enum StatusType: String, Codable {
13-
case good, minor, major
12+
public let status: Status
13+
}
14+
15+
public struct Status: Codable {
16+
public let indicator: StatusType
17+
public let description: String
18+
19+
public enum StatusType: String, Codable, CodingKey {
20+
case none, minor, major, critical
1421
}
15-
public let status: StatusType
1622
}
1723

24+
1825
public struct GitHubAPIStatusRequest: HTTPRequest {
1926
public typealias ResponseType = V3DataResponse<APIStatus>
20-
public var url: String { return "https://status.github.com/api/status.json" }
27+
public var url: String { return "https://www.githubstatus.com/api/v2/status.json" }
2128
public var logoutOnAuthFailure: Bool { return false }
2229
public var method: HTTPMethod { return .get }
2330
public var parameters: [String : Any]? { return nil }

0 commit comments

Comments
 (0)