Commit 831a61af authored by Leonardo Aramaki's avatar Leonardo Aramaki

Fixed code to embrace the new -dev flavor. Changes includes a newly

generated google-services.json file including chat.rocket.android.dev
app within clients
parent c0462fe1
......@@ -36,6 +36,37 @@
"status": 2
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:1020987621558:android:1551054db195f705",
"android_client_info": {
"package_name": "chat.rocket.android.dev"
}
},
"oauth_client": [
{
"client_id": "1020987621558-trk61fjrahho0ujtjap095p1jmi48pfq.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDc7VYUdU6kRkoRTToiCn1rh-W0wJvhLWk"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
......
......@@ -26,7 +26,7 @@ class ChatRoomsAdapter(private var dataSet: MutableList<ChatRoom>, private val c
val chatRoom = dataSet[position]
val chatRoomName = chatRoom.name
holder.chatName.textContent = chatRoomName
holder.chatName.textContent = chatRoomName!!
if (chatRoom.type == RoomType.ONE_TO_ONE) {
// TODO Check the best way to get the current server url.
......
package chat.rocket.android.push
import chat.rocket.android.R
import chat.rocket.android.dagger.module.AppModule
import chat.rocket.android.infrastructure.LocalRepository
import chat.rocket.android.push.di.DaggerPushComponent
import chat.rocket.android.push.di.PushModule
......@@ -26,7 +25,6 @@ class FirebaseTokenService : FirebaseInstanceIdService() {
override fun onCreate() {
super.onCreate()
DaggerPushComponent.builder()
.appModule(AppModule())
.pushModule(PushModule(this))
.build()
.inject(this)
......
......@@ -20,7 +20,7 @@ import android.text.Spanned
import android.util.Log
import chat.rocket.android.BuildConfig
import chat.rocket.android.R
import chat.rocket.android.app.MainActivity
import chat.rocket.android.chatrooms.ui.MainActivity
import org.json.JSONObject
import java.io.Serializable
import java.util.*
......
......@@ -6,7 +6,7 @@ import dagger.Component
import javax.inject.Singleton
@Singleton
@Component(modules = arrayOf(AppModule::class, PushModule::class))
@Component(modules = [PushModule::class])
interface PushComponent {
fun inject(service: FirebaseTokenService)
}
\ No newline at end of file
package chat.rocket.android.push.di
import chat.rocket.android.BuildConfig
import chat.rocket.android.authentication.infraestructure.AuthTokenRepository
import chat.rocket.android.infrastructure.LocalRepository
import chat.rocket.android.infrastructure.SharedPreferencesRepository
import chat.rocket.android.push.FirebaseTokenService
import chat.rocket.android.util.TimberLogger
import chat.rocket.common.util.PlatformLogger
import chat.rocket.core.RocketChatClient
import chat.rocket.core.TokenRepository
......@@ -11,6 +13,7 @@ import dagger.Module
import dagger.Provides
import okhttp3.HttpUrl
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import javax.inject.Singleton
@Module
......@@ -23,8 +26,32 @@ class PushModule(val context: FirebaseTokenService) {
@Provides
fun provideLocalRepository(): LocalRepository = SharedPreferencesRepository(context)
// @Provides
// fun provideCurrentServer() = "https://open.rocket.chat"
@Provides
@Singleton
fun providePlatformLogger(): PlatformLogger {
return TimberLogger
}
@Provides
@Singleton
fun provideHttpLoggingInterceptor(): HttpLoggingInterceptor {
val interceptor = HttpLoggingInterceptor()
if (BuildConfig.DEBUG) {
interceptor.level = HttpLoggingInterceptor.Level.BODY
} else {
interceptor.level = HttpLoggingInterceptor.Level.HEADERS
}
return interceptor
}
@Provides
@Singleton
fun provideOkHttpClient(logger: HttpLoggingInterceptor): OkHttpClient {
return OkHttpClient.Builder().apply {
addInterceptor(logger)
}.build()
}
@Provides
fun provideRocketChatClient(okHttpClient: OkHttpClient, repository: TokenRepository, logger: PlatformLogger): RocketChatClient {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment