Example #1
0
  public void siginUpFB(User user, String data, SunshineFacebookLoginCallback callback) {

    this.facebookLoginCallback = callback;

    parseUser = new ParseUser();
    parseUser.setEmail(user.getEmail());
    parseUser.setUsername(user.getUserName());
    parseUser.setPassword(user.getPassword());
    // prepareParseUser(parseUser, user);
    parseUser.put("name", user.getName());

    parseUser.put("facebookData", data);

    ParseUser.logInInBackground(
        user.getUserName(),
        user.getPassword(),
        new LogInCallback() {
          @Override
          public void done(ParseUser user, ParseException e) {
            if (user != null) facebookLoginCallback.doneLoginFacebook(true);
            else
              parseUser.signUpInBackground(
                  new SignUpCallback() {
                    @Override
                    public void done(ParseException e) {
                      if (e == null) facebookLoginCallback.doneLoginFacebook(true);
                      else facebookLoginCallback.doneLoginFacebook(false);
                    }
                  });
          }
        });
  }
Example #2
0
  public void siginUp(User user, SunshineLoginCallback callback) {

    this.callback = callback;

    parseUser = new ParseUser();
    parseUser.setEmail(user.getEmail());
    parseUser.setUsername(user.getUserName());
    parseUser.setPassword(user.getPassword());
    // prepareParseUser(parseUser, user);
    parseUser.put("name", user.getName());

    if (user.getImgPath() != null) {
      File file = new File(user.getImgPath());
      parseFile = new ParseFile(file);
      parseFile.saveInBackground(
          new SaveCallback() {
            @Override
            public void done(ParseException e) {
              if (e != null) e.printStackTrace();
              parseUser.put("img", parseFile);
              parseUser.signUpInBackground(SunshineLogin.this);
            }
          });
    } else {
      parseUser.signUpInBackground(SunshineLogin.this);
    }
  }