fix minor errors

This commit is contained in:
Phillip Thelen 2017-10-10 20:03:41 +02:00
parent 12325641cc
commit ac2bfaf7b3
6 changed files with 7 additions and 7 deletions

View file

@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.habitrpg.android.habitica"
android:versionCode="1940"
android:versionName="1.2.1"
android:versionCode="1943"
android:versionName="1.2.2"
android:screenOrientation="portrait"
android:installLocation="auto" >

View file

@ -109,7 +109,7 @@ public class TaskRepositoryImpl extends BaseRepositoryImpl<TaskLocalRepository>
@Override
public Observable<TaskScoringResult> taskChecked(User user, String taskId, boolean up, boolean force) {
return localRepository.getTask(taskId)
return localRepository.getTask(taskId).first()
.flatMap(task -> taskChecked(user, task, up, force));
}

View file

@ -1285,7 +1285,7 @@ public class TaskFormActivity extends BaseActivity implements AdapterView.OnItem
this.task.setType(taskType);
}
if (this.saveTask(this.task)) {
if (this.saveTask(this.task) && task.isValid()) {
//send back to other elements.
if (TaskFormActivity.this.task.getId() == null) {
taskRepository.createTaskInBackground(task);

View file

@ -145,7 +145,7 @@ public abstract class BaseMainFragment extends BaseFragment {
@Override
public void onSaveInstanceState(Bundle outState) {
if (user != null) {
if (user != null && user.isValid()) {
outState.putString("userId", user.getId());
}

View file

@ -76,7 +76,7 @@ public class HabitButtonWidgetProvider extends BaseWidgetProvider {
int[] ids = {appWidgetId};
if (taskId != null) {
userRepository.getUser(userId).flatMap(user -> taskRepository.taskChecked(user, taskId, TaskDirection.up.toString().equals(direction), false))
userRepository.getUser(userId).first().flatMap(user -> taskRepository.taskChecked(user, taskId, TaskDirection.up.toString().equals(direction), false))
.subscribe(taskDirectionData -> {
showToastForTaskDirection(context, taskDirectionData, userId);
}, RxErrorHandler.handleEmptyError(), () -> this.onUpdate(context, mgr, ids));

View file

@ -56,7 +56,7 @@ public abstract class TaskListWidgetProvider extends BaseWidgetProvider {
String taskId = intent.getStringExtra(TASK_ID_ITEM);
if (taskId != null) {
userRepository.getUser(userId).flatMap(user -> taskRepository.taskChecked(user, taskId, true, false))
userRepository.getUser(userId).first().flatMap(user -> taskRepository.taskChecked(user, taskId, true, false))
.subscribe(taskDirectionData -> {
taskRepository.markTaskCompleted(taskId, true);
showToastForTaskDirection(context, taskDirectionData, userId);