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
e25c7a05
Commit
e25c7a05
authored
Jan 02, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove logs and update/add funcitons.
parent
6c49a9fb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
26 deletions
+28
-26
LoginPresenter.kt
...droid/authentication/login/presentation/LoginPresenter.kt
+8
-11
LoginFragment.kt
...t/rocket/android/authentication/login/ui/LoginFragment.kt
+6
-2
ServerFragment.kt
...rocket/android/authentication/server/ui/ServerFragment.kt
+10
-6
SignupPresenter.kt
...oid/authentication/signup/presentation/SignupPresenter.kt
+4
-6
TwoFAFragment.kt
...cket/android/authentication/twofactor/ui/TwoFAFragment.kt
+0
-1
No files found.
app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginPresenter.kt
View file @
e25c7a05
...
...
@@ -26,22 +26,19 @@ class LoginPresenter @Inject constructor(private val view: LoginView,
}
else
->
{
launchUI
(
strategy
)
{
view
.
showLoading
()
if
(
NetworkHelper
.
hasInternetAccess
())
{
view
.
showLoading
()
try
{
val
token
=
client
.
login
(
usernameOrEmail
,
password
)
Timber
.
d
(
"Created token: $token"
)
// TODO Salve token?
navigator
.
toChatList
()
}
catch
(
rocketChatException
:
RocketChatException
)
{
when
(
rocketChatException
)
{
is
RocketChatTwoFactorException
->
{
navigator
.
toTwoFA
(
navigator
.
currentServer
!!
,
usernameOrEmail
,
password
)
}
else
->
{
val
errorMessage
=
rocketChatException
.
message
if
(
errorMessage
!=
null
)
{
view
.
showMessage
(
errorMessage
)
}
if
(
rocketChatException
is
RocketChatTwoFactorException
)
{
navigator
.
toTwoFA
(
navigator
.
currentServer
!!
,
usernameOrEmail
,
password
)
}
else
{
val
errorMessage
=
rocketChatException
.
message
if
(
errorMessage
!=
null
)
{
view
.
showMessage
(
errorMessage
)
}
}
}
finally
{
...
...
app/src/main/java/chat/rocket/android/authentication/login/ui/LoginFragment.kt
View file @
e25c7a05
...
...
@@ -27,13 +27,13 @@ class LoginFragment : Fragment(), LoginView {
private
val
layoutListener
=
ViewTreeObserver
.
OnGlobalLayoutListener
{
if
(
KeyboardHelper
.
isSoftKeyboardShown
(
scroll_view
.
rootView
))
{
showOauthView
(
false
)
showSignUpView
(
false
)
showOauthView
(
false
)
showLoginButton
(
true
)
}
else
{
if
(
isEditTextEmpty
())
{
showOauthView
(
true
)
showSignUpView
(
true
)
showOauthView
(
true
)
showLoginButton
(
false
)
}
}
...
...
@@ -219,6 +219,10 @@ class LoginFragment : Fragment(), LoginView {
button_log_in
.
isEnabled
=
value
text_username_or_email
.
isEnabled
=
value
text_password
.
isEnabled
=
value
if
(
isEditTextEmpty
())
{
showSignUpView
(
value
)
showOauthView
(
value
)
}
}
// Returns true if *all* EditTexts are empty.
...
...
app/src/main/java/chat/rocket/android/authentication/server/ui/ServerFragment.kt
View file @
e25c7a05
...
...
@@ -54,17 +54,16 @@ class ServerFragment : Fragment(), ServerView {
}
override
fun
showLoading
()
{
text_server_url
.
isEnabled
=
false
button_connect
.
isEnabled
=
false
view_loading
.
setVisibility
(
true
)
enableUserInput
(
false
)
view_loading
.
show
()
}
override
fun
hideLoading
()
{
view_loading
.
setVisibility
(
false
)
button_connect
.
isEnabled
=
true
text_server_url
.
isEnabled
=
true
view_loading
.
hide
()
enableUserInput
(
true
)
}
override
fun
showMessage
(
message
:
String
)
{
Toast
.
makeText
(
activity
,
message
,
Toast
.
LENGTH_SHORT
).
show
()
}
...
...
@@ -72,4 +71,9 @@ class ServerFragment : Fragment(), ServerView {
override
fun
showNoInternetConnection
()
{
Toast
.
makeText
(
activity
,
getString
(
R
.
string
.
msg_no_internet_connection
),
Toast
.
LENGTH_SHORT
).
show
()
}
private
fun
enableUserInput
(
value
:
Boolean
)
{
button_connect
.
isEnabled
=
value
text_server_url
.
isEnabled
=
value
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/signup/presentation/SignupPresenter.kt
View file @
e25c7a05
...
...
@@ -36,14 +36,12 @@ class SignupPresenter @Inject constructor(private val view: SignupView,
view
.
showLoading
()
try
{
val
user
=
client
.
signup
(
email
,
name
,
username
,
password
)
Timber
.
d
(
"Created user: $user"
)
// TODO Salve user?
val
token
=
client
.
login
(
username
,
password
)
Timber
.
d
(
"Logged in. Token: $token"
)
// TODO Salve token?
navigator
.
toChatList
()
}
catch
(
ex
:
RocketChatException
)
{
val
errorMessage
=
ex
.
message
}
catch
(
rocketChatException
:
RocketChatException
)
{
val
errorMessage
=
rocketChatException
.
message
if
(
errorMessage
!=
null
)
{
view
.
showMessage
(
errorMessage
)
}
...
...
app/src/main/java/chat/rocket/android/authentication/twofactor/ui/TwoFAFragment.kt
View file @
e25c7a05
...
...
@@ -77,7 +77,6 @@ class TwoFAFragment : Fragment(), TwoFAView {
}
override
fun
showLoading
()
{
view_loading
.
setVisibility
(
true
)
enableUserInput
(
false
)
view_loading
.
show
()
}
...
...
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