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
6f79e6a4
Commit
6f79e6a4
authored
Apr 23, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds API_Gitlab_URL setting.
parent
a6c52ad9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
6 deletions
+31
-6
LoginPresenter.kt
...droid/authentication/login/presentation/LoginPresenter.kt
+15
-1
OauthHelper.kt
app/src/main/java/chat/rocket/android/helper/OauthHelper.kt
+9
-2
RefreshSettingsInteractor.kt
...rocket/android/server/domain/RefreshSettingsInteractor.kt
+5
-3
SettingsRepository.kt
...a/chat/rocket/android/server/domain/SettingsRepository.kt
+2
-0
No files found.
app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginPresenter.kt
View file @
6f79e6a4
...
@@ -187,7 +187,21 @@ class LoginPresenter @Inject constructor(
...
@@ -187,7 +187,21 @@ class LoginPresenter @Inject constructor(
if
(
settings
.
isGitlabAuthenticationEnabled
())
{
if
(
settings
.
isGitlabAuthenticationEnabled
())
{
val
clientId
=
getOauthClientId
(
services
,
SERVICE_NAME_GILAB
)
val
clientId
=
getOauthClientId
(
services
,
SERVICE_NAME_GILAB
)
if
(
clientId
!=
null
)
{
if
(
clientId
!=
null
)
{
view
.
setupGitlabButtonListener
(
OauthHelper
.
getGitlabOauthUrl
(
clientId
,
currentServer
,
state
),
state
)
val
gitlabOauthUrl
=
if
(
settings
.
gitlabUrl
()
!=
null
)
{
OauthHelper
.
getGitlabOauthUrl
(
host
=
settings
.
gitlabUrl
(),
clientId
=
clientId
,
serverUrl
=
currentServer
,
state
=
state
)
}
else
{
OauthHelper
.
getGitlabOauthUrl
(
clientId
=
clientId
,
serverUrl
=
currentServer
,
state
=
state
)
}
view
.
setupGitlabButtonListener
(
gitlabOauthUrl
,
state
)
view
.
enableLoginByGitlab
()
view
.
enableLoginByGitlab
()
totalSocialAccountsEnabled
++
totalSocialAccountsEnabled
++
}
}
...
...
app/src/main/java/chat/rocket/android/helper/OauthHelper.kt
View file @
6f79e6a4
...
@@ -54,13 +54,20 @@ object OauthHelper {
...
@@ -54,13 +54,20 @@ object OauthHelper {
/**
/**
* Returns the Gitlab Oauth URL.
* Returns the Gitlab Oauth URL.
*
*
* @param host The Gitlab host.
* @param clientId The Gitlab client ID.
* @param clientId The Gitlab client ID.
* @param serverUrl The server URL.
* @param serverUrl The server URL.
* @param state An unguessable random string used to protect against forgery attacks.
* @param state An unguessable random string used to protect against forgery attacks.
* @return The Gitlab Oauth URL.
* @return The Gitlab Oauth URL.
*/
*/
fun
getGitlabOauthUrl
(
clientId
:
String
,
serverUrl
:
String
,
state
:
String
):
String
{
fun
getGitlabOauthUrl
(
return
"https://gitlab.com/oauth/authorize"
+
host
:
String
?
=
"https://gitlab.com"
,
clientId
:
String
,
serverUrl
:
String
,
state
:
String
):
String
{
return
host
+
"/oauth/authorize"
+
"?client_id=$clientId"
+
"?client_id=$clientId"
+
"&redirect_uri=${serverUrl.removeTrailingSlash()}/_oauth/gitlab?close"
+
"&redirect_uri=${serverUrl.removeTrailingSlash()}/_oauth/gitlab?close"
+
"&state=$state"
+
"&state=$state"
+
...
...
app/src/main/java/chat/rocket/android/server/domain/RefreshSettingsInteractor.kt
View file @
6f79e6a4
...
@@ -8,15 +8,17 @@ import kotlinx.coroutines.experimental.async
...
@@ -8,15 +8,17 @@ import kotlinx.coroutines.experimental.async
import
kotlinx.coroutines.experimental.withContext
import
kotlinx.coroutines.experimental.withContext
import
javax.inject.Inject
import
javax.inject.Inject
class
RefreshSettingsInteractor
@Inject
constructor
(
private
val
factory
:
RocketChatClientFactory
,
class
RefreshSettingsInteractor
@Inject
constructor
(
private
val
repository
:
SettingsRepository
)
{
private
val
factory
:
RocketChatClientFactory
,
private
val
repository
:
SettingsRepository
)
{
private
var
settingsFilter
=
arrayOf
(
private
var
settingsFilter
=
arrayOf
(
LDAP_ENABLE
,
CAS_ENABLE
,
CAS_LOGIN_URL
,
LDAP_ENABLE
,
CAS_ENABLE
,
CAS_LOGIN_URL
,
ACCOUNT_REGISTRATION
,
ACCOUNT_LOGIN_FORM
,
ACCOUNT_PASSWORD_RESET
,
ACCOUNT_CUSTOM_FIELDS
,
ACCOUNT_REGISTRATION
,
ACCOUNT_LOGIN_FORM
,
ACCOUNT_PASSWORD_RESET
,
ACCOUNT_CUSTOM_FIELDS
,
ACCOUNT_GOOGLE
,
ACCOUNT_FACEBOOK
,
ACCOUNT_GITHUB
,
ACCOUNT_LINKEDIN
,
ACCOUNT_METEOR
,
ACCOUNT_GOOGLE
,
ACCOUNT_FACEBOOK
,
ACCOUNT_GITHUB
,
ACCOUNT_LINKEDIN
,
ACCOUNT_METEOR
,
ACCOUNT_TWITTER
,
ACCOUNT_WORDPRESS
,
ACCOUNT_GITLAB
,
ACCOUNT_TWITTER
,
ACCOUNT_WORDPRESS
,
ACCOUNT_GITLAB
,
ACCOUNT_GITLAB_URL
,
SITE_URL
,
SITE_NAME
,
FAVICON_512
,
FAVICON_196
,
USE_REALNAME
,
ALLOW_ROOM_NAME_SPECIAL_CHARS
,
SITE_URL
,
SITE_NAME
,
FAVICON_512
,
FAVICON_196
,
USE_REALNAME
,
ALLOW_ROOM_NAME_SPECIAL_CHARS
,
FAVORITE_ROOMS
,
UPLOAD_STORAGE_TYPE
,
UPLOAD_MAX_FILE_SIZE
,
UPLOAD_WHITELIST_MIMETYPES
,
FAVORITE_ROOMS
,
UPLOAD_STORAGE_TYPE
,
UPLOAD_MAX_FILE_SIZE
,
UPLOAD_WHITELIST_MIMETYPES
,
...
...
app/src/main/java/chat/rocket/android/server/domain/SettingsRepository.kt
View file @
6f79e6a4
...
@@ -26,6 +26,7 @@ const val ACCOUNT_METEOR = "Accounts_OAuth_Meteor"
...
@@ -26,6 +26,7 @@ const val ACCOUNT_METEOR = "Accounts_OAuth_Meteor"
const
val
ACCOUNT_TWITTER
=
"Accounts_OAuth_Twitter"
const
val
ACCOUNT_TWITTER
=
"Accounts_OAuth_Twitter"
const
val
ACCOUNT_WORDPRESS
=
"Accounts_OAuth_Wordpress"
const
val
ACCOUNT_WORDPRESS
=
"Accounts_OAuth_Wordpress"
const
val
ACCOUNT_GITLAB
=
"Accounts_OAuth_Gitlab"
const
val
ACCOUNT_GITLAB
=
"Accounts_OAuth_Gitlab"
const
val
ACCOUNT_GITLAB_URL
=
"API_Gitlab_URL"
const
val
SITE_URL
=
"Site_Url"
const
val
SITE_URL
=
"Site_Url"
const
val
SITE_NAME
=
"Site_Name"
const
val
SITE_NAME
=
"Site_Name"
...
@@ -68,6 +69,7 @@ fun PublicSettings.isLinkedinAuthenticationEnabled(): Boolean = this[ACCOUNT_LIN
...
@@ -68,6 +69,7 @@ fun PublicSettings.isLinkedinAuthenticationEnabled(): Boolean = this[ACCOUNT_LIN
fun
PublicSettings
.
isMeteorAuthenticationEnabled
():
Boolean
=
this
[
ACCOUNT_METEOR
]
?.
value
==
true
fun
PublicSettings
.
isMeteorAuthenticationEnabled
():
Boolean
=
this
[
ACCOUNT_METEOR
]
?.
value
==
true
fun
PublicSettings
.
isTwitterAuthenticationEnabled
():
Boolean
=
this
[
ACCOUNT_TWITTER
]
?.
value
==
true
fun
PublicSettings
.
isTwitterAuthenticationEnabled
():
Boolean
=
this
[
ACCOUNT_TWITTER
]
?.
value
==
true
fun
PublicSettings
.
isGitlabAuthenticationEnabled
():
Boolean
=
this
[
ACCOUNT_GITLAB
]
?.
value
==
true
fun
PublicSettings
.
isGitlabAuthenticationEnabled
():
Boolean
=
this
[
ACCOUNT_GITLAB
]
?.
value
==
true
fun
PublicSettings
.
gitlabUrl
():
String
?
=
this
[
ACCOUNT_GITLAB_URL
]
?.
value
as
String
?
fun
PublicSettings
.
isWordpressAuthenticationEnabled
():
Boolean
=
this
[
ACCOUNT_WORDPRESS
]
?.
value
==
true
fun
PublicSettings
.
isWordpressAuthenticationEnabled
():
Boolean
=
this
[
ACCOUNT_WORDPRESS
]
?.
value
==
true
fun
PublicSettings
.
useRealName
():
Boolean
=
this
[
USE_REALNAME
]
?.
value
==
true
fun
PublicSettings
.
useRealName
():
Boolean
=
this
[
USE_REALNAME
]
?.
value
==
true
...
...
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