Esempio n. 1
0
    /*
     * (non-Javadoc)
     * @see android.os.AsyncTask#doInBackground(Params[])
     */
    @Override
    protected Boolean doInBackground(String... params) {
      if (mTarget.get() != null) {
        try {
          IssueCreateActivity activity = mTarget.get();
          GitHubServiceFactory factory = GitHubServiceFactory.newInstance();
          IssueService service = factory.createIssueService();
          Authentication auth =
              new LoginPasswordAuthentication(
                  mTarget.get().getAuthUsername(), mTarget.get().getAuthPassword());
          service.setAuthentication(auth);

          // CheckBox cbSign = (CheckBox) activity.findViewById(R.id.cb_sign);
          String comment = params[1];
          //                    if (cbSign.isChecked()) {
          //                        comment = comment + "\n\n" +
          // activity.getResources().getString(R.string.sign);
          //                    }

          service.createIssue(activity.mUserLogin, activity.mRepoName, params[0], comment);
          return true;
        } catch (GitHubException e) {
          Log.e(Constants.LOG_TAG, e.getMessage(), e);
          mException = true;
          return null;
        }
      } else {
        return false;
      }
    }
Esempio n. 2
0
  /*
   * (non-Javadoc)
   * @see com.gh4a.UserListActivity#getUsers()
   */
  protected List<User> getUsers() throws GitHubException {
    GitHubServiceFactory factory = GitHubServiceFactory.newInstance();
    RepositoryService repositoryService = factory.createRepositoryService();

    Authentication auth = new LoginPasswordAuthentication(getAuthUsername(), getAuthPassword());
    repositoryService.setAuthentication(auth);

    List<String> usernames = repositoryService.getCollaborators(mUserLogin, mRepoName);
    List<User> users = new ArrayList<User>();
    for (String username : usernames) {
      User user = new User();
      user.setLogin(username);
      users.add(user);
    }
    return users;
  }
Esempio n. 3
0
  @Override
  public Navigation run() throws Exception {
    GlobalSetting setting = Datastore.query(gm).limit(1).asSingle();
    OAuthService service =
        GitHubServiceFactory.newInstance()
            .createOAuthService(setting.getGithubClientId(), setting.getGithubClientSecret());

    String callbackUrl = "http://skillmaps.appspot.com/github/registration";
    // callbackは変えられないらしい
    //        if(AppEngineUtil.isDevelopment()){
    //            callbackUrl = "http://127.0.0.1:8888/github/registration";
    //        }

    String autorizationUrl = service.getAuthorizationUrl(callbackUrl);
    return redirect(autorizationUrl);
  }