Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sergpetrov committed Mar 6, 2020
2 parents dce5397 + dd40a1c commit b93a524
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/com/telex/utils/TimberTrees.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import java.io.IOException
import java.net.ConnectException
import java.net.SocketTimeoutException
import java.net.UnknownHostException
import javax.net.ssl.SSLHandshakeException
import timber.log.Timber

/**
Expand All @@ -32,6 +33,7 @@ class ReleaseTree : Timber.Tree() {
companion object {
private val IGNORED_ERRORS =
arrayListOf(
SSLHandshakeException::class.java,
ConnectException::class.java,
UnknownHostException::class.java,
SocketTimeoutException::class.java,
Expand Down
30 changes: 14 additions & 16 deletions base/src/main/java/com/telex/base/model/system/ServerManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,22 @@ class ServerManager @Inject constructor(

fun checkAvailableServer(): Completable {
return Completable.create { emitter ->
if (!emitter.isDisposed) {
if (context.isOnline()) {
val config = findAvailableServer()
if (config != null) {
appData.putServer(config.server)
endPoint = getEndPoint()
isServerConfigChanged = true
emitter.onComplete()
} else {
val error = when {
isUserProxyServerEnabled() -> ProxyConnectionException()
else -> TelegraphUnavailableException()
}
emitter.onError(error)
}
if (context.isOnline()) {
val config = findAvailableServer()
if (config != null) {
appData.putServer(config.server)
endPoint = getEndPoint()
isServerConfigChanged = true
emitter.onComplete()
} else {
emitter.onError(NoNetworkConnectionException())
val error = when {
isUserProxyServerEnabled() -> ProxyConnectionException()
else -> TelegraphUnavailableException()
}
emitter.tryOnError(error)
}
} else {
emitter.tryOnError(NoNetworkConnectionException())
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ task clean(type: Delete) {
}

ext {
versionCode = 47
versionCode = 48
versionName = "2.3.4"

compileSdk = 29
Expand Down

0 comments on commit b93a524

Please sign in to comment.