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
dbfcde7e
Unverified
Commit
dbfcde7e
authored
Oct 17, 2018
by
Filipe de Lima Brito
Committed by
GitHub
Oct 17, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1771 from RocketChat/fix/onboarding
[FIX] Fixes for Onboarding/Authentication
parents
c9471b6a
71328567
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
169 additions
and
178 deletions
+169
-178
LoginOptionsPresenter.kt
...cation/loginoptions/presentation/LoginOptionsPresenter.kt
+3
-0
LoginOptionsFragment.kt
...id/authentication/loginoptions/ui/LoginOptionsFragment.kt
+9
-9
CheckServerPresenter.kt
...ocket/android/server/presentation/CheckServerPresenter.kt
+146
-138
fragment_authentication_login_options.xml
...main/res/layout/fragment_authentication_login_options.xml
+10
-30
styles.xml
app/src/main/res/values/styles.xml
+1
-1
No files found.
app/src/main/java/chat/rocket/android/authentication/loginoptions/presentation/LoginOptionsPresenter.kt
View file @
dbfcde7e
...
...
@@ -72,6 +72,7 @@ class LoginOptionsPresenter @Inject constructor(
credentialToken
=
oauthToken
credentialSecret
=
oauthSecret
loginMethod
=
AuthenticationEvent
.
AuthenticationWithOauth
setupConnectionInfo
(
currentServer
)
doAuthentication
(
TYPE_LOGIN_OAUTH
)
}
...
...
@@ -79,6 +80,7 @@ class LoginOptionsPresenter @Inject constructor(
setupConnectionInfo
(
currentServer
)
credentialToken
=
casToken
loginMethod
=
AuthenticationEvent
.
AuthenticationWithCas
setupConnectionInfo
(
currentServer
)
doAuthentication
(
TYPE_LOGIN_CAS
)
}
...
...
@@ -86,6 +88,7 @@ class LoginOptionsPresenter @Inject constructor(
setupConnectionInfo
(
currentServer
)
credentialToken
=
samlToken
loginMethod
=
AuthenticationEvent
.
AuthenticationWithSaml
setupConnectionInfo
(
currentServer
)
doAuthentication
(
TYPE_LOGIN_SAML
)
}
...
...
app/src/main/java/chat/rocket/android/authentication/loginoptions/ui/LoginOptionsFragment.kt
View file @
dbfcde7e
...
...
@@ -9,6 +9,7 @@ import android.view.View
import
android.view.ViewGroup
import
android.widget.Button
import
android.widget.LinearLayout
import
androidx.appcompat.view.ContextThemeWrapper
import
androidx.core.view.isVisible
import
androidx.fragment.app.Fragment
import
chat.rocket.android.R
...
...
@@ -18,11 +19,7 @@ import chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
import
chat.rocket.android.authentication.loginoptions.presentation.LoginOptionsPresenter
import
chat.rocket.android.authentication.loginoptions.presentation.LoginOptionsView
import
chat.rocket.android.authentication.ui.AuthenticationActivity
import
chat.rocket.android.util.extensions.clearLightStatusBar
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.rotateBy
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_SECRET
import
chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_TOKEN
import
chat.rocket.android.webview.oauth.ui.oauthWebViewIntent
...
...
@@ -290,7 +287,6 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
}
}
// OAuth Accounts.
override
fun
enableLoginByFacebook
()
=
enableAccountButton
(
button_facebook
)
...
...
@@ -337,8 +333,8 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
buttonColor
:
Int
)
{
val
button
=
getCustomServiceButton
(
serviceName
,
serviceNameColor
,
buttonColor
)
accounts_container
.
addView
(
button
)
setupButtonListener
(
button
,
customOauthUrl
,
state
,
REQUEST_CODE_FOR_OAUTH
)
accounts_container
.
addView
(
button
)
}
// SAML account.
...
...
@@ -350,8 +346,8 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
buttonColor
:
Int
)
{
val
button
=
getCustomServiceButton
(
serviceName
,
serviceNameColor
,
buttonColor
)
accounts_container
.
addView
(
button
)
setupButtonListener
(
button
,
samlUrl
,
samlToken
,
REQUEST_CODE_FOR_SAML
)
accounts_container
.
addView
(
button
)
}
override
fun
showAccountsView
()
{
...
...
@@ -487,7 +483,11 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
val
marginTop
=
resources
.
getDimensionPixelSize
(
R
.
dimen
.
button_account_margin_top
)
params
.
setMargins
(
0
,
marginTop
,
0
,
0
)
val
button
=
Button
(
context
)
val
button
=
Button
(
ContextThemeWrapper
(
context
,
R
.
style
.
Authentication_Button
),
null
,
R
.
style
.
Authentication_Button
)
button
.
layoutParams
=
params
button
.
text
=
buttonText
button
.
setTextColor
(
buttonTextColor
)
...
...
app/src/main/java/chat/rocket/android/server/presentation/CheckServerPresenter.kt
View file @
dbfcde7e
...
...
@@ -124,8 +124,18 @@ abstract class CheckServerPresenter constructor(
if
(
services
.
isNotEmpty
())
{
state
=
OauthHelper
.
getState
()
checkEnabledOauthAccounts
(
services
,
serverUrl
)
checkEnabledCasAccounts
(
serverUrl
)
checkEnabledCustomOauthAccounts
(
services
,
serverUrl
)
checkEnabledSamlAccounts
(
services
,
serverUrl
)
}
}
catch
(
exception
:
RocketChatException
)
{
Timber
.
e
(
exception
)
}
}
private
fun
checkEnabledOauthAccounts
(
services
:
List
<
Map
<
String
,
Any
>>,
serverUrl
:
String
)
{
// OAuth accounts.
if
(
settings
.
isFacebookAuthenticationEnabled
())
{
getServiceMap
(
services
,
SERVICE_NAME_FACEBOOK
)
?.
let
{
serviceMap
->
getOauthClientId
(
serviceMap
)
?.
let
{
clientId
->
...
...
@@ -215,15 +225,17 @@ abstract class CheckServerPresenter constructor(
}
}
}
}
// CAS account.
private
fun
checkEnabledCasAccounts
(
serverUrl
:
String
)
{
if
(
settings
.
isCasAuthenticationEnabled
())
{
casToken
=
generateRandomString
(
17
)
casLoginUrl
=
settings
.
casLoginUrl
().
casUrl
(
serverUrl
,
casToken
.
toString
())
totalSocialAccountsEnabled
++
}
}
// Custom OAuth account.
private
fun
checkEnabledCustomOauthAccounts
(
services
:
List
<
Map
<
String
,
Any
>>,
serverUrl
:
String
)
{
getCustomOauthServices
(
services
).
let
{
for
(
serviceMap
in
it
)
{
customOauthServiceName
=
getCustomOauthServiceName
(
serviceMap
)
...
...
@@ -242,7 +254,6 @@ abstract class CheckServerPresenter constructor(
serviceNameTextColor
!=
null
&&
serviceButtonColor
!=
null
)
{
customOauthUrl
=
OauthHelper
.
getCustomOauthUrl
(
host
,
authorizePath
,
...
...
@@ -258,8 +269,9 @@ abstract class CheckServerPresenter constructor(
}
}
}
}
// SAML account.
private
fun
checkEnabledSamlAccounts
(
services
:
List
<
Map
<
String
,
Any
>>,
serverUrl
:
String
)
{
getSamlServices
(
services
).
let
{
samlToken
=
generateRandomString
(
17
)
for
(
serviceMap
in
it
)
{
...
...
@@ -282,10 +294,6 @@ abstract class CheckServerPresenter constructor(
}
}
}
}
catch
(
exception
:
RocketChatException
)
{
Timber
.
e
(
exception
)
}
}
internal
fun
checkIfLoginFormIsEnabled
()
{
if
(
settings
.
isLoginFormEnabled
())
{
...
...
app/src/main/res/layout/fragment_authentication_login_options.xml
View file @
dbfcde7e
...
...
@@ -12,18 +12,19 @@
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
>
<
androidx.constraintlayout.widget.Constraint
Layout
<
Linear
Layout
android:id=
"@+id/accounts_container"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
a
pp:layout_constraintTop_toTopOf=
"parent
"
a
ndroid:orientation=
"vertical
"
android:visibility=
"gone"
app:layout_constraintTop_toTopOf=
"parent"
tools:visibility=
"visible"
>
<Button
android:id=
"@+id/button_facebook"
style=
"?borderlessButtonStyle"
android:layout_width=
"
0dp
"
android:layout_width=
"
match_parent
"
android:layout_height=
"48dp"
android:background=
"@drawable/rounded_border"
android:clickable=
"false"
...
...
@@ -36,15 +37,12 @@
android:textColor=
"@color/colorPrimary"
android:textSize=
"16sp"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:visibility=
"visible"
/>
<Button
android:id=
"@+id/button_github"
style=
"?borderlessButtonStyle"
android:layout_width=
"
0dp
"
android:layout_width=
"
match_parent
"
android:layout_height=
"48dp"
android:layout_marginTop=
"10dp"
android:background=
"@drawable/rounded_border"
...
...
@@ -58,15 +56,12 @@
android:textColor=
"@color/colorPrimary"
android:textSize=
"16sp"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/button_facebook"
tools:visibility=
"visible"
/>
<Button
android:id=
"@+id/button_google"
style=
"?borderlessButtonStyle"
android:layout_width=
"
0dp
"
android:layout_width=
"
match_parent
"
android:layout_height=
"48dp"
android:layout_marginTop=
"10dp"
android:background=
"@drawable/rounded_border"
...
...
@@ -80,15 +75,12 @@
android:textColor=
"@color/colorPrimary"
android:textSize=
"16sp"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/button_github"
tools:visibility=
"visible"
/>
<Button
android:id=
"@+id/button_linkedin"
style=
"?borderlessButtonStyle"
android:layout_width=
"
0dp
"
android:layout_width=
"
match_parent
"
android:layout_height=
"48dp"
android:layout_marginTop=
"10dp"
android:background=
"@drawable/rounded_border"
...
...
@@ -102,15 +94,12 @@
android:textColor=
"@color/colorPrimary"
android:textSize=
"16sp"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/button_google"
tools:visibility=
"visible"
/>
<Button
android:id=
"@+id/button_gitlab"
style=
"?borderlessButtonStyle"
android:layout_width=
"
0dp
"
android:layout_width=
"
match_parent
"
android:layout_height=
"48dp"
android:layout_marginTop=
"10dp"
android:background=
"@drawable/rounded_border"
...
...
@@ -124,15 +113,12 @@
android:textColor=
"@color/colorPrimary"
android:textSize=
"16sp"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/button_linkedin"
tools:visibility=
"visible"
/>
<Button
android:id=
"@+id/button_wordpress"
style=
"?borderlessButtonStyle"
android:layout_width=
"
0dp
"
android:layout_width=
"
match_parent
"
android:layout_height=
"48dp"
android:layout_marginTop=
"10dp"
android:background=
"@drawable/rounded_border"
...
...
@@ -146,9 +132,6 @@
android:textColor=
"@color/colorPrimary"
android:textSize=
"16sp"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/button_gitlab"
tools:visibility=
"visible"
/>
<Button
...
...
@@ -158,11 +141,8 @@
android:clickable=
"false"
android:text=
"@string/action_login_or_sign_up"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/button_wordpress"
tools:visibility=
"visible"
/>
</
androidx.constraintlayout.widget.Constraint
Layout>
</
Linear
Layout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/expand_more_accounts_container"
...
...
app/src/main/res/values/styles.xml
View file @
dbfcde7e
...
...
@@ -80,7 +80,7 @@
</style>
<style
name=
"Authentication.Button"
parent=
"Widget.AppCompat.Button.Borderless"
>
<item
name=
"android:layout_width"
>
0dp
</item>
<item
name=
"android:layout_width"
>
match_parent
</item>
<item
name=
"android:layout_height"
>
48dp
</item>
<item
name=
"android:foreground"
>
?selectableItemBackground
</item>
<item
name=
"android:textSize"
>
18sp
</item>
...
...
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