Esempio n. 1
0
  static float[] updateGraph() {
    long timeStep = 1445214540000L;
    float[] results = new float[numData];

    ParseQuery<ParseObject> query = ParseQuery.getQuery("data");
    query.whereEqualTo("flag", 1);
    try {
      ParseObject flagged = query.getFirst();
      timeStep = flagged.getLong("unixTimeStamp");
      flagged.put("flag", 0);
      flagged.saveInBackground();
      Log.d("Find Flag", flagged.getObjectId());
    } catch (ParseException e) {
      Log.d("Find Flag", "Error: " + e.getMessage());
    }
    query = ParseQuery.getQuery("data");
    query.orderByAscending("unixTimeStamp");
    query.whereGreaterThan("unixTimeStamp", timeStep);
    try {
      ParseObject nextFlag = query.getFirst();
      nextFlag.put("flag", 1);
      nextFlag.saveInBackground();
      Log.d("Set Next Flag", nextFlag.getObjectId() + " is " + nextFlag.getInt("flag"));
    } catch (ParseException e) {
      Log.d("Set Next Flag", "Error: " + e.getMessage());
    }
    query = ParseQuery.getQuery("data");
    query.orderByDescending("unixTimeStamp");
    query.whereLessThan("unixTimeStamp", timeStep);
    for (int i = 0; i < numData; i++) {
      try {
        ParseObject data = query.getFirst();
        results[numData - i - 1] = (float) data.getInt("Bg");
        query.whereLessThan("unixTimeStamp", data.getLong("unixTimeStamp"));
      } catch (ParseException e) {
        Log.d("Fill Results Array", "Failed");
      }
    }
    /*query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> data, ParseException e) {
            int i = 0;

            if (e == null) {
                Log.d("Blood Glucose", "Retrieved " + data.size() + " Blood Glucose Data Points");
                for(ParseObject person : data) {
                    results[i] = person.getInt("Bg");
                    i++;
                }
            }
            else {
                Log.d("Blood Glucose", "Error: " + e.getMessage());
            }
        }
    });*/
    return results;
  }
Esempio n. 2
0
    @Override
    protected Void doInBackground(Void... params) {
      // Create the array
      photoarraylist = new ArrayList<PhotoList>();
      try {
        // Locate the class table named "ImageUpload" in Parse.com
        ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("ImageUpload");
        // Locate the column named "position" in Parse.com and order list
        // by descending order of created.
        query.orderByDescending("createdAt");
        query.setLimit(15);
        ob = query.find();
        for (ParseObject po : ob) {
          // retrieve objectID and Title
          String stringTitle = (String) po.get("Title");
          String stringObjectID = po.getObjectId();

          // retrieve the image file
          ParseFile image = (ParseFile) po.get("Photo");
          PhotoList map = new PhotoList();
          map.setPhoto(image.getUrl());
          map.setObjectID(stringObjectID);
          map.setTitle(stringTitle);
          photoarraylist.add(map);
        }
      } catch (ParseException e) {
        Log.e("Error", e.getMessage());
        e.printStackTrace();
      }
      return null;
    }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
      Bundle extras = data.getExtras();
      Bitmap imageBitmap = (Bitmap) extras.get("data");
      mImageView = (ImageView) findViewById(R.id.imgView);

      // Saving in Parse server
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      imageBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
      byte[] dataTostore = stream.toByteArray();

      final ParseFile imgFile = new ParseFile("img.png", dataTostore);
      imgFile.saveInBackground();

      GalleryObj tempPicObj = new GalleryObj();
      ParseObject obj = new ParseObject("Gallery");

      obj.put("pic", imgFile);
      obj.put("Apartment", ParseUser.getCurrentUser().getString("Apartment"));
      try {
        obj.save();
        tempPicObj.id = obj.getObjectId();
        tempPicObj.pic = imageBitmap;
        STgallery.getInstance().add(tempPicObj);
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      adapter.notifyDataSetChanged();
    }
  }
    @Override
    protected String doInBackground(String... params) {

      // Notify Parse Analytics that the app has been opened
      ParseAnalytics.trackAppOpenedInBackground(getIntent());

      CardDbHelper cardDbHelper = new CardDbHelper(getBaseContext());

      SQLiteDatabase db = cardDbHelper.getWritableDatabase();
      cardDbHelper.onCreate(db);

      try {
        ParseQuery<ParseObject> query = ParseQuery.getQuery("Card");
        query.setLimit(1000);
        query.selectKeys(Arrays.asList(""));
        List<ParseObject> results = query.find();

        Iterator<ParseObject> iterator = results.iterator();

        // Writing values to DB
        ContentValues values = new ContentValues();

        while (iterator.hasNext()) {
          ParseObject next = iterator.next();
          values.put("cardId", next.getObjectId().toString());
          db.insert(CardDbHelper.TABLE_NAME, "null", values);
        }

      } catch (ParseException e) {
        e.printStackTrace();
      }

      return "";
    }
Esempio n. 5
0
 public SharesModel(ParseObject parseObject, Context context) {
   startDay = HelperClass.getStringFormatDate(parseObject.getDate("share_due_date"), context);
   shareOrder = parseObject.getInt("share_order");
   isShareDelivered = parseObject.getBoolean("share_status");
   jamId = parseObject.getString("shares_jamNo");
   shareOwnerId = parseObject.getString("share_owner_id");
   shareId = parseObject.getObjectId();
   sharePaidAmount = parseObject.getInt("share_paid_amount");
 }
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    ParseObject statusObject = mStatus.get(position);
    String objectId = statusObject.getObjectId();

    Intent goToDetailView = new Intent(HomepageActivity.this, StatusDetailView.class);
    goToDetailView.putExtra("objectID", objectId);
    startActivity(goToDetailView);
  }
  protected static Category createCategory(ParseObject parseObject) {

    Category category = new Category(parseObject.getObjectId());
    Log.i("parse", "category " + parseObject);
    if (parseObject.has("category_name")) {
      category.setName(parseObject.getString("category_name"));
    }
    if (parseObject.has("short")) {
      category.setShortName(parseObject.getString("short"));
    }
    return category;
  }
Esempio n. 8
0
 public static void savePictureToPostSync(ParseObject mPost, Bitmap picture) {
   ByteArrayOutputStream stream = new ByteArrayOutputStream();
   picture.compress(Bitmap.CompressFormat.JPEG, 100, stream);
   byte[] bytearray = stream.toByteArray();
   ParseFile questionPicture = new ParseFile(mPost.getObjectId() + "_picture.jpg", bytearray);
   try {
     questionPicture.save();
     mPost.put(Common.OBJECT_POST_PICTURE, questionPicture);
     mPost.save();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Esempio n. 9
0
  public static void removeCommunityFromCurrentUser(final ParseObject community) {
    ParseUser user = ParseUser.getCurrentUser();
    ParseRelation<ParseObject> relation = user.getRelation(Common.OBJECT_USER_COMMUNITY_RELATION);
    relation.remove(community);
    user.saveInBackground();

    ParseRelation<ParseObject> communityUsers =
        community.getRelation(Common.OBJECT_COMMUNITY_USERS);
    communityUsers.remove(user);
    community.saveInBackground();

    String channel = "community_" + community.getObjectId();
    ParsePush.unsubscribeInBackground(channel);
  }
Esempio n. 10
0
  private void initializeData() {

    ParseUser current = ParseUser.getCurrentUser();

    if (current != null) {
      String[] classes = new String[1];
      if (current.getBoolean("isteach")) {
        c.setText("Create Class");
      } else {
        c.setText("Add Class");
      }
      if (current.getString("Classes").contains(",")) {
        classes = current.getString("Classes").split(",");
      } else {
        classes[0] = current.getString("Classes");
      }
      ParseObject[] classesList = new ParseObject[classes.length];
      int z = 0;

      for (z = 0; z < classes.length; z++) {
        ParseQuery<ParseObject> query = ParseQuery.getQuery("Classes");
        query.whereEqualTo("objectId", classes[z]);
        try {
          ParseObject f = query.getFirst();
          classesList[z] = f;
        } catch (ParseException e) {
          Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_LONG).show();
        }
      }
      courses = new ArrayList<>();
      for (ParseObject g : classesList) {
        courses.add(
            new Courses(
                g.getString("ClassName"),
                g.getString("Teacher"),
                R.drawable.logo_audio,
                g.getObjectId()));
      }
    } else {
      courses = new ArrayList<>();
      courses.add(new Courses("Physics", "Culbertson", R.drawable.physics));
      courses.add(new Courses("Mobile App Dev", "Galanos", R.drawable.mobile));
      courses.add(new Courses("AP Calculus BC", "Spoden", R.drawable.integral));
      courses.add(new Courses("AP Chemistry", "Acio", R.drawable.chemistry));
      courses.add(new Courses("DNA Science", "Cobb", R.drawable.dna));
    }
  }
 public static Pin createPin(ParseObject object) {
   cache().put(object);
   String title = getStringIfHas(object, "title");
   String description = getStringIfHas(object, "description");
   String image = getStringIfHas(object, "image");
   String linkUrl = getStringIfHas(object, "url");
   double aspectRatio = object.has("aspectratio") ? object.getDouble("aspectratio") : 1;
   ParseObject board = object.has("board") ? object.getParseObject("board") : null;
   return new Pin(
       object.getObjectId(),
       title,
       description,
       image,
       ParseHelper.createBoard(board),
       linkUrl,
       aspectRatio);
 }
Esempio n. 12
0
  public Politic(ParseObject parseObject) {

    setObjectId(parseObject.getObjectId());
    setCandidateName((String) parseObject.get(POLITIC_NAME));
    setCandidateNumber((String) parseObject.get(POLITIC_NUM));
    setElectionYear((String) parseObject.get(POLITIC_YEAR));
    setCompositionLegend((String) parseObject.get(POLITIC_LEGEND));
    setCandidateDocumentNumber((String) parseObject.get(POLITIC_CPF));
    setTurnNumber((String) parseObject.get(POLITIC_NUM_TURNO));
    setCandidatePartyNumber((String) parseObject.get(POLITIC_NUM_PART));
    setCandidateUf((String) parseObject.get(POLITIC_UF));
    setCandidateOffice((String) parseObject.get(POLITIC_CARGO));
    setCandidateUrnName((String) parseObject.get(POLITIC_URNA));
    setCandidatePartyName((String) parseObject.get(POLITIC_NOME_PART));
    setCandidateTurnDescription((String) parseObject.get(POLITIC_DESC_TURN));
    setCandidateEmail((String) parseObject.get(POLITIC_EMAIL));
    setCandidatePartyInitials((String) parseObject.get(POLITIC_PARTY_INIT));
  }
Esempio n. 13
0
  public static void addCommunityToUser(final ParseObject community) {
    ParseUser user = ParseUser.getCurrentUser();
    ParseRelation<ParseObject> relation = user.getRelation(Common.OBJECT_USER_COMMUNITY_RELATION);
    relation.add(community);
    user.saveInBackground(
        new SaveCallback() {
          @Override
          public void done(ParseException e) {
            getUserCommunity(ParseUser.getCurrentUser());
          }
        });

    ParseRelation<ParseObject> communityUsers =
        community.getRelation(Common.OBJECT_COMMUNITY_USERS);
    communityUsers.add(user);
    community.saveInBackground();

    String channel = "community_" + community.getObjectId();
    ParsePush.subscribeInBackground(channel);
  }
Esempio n. 14
0
 private void initializeData(String oid) {
   ParseQuery query = ParseQuery.getQuery("Classes");
   String assignment = new String();
   query.whereEqualTo("objectId", oid);
   try {
     ParseObject f = query.getFirst();
     assignment = f.getString("assignments");
   } catch (ParseException e) {
     Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
   }
   Log.e("Testing", assignment);
   String[] assignments = new String[1];
   if (assignment.length() < 10) {
     return;
   } else if (assignment.contains(",")) {
     assignments = assignment.split(",");
   } else {
     assignments = new String[1];
     assignments[0] = assignment;
   }
   ParseObject[] assignmentsList = new ParseObject[assignments.length];
   Log.e("Testing", Integer.toString(assignments.length));
   int z = 0;
   for (z = 0; z < assignments.length; z++) {
     ParseQuery<ParseObject> query3 = ParseQuery.getQuery("Assignments");
     Log.e("Testing", "a " + assignments[z]);
     Log.e("Testing", Integer.toString(z));
     try {
       ParseObject f = query3.get(assignments[z]);
       assignmentsList[z] = f;
     } catch (ParseException e) {
       Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
     }
   }
   courses = new ArrayList<>();
   for (ParseObject g : assignmentsList) {
     courses.add(
         new Assignments(g.getString("Assignment"), g.getString("Question"), g.getObjectId()));
   }
 }
  public ParseProxyObject(ParseObject object) {

    // Loop the keys in the ParseObject
    for (String key : object.keySet()) {
      @SuppressWarnings("rawtypes")
      Class classType = object.get(key).getClass();
      if (classType == byte[].class
          || classType == String.class
          || classType == Integer.class
          || classType == Boolean.class
          || classType == Double.class
          || classType == Date.class) {
        values.put(key, object.get(key));
      } else if (classType == ParseUser.class) {
        ParseProxyObject parseUserObject = new ParseProxyObject((ParseObject) object.get(key));
        values.put(key, parseUserObject);
      } else {
        // You might want to add more conditions here, for embedded ParseObject, ParseFile, etc.
      }
    }
    values.put("ObjectId", object.getObjectId());
  }
  public static Board createBoard(ParseObject o) {
    if (o == null) {
      return null;
    }
    cache().put(o);

    Board board = new Board(o.getObjectId());
    if (o.has("category")) {
      board.setCategory(ParseHelper.createCategory(o.getParseObject("category")));
    }
    if (o.has("name")) {
      board.setName(o.getString("name"));
    }
    if (o.has("description")) {
      board.setDescription(o.getString("description"));
    }
    if (o.has("owner")) {
      board.setOwner(ParseHelper.createUser(o.getParseObject("owner")));
    }
    if (o.has("followers_count")) {
      board.setFollowersCount(o.getInt("followers_count"));
    }
    return board;
  }
  public static User createUser(ParseObject parseObject) {
    cache().put(parseObject);

    String profilePictureUrl = null;
    Object object;
    if (parseObject.has("profile_picture")) {
      profilePictureUrl = parseObject.getString("profile_picture");
      object = parseObject.get("profile_picture");
      ParseFile file = (ParseFile) object;
      String url = file.getUrl();
      profilePictureUrl = url;
    }

    User user = new User(parseObject.getObjectId());
    user.setProfilePictureUrl(profilePictureUrl);
    if (parseObject.has("username")) {
      user.setName(parseObject.getString("username"));
    }
    if (parseObject.has("info")) {
      user.setInfo(parseObject.getString("info"));
    }

    return user;
  }
Esempio n. 18
0
  public <E extends SyncEntity> void synObjects(
      final Class<E> entityClass, boolean userAware, final SyncCallback<E> callback)
      throws SyncException {
    try {
      final String parseClass = extractParseClass(entityClass);

      // get updated remote objects
      ParseQuery query = ParseQuery.getQuery(parseClass);
      query.whereGreaterThan(PARSE_UPDATED_AT_FIELD, lastSyncDate);
      if (userAware && userId != null) query.whereEqualTo(PARSE_USER_ID_FIELD, userId);
      // query.orderByAscending(PARSE_OBJECT_ID_FIELD);
      final List<ParseObject> remoteObjects = ParseTools.findAllParseObjects(query);

      // get updated local objects
      final SyncDAO<E, ?> syncDao = dbHelper.getDao(entityClass);
      QueryBuilder<E, ?> dbQuery = syncDao.queryBuilder();
      // dbQuery.orderBy(DB_OBJECT_ID_FIELD, true);
      Where<E, ?> where = dbQuery.where().gt(DB_UPDATED_AT_FIELD, lastSyncDate);
      if (userAware && userId != null) where.and().eq(DB_USER_ID_FIELD, userId);
      final List<E> localObjects = where.query();

      // create local object map
      Map<String, E> localObjectMap = new HashMap<String, E>(localObjects.size());
      for (E localObject : localObjects) {
        localObjectMap.put(localObject.getSyncId(), localObject);
      }

      List<Pair<E, ParseObject>> toSaveLocally = new ArrayList<>();
      List<Pair<E, ParseObject>> toSaveRemotely = new ArrayList<>();

      for (ParseObject remoteObject : remoteObjects) {
        String syncId = remoteObject.getObjectId();
        E localObject = localObjectMap.get(syncId);

        if (localObject == null) {
          localObject = findBySyncId(syncDao, syncId);
          if (localObject == null) {
            // this object was created on the server but doesn't exist locally
            localObject = SyncEntity.fromParseObject(remoteObject, entityClass);
          } else {
            // the object exists locally but out-of-date
            SyncEntity.fromParseObject(remoteObject, localObject);
          }
          toSaveLocally.add(new Pair<>(localObject, remoteObject));
          continue;
        }

        if (localObject != null) {
          long localTime =
              (localObject.getSyncDate() == null) ? 0L : localObject.getSyncDate().getTime();
          long remoteTime =
              (remoteObject.getUpdatedAt() == null) ? 0L : remoteObject.getUpdatedAt().getTime();

          if (remoteTime > localTime) {
            // the remote object is newer
            SyncEntity.fromParseObject(remoteObject, localObject);
            toSaveLocally.add(new Pair<>(localObject, remoteObject));
          } else if (remoteTime < localTime) {
            // the local objects is newer
            SyncEntity.toParseObject(localObject, remoteObject);
            toSaveRemotely.add(new Pair<>(localObject, remoteObject));
          }
        }
      }
      localObjectMap = null;

      // create remote object map
      Map<String, ParseObject> remoteObjectMap =
          new HashMap<String, ParseObject>(remoteObjects.size());
      for (ParseObject remoteObject : remoteObjects) {
        remoteObjectMap.put(remoteObject.getObjectId(), remoteObject);
      }

      for (E localObject : localObjects) {
        String syncId = localObject.getSyncId();
        if (syncId == null) {
          // a brand new object!
          ParseObject remoteObject = SyncEntity.toParseObject(localObject);
          toSaveRemotely.add(new Pair<>(localObject, remoteObject));
          continue;
        }

        ParseObject remoteObject = remoteObjectMap.get(syncId);
        if (remoteObject == null && !localObject.isDeleted()) {
          // object was created locally but doesn't exist or too old on the server
          // this is weird because syncId is not null

          // try to get it from server
          remoteObject = ParseObject.createWithoutData(parseClass, syncId).fetch();
          toSaveRemotely.add(new Pair<>(localObject, remoteObject));
          continue;
        }

        if (remoteObject != null) {
          long localTime =
              (localObject.getSyncDate() == null) ? 0L : localObject.getSyncDate().getTime();
          long remoteTime =
              (remoteObject.getUpdatedAt() == null) ? 0L : remoteObject.getUpdatedAt().getTime();

          if (remoteTime > localTime) {
            // the remote object is newer
            SyncEntity.fromParseObject(remoteObject, localObject);
            toSaveLocally.add(new Pair<>(localObject, remoteObject));
          } else if (remoteTime < localTime) {
            // the local objects is newer
            SyncEntity.toParseObject(localObject, remoteObject);
            toSaveRemotely.add(new Pair<>(localObject, remoteObject));
          }
        }
      }

      if (callback != null) {
        callback.beforeSync(toSaveLocally, toSaveRemotely);
      }

      for (Pair<E, ParseObject> p : toSaveLocally) {
        final E localObject = p.first;
        final ParseObject remoteObject = p.second;
        TransactionManager.callInTransaction(
            dbHelper.getConnectionSource(),
            new Callable<Object>() {
              @Override
              public Object call() throws Exception {
                if (callback != null) {
                  callback.onSaveLocally(localObject, remoteObject);
                }
                syncDao.createOrUpdate(localObject);
                return null;
              }
            });
      }

      for (Pair<E, ParseObject> p : toSaveRemotely) {
        final E localObject = p.first;
        final ParseObject remoteObject = p.second;
        TransactionManager.callInTransaction(
            dbHelper.getConnectionSource(),
            new Callable<Object>() {
              @Override
              public Object call() throws Exception {
                if (callback != null) {
                  callback.onSaveRemotely(localObject, remoteObject);
                }
                remoteObject.save();
                if (localObject.getSyncId() == null) {
                  SyncEntity.fromParseObject(remoteObject, localObject);
                  syncDao.createOrUpdate(localObject);
                }
                return null;
              }
            });
      }

      if (callback != null) {
        callback.afterSync();
      }
    } catch (Exception ex) {
      throw new SyncException("Synchronization failed", ex);
    }
  }
Esempio n. 19
0
  public static void setPreferences(ParseObject userObject, final Context context) {
    PrefManager.with(context)
        .save(
            User.FIRST_NAME,
            userObject.getString(User.FIRST_NAME) != null
                ? userObject.getString(User.FIRST_NAME)
                : BuildConfig.FLAVOR);
    PrefManager.with(context)
        .save(
            User.LAST_NAME,
            userObject.getString(User.LAST_NAME) != null
                ? userObject.getString(User.LAST_NAME)
                : BuildConfig.FLAVOR);
    PrefManager.with(context)
        .save(
            PreferenceUtils.EMAIL,
            userObject.getString(PreferenceUtils.EMAIL) != null
                ? userObject.getString(PreferenceUtils.EMAIL)
                : BuildConfig.FLAVOR);
    PrefManager.with(context)
        .save(
            PreferenceUtils.AVATAR_URL,
            userObject.getString(PreferenceUtils.AVATAR_URL) != null
                ? userObject.getString(PreferenceUtils.AVATAR_URL)
                : BuildConfig.FLAVOR);
    PrefManager.with(context)
        .save(
            User.OBJECT_ID,
            userObject.getObjectId() != null ? userObject.getObjectId() : BuildConfig.FLAVOR);
    PrefManager.with(context).save(User.HAS_FITBIT, userObject.getBoolean(User.HAS_FITBIT));
    PrefManager.with(context).save(User.HAS_JAWBONE, userObject.getBoolean(User.HAS_JAWBONE));
    PrefManager.with(context).save(User.HAS_GOOGLEFIT, userObject.getBoolean(User.HAS_GOOGLEFIT));
    PrefManager.with(context).save(User.HAS_MISFIT, userObject.getBoolean(User.HAS_MISFIT));
    PrefManager.with(context).save(User.HAS_MOVES, userObject.getBoolean(User.HAS_MOVES));
    PrefManager.with(context)
        .save(
            User.MOVES_TOKEN,
            userObject.getString(User.MOVES_TOKEN) != null
                ? userObject.getString(User.MOVES_TOKEN)
                : BuildConfig.FLAVOR);
    PrefManager.with(context)
        .save(
            User.MOVES_REFRESH_TOKEN,
            userObject.getString(User.MOVES_REFRESH_TOKEN) != null
                ? userObject.getString(User.MOVES_REFRESH_TOKEN)
                : BuildConfig.FLAVOR);
    PrefManager.with(context)
        .save(
            User.UNITS,
            userObject.getString(User.UNITS) != null
                ? userObject.getString(User.UNITS)
                : context.getString(R.string.pref_units_imperial));
    try {
      String[] fitbitToken = userObject.getString(User.FITBIT_TOKEN).split(",");
      if (fitbitToken.length > 0) {
        PrefManager.with(context).save(FitbitClient.FITBIT_TOKEN, fitbitToken[0]);
        PrefManager.with(context).save(FitbitClient.FITBIT_TOKEN_SECRET, fitbitToken[1]);
        PrefManager.with(context).save(FitbitClient.FITBIT_TOKEN_RAW, fitbitToken[2]);
      }
    } catch (Exception ex) {
      if (ex.getMessage() != null) {
        Log.d(LOG_TAG, ex.getMessage());
      } else {
        Log.d(LOG_TAG, "Exception!", ex);
      }
    }
    if (userObject.getBoolean(User.HAS_MOVES)) {
      MoveApiClient.getBaseRestAdapter(context)
          .create(MoveApiClient.MovesConnector.class)
          .getUser(
              new Callback<MovesUser>() {
                @Override
                public void success(MovesUser movesUser, Response response) {
                  PrefManager.with(context)
                      .save(MoveApiClient.MOVES_FIRST_DATE, movesUser.getProfile().getFirstDate());
                }

                @Override
                public void failure(RetrofitError error) {}
              });
    }
    PrefManager.with(context)
        .save(
            MisfitClient.MISFIT_TOKEN,
            userObject.getString(MisfitClient.MISFIT_TOKEN) != null
                ? userObject.getString(MisfitClient.MISFIT_TOKEN)
                : BuildConfig.FLAVOR);
    PrefManager.with(context)
        .save(
            ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN,
            userObject.getString(User.JAWBONE_TOKEN) != null
                ? userObject.getString(User.JAWBONE_TOKEN)
                : BuildConfig.FLAVOR);
    PrefManager.with(context)
        .save(PreferenceUtils.WEEK_AVERAGE, String.valueOf(userObject.getInt(User.STEPS_AVERAGE)));
  }
 public String getParseObjectId() {
   return user.getObjectId();
 }