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
f4c434e2
Commit
f4c434e2
authored
May 22, 2018
by
aniket
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor fixes
parent
e528cdf2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
26 deletions
+14
-26
LoginPresenter.kt
...droid/authentication/login/presentation/LoginPresenter.kt
+7
-4
LoginFragment.kt
...t/rocket/android/authentication/login/ui/LoginFragment.kt
+7
-21
OauthWebViewActivity.kt
...t/rocket/android/webview/oauth/ui/OauthWebViewActivity.kt
+0
-1
No files found.
app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginPresenter.kt
View file @
f4c434e2
...
...
@@ -55,6 +55,7 @@ class LoginPresenter @Inject constructor(
private
lateinit
var
credentialSecret
:
String
private
lateinit
var
deepLinkUserId
:
String
private
lateinit
var
deepLinkToken
:
String
private
var
loginCredentials
:
Credential
?
=
null
fun
setupView
()
{
setupConnectionInfo
(
currentServer
)
...
...
@@ -304,10 +305,12 @@ class LoginPresenter @Inject constructor(
saveAccount
(
username
)
saveToken
(
token
)
registerPushToken
()
var
loginCredentials
:
Credential
=
Credential
.
Builder
(
usernameOrEmail
)
.
setPassword
(
password
)
.
build
()
view
.
saveSmartLockCredentials
(
loginCredentials
)
if
(
loginType
==
TYPE_LOGIN_USER_EMAIL
)
{
loginCredentials
=
Credential
.
Builder
(
usernameOrEmail
)
.
setPassword
(
password
)
.
build
()
view
.
saveSmartLockCredentials
(
loginCredentials
)
}
navigator
.
toChatList
()
}
else
if
(
loginType
==
TYPE_LOGIN_OAUTH
)
{
navigator
.
toRegisterUsername
(
token
.
userId
,
token
.
authToken
)
...
...
app/src/main/java/chat/rocket/android/authentication/login/ui/LoginFragment.kt
View file @
f4c434e2
...
...
@@ -57,6 +57,7 @@ class LoginFragment : Fragment(), LoginView, GoogleApiClient.ConnectionCallbacks
private
val
layoutListener
=
ViewTreeObserver
.
OnGlobalLayoutListener
{
areLoginOptionsNeeded
()
}
private
var
isOauthSuccessful
=
false
private
var
isGlobalLayoutListenerSetUp
=
false
private
var
deepLinkInfo
:
LoginDeepLinkInfo
?
=
null
private
var
credentialsToBeSaved
:
Credential
?
=
null
...
...
@@ -122,6 +123,7 @@ class LoginFragment : Fragment(), LoginView, GoogleApiClient.ConnectionCallbacks
presenter
.
authenticateWithCas
(
getStringExtra
(
INTENT_CAS_TOKEN
))
}
}
else
if
(
requestCode
==
REQUEST_CODE_FOR_OAUTH
)
{
isOauthSuccessful
=
true
data
?.
apply
{
presenter
.
authenticateWithOauth
(
getStringExtra
(
INTENT_OAUTH_CREDENTIAL_TOKEN
),
...
...
@@ -147,20 +149,12 @@ class LoginFragment : Fragment(), LoginView, GoogleApiClient.ConnectionCallbacks
}
else
if
(
requestCode
==
MULTIPLE_CREDENTIALS_READ
)
{
Log
.
d
(
"STATUS"
,
"failed "
)
}
//cancel button pressed by the user in case of reading from smart lock
else
if
(
resultCode
==
Activity
.
RESULT_CANCELED
)
{
//add shared preference so that the dialog is not shown always
}
//create new account to use it as login account (deal with this case carefully, many edge cases)
else
if
(
resultCode
==
CredentialsApi
.
ACTIVITY_RESULT_ADD_ACCOUNT
)
{
else
if
(
resultCode
==
Activity
.
RESULT_CANCELED
&&
requestCode
==
REQUEST_CODE_FOR_OAUTH
)
{
Log
.
d
(
"returned"
,
"from oauth"
)
}
//no hints for user id's exist
else
if
(
resultCode
==
CredentialsApi
.
ACTIVITY_RESULT_NO_HINTS_AVAILABLE
)
{
}
else
{
Log
.
d
(
"Status"
,
"nothing happening"
)
}
}
...
...
@@ -182,14 +176,14 @@ class LoginFragment : Fragment(), LoginView, GoogleApiClient.ConnectionCallbacks
override
fun
onStart
()
{
super
.
onStart
()
requestCredentials
()
if
(!
isOauthSuccessful
)
{
requestCredentials
()
}
}
private
fun
requestCredentials
()
{
var
request
:
CredentialRequest
=
CredentialRequest
.
Builder
()
.
setPasswordLoginSupported
(
true
)
//add account types for custom login methods
/*.setAccountTypes(IdentityProviders.GOOGLE,IdentityProviders.FACEBOOK)*/
.
build
()
Auth
.
CredentialsApi
.
request
(
googleApiClient
,
request
).
setResultCallback
{
credentialRequestResult
->
...
...
@@ -224,14 +218,6 @@ class LoginFragment : Fragment(), LoginView, GoogleApiClient.ConnectionCallbacks
private
fun
handleCredential
(
loginCredentials
:
Credential
)
{
if
(
loginCredentials
.
accountType
==
null
)
{
presenter
.
authenticateWithUserAndPassword
(
loginCredentials
.
id
,
loginCredentials
.
password
!!
)
}
else
if
(
loginCredentials
.
accountType
==
IdentityProviders
.
GOOGLE
)
{
//TODO add SL code for google as custom login method
}
else
if
(
loginCredentials
.
accountType
==
IdentityProviders
.
FACEBOOK
)
{
//TODO add SL code for facebook as custom login method
}
else
if
(
loginCredentials
.
accountType
==
IdentityProviders
.
TWITTER
)
{
//TODO add SL code for twitter as custom login method
}
else
if
(
loginCredentials
.
accountType
==
IdentityProviders
.
LINKEDIN
)
{
//TODO add SL code for linkedin as custom login method
}
}
...
...
app/src/main/java/chat/rocket/android/webview/oauth/ui/OauthWebViewActivity.kt
View file @
f4c434e2
...
...
@@ -40,7 +40,6 @@ class OauthWebViewActivity : AppCompatActivity() {
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_web_view
)
webPageUrl
=
intent
.
getStringExtra
(
INTENT_WEB_PAGE_URL
)
requireNotNull
(
webPageUrl
)
{
"no web_page_url provided in Intent extras"
}
...
...
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