mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-21 20:41:27 +00:00
Remove unused Room database code
This commit is contained in:
parent
7d87777bf8
commit
4122ebe18f
@ -88,9 +88,6 @@ dependencies {
|
|||||||
implementation "com.squareup.moshi:moshi:${vMoshi}"
|
implementation "com.squareup.moshi:moshi:${vMoshi}"
|
||||||
kapt "com.squareup.moshi:moshi-kotlin-codegen:${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.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation 'androidx.browser:browser:1.0.0'
|
implementation 'androidx.browser:browser:1.0.0'
|
||||||
implementation 'androidx.preference:preference:1.0.0'
|
implementation 'androidx.preference:preference:1.0.0'
|
||||||
|
@ -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
|
|
||||||
|
|
||||||
}
|
|
@ -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>
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +1,15 @@
|
|||||||
package com.topjohnwu.magisk.di
|
package com.topjohnwu.magisk.di
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.room.Room
|
|
||||||
import com.topjohnwu.magisk.data.database.*
|
import com.topjohnwu.magisk.data.database.*
|
||||||
import com.topjohnwu.magisk.tasks.UpdateRepos
|
import com.topjohnwu.magisk.tasks.UpdateRepos
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
|
|
||||||
|
|
||||||
val databaseModule = module {
|
val databaseModule = module {
|
||||||
single { createDatabase(get()) }
|
|
||||||
single { LogDao() }
|
single { LogDao() }
|
||||||
single { PolicyDao(get()) }
|
single { PolicyDao(get()) }
|
||||||
single { SettingsDao() }
|
single { SettingsDao() }
|
||||||
single { StringDao() }
|
single { StringDao() }
|
||||||
single { createRepositoryDao(get()) }
|
|
||||||
single { RepoDatabaseHelper(get()) }
|
single { RepoDatabaseHelper(get()) }
|
||||||
single { UpdateRepos(get()) }
|
single { UpdateRepos(get()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createDatabase(context: Context): AppDatabase =
|
|
||||||
Room.databaseBuilder(context, AppDatabase::class.java, AppDatabase.NAME).build()
|
|
||||||
|
|
||||||
fun createRepositoryDao(db: AppDatabase) = db.repoDao()
|
|
@ -14,12 +14,9 @@ import retrofit2.converter.moshi.MoshiConverterFactory
|
|||||||
|
|
||||||
val networkingModule = module {
|
val networkingModule = module {
|
||||||
single { createOkHttpClient() }
|
single { createOkHttpClient() }
|
||||||
|
|
||||||
single { createConverterFactory() }
|
single { createConverterFactory() }
|
||||||
single { createCallAdapterFactory() }
|
single { createCallAdapterFactory() }
|
||||||
|
|
||||||
single { createRetrofit(get(), get(), get()) }
|
single { createRetrofit(get(), get(), get()) }
|
||||||
|
|
||||||
single { createApiService<GithubRawApiServices>(get(), Constants.GITHUB_RAW_API_URL) }
|
single { createApiService<GithubRawApiServices>(get(), Constants.GITHUB_RAW_API_URL) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user