apply changes

This commit is contained in:
Thomas 2022-11-12 18:57:07 +01:00
parent 144dddcc0f
commit 6063246b96
3 changed files with 10 additions and 2 deletions

View File

@ -147,7 +147,7 @@ public class AdminAccountActivity extends BaseActivity {
});
binding.silenceAction.setOnClickListener(v -> {
if (adminAccount.disabled) {
if (adminAccount.silenced) {
adminVM.unsilence(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id)
.observe(AdminAccountActivity.this, adminAccountResult -> {
adminAccount = adminAccountResult;
@ -161,7 +161,7 @@ public class AdminAccountActivity extends BaseActivity {
});
binding.suspendAction.setOnClickListener(v -> {
if (adminAccount.disabled) {
if (adminAccount.suspended) {
adminVM.unsuspend(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id)
.observe(AdminAccountActivity.this, adminAccountResult -> {
adminAccount = adminAccountResult;

View File

@ -17,6 +17,7 @@ package app.fedilab.android.viewmodel.mastodon;
import android.app.Application;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
@ -213,10 +214,13 @@ public class AdminVM extends AndroidViewModel {
AdminAccount adminAccount = null;
Call<AdminAccount> approveCall = mastodonAdminService.approve(token, accountId);
if (approveCall != null) {
Log.v(Helper.TAG, "request: " + approveCall.request());
try {
Response<AdminAccount> approveResponse = approveCall.execute();
if (approveResponse.isSuccessful()) {
adminAccount = approveResponse.body();
} else {
Log.v(Helper.TAG, "err: " + approveResponse.errorBody().string());
}
} catch (Exception e) {
e.printStackTrace();
@ -342,10 +346,13 @@ public class AdminVM extends AndroidViewModel {
AdminAccount adminAccount = null;
Call<AdminAccount> unsuspendCall = mastodonAdminService.unsuspend(token, accountId);
if (unsuspendCall != null) {
Log.v(Helper.TAG, "request: " + unsuspendCall.request());
try {
Response<AdminAccount> unsuspendResponse = unsuspendCall.execute();
if (unsuspendResponse.isSuccessful()) {
adminAccount = unsuspendResponse.body();
} else {
Log.v(Helper.TAG, "err: " + unsuspendResponse.errorBody().string());
}
} catch (Exception e) {
e.printStackTrace();

View File

@ -10,5 +10,6 @@
android:textAlignment="textStart"
android:textColor="@color/cyanea_accent_dark_reference"
app:icon="@drawable/ic_baseline_navigate_next_24"
app:iconTint="@color/cyanea_accent_dark_reference"
app:iconGravity="end"
app:strokeColor="@color/cyanea_accent_dark_reference" />