mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 13:53:54 +01:00
Database bug fix (#5902)
* make database function calls suspending and update room version * replace MainScope with coroutineScope for database operations * add suspend keyword and refactor code
This commit is contained in:
parent
bc065c8792
commit
cdc4f89da5
7 changed files with 28 additions and 34 deletions
|
|
@ -37,15 +37,11 @@ public abstract class PlaceDao {
|
|||
*/
|
||||
public Completable save(final Place place) {
|
||||
return Completable
|
||||
.fromAction(() -> {
|
||||
saveSynchronous(place);
|
||||
});
|
||||
.fromAction(() -> saveSynchronous(place));
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all Place objects from the database.
|
||||
*
|
||||
* @return A Completable that completes once the deletion operation is done.
|
||||
*/
|
||||
@Query("DELETE FROM place")
|
||||
public abstract void deleteAllSynchronous();
|
||||
|
|
@ -53,11 +49,9 @@ public abstract class PlaceDao {
|
|||
/**
|
||||
* Deletes all Place objects from the database.
|
||||
*
|
||||
* @return A Completable that completes once the deletion operation is done.
|
||||
*/
|
||||
public Completable deleteAll() {
|
||||
return Completable
|
||||
.fromAction(() -> {
|
||||
deleteAllSynchronous();
|
||||
});
|
||||
return Completable.fromAction(this::deleteAllSynchronous);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue