Commit 26f3f46a authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update ServerPresenter.kt

parent 7e4bc998
package chat.rocket.android.authentication.server.presentation
import android.content.Context
import chat.rocket.android.R
import chat.rocket.android.authentication.presentation.AuthenticationNavigator
import chat.rocket.android.core.lifecycle.CancelStrategy
import chat.rocket.android.helper.NetworkHelper
import chat.rocket.android.util.launchUI
import javax.inject.Inject
class ServerPresenter @Inject constructor(private val view: ServerView,
private val strategy: CancelStrategy,
private val navigator: AuthenticationNavigator) {
fun login(server: String) {
fun login(context: Context, server: String) {
launchUI(strategy) {
if (NetworkHelper.hasInternetAccess()) {
view.showLoading()
// TODO - validate server URL and get server settings and info before going to Login screen
view.hideLoading()
navigator.toLogin(server)
} else {
view.showMessage(context.getString(R.string.msg_no_internet_connection))
}
}
}
}
\ No newline at end of file
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