Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
2ef088cb
Commit
2ef088cb
authored
Nov 13, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update RepoDao
parent
7c320b6f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
25 deletions
+10
-25
RepoDao.kt
...c/main/java/com/topjohnwu/magisk/data/database/RepoDao.kt
+9
-12
RepoDatabase.kt
...n/java/com/topjohnwu/magisk/data/database/RepoDatabase.kt
+0
-11
DatabaseModule.kt
app/src/main/java/com/topjohnwu/magisk/di/DatabaseModule.kt
+1
-2
No files found.
app/src/main/java/com/topjohnwu/magisk/data/database/RepoDao.kt
View file @
2ef088cb
...
@@ -4,8 +4,14 @@ import androidx.room.*
...
@@ -4,8 +4,14 @@ import androidx.room.*
import
com.topjohnwu.magisk.Config
import
com.topjohnwu.magisk.Config
import
com.topjohnwu.magisk.model.entity.module.Repo
import
com.topjohnwu.magisk.model.entity.module.Repo
@Database
(
version
=
6
,
entities
=
[
Repo
::
class
,
RepoEtag
::
class
])
abstract
class
RepoDatabase
:
RoomDatabase
()
{
abstract
fun
repoDao
()
:
RepoDao
}
@Dao
@Dao
abstract
class
RepoDao
{
abstract
class
RepoDao
(
private
val
db
:
RepoDatabase
)
{
val
repoIDList
get
()
=
getRepoID
().
map
{
it
.
id
}
val
repoIDList
get
()
=
getRepoID
().
map
{
it
.
id
}
...
@@ -15,13 +21,10 @@ abstract class RepoDao {
...
@@ -15,13 +21,10 @@ abstract class RepoDao {
}
}
var
etagKey
:
String
var
etagKey
:
String
set
(
etag
)
=
addEtagRaw
(
RepoEtag
(
0
,
etag
))
set
(
value
)
=
addEtagRaw
(
RepoEtag
(
0
,
value
))
get
()
=
etagRaw
()
?.
key
.
orEmpty
()
get
()
=
etagRaw
()
?.
key
.
orEmpty
()
fun
clear
()
{
fun
clear
()
=
db
.
clearAllTables
()
clearRepos
()
clearEtag
()
}
@Query
(
"SELECT * FROM repos ORDER BY last_update DESC"
)
@Query
(
"SELECT * FROM repos ORDER BY last_update DESC"
)
protected
abstract
fun
getReposDateOrder
():
List
<
Repo
>
protected
abstract
fun
getReposDateOrder
():
List
<
Repo
>
...
@@ -52,12 +55,6 @@ abstract class RepoDao {
...
@@ -52,12 +55,6 @@ abstract class RepoDao {
@Insert
(
onConflict
=
OnConflictStrategy
.
REPLACE
)
@Insert
(
onConflict
=
OnConflictStrategy
.
REPLACE
)
protected
abstract
fun
addEtagRaw
(
etag
:
RepoEtag
)
protected
abstract
fun
addEtagRaw
(
etag
:
RepoEtag
)
@Query
(
"DELETE FROM repos"
)
protected
abstract
fun
clearRepos
()
@Query
(
"DELETE FROM etag"
)
protected
abstract
fun
clearEtag
()
}
}
data class
RepoID
(
data class
RepoID
(
...
...
app/src/main/java/com/topjohnwu/magisk/data/database/RepoDatabase.kt
deleted
100644 → 0
View file @
7c320b6f
package
com.topjohnwu.magisk.data.database
import
androidx.room.Database
import
androidx.room.RoomDatabase
import
com.topjohnwu.magisk.model.entity.module.Repo
@Database
(
version
=
6
,
entities
=
[
Repo
::
class
,
RepoEtag
::
class
])
abstract
class
RepoDatabase
:
RoomDatabase
()
{
abstract
fun
repoDao
()
:
RepoDao
}
app/src/main/java/com/topjohnwu/magisk/di/DatabaseModule.kt
View file @
2ef088cb
...
@@ -12,8 +12,7 @@ val databaseModule = module {
...
@@ -12,8 +12,7 @@ val databaseModule = module {
single
{
PolicyDao
(
get
())
}
single
{
PolicyDao
(
get
())
}
single
{
SettingsDao
()
}
single
{
SettingsDao
()
}
single
{
StringDao
()
}
single
{
StringDao
()
}
single
{
createRepoDatabase
(
get
())
}
single
{
createRepoDatabase
(
get
()).
repoDao
()
}
single
{
get
<
RepoDatabase
>().
repoDao
()
}
single
{
RepoUpdater
(
get
(),
get
())
}
single
{
RepoUpdater
(
get
(),
get
())
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment