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
fda874b9
Unverified
Commit
fda874b9
authored
May 07, 2018
by
Filipe de Lima Brito
Committed by
GitHub
May 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1213 from MariusVolkhart/frescoAuthenticator
[IMPROVEMENT] Remove the FrescoAuthInterceptor
parents
c0c5ec4e
965d8567
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
57 deletions
+1
-57
AppModule.kt
.../main/java/chat/rocket/android/dagger/module/AppModule.kt
+1
-20
ForFresco.kt
...in/java/chat/rocket/android/dagger/qualifier/ForFresco.kt
+0
-7
FrescoAuthInterceptor.kt
.../java/chat/rocket/android/helper/FrescoAuthInterceptor.kt
+0
-30
No files found.
app/src/main/java/chat/rocket/android/dagger/module/AppModule.kt
View file @
fda874b9
...
...
@@ -14,9 +14,7 @@ import chat.rocket.android.app.RocketChatDatabase
import
chat.rocket.android.authentication.infraestructure.SharedPreferencesMultiServerTokenRepository
import
chat.rocket.android.authentication.infraestructure.SharedPreferencesTokenRepository
import
chat.rocket.android.chatroom.service.MessageService
import
chat.rocket.android.dagger.qualifier.ForFresco
import
chat.rocket.android.dagger.qualifier.ForMessages
import
chat.rocket.android.helper.FrescoAuthInterceptor
import
chat.rocket.android.helper.MessageParser
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.infrastructure.SharedPrefsLocalRepository
...
...
@@ -43,7 +41,6 @@ import com.squareup.moshi.Moshi
import
dagger.Module
import
dagger.Provides
import
kotlinx.coroutines.experimental.Job
import
okhttp3.Interceptor
import
okhttp3.OkHttpClient
import
okhttp3.logging.HttpLoggingInterceptor
import
ru.noties.markwon.SpannableConfiguration
...
...
@@ -119,24 +116,8 @@ class AppModule {
}
@Provides
@ForFresco
@Singleton
fun
provideFrescoAuthInterceptor
(
tokenRepository
:
TokenRepository
,
currentServerInteractor
:
GetCurrentServerInteractor
):
Interceptor
{
return
FrescoAuthInterceptor
(
tokenRepository
,
currentServerInteractor
)
}
@Provides
@ForFresco
@Singleton
fun
provideFrescoOkHttpClient
(
okHttpClient
:
OkHttpClient
,
@ForFresco
authInterceptor
:
Interceptor
):
OkHttpClient
{
return
okHttpClient
.
newBuilder
().
apply
{
//addInterceptor(authInterceptor)
}.
build
()
}
@Provides
@Singleton
fun
provideImagePipelineConfig
(
context
:
Context
,
@ForFresco
okHttpClient
:
OkHttpClient
):
ImagePipelineConfig
{
fun
provideImagePipelineConfig
(
context
:
Context
,
okHttpClient
:
OkHttpClient
):
ImagePipelineConfig
{
val
listeners
=
setOf
(
RequestLoggingListener
())
return
OkHttpImagePipelineConfigFactory
.
newBuilder
(
context
,
okHttpClient
)
...
...
app/src/main/java/chat/rocket/android/dagger/qualifier/ForFresco.kt
deleted
100644 → 0
View file @
c0c5ec4e
package
chat.rocket.android.dagger.qualifier
import
javax.inject.Qualifier
@Qualifier
@Retention
(
AnnotationRetention
.
RUNTIME
)
annotation
class
ForFresco
\ No newline at end of file
app/src/main/java/chat/rocket/android/helper/FrescoAuthInterceptor.kt
deleted
100644 → 0
View file @
c0c5ec4e
package
chat.rocket.android.helper
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.TokenRepository
import
okhttp3.Interceptor
import
okhttp3.Response
class
FrescoAuthInterceptor
(
private
val
tokenRepository
:
TokenRepository
,
private
val
currentServerInteractor
:
GetCurrentServerInteractor
)
:
Interceptor
{
override
fun
intercept
(
chain
:
Interceptor
.
Chain
):
Response
{
var
request
=
chain
.
request
()
currentServerInteractor
.
get
()
?.
let
{
serverUrl
->
val
token
=
tokenRepository
.
get
(
serverUrl
)
return
@let
token
?.
let
{
val
url
=
request
.
url
().
newBuilder
().
apply
{
addQueryParameter
(
"rc_uid"
,
token
.
userId
)
addQueryParameter
(
"rc_token"
,
token
.
authToken
)
}.
build
()
request
=
request
.
newBuilder
().
apply
{
url
(
url
)
}.
build
()
}
}
return
chain
.
proceed
(
request
)
}
}
\ No newline at end of file
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