Refactoring

pull/152/head
M66B 6 years ago
parent f52fc17136
commit 61240a541f

@ -86,10 +86,6 @@ public interface DaoAccount {
" WHERE account.synchronize) AS operations")
LiveData<TupleAccountStats> liveStats();
@Query("SELECT COUNT(operation.id) FROM operation" +
" WHERE operation.name = '" + EntityOperation.SEND + "'")
LiveData<Integer> liveUnsent();
@Query("SELECT account.id, swipe_left, l.type AS left_type, swipe_right, r.type AS right_type" +
" FROM account" +
" LEFT JOIN folder l ON l.id = account.swipe_left" +

@ -65,6 +65,10 @@ public interface DaoOperation {
@Query(GET_OPS_FOLDER)
LiveData<List<EntityOperation>> liveOperations(long folder);
@Query("SELECT COUNT(operation.id) FROM operation" +
" WHERE operation.name = '" + EntityOperation.SEND + "'")
LiveData<Integer> liveUnsent();
@Query("SELECT * FROM operation ORDER BY id")
List<EntityOperation> getOperations();

@ -76,7 +76,7 @@ public class ServiceSend extends LifecycleService {
DB db = DB.getInstance(this);
db.account().liveUnsent().observe(this, new Observer<Integer>() {
db.operation().liveUnsent().observe(this, new Observer<Integer>() {
@Override
public void onChanged(Integer unsent) {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

Loading…
Cancel
Save