Skip to content

Commit

Permalink
Changed network settings, using more efficient server
Browse files Browse the repository at this point in the history
  • Loading branch information
insidegui committed Jun 20, 2016
1 parent 1963c2c commit ec1ab81
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 8 additions & 2 deletions WWDC/AppConfigAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ class AppConfigAdapter: JSONAdapter {
static func adapt(json: JSON) -> ModelType {
let config = AppConfig()

config.sessionsURL = json["sessions"].stringValue
config.videosURL = json["videos"].stringValue
if let baseURL = json["baseURL"].string {
config.sessionsURL = baseURL + json["sessions"].stringValue
config.videosURL = baseURL + json["videos"].stringValue
} else {
config.sessionsURL = json["sessions"].stringValue
config.videosURL = json["videos"].stringValue
}

config.isWWDCWeek = json["wwdc_week"].intValue == 1
config.scheduleEnabled = json["schedule"].intValue == 1
config.shouldIgnoreCache = json["ignore_cache"].intValue == 1
Expand Down
4 changes: 2 additions & 2 deletions WWDC/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class Preferences {
static let userKnowsLiveEventThing = false
static let tvTechTalksAlerted = false
static let automaticRefreshEnabled = true
static let automaticRefreshIntervalOnWWDCWeek = 300.0
static let automaticRefreshIntervalRegular = 1800.0
static let automaticRefreshIntervalOnWWDCWeek = 900.0
static let automaticRefreshIntervalRegular = 3600.0
static let floatOnTopEnabled = false
static let automaticRefreshSuggestionPresentedAt = NSDate.distantPast()

Expand Down
14 changes: 4 additions & 10 deletions WWDC/WWDCEnvironment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,16 @@ struct WWDCEnvironment {
#endif
}

private static var cacheAvoidingToken: String {
return "?t=\(rand())&s=\(NSDate.timeIntervalSinceReferenceDate())"
}

private static var server: String {
if shouldUseTestServer {
return "http://localhost"
} else {
return "http://wwdc.guilhermerambo.me"
return "http://cdn.wwdc.guilhermerambo.me"
}
}

private static func URL(path: String) -> String {
sranddev()

return server + path + cacheAvoidingToken
return server + path
}

// MARK: - Paths
Expand All @@ -54,7 +48,7 @@ struct WWDCEnvironment {
if shouldUseFakeTestData {
return URL("/fake_index.json")
} else {
return URL("/index.json")
return URL("/index2.json")
}
}

Expand All @@ -69,7 +63,7 @@ struct WWDCEnvironment {
}

static var liveSessionsURL: String {
return URL("/videos_live.php")
return URL("/videos_live.json")
}

// MARK: - Transcript ignore
Expand Down

0 comments on commit ec1ab81

Please sign in to comment.