Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Classes/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ GitHubSessionListener {
case .success(let response):
let text: String
let color: UIColor
switch response.data.status {
case .good:
text = NSLocalizedString("Good", comment: "")
text = response.data.status.description
switch response.data.status.indicator {
case .normal:
color = Styles.Colors.Green.medium.color
case .minor:
text = NSLocalizedString("Minor", comment: "")
color = Styles.Colors.Yellow.medium.color
case .major:
text = NSLocalizedString("Major", comment: "")
color = Styles.Colors.Orange.medium.color
case .critical:
color = Styles.Colors.Red.medium.color
}
strongSelf.apiStatusView.isHidden = false
Expand Down Expand Up @@ -146,7 +146,7 @@ GitHubSessionListener {
}

private func onGitHubStatus() {
guard let url = URLBuilder(host: "status.github.com").add(path: "messages").url
guard let url = URLBuilder(host: "www.githubstatus.com").url
else { return }
presentSafari(url: url)
}
Expand Down
5 changes: 5 additions & 0 deletions Classes/Views/Styles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ enum Styles {
static let light = "f1f8ff"
static let menu = "5d9cf4"
}

enum Orange {
static let medium = "fe642e"
static let light = "f6d8ce"
}

enum Gray {
static let dark = "24292e"
Expand Down
15 changes: 11 additions & 4 deletions Local Pods/GitHubAPI/GitHubAPI/GitHubAPIStatusRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@
import Foundation

public struct APIStatus: Codable {
public enum StatusType: String, Codable {
case good, minor, major
public let status: Status
}

public struct Status: Codable {
public let indicator: StatusType
public let description: String

public enum StatusType: String, Codable, CodingKey {
case normal = "none"
case minor, major, critical
}
public let status: StatusType
}

public struct GitHubAPIStatusRequest: HTTPRequest {
public typealias ResponseType = V3DataResponse<APIStatus>
public var url: String { return "https://status.github.com/api/status.json" }
public var url: String { return "https://www.githubstatus.com/api/v2/status.json" }
public var logoutOnAuthFailure: Bool { return false }
public var method: HTTPMethod { return .get }
public var parameters: [String : Any]? { return nil }
Expand Down