Commit 7b00bc8e authored by Leonardo Aramaki's avatar Leonardo Aramaki

Remove hack to connect to unsecured servers

parent 5f2696ac
...@@ -9,7 +9,6 @@ import chat.rocket.android.util.extensions.isValidUrl ...@@ -9,7 +9,6 @@ import chat.rocket.android.util.extensions.isValidUrl
import chat.rocket.android.util.extensions.launchUI import chat.rocket.android.util.extensions.launchUI
import chat.rocket.common.util.ifNull import chat.rocket.common.util.ifNull
import javax.inject.Inject import javax.inject.Inject
import javax.net.ssl.SSLHandshakeException
class ServerPresenter @Inject constructor(private val view: ServerView, class ServerPresenter @Inject constructor(private val view: ServerView,
private val strategy: CancelStrategy, private val strategy: CancelStrategy,
...@@ -17,7 +16,6 @@ class ServerPresenter @Inject constructor(private val view: ServerView, ...@@ -17,7 +16,6 @@ class ServerPresenter @Inject constructor(private val view: ServerView,
private val serverInteractor: SaveCurrentServerInteractor, private val serverInteractor: SaveCurrentServerInteractor,
private val refreshSettingsInteractor: RefreshSettingsInteractor, private val refreshSettingsInteractor: RefreshSettingsInteractor,
private val getAccountsInteractor: GetAccountsInteractor) { private val getAccountsInteractor: GetAccountsInteractor) {
private var retryCount = 0
fun connect(server: String) { fun connect(server: String) {
if (!server.isValidUrl()) { if (!server.isValidUrl()) {
...@@ -37,15 +35,10 @@ class ServerPresenter @Inject constructor(private val view: ServerView, ...@@ -37,15 +35,10 @@ class ServerPresenter @Inject constructor(private val view: ServerView,
serverInteractor.save(server) serverInteractor.save(server)
navigator.toLogin() navigator.toLogin()
} catch (ex: Exception) { } catch (ex: Exception) {
if (ex.cause is SSLHandshakeException && retryCount < MAX_RETRY_ATTEMPTS) { ex.message?.let {
retryCount++ view.showMessage(it)
connect(server.replace("https", "http")) }.ifNull {
} else { view.showGenericErrorMessage()
ex.message?.let {
view.showMessage(it)
}.ifNull {
view.showGenericErrorMessage()
}
} }
} finally { } finally {
view.hideLoading() view.hideLoading()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment