Remove TOGGLE_STATE from CompleteTaskReceiver

pull/848/head^2
Alex Baker 5 years ago
parent 05f385db7d
commit c5e4825822

@ -14,7 +14,6 @@ import timber.log.Timber;
public class CompleteTaskReceiver extends InjectingBroadcastReceiver {
public static final String TASK_ID = "id";
public static final String TOGGLE_STATE = "flip_state";
@Inject TaskDao taskDao;
@ -23,13 +22,12 @@ public class CompleteTaskReceiver extends InjectingBroadcastReceiver {
super.onReceive(context, intent);
long taskId = intent.getLongExtra(TASK_ID, 0);
boolean flipState = intent.getBooleanExtra(TOGGLE_STATE, false);
Timber.i("Completing %s", taskId);
Completable.fromAction(
() -> {
Task task = taskDao.fetch(taskId);
if (task != null) {
taskDao.setComplete(task, !flipState || !task.isCompleted());
taskDao.setComplete(task, true);
} else {
Timber.e("Could not find task with id %s", taskId);
}

@ -110,7 +110,6 @@ public class NotificationActivity extends InjectingAppCompatActivity
public void complete() {
Intent intent = new Intent(this, CompleteTaskReceiver.class);
intent.putExtra(CompleteTaskReceiver.TASK_ID, taskId);
intent.putExtra(CompleteTaskReceiver.TOGGLE_STATE, false);
sendBroadcast(intent);
finish();
}

Loading…
Cancel
Save