mirror of
https://github.com/gitnex-org/gitnex.git
synced 2026-07-20 09:32:17 -05:00
Clean up
This commit is contained in:
@@ -2,7 +2,6 @@ package org.mian.gitnex.actions;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import org.gitnex.tea4j.models.Collaborators;
|
||||
@@ -18,7 +17,7 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class AssigneesActions {
|
||||
@@ -29,7 +28,7 @@ public class AssigneesActions {
|
||||
.getApiInterface(ctx)
|
||||
.getIssueByIndex(((BaseActivity) ctx).getAccount().getAuthorization(), repoOwner, repoName, issueIndex);
|
||||
|
||||
callSingleIssueLabels.enqueue(new Callback<Issues>() {
|
||||
callSingleIssueLabels.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<Issues> call, @NonNull retrofit2.Response<Issues> response) {
|
||||
@@ -39,7 +38,7 @@ public class AssigneesActions {
|
||||
Issues issueAssigneesList = response.body();
|
||||
assert issueAssigneesList != null;
|
||||
|
||||
if (issueAssigneesList.getAssignees() != null) {
|
||||
if(issueAssigneesList.getAssignees() != null) {
|
||||
|
||||
if(issueAssigneesList.getAssignees().size() > 0) {
|
||||
|
||||
@@ -50,14 +49,17 @@ public class AssigneesActions {
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(ctx, ctx.getResources().getString(R.string.genericError));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<Issues> call, @NonNull Throwable t) {
|
||||
|
||||
Log.e("onFailure", t.toString());
|
||||
Toasty.error(ctx, ctx.getResources().getString(R.string.genericServerResponseError));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,7 +69,7 @@ public class AssigneesActions {
|
||||
.getApiInterface(ctx)
|
||||
.getAllAssignees(((BaseActivity) ctx).getAccount().getAuthorization(), repoOwner, repoName);
|
||||
|
||||
call.enqueue(new Callback<List<Collaborators>>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<Collaborators>> call, @NonNull retrofit2.Response<List<Collaborators>> response) {
|
||||
@@ -78,7 +80,7 @@ public class AssigneesActions {
|
||||
assigneesBinding.progressBar.setVisibility(View.GONE);
|
||||
assigneesBinding.dialogFrame.setVisibility(View.VISIBLE);
|
||||
|
||||
if (response.code() == 200) {
|
||||
if(response.code() == 200) {
|
||||
|
||||
assert assigneesList_ != null;
|
||||
|
||||
@@ -99,7 +101,6 @@ public class AssigneesActions {
|
||||
|
||||
Toasty.error(ctx, ctx.getResources().getString(R.string.genericError));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,7 +109,5 @@ public class AssigneesActions {
|
||||
Toasty.error(ctx, ctx.getResources().getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.mian.gitnex.actions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import org.gitnex.tea4j.models.Collaborators;
|
||||
import org.gitnex.tea4j.models.Permission;
|
||||
@@ -13,13 +12,11 @@ import org.mian.gitnex.fragments.CollaboratorsFragment;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
||||
import java.util.List;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class CollaboratorActions {
|
||||
@@ -30,53 +27,44 @@ public class CollaboratorActions {
|
||||
.getApiInterface(context)
|
||||
.deleteCollaborator(((BaseActivity) context).getAccount().getAuthorization(), repository.getOwner(), repository.getName(), userName);
|
||||
|
||||
call.enqueue(new Callback<Collaborators>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<Collaborators> call, @NonNull retrofit2.Response<Collaborators> response) {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<Collaborators> call, @NonNull retrofit2.Response<Collaborators> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 204) {
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 204) {
|
||||
|
||||
CollaboratorsFragment.refreshCollaborators = true;
|
||||
Toasty.success(context, context.getString(R.string.removeCollaboratorToastText));
|
||||
((AddCollaboratorToRepositoryActivity)context).finish();
|
||||
//Log.i("addCollaboratorSearch", addCollaboratorSearch.getText().toString());
|
||||
//AddCollaboratorToRepositoryActivity usersSearchData = new AddCollaboratorToRepositoryActivity();
|
||||
//usersSearchData.loadUserSearchList(instanceToken, searchKeyword, context);
|
||||
CollaboratorsFragment.refreshCollaborators = true;
|
||||
Toasty.success(context, context.getString(R.string.removeCollaboratorToastText));
|
||||
((AddCollaboratorToRepositoryActivity) context).finish();
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<Collaborators> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<Collaborators> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
Toasty.error(context, context.getResources().getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
@@ -89,90 +77,44 @@ public class CollaboratorActions {
|
||||
.getApiInterface(context)
|
||||
.addCollaborator(((BaseActivity) context).getAccount().getAuthorization(), repository.getOwner(), repository.getName(), userName, permissionString);
|
||||
|
||||
call.enqueue(new Callback<Permission>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<Permission> call, @NonNull retrofit2.Response<Permission> response) {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<Permission> call, @NonNull retrofit2.Response<Permission> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 204) {
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 204) {
|
||||
|
||||
CollaboratorsFragment.refreshCollaborators = true;
|
||||
Toasty.success(context, context.getString(R.string.addCollaboratorToastText));
|
||||
((AddCollaboratorToRepositoryActivity)context).finish();
|
||||
//AddCollaboratorToRepositoryActivity usersSearchData = new AddCollaboratorToRepositoryActivity();
|
||||
//usersSearchData.loadUserSearchList(instanceToken, searchKeyword, context);
|
||||
CollaboratorsFragment.refreshCollaborators = true;
|
||||
Toasty.success(context, context.getString(R.string.addCollaboratorToastText));
|
||||
((AddCollaboratorToRepositoryActivity) context).finish();
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<Permission> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<Permission> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(context, context.getResources().getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static ActionResult<List<Collaborators>> getCollaborators(Context context, RepositoryContext repository) {
|
||||
|
||||
ActionResult<List<Collaborators>> actionResult = new ActionResult<>();
|
||||
|
||||
Call<List<Collaborators>> call = RetrofitClient
|
||||
.getApiInterface(context)
|
||||
.getCollaborators(((BaseActivity) context).getAccount().getAuthorization(), repository.getOwner(), repository.getName());
|
||||
|
||||
call.enqueue(new Callback<List<Collaborators>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<Collaborators>> call, @NonNull Response<List<Collaborators>> response) {
|
||||
|
||||
if (response.isSuccessful()) {
|
||||
|
||||
assert response.body() != null;
|
||||
actionResult.finish(ActionResult.Status.SUCCESS, response.body());
|
||||
}
|
||||
else {
|
||||
|
||||
actionResult.finish(ActionResult.Status.FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Collaborators>> call, @NonNull Throwable t) {
|
||||
|
||||
actionResult.finish(ActionResult.Status.FAILED);
|
||||
}
|
||||
});
|
||||
|
||||
return actionResult;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class IssueActions {
|
||||
@@ -34,7 +34,7 @@ public class IssueActions {
|
||||
.patchIssueComment(((BaseActivity) context).getAccount().getAuthorization(), issue.getRepository().getOwner(),
|
||||
issue.getRepository().getName(), commentId, new IssueComments(comment));
|
||||
|
||||
call.enqueue(new Callback<IssueComments>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<IssueComments> call, @NonNull retrofit2.Response<IssueComments> response) {
|
||||
@@ -47,7 +47,8 @@ public class IssueActions {
|
||||
|
||||
case 401:
|
||||
actionResult.finish(ActionResult.Status.FAILED, response);
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle), context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.cancelButton), context.getResources().getString(R.string.navLogout));
|
||||
break;
|
||||
|
||||
@@ -79,7 +80,7 @@ public class IssueActions {
|
||||
.closeReopenIssue(((BaseActivity) ctx).getAccount().getAuthorization(), issue.getRepository().getOwner(),
|
||||
issue.getRepository().getName(), issue.getIssueIndex(), issueStatJson);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
@@ -87,7 +88,7 @@ public class IssueActions {
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 201) {
|
||||
|
||||
if (issue.hasIssue()) {
|
||||
if(issue.hasIssue()) {
|
||||
IssuesFragment.resumeIssues = issue.getIssue().getPull_request() == null;
|
||||
PullRequestsFragment.resumePullRequests = issue.getIssue().getPull_request() != null;
|
||||
}
|
||||
@@ -104,25 +105,22 @@ public class IssueActions {
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle), ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton), ctx.getResources().getString(R.string.navLogout));
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton),
|
||||
ctx.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -143,7 +141,7 @@ public class IssueActions {
|
||||
.addIssueSubscriber(((BaseActivity) ctx).getAccount().getAuthorization(), issue.getRepository().getOwner(),
|
||||
issue.getRepository().getName(), issue.getIssueIndex(), ((BaseActivity) ctx).getAccount().getAccount().getUserName());
|
||||
|
||||
call.enqueue(new Callback<Void>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<Void> call, @NonNull retrofit2.Response<Void> response) {
|
||||
@@ -153,26 +151,20 @@ public class IssueActions {
|
||||
if(response.code() == 201) {
|
||||
|
||||
Toasty.success(ctx, ctx.getString(R.string.subscribedSuccessfully));
|
||||
|
||||
}
|
||||
else if(response.code() == 200) {
|
||||
|
||||
Toasty.success(ctx, ctx.getString(R.string.alreadySubscribed));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle), ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton), ctx.getResources().getString(R.string.navLogout));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.subscriptionError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -191,7 +183,7 @@ public class IssueActions {
|
||||
call = RetrofitClient.getApiInterface(ctx).delIssueSubscriber(((BaseActivity) ctx).getAccount().getAuthorization(), issue.getRepository().getOwner(),
|
||||
issue.getRepository().getName(), issue.getIssueIndex(), ((BaseActivity) ctx).getAccount().getAccount().getUserName());
|
||||
|
||||
call.enqueue(new Callback<Void>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<Void> call, @NonNull retrofit2.Response<Void> response) {
|
||||
@@ -201,26 +193,22 @@ public class IssueActions {
|
||||
if(response.code() == 201) {
|
||||
|
||||
Toasty.success(ctx, ctx.getString(R.string.unsubscribedSuccessfully));
|
||||
|
||||
}
|
||||
else if(response.code() == 200) {
|
||||
|
||||
Toasty.success(ctx, ctx.getString(R.string.alreadyUnsubscribed));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle), ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton), ctx.getResources().getString(R.string.navLogout));
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton),
|
||||
ctx.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.unSubscriptionError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -242,7 +230,7 @@ public class IssueActions {
|
||||
.replyCommentToIssue(((BaseActivity) context).getAccount().getAuthorization(), issue.getRepository().getOwner(),
|
||||
issue.getRepository().getName(), issue.getIssueIndex(), issueComment);
|
||||
|
||||
call.enqueue(new Callback<Issues>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<Issues> call, @NonNull retrofit2.Response<Issues> response) {
|
||||
@@ -250,7 +238,7 @@ public class IssueActions {
|
||||
if(response.code() == 201) {
|
||||
actionResult.finish(ActionResult.Status.SUCCESS);
|
||||
|
||||
if (issue.hasIssue()) {
|
||||
if(issue.hasIssue()) {
|
||||
IssuesFragment.resumeIssues = issue.getIssue().getPull_request() == null;
|
||||
PullRequestsFragment.resumePullRequests = issue.getIssue().getPull_request() != null;
|
||||
}
|
||||
@@ -258,8 +246,7 @@ public class IssueActions {
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getString(R.string.cancelButton),
|
||||
context.getString(R.string.alertDialogTokenRevokedMessage), context.getString(R.string.cancelButton),
|
||||
context.getString(R.string.navLogout));
|
||||
|
||||
}
|
||||
@@ -277,7 +264,5 @@ public class IssueActions {
|
||||
});
|
||||
|
||||
return actionResult;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.mian.gitnex.actions;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import org.gitnex.tea4j.models.Labels;
|
||||
@@ -17,7 +16,7 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class LabelsActions {
|
||||
@@ -28,34 +27,34 @@ public class LabelsActions {
|
||||
.getApiInterface(ctx)
|
||||
.getIssueLabels(((BaseActivity) ctx).getAccount().getAuthorization(), repoOwner, repoName, issueIndex);
|
||||
|
||||
callSingleIssueLabels.enqueue(new Callback<List<Labels>>() {
|
||||
callSingleIssueLabels.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<Labels>> call, @NonNull retrofit2.Response<List<Labels>> response) {
|
||||
|
||||
if(response.code() == 200) {
|
||||
if(response.isSuccessful()) {
|
||||
|
||||
List<Labels> issueLabelsList = response.body();
|
||||
|
||||
assert issueLabelsList != null;
|
||||
|
||||
if(issueLabelsList.size() > 0) {
|
||||
|
||||
for (int i = 0; i < issueLabelsList.size(); i++) {
|
||||
for(int i = 0; i < issueLabelsList.size(); i++) {
|
||||
|
||||
currentLabelsIds.add(issueLabelsList.get(i).getId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Labels>> call, @NonNull Throwable t) {
|
||||
|
||||
Log.e("onFailure", t.toString());
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -65,14 +64,14 @@ public class LabelsActions {
|
||||
.getApiInterface(ctx)
|
||||
.getLabels(((BaseActivity) ctx).getAccount().getAuthorization(), repoOwner, repoName);
|
||||
|
||||
call.enqueue(new Callback<List<Labels>>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<Labels>> call, @NonNull retrofit2.Response<List<Labels>> response) {
|
||||
|
||||
labelsList.clear();
|
||||
|
||||
if (response.code() == 200) {
|
||||
if(response.isSuccessful()) {
|
||||
|
||||
if(response.body() != null) {
|
||||
|
||||
@@ -80,11 +79,10 @@ public class LabelsActions {
|
||||
}
|
||||
|
||||
// Load organization labels
|
||||
Call<List<Labels>> callOrgLabels = RetrofitClient
|
||||
.getApiInterface(ctx)
|
||||
Call<List<Labels>> callOrgLabels = RetrofitClient.getApiInterface(ctx)
|
||||
.getOrganizationLabels(((BaseActivity) ctx).getAccount().getAuthorization(), repoOwner);
|
||||
|
||||
callOrgLabels.enqueue(new Callback<List<Labels>>() {
|
||||
callOrgLabels.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<List<Labels>> call, @NonNull retrofit2.Response<List<Labels>> responseOrg) {
|
||||
@@ -107,7 +105,11 @@ public class LabelsActions {
|
||||
labelsBinding.labelsRecyclerView.setAdapter(labelsAdapter);
|
||||
}
|
||||
|
||||
@Override public void onFailure(@NonNull Call<List<Labels>> call, @NonNull Throwable t) {}
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Labels>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -116,7 +118,6 @@ public class LabelsActions {
|
||||
|
||||
Toasty.error(ctx, ctx.getResources().getString(R.string.genericError));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,7 +126,5 @@ public class LabelsActions {
|
||||
Toasty.error(ctx, ctx.getResources().getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.mian.gitnex.actions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.gson.JsonElement;
|
||||
import org.gitnex.tea4j.models.Milestones;
|
||||
@@ -15,13 +14,11 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class MilestoneActions {
|
||||
|
||||
static final private String TAG = "MilestoneActions : ";
|
||||
|
||||
public static void closeMilestone(final Context ctx, int milestoneId_, RepositoryContext repository) {
|
||||
|
||||
Milestones milestoneStateJson = new Milestones("closed");
|
||||
@@ -31,7 +28,7 @@ public class MilestoneActions {
|
||||
.getApiInterface(ctx)
|
||||
.closeReopenMilestone(((BaseActivity) ctx).getAccount().getAuthorization(), repository.getOwner(), repository.getOwner(), milestoneId_, milestoneStateJson);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
@@ -44,29 +41,21 @@ public class MilestoneActions {
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
ctx.getResources().getString(R.string.cancelButton),
|
||||
ctx.getResources().getString(R.string.navLogout));
|
||||
|
||||
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton),
|
||||
ctx.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
|
||||
Log.e(TAG, t.toString());
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void openMilestone(final Context ctx, int milestoneId_, RepositoryContext repository) {
|
||||
@@ -78,7 +67,7 @@ public class MilestoneActions {
|
||||
.getApiInterface(ctx)
|
||||
.closeReopenMilestone(((BaseActivity) ctx).getAccount().getAuthorization(), repository.getOwner(), repository.getOwner(), milestoneId_, milestoneStateJson);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
@@ -86,33 +75,24 @@ public class MilestoneActions {
|
||||
if(response.isSuccessful()) {
|
||||
|
||||
Toasty.success(ctx, ctx.getString(R.string.milestoneStatusUpdate));
|
||||
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, ctx.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
ctx.getResources().getString(R.string.cancelButton),
|
||||
ctx.getResources().getString(R.string.navLogout));
|
||||
|
||||
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage), ctx.getResources().getString(R.string.cancelButton),
|
||||
ctx.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
|
||||
Log.e(TAG, t.toString());
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,44 +23,56 @@ public class PullRequestActions {
|
||||
.getApiInterface(context)
|
||||
.deleteBranch(((BaseActivity) context).getAccount().getAuthorization(), repoOwner, repoName, headBranch);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
|
||||
if(response.code() == 204) {
|
||||
|
||||
if(showToasts) Toasty.success(context, context.getString(R.string.deleteBranchSuccess));
|
||||
if(showToasts) {
|
||||
Toasty.success(context, context.getString(R.string.deleteBranchSuccess));
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs
|
||||
.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle), context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton), context.getResources().getString(R.string.navLogout));
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.cancelButton), context.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
if(showToasts) Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
if(showToasts) {
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
}
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
if(showToasts) Toasty.warning(context, context.getString(R.string.deleteBranchErrorNotFound));
|
||||
if(showToasts) {
|
||||
Toasty.warning(context, context.getString(R.string.deleteBranchErrorNotFound));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if(showToasts) Toasty.error(context, context.getString(R.string.genericError));
|
||||
if(showToasts) {
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
|
||||
if(showToasts) Toasty.error(context, context.getString(R.string.deleteBranchError));
|
||||
if(showToasts) {
|
||||
Toasty.error(context, context.getString(R.string.deleteBranchError));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public static void updatePr(Context context, String repoOwner, String repoName, String index, Boolean rebase) {
|
||||
|
||||
String strategy;
|
||||
if(rebase == null) {
|
||||
strategy = null;
|
||||
@@ -71,11 +83,13 @@ public class PullRequestActions {
|
||||
else {
|
||||
strategy = "rebase";
|
||||
}
|
||||
|
||||
RetrofitClient.getApiInterface(context).updatePullRequest(((BaseActivity) context).getAccount().getAuthorization(), repoOwner, repoName, Integer.parseInt(index), strategy)
|
||||
.enqueue(new Callback<Void>() {
|
||||
.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call call, @NonNull Response response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
Toasty.success(context, context.getString(R.string.updatePrSuccess));
|
||||
}
|
||||
@@ -94,9 +108,9 @@ public class PullRequestActions {
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.mian.gitnex.actions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.gson.JsonElement;
|
||||
import org.mian.gitnex.R;
|
||||
@@ -15,7 +14,7 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class RepositoryActions {
|
||||
@@ -28,51 +27,44 @@ public class RepositoryActions {
|
||||
.getApiInterface(context)
|
||||
.starRepository(((BaseActivity) context).getAccount().getAuthorization(), repository.getOwner(), repository.getName());
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 204) {
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 204) {
|
||||
|
||||
MainActivity.repoCreated = true;
|
||||
Toasty.success(context, context.getString(R.string.starRepositorySuccess));
|
||||
MainActivity.repoCreated = true;
|
||||
Toasty.success(context, context.getString(R.string.starRepositorySuccess));
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
Toasty.error(context, context.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void unStarRepository(final Context context, RepositoryContext repository) {
|
||||
@@ -83,51 +75,44 @@ public class RepositoryActions {
|
||||
.getApiInterface(context)
|
||||
.unStarRepository(((BaseActivity) context).getAccount().getAuthorization(), repository.getOwner(), repository.getName());
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 204) {
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 204) {
|
||||
|
||||
MainActivity.repoCreated = true;
|
||||
Toasty.success(context, context.getString(R.string.unStarRepositorySuccess));
|
||||
MainActivity.repoCreated = true;
|
||||
Toasty.success(context, context.getString(R.string.unStarRepositorySuccess));
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
Toasty.error(context, context.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void watchRepository(final Context context, RepositoryContext repository) {
|
||||
@@ -138,50 +123,45 @@ public class RepositoryActions {
|
||||
.getApiInterface(context)
|
||||
.watchRepository(((BaseActivity) context).getAccount().getAuthorization(), repository.getOwner(), repository.getName());
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 200) {
|
||||
if(response.isSuccessful()) {
|
||||
if(response.code() == 200) {
|
||||
|
||||
Toasty.success(context, context.getString(R.string.watchRepositorySuccess));
|
||||
Toasty.success(context, context.getString(R.string.watchRepositorySuccess));
|
||||
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
}
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
}
|
||||
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
Toasty.error(context, context.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void unWatchRepository(final Context context, RepositoryContext repository) {
|
||||
@@ -192,48 +172,40 @@ public class RepositoryActions {
|
||||
.getApiInterface(context)
|
||||
.unWatchRepository(((BaseActivity) context).getAccount().getAuthorization(), repository.getOwner(), repository.getName());
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
|
||||
if(response.code() == 204) {
|
||||
if(response.code() == 204) {
|
||||
|
||||
Toasty.success(context, context.getString(R.string.unWatchRepositorySuccess));
|
||||
Toasty.success(context, context.getString(R.string.unWatchRepositorySuccess));
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
Log.e("onFailure", t.toString());
|
||||
}
|
||||
Toasty.error(context, context.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class TeamActions {
|
||||
@@ -24,7 +24,7 @@ public class TeamActions {
|
||||
.getApiInterface(context)
|
||||
.removeTeamMember(((BaseActivity) context).getAccount().getAuthorization(), teamId, userName);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
@@ -34,45 +34,36 @@ public class TeamActions {
|
||||
if(response.code() == 204) {
|
||||
|
||||
Toasty.success(context, context.getString(R.string.memberRemovedMessage));
|
||||
((AddNewTeamMemberActivity)context).finish();
|
||||
|
||||
((AddNewTeamMemberActivity) context).finish();
|
||||
}
|
||||
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(context, context.getResources().getString(R.string.genericServerResponseError));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void addTeamMember(final Context context, String userName, int teamId) {
|
||||
@@ -81,7 +72,7 @@ public class TeamActions {
|
||||
.getApiInterface(context)
|
||||
.addTeamMember(((BaseActivity) context).getAccount().getAuthorization(), teamId, userName);
|
||||
|
||||
call.enqueue(new Callback<JsonElement>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||
@@ -91,45 +82,34 @@ public class TeamActions {
|
||||
if(response.code() == 204) {
|
||||
|
||||
Toasty.success(context, context.getString(R.string.memberAddedMessage));
|
||||
((AddNewTeamMemberActivity)context).finish();
|
||||
|
||||
((AddNewTeamMemberActivity) context).finish();
|
||||
}
|
||||
|
||||
}
|
||||
else if(response.code() == 401) {
|
||||
|
||||
AlertDialogs.authorizationTokenRevokedDialog(context, context.getResources().getString(R.string.alertDialogTokenRevokedTitle),
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||
context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
|
||||
context.getResources().getString(R.string.alertDialogTokenRevokedMessage), context.getResources().getString(R.string.cancelButton),
|
||||
context.getResources().getString(R.string.navLogout));
|
||||
}
|
||||
else if(response.code() == 403) {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||
|
||||
}
|
||||
else if(response.code() == 404) {
|
||||
|
||||
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Toasty.error(context, context.getString(R.string.genericError));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(context, context.getResources().getString(R.string.genericServerResponseError));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+19
-20
@@ -2,7 +2,6 @@ package org.mian.gitnex.activities;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@@ -15,9 +14,11 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import org.gitnex.tea4j.models.UserInfo;
|
||||
import org.gitnex.tea4j.models.UserSearch;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.adapters.CollaboratorSearchAdapter;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.databinding.ActivityAddCollaboratorToRepositoryBinding;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
||||
import java.util.List;
|
||||
import retrofit2.Call;
|
||||
@@ -25,7 +26,7 @@ import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class AddCollaboratorToRepositoryActivity extends BaseActivity {
|
||||
@@ -86,30 +87,29 @@ public class AddCollaboratorToRepositoryActivity extends BaseActivity {
|
||||
.getApiInterface(ctx)
|
||||
.getUserBySearch(getAccount().getAuthorization(), searchKeyword, 10, 1);
|
||||
|
||||
call.enqueue(new Callback<UserSearch>() {
|
||||
call.enqueue(new Callback<>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<UserSearch> call, @NonNull Response<UserSearch> response) {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<UserSearch> call, @NonNull Response<UserSearch> response) {
|
||||
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
|
||||
if (response.code() == 200) {
|
||||
if(response.isSuccessful()) {
|
||||
|
||||
assert response.body() != null;
|
||||
getUsersList(response.body().getData(), ctx);
|
||||
}
|
||||
else {
|
||||
assert response.body() != null;
|
||||
getUsersList(response.body().getData(), ctx);
|
||||
}
|
||||
else {
|
||||
|
||||
Log.i("onResponse", String.valueOf(response.code()));
|
||||
}
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<UserSearch> call, @NonNull Throwable t) {
|
||||
Log.i("onFailure", t.toString());
|
||||
}
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<UserSearch> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -147,5 +147,4 @@ public class AddCollaboratorToRepositoryActivity extends BaseActivity {
|
||||
super.onResume();
|
||||
repository.checkAccountSwitch(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public class AddNewAccountActivity extends BaseActivity {
|
||||
public void onFailure(@NonNull Call<GiteaVersion> callVersion, @NonNull Throwable t) {
|
||||
|
||||
Log.e("onFailure-versionCheck", t.toString());
|
||||
Toasty.error(ctx, getResources().getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, getResources().getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class CommitsActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Commits>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, getResources().getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, getResources().getString(R.string.genericServerResponseError));
|
||||
}
|
||||
|
||||
});
|
||||
@@ -200,7 +200,7 @@ public class CommitsActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Commits>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, getResources().getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, getResources().getString(R.string.genericServerResponseError));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -302,8 +302,7 @@ public class LoginActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<GiteaVersion> callVersion, @NonNull Throwable t) {
|
||||
|
||||
Log.e("onFailure-versionCheck", t.toString());
|
||||
Toasty.error(ctx, getResources().getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, getResources().getString(R.string.genericServerResponseError));
|
||||
enableProcessButton();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
* @author M M Arif
|
||||
*/
|
||||
|
||||
public class CollaboratorSearchAdapter extends RecyclerView.Adapter<CollaboratorSearchAdapter.CollaboratorSearchViewHolder> {
|
||||
@@ -74,7 +74,7 @@ public class CollaboratorSearchAdapter extends RecyclerView.Adapter<Collaborator
|
||||
pBuilder.setTitle(R.string.newTeamPermission);
|
||||
pBuilder.setSingleChoiceItems(permissionList, permissionSelectedChoice, null)
|
||||
.setCancelable(false)
|
||||
.setNegativeButton(R.string.cancelButton, null)
|
||||
.setNeutralButton(R.string.cancelButton, null)
|
||||
.setPositiveButton(R.string.addButton, (dialog, which) -> {
|
||||
|
||||
ListView lw = ((AlertDialog)dialog).getListView();
|
||||
@@ -164,7 +164,6 @@ public class CollaboratorSearchAdapter extends RecyclerView.Adapter<Collaborator
|
||||
else {
|
||||
holder.addCollaboratorButtonRemove.setVisibility(View.GONE);
|
||||
holder.addCollaboratorButtonAdd.setVisibility(View.GONE);
|
||||
Log.i("onResponse", String.valueOf(response.code()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ public class OrganizationTeamInfoMembersFragment extends Fragment {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserInfo>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class AdminCronTasksViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<CronTasks>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class AdminGetUsersViewModel extends ViewModel {
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserInfo>> call, @NonNull Throwable t) {
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class AdminGetUsersViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserInfo>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class CollaboratorsViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Collaborators>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class FilesViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Files>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class FilesViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Files>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class IssueCommentsViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<IssueComments>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class IssuesViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Issues>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class IssuesViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Issues>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class LabelsViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Labels>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class MembersByOrgViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserInfo>> call, Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class OrganizationLabelsViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Labels>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class OrganizationsViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserOrganizations>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class OrganizationsViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserOrganizations>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ProfileEmailsViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Emails>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ReleasesViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Releases>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class ReleasesViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<Releases>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public class ReleasesViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<GitTag>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public class ReleasesViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<GitTag>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class RepoStargazersViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserInfo>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class RepoWatchersViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserInfo>> call, Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class RepositoriesViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserRepositories>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
|
||||
});
|
||||
@@ -119,7 +119,7 @@ public class RepositoriesViewModel extends ViewModel {
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<List<UserRepositories>> call, @NonNull Throwable t) {
|
||||
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class TeamsByOrgViewModel extends ViewModel {
|
||||
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
noDataTeams.setVisibility(View.GONE);
|
||||
Toasty.error(ctx, ctx.getString(R.string.errorOnLogin));
|
||||
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -594,8 +594,6 @@
|
||||
<string name="openMilestone">Open Milestone</string>
|
||||
<string name="milestoneStatusUpdate">Milestone status updated successfully</string>
|
||||
|
||||
<string name="errorOnLogin">We cannot reach the server, please check your server status</string>
|
||||
|
||||
<string name="reportViewerHeader">Crash Reports</string>
|
||||
<string name="settingsEnableReportsText">Enable Crash Reports</string>
|
||||
<string name="crashTitle">GitNex has stopped :(</string>
|
||||
|
||||
Reference in New Issue
Block a user