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 @@ ...@@ -36,6 +36,37 @@
"status": 2 "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" "configuration_version": "1"
......
...@@ -26,7 +26,7 @@ class ChatRoomsAdapter(private var dataSet: MutableList<ChatRoom>, private val c ...@@ -26,7 +26,7 @@ class ChatRoomsAdapter(private var dataSet: MutableList<ChatRoom>, private val c
val chatRoom = dataSet[position] val chatRoom = dataSet[position]
val chatRoomName = chatRoom.name val chatRoomName = chatRoom.name
holder.chatName.textContent = chatRoomName holder.chatName.textContent = chatRoomName!!
if (chatRoom.type == RoomType.ONE_TO_ONE) { if (chatRoom.type == RoomType.ONE_TO_ONE) {
// TODO Check the best way to get the current server url. // TODO Check the best way to get the current server url.
......
package chat.rocket.android.push package chat.rocket.android.push
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.dagger.module.AppModule
import chat.rocket.android.infrastructure.LocalRepository import chat.rocket.android.infrastructure.LocalRepository
import chat.rocket.android.push.di.DaggerPushComponent import chat.rocket.android.push.di.DaggerPushComponent
import chat.rocket.android.push.di.PushModule import chat.rocket.android.push.di.PushModule
...@@ -26,7 +25,6 @@ class FirebaseTokenService : FirebaseInstanceIdService() { ...@@ -26,7 +25,6 @@ class FirebaseTokenService : FirebaseInstanceIdService() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
DaggerPushComponent.builder() DaggerPushComponent.builder()
.appModule(AppModule())
.pushModule(PushModule(this)) .pushModule(PushModule(this))
.build() .build()
.inject(this) .inject(this)
......
...@@ -20,7 +20,7 @@ import android.text.Spanned ...@@ -20,7 +20,7 @@ import android.text.Spanned
import android.util.Log import android.util.Log
import chat.rocket.android.BuildConfig import chat.rocket.android.BuildConfig
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.app.MainActivity import chat.rocket.android.chatrooms.ui.MainActivity
import org.json.JSONObject import org.json.JSONObject
import java.io.Serializable import java.io.Serializable
import java.util.* import java.util.*
......
...@@ -6,7 +6,7 @@ import dagger.Component ...@@ -6,7 +6,7 @@ import dagger.Component
import javax.inject.Singleton import javax.inject.Singleton
@Singleton @Singleton
@Component(modules = arrayOf(AppModule::class, PushModule::class)) @Component(modules = [PushModule::class])
interface PushComponent { interface PushComponent {
fun inject(service: FirebaseTokenService) fun inject(service: FirebaseTokenService)
} }
\ No newline at end of file
package chat.rocket.android.push.di package chat.rocket.android.push.di
import chat.rocket.android.BuildConfig
import chat.rocket.android.authentication.infraestructure.AuthTokenRepository import chat.rocket.android.authentication.infraestructure.AuthTokenRepository
import chat.rocket.android.infrastructure.LocalRepository import chat.rocket.android.infrastructure.LocalRepository
import chat.rocket.android.infrastructure.SharedPreferencesRepository import chat.rocket.android.infrastructure.SharedPreferencesRepository
import chat.rocket.android.push.FirebaseTokenService import chat.rocket.android.push.FirebaseTokenService
import chat.rocket.android.util.TimberLogger
import chat.rocket.common.util.PlatformLogger import chat.rocket.common.util.PlatformLogger
import chat.rocket.core.RocketChatClient import chat.rocket.core.RocketChatClient
import chat.rocket.core.TokenRepository import chat.rocket.core.TokenRepository
...@@ -11,6 +13,7 @@ import dagger.Module ...@@ -11,6 +13,7 @@ import dagger.Module
import dagger.Provides import dagger.Provides
import okhttp3.HttpUrl import okhttp3.HttpUrl
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import javax.inject.Singleton import javax.inject.Singleton
@Module @Module
...@@ -23,8 +26,32 @@ class PushModule(val context: FirebaseTokenService) { ...@@ -23,8 +26,32 @@ class PushModule(val context: FirebaseTokenService) {
@Provides @Provides
fun provideLocalRepository(): LocalRepository = SharedPreferencesRepository(context) fun provideLocalRepository(): LocalRepository = SharedPreferencesRepository(context)
// @Provides @Provides
// fun provideCurrentServer() = "https://open.rocket.chat" @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 @Provides
fun provideRocketChatClient(okHttpClient: OkHttpClient, repository: TokenRepository, logger: PlatformLogger): RocketChatClient { 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