TODOs: Sidestep the cross-sharing bug.
This improves app stability by sidestepping the cross-sharing bug of
https://github.com/vanadium/issues/issues/1320
We discovered a new bug along the way
https://github.com/vanadium/issues/issues/1322
Change-Id: Ia657d91a5d2f5f3e14fec76129d52b06a10a0a0a
diff --git a/app/src/syncbase/java/io/v/todos/persistence/syncbase/SyncbasePersistence.java b/app/src/syncbase/java/io/v/todos/persistence/syncbase/SyncbasePersistence.java
index 4ca22e7..742f5b3 100644
--- a/app/src/syncbase/java/io/v/todos/persistence/syncbase/SyncbasePersistence.java
+++ b/app/src/syncbase/java/io/v/todos/persistence/syncbase/SyncbasePersistence.java
@@ -230,8 +230,21 @@
private static void ensureUserCollectionExists() throws VException {
synchronized (sUserCollectionMutex) {
if (sUserCollection == null) {
+ // The reason the following doesn't work yet is that collections cross-share.
+ // https://github.com/vanadium/issues/issues/1320
+ //Collection userCollection = sDatabase.getCollection(sVContext,
+ // USER_COLLECTION_NAME);
+
+ // The reason the following workaround doesn't work is the blessing is too long.
+ // https://github.com/vanadium/issues/issues/1322
+ // Collection userCollection = sDatabase.getCollection(
+ // new Id(getPersonalBlessings(sVContext).toString(), USER_COLLECTION_NAME));
+
+ // TODO(alexfandrianto): Replace this with one of the above solutions when possible.
+ // This solution is forced to use the email and replace invalid characters.
+ String email = getPersonalEmail(sVContext).replace(".", "_").replace("@", "_AT_");
Collection userCollection = sDatabase.getCollection(sVContext,
- USER_COLLECTION_NAME);
+ USER_COLLECTION_NAME + "_" + email);
try {
VFutures.sync(userCollection.create(sVContext, null));
} catch (ExistException e) {