Org level labels in issue labels (#763)
Adding null checks. Minor cleanups. Merge branch 'master' into org-labels-in-issue Fix repo size Add new instances Merge branch 'master' into org-labels-in-issue Add org level labels to issue labels Co-authored-by: opyale <opyale@noreply.codeberg.org> Co-authored-by: M M Arif <mmarif@swatian.com> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/763 Reviewed-by: opyale <opyale@noreply.codeberg.org>
This commit is contained in:
parent
a92da6a6d4
commit
639cf51027
@ -179,6 +179,8 @@
|
|||||||
<data android:host="gitea.com" />
|
<data android:host="gitea.com" />
|
||||||
<data android:host="try.gitea.io" />
|
<data android:host="try.gitea.io" />
|
||||||
<data android:host="code.obermui.de" />
|
<data android:host="code.obermui.de" />
|
||||||
|
<data android:host="git.fsfe.org" />
|
||||||
|
<data android:host="opendev.org" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
@ -63,7 +63,7 @@ public class LabelsActions {
|
|||||||
|
|
||||||
Call<List<Labels>> call = RetrofitClient
|
Call<List<Labels>> call = RetrofitClient
|
||||||
.getApiInterface(ctx)
|
.getApiInterface(ctx)
|
||||||
.getlabels(Authorization.get(ctx), repoOwner, repoName);
|
.getLabels(Authorization.get(ctx), repoOwner, repoName);
|
||||||
|
|
||||||
call.enqueue(new Callback<List<Labels>>() {
|
call.enqueue(new Callback<List<Labels>>() {
|
||||||
|
|
||||||
@ -71,26 +71,45 @@ public class LabelsActions {
|
|||||||
public void onResponse(@NonNull Call<List<Labels>> call, @NonNull retrofit2.Response<List<Labels>> response) {
|
public void onResponse(@NonNull Call<List<Labels>> call, @NonNull retrofit2.Response<List<Labels>> response) {
|
||||||
|
|
||||||
labelsList.clear();
|
labelsList.clear();
|
||||||
List<Labels> labelsList_ = response.body();
|
|
||||||
|
if (response.code() == 200) {
|
||||||
|
|
||||||
|
if(response.body() != null) {
|
||||||
|
|
||||||
|
labelsList.addAll(response.body());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load organization labels
|
||||||
|
Call<List<Labels>> callOrgLabels = RetrofitClient
|
||||||
|
.getApiInterface(ctx)
|
||||||
|
.getOrganizationLabels(Authorization.get(ctx), repoOwner);
|
||||||
|
|
||||||
|
callOrgLabels.enqueue(new Callback<List<Labels>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<List<Labels>> call, @NonNull retrofit2.Response<List<Labels>> responseOrg) {
|
||||||
|
|
||||||
labelsBinding.progressBar.setVisibility(View.GONE);
|
labelsBinding.progressBar.setVisibility(View.GONE);
|
||||||
labelsBinding.dialogFrame.setVisibility(View.VISIBLE);
|
labelsBinding.dialogFrame.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if (response.code() == 200) {
|
if(responseOrg.body() != null) {
|
||||||
|
|
||||||
assert labelsList_ != null;
|
labelsList.addAll(responseOrg.body());
|
||||||
|
|
||||||
if(labelsList_.size() > 0) {
|
|
||||||
|
|
||||||
labelsList.addAll(labelsList_);
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
if(labelsList.isEmpty()) {
|
||||||
|
|
||||||
dialogLabels.dismiss();
|
dialogLabels.dismiss();
|
||||||
Toasty.warning(ctx, ctx.getResources().getString(R.string.noLabelsFound));
|
Toasty.warning(ctx, ctx.getResources().getString(R.string.noLabelsFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
labelsBinding.labelsRecyclerView.setAdapter(labelsAdapter);
|
labelsBinding.labelsRecyclerView.setAdapter(labelsAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void onFailure(@NonNull Call<List<Labels>> call, @NonNull Throwable t) {}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -262,7 +262,7 @@ public class RepoInfoFragment extends Fragment {
|
|||||||
|
|
||||||
repoMetaForks.setText(repoInfo.getForks_count());
|
repoMetaForks.setText(repoInfo.getForks_count());
|
||||||
repoMetaWatchers.setText(repoInfo.getWatchers_count());
|
repoMetaWatchers.setText(repoInfo.getWatchers_count());
|
||||||
repoMetaSize.setText(FileUtils.byteCountToDisplaySize((int) repoInfo.getSize()));
|
repoMetaSize.setText(FileUtils.byteCountToDisplaySize((int) (repoInfo.getSize() * 1024)));
|
||||||
|
|
||||||
repoMetaCreatedAt.setText(TimeHelper.formatTime(repoInfo.getCreated_at(), new Locale(locale), timeFormat, ctx));
|
repoMetaCreatedAt.setText(TimeHelper.formatTime(repoInfo.getCreated_at(), new Locale(locale), timeFormat, ctx));
|
||||||
if(timeFormat.equals("pretty")) {
|
if(timeFormat.equals("pretty")) {
|
||||||
|
@ -176,7 +176,10 @@ public interface ApiInterface {
|
|||||||
Call<JsonElement> createNewIssue(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Body CreateIssue jsonStr);
|
Call<JsonElement> createNewIssue(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Body CreateIssue jsonStr);
|
||||||
|
|
||||||
@GET("repos/{owner}/{repo}/labels") // get labels list
|
@GET("repos/{owner}/{repo}/labels") // get labels list
|
||||||
Call<List<Labels>> getlabels(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
Call<List<Labels>> getLabels(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||||
|
|
||||||
|
@GET("orgs/{owner}/labels") // get org labels list
|
||||||
|
Call<List<Labels>> getOrganizationLabels(@Header("Authorization") String token, @Path("owner") String ownerName);
|
||||||
|
|
||||||
@GET("users/{username}/repos") // get current logged in user repositories
|
@GET("users/{username}/repos") // get current logged in user repositories
|
||||||
Call<List<UserRepositories>> getCurrentUserRepositories(@Header("Authorization") String token, @Path("username") String username, @Query("page") int page, @Query("limit") int limit);
|
Call<List<UserRepositories>> getCurrentUserRepositories(@Header("Authorization") String token, @Path("username") String username, @Query("page") int page, @Query("limit") int limit);
|
||||||
|
@ -33,7 +33,7 @@ public class LabelsViewModel extends ViewModel {
|
|||||||
|
|
||||||
Call<List<Labels>> call = RetrofitClient
|
Call<List<Labels>> call = RetrofitClient
|
||||||
.getApiInterface(ctx)
|
.getApiInterface(ctx)
|
||||||
.getlabels(token, owner, repo);
|
.getLabels(token, owner, repo);
|
||||||
|
|
||||||
call.enqueue(new Callback<List<Labels>>() {
|
call.enqueue(new Callback<List<Labels>>() {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user