Skip to content
Snippets Groups Projects
Commit 3838acb5 authored by Kamal Bramwell's avatar Kamal Bramwell
Browse files

Renamed logging package -> common, implemented Hilt

parent 7bf8a921
Branches
No related tags found
No related merge requests found
Showing
with 81 additions and 16 deletions
......@@ -108,7 +108,7 @@ dependencies {
implementation(project(":depconstraints"))
implementation(project(":core:preferences"))
implementation(project(":core:ui"))
implementation(project(":core:logging"))
implementation(project(":core:common"))
implementation(project(":feature:home"))
implementation(project(":feature:registration"))
implementation(project(":feature:splash"))
......
File moved
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
kotlin("android")
kotlin("kapt")
id("dagger.hilt.android.plugin")
}
android {
......@@ -32,6 +34,10 @@ android {
}
}
kapt {
correctErrorTypes = true
}
dependencies {
implementation(project(":depconstraints"))
implementation(project(":core:preferences"))
......@@ -39,4 +45,7 @@ dependencies {
implementation(platform(Libs.Logging.FIREBASE_BOM))
implementation(Libs.Logging.CRASHLYTICS)
implementation(Libs.Logging.TIMBER)
implementation(Libs.DI.HILT)
kapt(Libs.DI.HILT_KAPT)
}
\ No newline at end of file
File moved
File moved
package io.elixxir.core.logging
package io.elixxir.core.common
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.elixxir.core.logging">
package="io.elixxir.core.common">
</manifest>
\ No newline at end of file
package io.elixxir.core.common
import com.google.android.datatransport.runtime.dagger.Binds
import com.google.android.datatransport.runtime.dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
@Module
@InstallIn(SingletonComponent::class)
interface CommonModule {
@Binds
fun bindConfig(
config: DefaultConfig
): Config
}
\ No newline at end of file
package io.elixxir.core.common
import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import timber.log.Timber
interface Config {
val defaultDispatcher: CoroutineDispatcher
fun log(message: String, export: Boolean = false)
fun logException(e: Exception, export: Boolean = true)
}
object DefaultConfig : Config {
override val defaultDispatcher: CoroutineDispatcher
get() = Dispatchers.IO
override fun log(message: String, export: Boolean) {
Timber.d(message)
if (export) Firebase.crashlytics.log(message)
}
override fun logException(e: Exception, export: Boolean) {
Timber.e(e)
if (export) Firebase.crashlytics.recordException(e)
}
}
\ No newline at end of file
package io.elixxir.core.logging
package io.elixxir.core.common
import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase
......
package io.elixxir.core.common
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
fun NotExposedYet(): Nothing = TODO("Not exposed in Bindings yet")
fun newScopeNamed(name: String): CoroutineScope =
CoroutineScope(
CoroutineName(name)
+ Job()
+ Dispatchers.Default
)
\ No newline at end of file
package io.elixxir.core.logging
package io.elixxir.core.common
import org.junit.Test
......
package io.elixxir.core.logging
fun NotExposedYet(): Nothing = TODO("Not exposed in Bindings yet")
\ No newline at end of file
......@@ -41,7 +41,7 @@ kapt {
dependencies {
implementation(project(":depconstraints"))
implementation(project(":xxclient"))
implementation(project(":core:logging"))
implementation(project(":core:common"))
implementation(Libs.Core.ANDROIDX_APPCOMPAT)
implementation(Libs.Core.CORE_KTX)
......
package io.elixxir.data.networking.data
import io.elixxir.core.logging.log
import io.elixxir.core.common.log
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
......
......@@ -40,7 +40,7 @@ android {
dependencies {
implementation(project(":depconstraints"))
implementation(project(":core:logging"))
implementation(project(":core:common"))
implementation(Libs.Core.ANDROIDX_APPCOMPAT)
implementation(Libs.Core.CORE_KTX)
......
......@@ -7,7 +7,7 @@ import android.net.Uri
import android.os.Bundle
import android.widget.Toast
import androidx.fragment.app.Fragment
import io.elixxir.core.logging.log
import io.elixxir.core.common.log
import io.elixxir.core.ui.R
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
......
......@@ -3,7 +3,7 @@ package io.elixxir.core.ui.util
import androidx.fragment.app.Fragment
import androidx.navigation.NavDirections
import androidx.navigation.fragment.findNavController
import io.elixxir.core.logging.log
import io.elixxir.core.common.log
fun Fragment.navigateSafe(directions: NavDirections) {
try {
......
......@@ -41,7 +41,7 @@ kapt {
dependencies {
implementation(project(":depconstraints"))
implementation(project(":xxclient"))
implementation(project(":core:logging"))
implementation(project(":core:common"))
implementation(project(":core:preferences"))
implementation(Libs.Core.ANDROIDX_APPCOMPAT)
......
......@@ -3,7 +3,7 @@ package io.elixxir.data.session.data
import android.os.Build
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
import io.elixxir.core.logging.log
import io.elixxir.core.common.log
import io.elixxir.data.session.util.fromBase64toByteArray
import io.elixxir.data.session.util.toBase64String
import io.elixxir.xxclient.bindings.Bindings
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment