Skip to content
Permalink
Browse files

2.5.3.0.005: Fixed the bugs related to setting the proxy

  • Loading branch information
iamashks committed Feb 18, 2019
1 parent a44c34d commit cc7c9bcad8f60126dd8351005b81c9194cf1bc00
Showing with 22 additions and 6 deletions.
  1. +22 −6 src/main/kotlin/net/aksingh/owmjapis/core/OWM.kt
@@ -69,6 +69,7 @@ open class OWM {
var accuracy: OWM.Accuracy = OWM.Accuracy.LIKE
set(value) {
field = value

retrofit4weather = createRetrofit4WeatherInstance(proxy)
}

@@ -79,25 +80,34 @@ open class OWM {
}

field = value

retrofit4history = createRetrofit4HistoryInstance(proxy)
retrofit4others = createRetrofit4OthersInstance(proxy)
retrofit4pollution = createRetrofit4PollutionInstance(proxy)
retrofit4weather = createRetrofit4WeatherInstance(proxy)
}

var language: OWM.Language = OWM.Language.ENGLISH
set(value) {
field = value

retrofit4weather = createRetrofit4WeatherInstance(proxy)
}

var proxy: Proxy = SystemTools.getSystemProxy()
set(value) {
field = value

retrofit4history = createRetrofit4HistoryInstance(proxy)
retrofit4others = createRetrofit4OthersInstance(proxy)
retrofit4pollution = createRetrofit4PollutionInstance(proxy)
retrofit4weather = createRetrofit4WeatherInstance(proxy)
}

var unit: OWM.Unit = OWM.Unit.STANDARD
set(value) {
field = value
retrofit4others = createRetrofit4OthersInstance(proxy)
retrofit4pollution = createRetrofit4PollutionInstance(proxy)

retrofit4weather = createRetrofit4WeatherInstance(proxy)
}

@@ -133,9 +143,10 @@ open class OWM {
* @param pass Password for the proxy
*/
fun setProxy(proxy: Proxy, user: String, pass: String): OWM {
this.proxy = proxy
SystemTools.setProxyAuthDetails(user, pass)

this.proxy = proxy

return this
}

@@ -160,6 +171,7 @@ open class OWM {
*/
fun setProxy(host: String, port: Int, type: Proxy.Type): OWM {
proxy = Proxy(type, InetSocketAddress(host, port))

this.proxy = proxy

return this
@@ -189,9 +201,10 @@ open class OWM {
* @param type Type of the proxy
*/
fun setProxy(host: String, port: Int, user: String, pass: String, type: Proxy.Type): OWM {
setProxy(host, port, type)
SystemTools.setProxyAuthDetails(user, pass)

setProxy(host, port, type)

return this
}

@@ -207,9 +220,12 @@ open class OWM {
/**
* Reset proxy to system's proxy for getting data from OpenWeatherMap.org
*/
fun resetProxy() {
this.proxy = SystemTools.getSystemProxy()
fun resetProxy(): OWM {
SystemTools.setProxyAuthDetails("", "")

this.proxy = SystemTools.getSystemProxy()

return this
}

@Throws(APIException::class)

0 comments on commit cc7c9bc

Please sign in to comment.
You can’t perform that action at this time.