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
Show 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,24 +26,21 @@ class LoginPresenter @Inject constructor(private val view: LoginView,
...
@@ -26,24 +26,21 @@ class LoginPresenter @Inject constructor(private val view: LoginView,
}
}
else
->
{
else
->
{
launchUI
(
strategy
)
{
launchUI
(
strategy
)
{
view
.
showLoading
()
if
(
NetworkHelper
.
hasInternetAccess
())
{
if
(
NetworkHelper
.
hasInternetAccess
())
{
view
.
showLoading
()
try
{
try
{
val
token
=
client
.
login
(
usernameOrEmail
,
password
)
val
token
=
client
.
login
(
usernameOrEmail
,
password
)
Timber
.
d
(
"Created token: $token"
)
// TODO Salve token?
navigator
.
toChatList
()
navigator
.
toChatList
()
}
catch
(
rocketChatException
:
RocketChatException
)
{
}
catch
(
rocketChatException
:
RocketChatException
)
{
when
(
rocketChatException
)
{
if
(
rocketChatException
is
RocketChatTwoFactorException
)
{
is
RocketChatTwoFactorException
->
{
navigator
.
toTwoFA
(
navigator
.
currentServer
!!
,
usernameOrEmail
,
password
)
navigator
.
toTwoFA
(
navigator
.
currentServer
!!
,
usernameOrEmail
,
password
)
}
}
else
{
else
->
{
val
errorMessage
=
rocketChatException
.
message
val
errorMessage
=
rocketChatException
.
message
if
(
errorMessage
!=
null
)
{
if
(
errorMessage
!=
null
)
{
view
.
showMessage
(
errorMessage
)
view
.
showMessage
(
errorMessage
)
}
}
}
}
}
}
finally
{
}
finally
{
view
.
hideLoading
()
view
.
hideLoading
()
}
}
...
...
app/src/main/java/chat/rocket/android/authentication/login/ui/LoginFragment.kt
View file @
e25c7a05
...
@@ -27,13 +27,13 @@ class LoginFragment : Fragment(), LoginView {
...
@@ -27,13 +27,13 @@ class LoginFragment : Fragment(), LoginView {
private
val
layoutListener
=
ViewTreeObserver
.
OnGlobalLayoutListener
{
private
val
layoutListener
=
ViewTreeObserver
.
OnGlobalLayoutListener
{
if
(
KeyboardHelper
.
isSoftKeyboardShown
(
scroll_view
.
rootView
))
{
if
(
KeyboardHelper
.
isSoftKeyboardShown
(
scroll_view
.
rootView
))
{
showOauthView
(
false
)
showSignUpView
(
false
)
showSignUpView
(
false
)
showOauthView
(
false
)
showLoginButton
(
true
)
showLoginButton
(
true
)
}
else
{
}
else
{
if
(
isEditTextEmpty
())
{
if
(
isEditTextEmpty
())
{
showOauthView
(
true
)
showSignUpView
(
true
)
showSignUpView
(
true
)
showOauthView
(
true
)
showLoginButton
(
false
)
showLoginButton
(
false
)
}
}
}
}
...
@@ -219,6 +219,10 @@ class LoginFragment : Fragment(), LoginView {
...
@@ -219,6 +219,10 @@ class LoginFragment : Fragment(), LoginView {
button_log_in
.
isEnabled
=
value
button_log_in
.
isEnabled
=
value
text_username_or_email
.
isEnabled
=
value
text_username_or_email
.
isEnabled
=
value
text_password
.
isEnabled
=
value
text_password
.
isEnabled
=
value
if
(
isEditTextEmpty
())
{
showSignUpView
(
value
)
showOauthView
(
value
)
}
}
}
// Returns true if *all* EditTexts are empty.
// 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 {
...
@@ -54,17 +54,16 @@ class ServerFragment : Fragment(), ServerView {
}
}
override
fun
showLoading
()
{
override
fun
showLoading
()
{
text_server_url
.
isEnabled
=
false
enableUserInput
(
false
)
button_connect
.
isEnabled
=
false
view_loading
.
show
()
view_loading
.
setVisibility
(
true
)
}
}
override
fun
hideLoading
()
{
override
fun
hideLoading
()
{
view_loading
.
setVisibility
(
false
)
view_loading
.
hide
()
button_connect
.
isEnabled
=
true
enableUserInput
(
true
)
text_server_url
.
isEnabled
=
true
}
}
override
fun
showMessage
(
message
:
String
)
{
override
fun
showMessage
(
message
:
String
)
{
Toast
.
makeText
(
activity
,
message
,
Toast
.
LENGTH_SHORT
).
show
()
Toast
.
makeText
(
activity
,
message
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
...
@@ -72,4 +71,9 @@ class ServerFragment : Fragment(), ServerView {
...
@@ -72,4 +71,9 @@ class ServerFragment : Fragment(), ServerView {
override
fun
showNoInternetConnection
()
{
override
fun
showNoInternetConnection
()
{
Toast
.
makeText
(
activity
,
getString
(
R
.
string
.
msg_no_internet_connection
),
Toast
.
LENGTH_SHORT
).
show
()
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,
...
@@ -36,14 +36,12 @@ class SignupPresenter @Inject constructor(private val view: SignupView,
view
.
showLoading
()
view
.
showLoading
()
try
{
try
{
val
user
=
client
.
signup
(
email
,
name
,
username
,
password
)
val
user
=
client
.
signup
(
email
,
name
,
username
,
password
)
Timber
.
d
(
"Created user: $user"
)
// TODO Salve user?
val
token
=
client
.
login
(
username
,
password
)
val
token
=
client
.
login
(
username
,
password
)
Timber
.
d
(
"Logged in. Token: $token"
)
// TODO Salve token?
navigator
.
toChatList
()
navigator
.
toChatList
()
}
catch
(
ex
:
RocketChatException
)
{
}
catch
(
rocketChatException
:
RocketChatException
)
{
val
errorMessage
=
ex
.
message
val
errorMessage
=
rocketChatException
.
message
if
(
errorMessage
!=
null
)
{
if
(
errorMessage
!=
null
)
{
view
.
showMessage
(
errorMessage
)
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 {
...
@@ -77,7 +77,6 @@ class TwoFAFragment : Fragment(), TwoFAView {
}
}
override
fun
showLoading
()
{
override
fun
showLoading
()
{
view_loading
.
setVisibility
(
true
)
enableUserInput
(
false
)
enableUserInput
(
false
)
view_loading
.
show
()
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