Commit 149fb862 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Remove version check from login screen since we are doing it on server screen; fix typo

parent 0488863a
...@@ -32,17 +32,18 @@ private const val SERVICE_NAME_GOOGLE = "google" ...@@ -32,17 +32,18 @@ private const val SERVICE_NAME_GOOGLE = "google"
private const val SERVICE_NAME_LINKEDIN = "linkedin" private const val SERVICE_NAME_LINKEDIN = "linkedin"
private const val SERVICE_NAME_GILAB = "gitlab" private const val SERVICE_NAME_GILAB = "gitlab"
class LoginPresenter @Inject constructor(private val view: LoginView, class LoginPresenter @Inject constructor(
private val strategy: CancelStrategy, private val view: LoginView,
private val navigator: AuthenticationNavigator, private val strategy: CancelStrategy,
private val tokenRepository: TokenRepository, private val navigator: AuthenticationNavigator,
private val localRepository: LocalRepository, private val tokenRepository: TokenRepository,
private val getAccountsInteractor: GetAccountsInteractor, private val localRepository: LocalRepository,
private val settingsInteractor: GetSettingsInteractor, private val getAccountsInteractor: GetAccountsInteractor,
serverInteractor: GetCurrentServerInteractor, private val settingsInteractor: GetSettingsInteractor,
private val saveAccountInteractor: SaveAccountInteractor, serverInteractor: GetCurrentServerInteractor,
private val factory: RocketChatClientFactory) private val saveAccountInteractor: SaveAccountInteractor,
: CheckServerPresenter(strategy, factory, view) { private val factory: RocketChatClientFactory
) : CheckServerPresenter(strategy, factory, view) {
// TODO - we should validate the current server when opening the app, and have a nonnull get() // TODO - we should validate the current server when opening the app, and have a nonnull get()
private val currentServer = serverInteractor.get()!! private val currentServer = serverInteractor.get()!!
private lateinit var client: RocketChatClient private lateinit var client: RocketChatClient
...@@ -62,7 +63,6 @@ class LoginPresenter @Inject constructor(private val view: LoginView, ...@@ -62,7 +63,6 @@ class LoginPresenter @Inject constructor(private val view: LoginView,
setupUserRegistrationView() setupUserRegistrationView()
setupCasView() setupCasView()
setupOauthServicesView() setupOauthServicesView()
checkServerInfo(currentServer)
} }
fun authenticateWithUserAndPassword(usernameOrEmail: String, password: String) { fun authenticateWithUserAndPassword(usernameOrEmail: String, password: String) {
...@@ -92,7 +92,7 @@ class LoginPresenter @Inject constructor(private val view: LoginView, ...@@ -92,7 +92,7 @@ class LoginPresenter @Inject constructor(private val view: LoginView,
doAuthentication(TYPE_LOGIN_OAUTH) doAuthentication(TYPE_LOGIN_OAUTH)
} }
fun authenticadeWithDeepLink(deepLinkInfo: LoginDeepLinkInfo) { fun authenticateWithDeepLink(deepLinkInfo: LoginDeepLinkInfo) {
val serverUrl = deepLinkInfo.url val serverUrl = deepLinkInfo.url
setupConnectionInfo(serverUrl) setupConnectionInfo(serverUrl)
deepLinkUserId = deepLinkInfo.userId deepLinkUserId = deepLinkInfo.userId
...@@ -291,7 +291,7 @@ class LoginPresenter @Inject constructor(private val view: LoginView, ...@@ -291,7 +291,7 @@ class LoginPresenter @Inject constructor(private val view: LoginView,
private fun getOauthClientId(listMap: List<Map<String, String>>, serviceName: String): String? { private fun getOauthClientId(listMap: List<Map<String, String>>, serviceName: String): String? {
return listMap.find { map -> map.containsValue(serviceName) } return listMap.find { map -> map.containsValue(serviceName) }
?.get("appId") ?.get("appId")
} }
private suspend fun saveAccount(username: String) { private suspend fun saveAccount(username: String) {
......
...@@ -72,7 +72,7 @@ class LoginFragment : Fragment(), LoginView { ...@@ -72,7 +72,7 @@ class LoginFragment : Fragment(), LoginView {
} }
deepLinkInfo?.let { deepLinkInfo?.let {
presenter.authenticadeWithDeepLink(it) presenter.authenticateWithDeepLink(it)
}.ifNull { }.ifNull {
presenter.setupView() presenter.setupView()
} }
......
...@@ -34,7 +34,7 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector { ...@@ -34,7 +34,7 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
val deepLinkInfo = intent.getLoginDeepLinkInfo() val deepLinkInfo = intent.getLoginDeepLinkInfo()
launch(UI + job) { launch(UI + job) {
val newServer = intent.getBooleanExtra(INTENT_ADD_NEW_SERVER, false) val newServer = intent.getBooleanExtra(INTENT_ADD_NEW_SERVER, false)
// if we got authenticadeWithDeepLink information, pass true to newServer also // if we got authenticateWithDeepLink information, pass true to newServer also
presenter.loadCredentials(newServer || deepLinkInfo != null) { authenticated -> presenter.loadCredentials(newServer || deepLinkInfo != null) { authenticated ->
if (!authenticated) { if (!authenticated) {
showServerInput(savedInstanceState, deepLinkInfo) showServerInput(savedInstanceState, deepLinkInfo)
......
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