Remove unused Room database code

This commit is contained in:
topjohnwu 2019-06-01 02:20:40 -07:00
parent 7d87777bf8
commit 4122ebe18f
5 changed files with 0 additions and 56 deletions

View File

@ -88,9 +88,6 @@ dependencies {
implementation "com.squareup.moshi:moshi:${vMoshi}"
kapt "com.squareup.moshi:moshi-kotlin-codegen:${vMoshi}"
def vRoom = '2.1.0-rc01'
implementation "androidx.room:room-rxjava2:${vRoom}"
kapt "androidx.room:room-compiler:${vRoom}"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.preference:preference:1.0.0'

View File

@ -1,19 +0,0 @@
package com.topjohnwu.magisk.data.database
import androidx.room.Database
import androidx.room.RoomDatabase
import com.topjohnwu.magisk.model.entity.Repository
@Database(
version = 1,
entities = [Repository::class]
)
abstract class AppDatabase : RoomDatabase() {
companion object {
const val NAME = "database"
}
abstract fun repoDao(): RepositoryDao
}

View File

@ -1,22 +0,0 @@
package com.topjohnwu.magisk.data.database
import androidx.room.Dao
import androidx.room.Query
import androidx.room.Transaction
import com.skoumal.teanity.database.BaseDao
import com.topjohnwu.magisk.model.entity.Repository
@Dao
interface RepositoryDao : BaseDao<Repository> {
@Query("DELETE FROM repos")
@Transaction
override fun deleteAll()
@Query("SELECT * FROM repos ORDER BY lastUpdate DESC")
override fun fetchAll(): List<Repository>
@Query("SELECT * FROM repos ORDER BY name ASC")
fun fetchAllOrderByName(): List<Repository>
}

View File

@ -1,24 +1,15 @@
package com.topjohnwu.magisk.di
import android.content.Context
import androidx.room.Room
import com.topjohnwu.magisk.data.database.*
import com.topjohnwu.magisk.tasks.UpdateRepos
import org.koin.dsl.module
val databaseModule = module {
single { createDatabase(get()) }
single { LogDao() }
single { PolicyDao(get()) }
single { SettingsDao() }
single { StringDao() }
single { createRepositoryDao(get()) }
single { RepoDatabaseHelper(get()) }
single { UpdateRepos(get()) }
}
fun createDatabase(context: Context): AppDatabase =
Room.databaseBuilder(context, AppDatabase::class.java, AppDatabase.NAME).build()
fun createRepositoryDao(db: AppDatabase) = db.repoDao()

View File

@ -14,12 +14,9 @@ import retrofit2.converter.moshi.MoshiConverterFactory
val networkingModule = module {
single { createOkHttpClient() }
single { createConverterFactory() }
single { createCallAdapterFactory() }
single { createRetrofit(get(), get(), get()) }
single { createApiService<GithubRawApiServices>(get(), Constants.GITHUB_RAW_API_URL) }
}