mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 17:51:57 +00:00
fix challenge loading.
This commit is contained in:
parent
ed38ca6000
commit
afd3303256
3 changed files with 12 additions and 3 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="com.habitrpg.android.habitica"
|
package="com.habitrpg.android.habitica"
|
||||||
android:versionCode="1974"
|
android:versionCode="1975"
|
||||||
android:versionName="1.4.3"
|
android:versionName="1.4.3"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:installLocation="auto" >
|
android:installLocation="auto" >
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class RealmUserLocalRepository(realm: Realm) : RealmBaseLocalRepository(realm),
|
||||||
removeOldTags(user.id, user.tags)
|
removeOldTags(user.id, user.tags)
|
||||||
}
|
}
|
||||||
if (user.challenges != null) {
|
if (user.challenges != null) {
|
||||||
removeOldChallenges(user.id, user.challenges)
|
removeOldChallenges(user.challenges)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ class RealmUserLocalRepository(realm: Realm) : RealmBaseLocalRepository(realm),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeOldChallenges(userId: String, onlineChallenges: List<Challenge>) {
|
private fun removeOldChallenges(onlineChallenges: List<Challenge>) {
|
||||||
val challenges = realm.where(Challenge::class.java).equalTo("isParticipating", true).findAll().createSnapshot()
|
val challenges = realm.where(Challenge::class.java).equalTo("isParticipating", true).findAll().createSnapshot()
|
||||||
val challengesToDelete = challenges.filterNot { onlineChallenges.contains(it) }
|
val challengesToDelete = challenges.filterNot { onlineChallenges.contains(it) }
|
||||||
realm.executeTransaction {
|
realm.executeTransaction {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.habitrpg.android.habitica.models.social;
|
package com.habitrpg.android.habitica.models.social;
|
||||||
|
|
||||||
|
import com.habitrpg.android.habitica.models.tasks.ChecklistItem;
|
||||||
import com.habitrpg.android.habitica.models.tasks.TasksOrder;
|
import com.habitrpg.android.habitica.models.tasks.TasksOrder;
|
||||||
import com.habitrpg.android.habitica.models.user.User;
|
import com.habitrpg.android.habitica.models.user.User;
|
||||||
|
|
||||||
|
|
@ -64,4 +65,12 @@ public class Challenge extends RealmObject {
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj.getClass().equals(Challenge.class) && this.id != null) {
|
||||||
|
return this.id.equals(((Challenge)obj).id);
|
||||||
|
}
|
||||||
|
return super.equals(obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue