Uploaded image for project: 'Realm Java SDK'
  1. Realm Java SDK
  2. RJAVA-193

SyncUser Profile Values

      The Object Server is getting support for a map of customizable user data. We need to expose this in the public API: https://github.com/realm/product/issues/143

      So far the working API proposal is

      SyncUser user = getUser();
      
      // Synchronous API
      Map<String, String> SyncUser.getProfileValues() throws ObjectServerError
      void SyncUser.setProfileValues(Map<String, String> values) throws ObjectServerError
      
      // Async API
      RealmAsyncTask task = user.getProfileValuesAsync(Callback);
      RealmAsyncTask task  = user.setProfileValues(Map<String, String> values, Callback);
      

      We are starting to see quite a few different callbacks. Perhaps we should create a new Callback interface that allow generics and slowly switch to that. Something like:

      public interface ServerCallback<T> {
        void onSuccess(T result);
        void onError(ObjectServerError error);
      }
      
      // No-op result
      new ServerCallback<Void>() { ... } // 
      
      // Results with return values
      new ServerCallback<SyncUser>() { ... }
      new ServerCallback<Map<String, String>>() { ... }
      

      TODO:

      • [ ] Finalize API. Align with Cooca
      • [ ] Make sure that server API only return maps of strings and not other JSON values like longs or booleans
      • [ ] Decide on Callback interface. Depending on this we might have to deprecate some of the other API's we already implemented.
      • [ ] Unit tests
      • [ ] Integration tests.

      This is currently blocked on the Object Server releasing the functionality.

            Assignee:
            Unassigned Unassigned
            Reporter:
            christian.melchior@mongodb.com Christian Melchior (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: