mirror of
https://github.com/k0shk0sh/FastHub.git
synced 2026-02-01 15:56:14 +00:00
this commit fixes #56 where now FastHub shows user private repos.
This commit is contained in:
parent
c6adcc857e
commit
afaa721f4a
@ -40,8 +40,10 @@ public interface UserRestService {
|
||||
@GET("users/{username}/received_events")
|
||||
Observable<Pageable<EventsModel>> getReceivedEvents(@NonNull @Path("username") String userName, @Query("page") int page);
|
||||
|
||||
@GET("users/{username}/repos?sort=pushed&direction=desc") Observable<Pageable<RepoModel>>
|
||||
getRepos(@Path("username") @NonNull String username, @Query("page") int page);
|
||||
@GET("users/{username}/repos?sort=pushed&direction=desc")
|
||||
Observable<Pageable<RepoModel>> getRepos(@Path("username") @NonNull String username, @Query("page") int page);
|
||||
|
||||
@GET("/user/repos?sort=pushed&direction=desc") Observable<Pageable<RepoModel>> getRepos(@Query("page") int page);
|
||||
|
||||
@GET("users/{username}/starred") Observable<Pageable<RepoModel>>
|
||||
getStarred(@Path("username") @NonNull String username, @Query("page") int page);
|
||||
|
||||
@ -2,8 +2,10 @@ package com.fastaccess.ui.modules.profile.repos;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.fastaccess.data.dao.LoginModel;
|
||||
import com.fastaccess.data.dao.NameParser;
|
||||
import com.fastaccess.data.dao.RepoModel;
|
||||
import com.fastaccess.provider.rest.RestProvider;
|
||||
@ -24,6 +26,7 @@ class ProfileReposPresenter extends BasePresenter<ProfileReposMvp.View> implemen
|
||||
private int page;
|
||||
private int previousTotal;
|
||||
private int lastPage = Integer.MAX_VALUE;
|
||||
private String currentLoggedIn;
|
||||
|
||||
@Override public int getCurrentPage() {
|
||||
return page;
|
||||
@ -51,6 +54,9 @@ class ProfileReposPresenter extends BasePresenter<ProfileReposMvp.View> implemen
|
||||
}
|
||||
|
||||
@Override public void onCallApi(int page, @Nullable String parameter) {
|
||||
if (currentLoggedIn == null) {
|
||||
currentLoggedIn = LoginModel.getUser().getLogin();
|
||||
}
|
||||
if (parameter == null) {
|
||||
throw new NullPointerException("Username is null");
|
||||
}
|
||||
@ -63,7 +69,9 @@ class ProfileReposPresenter extends BasePresenter<ProfileReposMvp.View> implemen
|
||||
sendToView(ProfileReposMvp.View::hideProgress);
|
||||
return;
|
||||
}
|
||||
makeRestCall(RestProvider.getUserService().getRepos(parameter, page),
|
||||
makeRestCall(TextUtils.equals(currentLoggedIn, parameter)
|
||||
? RestProvider.getUserService().getRepos(page)
|
||||
: RestProvider.getUserService().getRepos(parameter, page),
|
||||
repoModelPageable -> {
|
||||
lastPage = repoModelPageable.getLast();
|
||||
if (getCurrentPage() == 1) {
|
||||
|
||||
@ -28,7 +28,6 @@
|
||||
<item name="android:windowBackground">@drawable/splash_screen_drawable</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="Transparent_Activity" parent="Theme.AppCompat.Light.Dialog">
|
||||
<item name="android:windowBackground">@color/windowBackground</item>
|
||||
<item name="colorPrimary">@color/primary</item>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user