Skip to content

Commit

Permalink
Remoção libs desnecessárias
Browse files Browse the repository at this point in the history
  • Loading branch information
diefferson committed Nov 13, 2018
1 parent ed5d8ac commit e9a2a1b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
4 changes: 0 additions & 4 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apply plugin: 'realm-android'


group = 'com.github.diefferson'
version='0.0.10'
version='0.0.11'

android {
compileSdkVersion 28
Expand All @@ -15,7 +15,7 @@ android {
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "0.0.10"
versionName "0.0.11"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand All @@ -31,6 +31,4 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.26.1-eap13"
implementation 'com.google.code.gson:gson:2.8.5'
implementation "android.arch.persistence.room:runtime:1.1.1"
kapt "android.arch.persistence.room:compiler:1.1.1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ open class CoroutinesCache(private var context: Context): CoroutineScope{
initDatabase()
}
}

inline fun <reified T:Any> asyncCache(noinline source: suspend ()->Deferred<T>, key: String, forceSource:Boolean): Deferred<T> {
return if (forceSource) {
getFromSource(source, key)
Expand Down Expand Up @@ -57,6 +58,6 @@ open class CoroutinesCache(private var context: Context): CoroutineScope{
}

companion object {
const val CACHE_PREFIX = "cache"

}
}
12 changes: 8 additions & 4 deletions library/src/main/java/io/coroutines/cache/dao/LocalDatabase.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.coroutines.cache.dao

import android.content.Context
import io.coroutines.cache.core.CoroutinesCache
import io.realm.Realm
import io.realm.RealmConfiguration
import io.realm.RealmObject
Expand All @@ -13,18 +12,23 @@ class RealmDatabase(var context: Context) {
Realm.init(context)

val realmConfiguration = RealmConfiguration.Builder()
.name(context.packageName+ CoroutinesCache.CACHE_PREFIX)
.schemaVersion(1)
.name(context.packageName+CACHE_PREFIX)
.schemaVersion(VERSION)
.deleteRealmIfMigrationNeeded()
.build()

Realm.setDefaultConfiguration(realmConfiguration)

}

fun getDatabase(): Realm {
return Realm.getDefaultInstance()
}

companion object {
private const val VERSION = 1L
private const val CACHE_PREFIX = "cache"
}

}

open class Cache constructor(): RealmObject(){
Expand Down

0 comments on commit e9a2a1b

Please sign in to comment.