mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 01:38:21 +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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.habitrpg.android.habitica"
|
||||
android:versionCode="1974"
|
||||
android:versionCode="1975"
|
||||
android:versionName="1.4.3"
|
||||
android:screenOrientation="portrait"
|
||||
android:installLocation="auto" >
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class RealmUserLocalRepository(realm: Realm) : RealmBaseLocalRepository(realm),
|
|||
removeOldTags(user.id, user.tags)
|
||||
}
|
||||
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 challengesToDelete = challenges.filterNot { onlineChallenges.contains(it) }
|
||||
realm.executeTransaction {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
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.user.User;
|
||||
|
||||
|
|
@ -64,4 +65,12 @@ public class Challenge extends RealmObject {
|
|||
|
||||
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