mirror of
https://github.com/hmalik144/EasyCC_Master.git
synced 2025-12-10 03:05:29 +00:00
key removed from gradle properties moved to keys string
This commit is contained in:
@@ -24,7 +24,7 @@ class AppClass : Application(), KodeinAware {
|
||||
|
||||
// instance() can be context or other binding created
|
||||
bind() from singleton { NetworkConnectionInterceptor(instance()) }
|
||||
bind() from singleton { QueryInterceptor() }
|
||||
bind() from singleton { QueryInterceptor(instance()) }
|
||||
bind() from singleton { CurrencyApi(instance(),instance()) }
|
||||
bind() from singleton { PreferenceProvider(instance()) }
|
||||
bind() from singleton { RepositoryImpl(instance(), instance(), instance()) }
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.appttude.h_mal.easycc.data.network.interceptors
|
||||
|
||||
import android.content.Context
|
||||
import com.appttude.h_mal.easycc.BuildConfig
|
||||
import com.appttude.h_mal.easycc.R
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Request
|
||||
@@ -10,14 +12,16 @@ import okhttp3.Response
|
||||
* Interceptor used in CurrencyApi
|
||||
* Adds apiKey to query parameters
|
||||
*/
|
||||
class QueryInterceptor() : Interceptor {
|
||||
class QueryInterceptor(
|
||||
val context: Context
|
||||
) : Interceptor {
|
||||
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val original: Request = chain.request()
|
||||
val originalHttpUrl: HttpUrl = original.url()
|
||||
|
||||
val url = originalHttpUrl.newBuilder()
|
||||
.addQueryParameter("apiKey", "a4f93cc2ff05dd772321")
|
||||
.addQueryParameter("apiKey", context.getString(R.string.apiKey))
|
||||
.build()
|
||||
|
||||
// Add amended Url back to request
|
||||
|
||||
Reference in New Issue
Block a user