Search in sources :

Example 1 with RepositoryCollaboratorService

use of com.meisolsson.githubsdk.service.repositories.RepositoryCollaboratorService in project gh4a by slapperwan.

the class CollaboratorListFragment method loadPage.

@Override
protected Single<Response<Page<User>>> loadPage(int page, boolean bypassCache) {
    String owner = getArguments().getString("owner");
    String repo = getArguments().getString("repo");
    final RepositoryCollaboratorService service = ServiceFactory.get(RepositoryCollaboratorService.class, bypassCache);
    return service.getCollaborators(owner, repo, page);
}
Also used : RepositoryCollaboratorService(com.meisolsson.githubsdk.service.repositories.RepositoryCollaboratorService)

Example 2 with RepositoryCollaboratorService

use of com.meisolsson.githubsdk.service.repositories.RepositoryCollaboratorService in project gh4a by slapperwan.

the class SingleFactory method isAppUserRepoCollaborator.

public static Single<Boolean> isAppUserRepoCollaborator(String repoOwner, String repoName, boolean bypassCache) {
    Gh4Application app = Gh4Application.get();
    RepositoryCollaboratorService service = ServiceFactory.get(RepositoryCollaboratorService.class, bypassCache);
    if (!app.isAuthorized()) {
        return Single.just(false);
    }
    return service.isUserCollaborator(repoOwner, repoName, app.getAuthLogin()).map(ApiHelpers::throwOnFailure).compose(RxUtils.mapFailureToValue(403, false)).map(result -> true);
}
Also used : RepositoryCollaboratorService(com.meisolsson.githubsdk.service.repositories.RepositoryCollaboratorService) Gh4Application(com.gh4a.Gh4Application)

Example 3 with RepositoryCollaboratorService

use of com.meisolsson.githubsdk.service.repositories.RepositoryCollaboratorService in project gh4a by slapperwan.

the class IssueEditActivity method loadPotentialAssignees.

private void loadPotentialAssignees() {
    final RepositoryCollaboratorService service = ServiceFactory.get(RepositoryCollaboratorService.class, false);
    registerTemporarySubscription(ApiHelpers.PageIterator.toSingle(page -> service.getCollaborators(mRepoOwner, mRepoName, page)).compose(RxUtils::doInBackground).compose(RxUtils.wrapWithProgressDialog(this, R.string.loading_msg)).subscribe(result -> {
        mAllAssignee = result;
        User creator = mEditIssue.user();
        if (creator != null && !mAllAssignee.contains(creator)) {
            mAllAssignee.add(creator);
        }
        showAssigneesDialog();
    }, this::handleLoadFailure));
}
Also used : HttpURLConnection(java.net.HttpURLConnection) Bundle(android.os.Bundle) ImageView(android.widget.ImageView) IssueMilestoneService(com.meisolsson.githubsdk.service.issues.IssueMilestoneService) TextInputLayout(android.support.design.widget.TextInputLayout) MarkdownPreviewWebView(com.gh4a.widget.MarkdownPreviewWebView) IssueState(com.meisolsson.githubsdk.model.IssueState) Label(com.meisolsson.githubsdk.model.Label) Locale(java.util.Locale) ContentType(com.meisolsson.githubsdk.model.ContentType) Issue(com.meisolsson.githubsdk.model.Issue) View(android.view.View) StringUtils(com.gh4a.utils.StringUtils) FloatingActionButton(android.support.design.widget.FloatingActionButton) ContextCompat(android.support.v4.content.ContextCompat) IssueLabelService(com.meisolsson.githubsdk.service.issues.IssueLabelService) ViewGroup(android.view.ViewGroup) RepositoryContentService(com.meisolsson.githubsdk.service.repositories.RepositoryContentService) List(java.util.List) TextView(android.widget.TextView) RxUtils(com.gh4a.utils.RxUtils) Optional(com.gh4a.utils.Optional) Nullable(android.support.annotation.Nullable) Typeface(android.graphics.Typeface) Context(android.content.Context) AppBarLayout(android.support.design.widget.AppBarLayout) CoordinatorLayout(android.support.design.widget.CoordinatorLayout) MarkdownButtonsBar(com.gh4a.widget.MarkdownButtonsBar) BasePagerActivity(com.gh4a.BasePagerActivity) Intent(android.content.Intent) Response(retrofit2.Response) Single(io.reactivex.Single) UiUtils(com.gh4a.utils.UiUtils) ArrayList(java.util.ArrayList) User(com.meisolsson.githubsdk.model.User) AvatarHandler(com.gh4a.utils.AvatarHandler) Milestone(com.meisolsson.githubsdk.model.Milestone) Content(com.meisolsson.githubsdk.model.Content) R(com.gh4a.R) IssueRequest(com.meisolsson.githubsdk.model.request.issue.IssueRequest) IssueService(com.meisolsson.githubsdk.service.issues.IssueService) RepositoryCollaboratorService(com.meisolsson.githubsdk.service.repositories.RepositoryCollaboratorService) DialogInterface(android.content.DialogInterface) ApiHelpers(com.gh4a.utils.ApiHelpers) LayoutInflater(android.view.LayoutInflater) PagerAdapter(android.support.v4.view.PagerAdapter) IdRes(android.support.annotation.IdRes) AlertDialog(android.support.v7.app.AlertDialog) Gh4Application(com.gh4a.Gh4Application) ObjectsCompat(android.support.v4.util.ObjectsCompat) SingleFactory(com.gh4a.utils.SingleFactory) ServiceFactory(com.gh4a.ServiceFactory) EditText(android.widget.EditText) RepositoryCollaboratorService(com.meisolsson.githubsdk.service.repositories.RepositoryCollaboratorService) User(com.meisolsson.githubsdk.model.User)

Aggregations

RepositoryCollaboratorService (com.meisolsson.githubsdk.service.repositories.RepositoryCollaboratorService)3 Gh4Application (com.gh4a.Gh4Application)2 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 Typeface (android.graphics.Typeface)1 Bundle (android.os.Bundle)1 IdRes (android.support.annotation.IdRes)1 Nullable (android.support.annotation.Nullable)1 AppBarLayout (android.support.design.widget.AppBarLayout)1 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)1 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 TextInputLayout (android.support.design.widget.TextInputLayout)1 ContextCompat (android.support.v4.content.ContextCompat)1 ObjectsCompat (android.support.v4.util.ObjectsCompat)1 PagerAdapter (android.support.v4.view.PagerAdapter)1 AlertDialog (android.support.v7.app.AlertDialog)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1