mirror of
				https://codeberg.org/tom79/Fedilab.git
				synced 2025-10-20 11:20:16 +03:00 
			
		
		
		
	apply changes
This commit is contained in:
		
							parent
							
								
									144dddcc0f
								
							
						
					
					
						commit
						6063246b96
					
				
					 3 changed files with 10 additions and 2 deletions
				
			
		| 
						 | 
					@ -147,7 +147,7 @@ public class AdminAccountActivity extends BaseActivity {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        binding.silenceAction.setOnClickListener(v -> {
 | 
					        binding.silenceAction.setOnClickListener(v -> {
 | 
				
			||||||
            if (adminAccount.disabled) {
 | 
					            if (adminAccount.silenced) {
 | 
				
			||||||
                adminVM.unsilence(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id)
 | 
					                adminVM.unsilence(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id)
 | 
				
			||||||
                        .observe(AdminAccountActivity.this, adminAccountResult -> {
 | 
					                        .observe(AdminAccountActivity.this, adminAccountResult -> {
 | 
				
			||||||
                            adminAccount = adminAccountResult;
 | 
					                            adminAccount = adminAccountResult;
 | 
				
			||||||
| 
						 | 
					@ -161,7 +161,7 @@ public class AdminAccountActivity extends BaseActivity {
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        binding.suspendAction.setOnClickListener(v -> {
 | 
					        binding.suspendAction.setOnClickListener(v -> {
 | 
				
			||||||
            if (adminAccount.disabled) {
 | 
					            if (adminAccount.suspended) {
 | 
				
			||||||
                adminVM.unsuspend(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id)
 | 
					                adminVM.unsuspend(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, adminAccount.id)
 | 
				
			||||||
                        .observe(AdminAccountActivity.this, adminAccountResult -> {
 | 
					                        .observe(AdminAccountActivity.this, adminAccountResult -> {
 | 
				
			||||||
                            adminAccount = adminAccountResult;
 | 
					                            adminAccount = adminAccountResult;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,6 +17,7 @@ package app.fedilab.android.viewmodel.mastodon;
 | 
				
			||||||
import android.app.Application;
 | 
					import android.app.Application;
 | 
				
			||||||
import android.os.Handler;
 | 
					import android.os.Handler;
 | 
				
			||||||
import android.os.Looper;
 | 
					import android.os.Looper;
 | 
				
			||||||
 | 
					import android.util.Log;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import androidx.annotation.NonNull;
 | 
					import androidx.annotation.NonNull;
 | 
				
			||||||
import androidx.lifecycle.AndroidViewModel;
 | 
					import androidx.lifecycle.AndroidViewModel;
 | 
				
			||||||
| 
						 | 
					@ -213,10 +214,13 @@ public class AdminVM extends AndroidViewModel {
 | 
				
			||||||
            AdminAccount adminAccount = null;
 | 
					            AdminAccount adminAccount = null;
 | 
				
			||||||
            Call<AdminAccount> approveCall = mastodonAdminService.approve(token, accountId);
 | 
					            Call<AdminAccount> approveCall = mastodonAdminService.approve(token, accountId);
 | 
				
			||||||
            if (approveCall != null) {
 | 
					            if (approveCall != null) {
 | 
				
			||||||
 | 
					                Log.v(Helper.TAG, "request: " + approveCall.request());
 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    Response<AdminAccount> approveResponse = approveCall.execute();
 | 
					                    Response<AdminAccount> approveResponse = approveCall.execute();
 | 
				
			||||||
                    if (approveResponse.isSuccessful()) {
 | 
					                    if (approveResponse.isSuccessful()) {
 | 
				
			||||||
                        adminAccount = approveResponse.body();
 | 
					                        adminAccount = approveResponse.body();
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        Log.v(Helper.TAG, "err: " + approveResponse.errorBody().string());
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } catch (Exception e) {
 | 
					                } catch (Exception e) {
 | 
				
			||||||
                    e.printStackTrace();
 | 
					                    e.printStackTrace();
 | 
				
			||||||
| 
						 | 
					@ -342,10 +346,13 @@ public class AdminVM extends AndroidViewModel {
 | 
				
			||||||
            AdminAccount adminAccount = null;
 | 
					            AdminAccount adminAccount = null;
 | 
				
			||||||
            Call<AdminAccount> unsuspendCall = mastodonAdminService.unsuspend(token, accountId);
 | 
					            Call<AdminAccount> unsuspendCall = mastodonAdminService.unsuspend(token, accountId);
 | 
				
			||||||
            if (unsuspendCall != null) {
 | 
					            if (unsuspendCall != null) {
 | 
				
			||||||
 | 
					                Log.v(Helper.TAG, "request: " + unsuspendCall.request());
 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    Response<AdminAccount> unsuspendResponse = unsuspendCall.execute();
 | 
					                    Response<AdminAccount> unsuspendResponse = unsuspendCall.execute();
 | 
				
			||||||
                    if (unsuspendResponse.isSuccessful()) {
 | 
					                    if (unsuspendResponse.isSuccessful()) {
 | 
				
			||||||
                        adminAccount = unsuspendResponse.body();
 | 
					                        adminAccount = unsuspendResponse.body();
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        Log.v(Helper.TAG, "err: " + unsuspendResponse.errorBody().string());
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } catch (Exception e) {
 | 
					                } catch (Exception e) {
 | 
				
			||||||
                    e.printStackTrace();
 | 
					                    e.printStackTrace();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,5 +10,6 @@
 | 
				
			||||||
    android:textAlignment="textStart"
 | 
					    android:textAlignment="textStart"
 | 
				
			||||||
    android:textColor="@color/cyanea_accent_dark_reference"
 | 
					    android:textColor="@color/cyanea_accent_dark_reference"
 | 
				
			||||||
    app:icon="@drawable/ic_baseline_navigate_next_24"
 | 
					    app:icon="@drawable/ic_baseline_navigate_next_24"
 | 
				
			||||||
 | 
					    app:iconTint="@color/cyanea_accent_dark_reference"
 | 
				
			||||||
    app:iconGravity="end"
 | 
					    app:iconGravity="end"
 | 
				
			||||||
    app:strokeColor="@color/cyanea_accent_dark_reference" />
 | 
					    app:strokeColor="@color/cyanea_accent_dark_reference" />
 | 
				
			||||||
		Loading…
	
		Reference in a new issue