Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
78350cb1
Commit
78350cb1
authored
Apr 19, 2018
by
Lucio Maciel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check server version on ServerFragment for deeplink also
parent
86fe6abe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
42 deletions
+23
-42
LoginPresenter.kt
...droid/authentication/login/presentation/LoginPresenter.kt
+3
-16
LoginView.kt
...et/android/authentication/login/presentation/LoginView.kt
+1
-1
LoginFragment.kt
...t/rocket/android/authentication/login/ui/LoginFragment.kt
+0
-21
ServerFragment.kt
...rocket/android/authentication/server/ui/ServerFragment.kt
+19
-4
No files found.
app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginPresenter.kt
View file @
78350cb1
...
@@ -43,13 +43,11 @@ class LoginPresenter @Inject constructor(
...
@@ -43,13 +43,11 @@ class LoginPresenter @Inject constructor(
serverInteractor
:
GetCurrentServerInteractor
,
serverInteractor
:
GetCurrentServerInteractor
,
private
val
saveAccountInteractor
:
SaveAccountInteractor
,
private
val
saveAccountInteractor
:
SaveAccountInteractor
,
private
val
factory
:
RocketChatClientFactory
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
private
lateinit
var
settings
:
PublicSettings
private
lateinit
var
settings
:
PublicSettings
//private val client: RocketChatClient = factory.create(currentServer)
//private val settings: PublicSettings = settingsInteractor.get(currentServer)
private
lateinit
var
usernameOrEmail
:
String
private
lateinit
var
usernameOrEmail
:
String
private
lateinit
var
password
:
String
private
lateinit
var
password
:
String
private
lateinit
var
credentialToken
:
String
private
lateinit
var
credentialToken
:
String
...
@@ -98,19 +96,8 @@ class LoginPresenter @Inject constructor(
...
@@ -98,19 +96,8 @@ class LoginPresenter @Inject constructor(
deepLinkUserId
=
deepLinkInfo
.
userId
deepLinkUserId
=
deepLinkInfo
.
userId
deepLinkToken
=
deepLinkInfo
.
token
deepLinkToken
=
deepLinkInfo
.
token
tokenRepository
.
save
(
serverUrl
,
Token
(
deepLinkUserId
,
deepLinkToken
))
tokenRepository
.
save
(
serverUrl
,
Token
(
deepLinkUserId
,
deepLinkToken
))
launchUI
(
strategy
)
{
try
{
doAuthentication
(
TYPE_LOGIN_DEEP_LINK
)
val
version
=
checkServerVersion
(
serverUrl
).
await
()
when
(
version
)
{
is
Version
.
OutOfDateError
->
{
view
.
blockAndAlertNotRequiredVersion
()
}
else
->
doAuthentication
(
TYPE_LOGIN_DEEP_LINK
)
}
}
catch
(
ex
:
Exception
)
{
Timber
.
d
(
ex
,
"Error performing deep link login"
)
}
}
}
}
private
fun
setupConnectionInfo
(
serverUrl
:
String
)
{
private
fun
setupConnectionInfo
(
serverUrl
:
String
)
{
...
...
app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginView.kt
View file @
78350cb1
...
@@ -4,7 +4,7 @@ import chat.rocket.android.authentication.server.presentation.VersionCheckView
...
@@ -4,7 +4,7 @@ import chat.rocket.android.authentication.server.presentation.VersionCheckView
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.MessageView
import
chat.rocket.android.core.behaviours.MessageView
interface
LoginView
:
LoadingView
,
MessageView
,
VersionCheckView
{
interface
LoginView
:
LoadingView
,
MessageView
{
/**
/**
* Shows the form view (i.e the username/email and password fields) if it is enabled by the server settings.
* Shows the form view (i.e the username/email and password fields) if it is enabled by the server settings.
...
...
app/src/main/java/chat/rocket/android/authentication/login/ui/LoginFragment.kt
View file @
78350cb1
...
@@ -370,27 +370,6 @@ class LoginFragment : Fragment(), LoginView {
...
@@ -370,27 +370,6 @@ class LoginFragment : Fragment(), LoginView {
}
}
}
}
override
fun
alertNotRecommendedVersion
()
{
ui
{
AlertDialog
.
Builder
(
it
)
.
setMessage
(
getString
(
R
.
string
.
msg_ver_not_recommended
,
BuildConfig
.
RECOMMENDED_SERVER_VERSION
))
.
setPositiveButton
(
R
.
string
.
msg_ok
,
null
)
.
create
()
.
show
()
}
}
override
fun
blockAndAlertNotRequiredVersion
()
{
ui
{
AlertDialog
.
Builder
(
it
)
.
setMessage
(
getString
(
R
.
string
.
msg_ver_not_minimum
,
BuildConfig
.
REQUIRED_SERVER_VERSION
))
.
setOnDismissListener
{
activity
?.
onBackPressed
()
}
.
setPositiveButton
(
R
.
string
.
msg_ok
,
null
)
.
create
()
.
show
()
}
}
private
fun
showRemainingSocialAccountsView
()
{
private
fun
showRemainingSocialAccountsView
()
{
social_accounts_container
.
postDelayed
(
300
)
{
social_accounts_container
.
postDelayed
(
300
)
{
ui
{
ui
{
...
...
app/src/main/java/chat/rocket/android/authentication/server/ui/ServerFragment.kt
View file @
78350cb1
package
chat.rocket.android.authentication.server.ui
package
chat.rocket.android.authentication.server.ui
import
android.app.AlertDialog
import
android.app.AlertDialog
import
android.net.Uri
import
android.os.Bundle
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.support.v4.app.Fragment
import
android.view.LayoutInflater
import
android.view.LayoutInflater
...
@@ -14,6 +15,7 @@ import chat.rocket.android.authentication.server.presentation.ServerPresenter
...
@@ -14,6 +15,7 @@ import chat.rocket.android.authentication.server.presentation.ServerPresenter
import
chat.rocket.android.authentication.server.presentation.ServerView
import
chat.rocket.android.authentication.server.presentation.ServerView
import
chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.util.extensions.*
import
chat.rocket.common.util.ifNull
import
dagger.android.support.AndroidSupportInjection
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_server.*
import
kotlinx.android.synthetic.main.fragment_authentication_server.*
import
javax.inject.Inject
import
javax.inject.Inject
...
@@ -52,6 +54,8 @@ class ServerFragment : Fragment(), ServerView {
...
@@ -52,6 +54,8 @@ class ServerFragment : Fragment(), ServerView {
setupOnClickListener
()
setupOnClickListener
()
deepLinkInfo
?.
let
{
deepLinkInfo
?.
let
{
val
uri
=
Uri
.
parse
(
it
.
url
)
uri
?.
let
{
text_server_protocol
.
hintContent
=
it
.
host
}
presenter
.
deepLink
(
it
)
presenter
.
deepLink
(
it
)
}
}
}
}
...
@@ -99,8 +103,7 @@ class ServerFragment : Fragment(), ServerView {
...
@@ -99,8 +103,7 @@ class ServerFragment : Fragment(), ServerView {
AlertDialog
.
Builder
(
it
)
AlertDialog
.
Builder
(
it
)
.
setMessage
(
getString
(
R
.
string
.
msg_ver_not_recommended
,
BuildConfig
.
RECOMMENDED_SERVER_VERSION
))
.
setMessage
(
getString
(
R
.
string
.
msg_ver_not_recommended
,
BuildConfig
.
RECOMMENDED_SERVER_VERSION
))
.
setPositiveButton
(
R
.
string
.
msg_ok
,
{
_
,
_
->
.
setPositiveButton
(
R
.
string
.
msg_ok
,
{
_
,
_
->
val
url
=
text_server_url
.
textContent
.
ifEmpty
(
text_server_url
.
hintContent
)
performConnect
()
presenter
.
connect
(
text_server_protocol
.
textContent
+
url
)
})
})
.
create
()
.
create
()
.
show
()
.
show
()
...
@@ -113,15 +116,27 @@ class ServerFragment : Fragment(), ServerView {
...
@@ -113,15 +116,27 @@ class ServerFragment : Fragment(), ServerView {
AlertDialog
.
Builder
(
it
)
AlertDialog
.
Builder
(
it
)
.
setMessage
(
getString
(
R
.
string
.
msg_ver_not_minimum
,
BuildConfig
.
REQUIRED_SERVER_VERSION
))
.
setMessage
(
getString
(
R
.
string
.
msg_ver_not_minimum
,
BuildConfig
.
REQUIRED_SERVER_VERSION
))
.
setPositiveButton
(
R
.
string
.
msg_ok
,
null
)
.
setPositiveButton
(
R
.
string
.
msg_ok
,
null
)
.
setOnDismissListener
{
// reset the deeplink info, so the user can log to another server...
deepLinkInfo
=
null
}
.
create
()
.
create
()
.
show
()
.
show
()
}
}
}
}
override
fun
versionOk
()
{
override
fun
versionOk
()
{
performConnect
()
}
private
fun
performConnect
()
{
ui
{
ui
{
val
url
=
text_server_url
.
textContent
.
ifEmpty
(
text_server_url
.
hintContent
)
deepLinkInfo
?.
let
{
presenter
.
connect
(
text_server_protocol
.
textContent
+
url
)
presenter
.
deepLink
(
it
)
}.
ifNull
{
val
url
=
text_server_url
.
textContent
.
ifEmpty
(
text_server_url
.
hintContent
)
presenter
.
connect
(
text_server_protocol
.
textContent
+
url
)
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment