From 8f1f4785a63a4ee7ae1ddf0ee8aba3715b697f00 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 13 Apr 2017 10:04:47 +0100 Subject: [PATCH] Revert "Update requery and remove the afterLoad workaround." Unfortunately this requery version introduced a regression. When adding a new account, it takes syncign a few times until it works. It looks like requery is not loading the recently saved instances. This reverts commit f0f70ff1c61996d0e45d8f72d24654c739c325f7. --- app/build.gradle | 6 +++--- .../java/com/etesync/syncadapter/model/JournalModel.java | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c1ea6de7..5e7533dd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -130,9 +130,9 @@ dependencies { transitive=true } - compile 'io.requery:requery:1.3.0' - compile 'io.requery:requery-android:1.3.0' - annotationProcessor 'io.requery:requery-processor:1.3.0' + compile 'io.requery:requery:1.2.0' + compile 'io.requery:requery-android:1.2.0' + annotationProcessor 'io.requery:requery-processor:1.2.0' compile group: 'com.madgag.spongycastle', name: 'core', version: '1.54.0.0' compile group: 'com.madgag.spongycastle', name: 'prov', version: '1.54.0.0' diff --git a/app/src/main/java/com/etesync/syncadapter/model/JournalModel.java b/app/src/main/java/com/etesync/syncadapter/model/JournalModel.java index 52af8825..fa19b868 100644 --- a/app/src/main/java/com/etesync/syncadapter/model/JournalModel.java +++ b/app/src/main/java/com/etesync/syncadapter/model/JournalModel.java @@ -56,6 +56,8 @@ public class JournalModel { List journals = data.select(JournalEntity.class).where(JournalEntity.SERVICE.eq(service).and(JournalEntity.DELETED.eq(false))).get().toList(); for (JournalEntity journal : journals) { + // FIXME: For some reason this isn't always being called, manually do it here. + journal.afterLoad(); ret.add(journal.getInfo()); } @@ -64,6 +66,10 @@ public class JournalModel { public static JournalEntity fetch(EntityDataStore data, String url) { JournalEntity ret = data.select(JournalEntity.class).where(JournalEntity.UID.eq(url)).limit(1).get().firstOrNull(); + if (ret != null) { + // FIXME: For some reason this isn't always being called, manually do it here. + ret.afterLoad(); + } return ret; }