From 4122ebe18f41995f7223816db2bb73bab002ec75 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 1 Jun 2019 02:20:40 -0700 Subject: [PATCH] Remove unused Room database code --- app/build.gradle | 3 --- .../magisk/data/database/AppDatabase.kt | 19 ---------------- .../magisk/data/database/RepositoryDao.kt | 22 ------------------- .../com/topjohnwu/magisk/di/DatabaseModule.kt | 9 -------- .../topjohnwu/magisk/di/NetworkingModule.kt | 3 --- 5 files changed, 56 deletions(-) delete mode 100644 app/src/main/java/com/topjohnwu/magisk/data/database/AppDatabase.kt delete mode 100644 app/src/main/java/com/topjohnwu/magisk/data/database/RepositoryDao.kt diff --git a/app/build.gradle b/app/build.gradle index e0787350e..0405cf009 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/java/com/topjohnwu/magisk/data/database/AppDatabase.kt b/app/src/main/java/com/topjohnwu/magisk/data/database/AppDatabase.kt deleted file mode 100644 index e09f238bb..000000000 --- a/app/src/main/java/com/topjohnwu/magisk/data/database/AppDatabase.kt +++ /dev/null @@ -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 - -} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/data/database/RepositoryDao.kt b/app/src/main/java/com/topjohnwu/magisk/data/database/RepositoryDao.kt deleted file mode 100644 index 78f74302b..000000000 --- a/app/src/main/java/com/topjohnwu/magisk/data/database/RepositoryDao.kt +++ /dev/null @@ -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 { - - @Query("DELETE FROM repos") - @Transaction - override fun deleteAll() - - @Query("SELECT * FROM repos ORDER BY lastUpdate DESC") - override fun fetchAll(): List - - @Query("SELECT * FROM repos ORDER BY name ASC") - fun fetchAllOrderByName(): List - -} \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/di/DatabaseModule.kt b/app/src/main/java/com/topjohnwu/magisk/di/DatabaseModule.kt index 218329d24..f9015063c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/di/DatabaseModule.kt +++ b/app/src/main/java/com/topjohnwu/magisk/di/DatabaseModule.kt @@ -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() \ No newline at end of file diff --git a/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt b/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt index 91d0a6d9f..3c96836c9 100644 --- a/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt +++ b/app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt @@ -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(get(), Constants.GITHUB_RAW_API_URL) } }