diff --git a/app/src/main/java/com/example/citrusclient/viewmodels/SettingsViewModel.java b/app/src/main/java/com/example/citrusclient/viewmodels/SettingsViewModel.java index ed904e0..a696254 100644 --- a/app/src/main/java/com/example/citrusclient/viewmodels/SettingsViewModel.java +++ b/app/src/main/java/com/example/citrusclient/viewmodels/SettingsViewModel.java @@ -1,10 +1,7 @@ package com.example.citrusclient.viewmodels; -import com.example.citrusclient.Citrus; import com.example.citrusclient.rest.AccountsRest; -import java.net.HttpCookie; - import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; import retrofit2.Call; @@ -19,9 +16,9 @@ private final MutableLiveData accountColorLiveData; //通信レスポンスの画面表示用のライブデーター //PW変更時の通信レスポンス結果格納用 - private final MutableLiveData response_changePw_LiveData; + private final MutableLiveData error_changePw_LiveData; //アカウント削除時の通信レスポンス結果格納用 - private final MutableLiveData response_deleteAccount_LiveData; + private final MutableLiveData error_deleteAccount_LiveData; //アカウントID変更はやるのか不明なので一旦保留 @@ -33,12 +30,12 @@ .build(); this.accountsRest = retrofit.create(AccountsRest.class); this.accountColorLiveData = new MutableLiveData<>(); - this.response_changePw_LiveData = new MutableLiveData<>(); - this.response_deleteAccount_LiveData = new MutableLiveData<>(); + this.error_changePw_LiveData = new MutableLiveData<>(); + this.error_deleteAccount_LiveData = new MutableLiveData<>(); } public MutableLiveData getAccountColorLiveData(){return accountColorLiveData;} - public MutableLiveData getResponse_changePw(){return response_changePw_LiveData;} - public MutableLiveDatagetResponse_deleteAccount(){return response_deleteAccount_LiveData;} + public MutableLiveData getResponse_changePw(){return error_changePw_LiveData;} + public MutableLiveDatagetResponse_deleteAccount(){return error_deleteAccount_LiveData;} public void loadAccountColor(String accountId){ Call call= accountsRest.getAccountColor(accountId); @@ -71,19 +68,19 @@ public void onResponse(Call call, Response response) { if (response.isSuccessful()) { System.out.println("success"); - response_changePw_LiveData.setValue(204); + error_changePw_LiveData.setValue(204); //成功処理 } else { System.out.println("fail"); - response_changePw_LiveData.setValue(404); + error_changePw_LiveData.setValue(404); } } @Override public void onFailure(Call call, Throwable t) { System.out.println("NetWorkError"+t); - response_changePw_LiveData.setValue(404); + error_changePw_LiveData.setValue(404); } }); } @@ -97,11 +94,11 @@ if(response.isSuccessful()){ System.out.println("success"); //成功処理 - response_deleteAccount_LiveData.setValue(204); + error_deleteAccount_LiveData.setValue(204); }else{ System.out.println("fail"); //もしコンソール表記をするならこの下に処理を記載 - response_deleteAccount_LiveData.setValue(404); + error_deleteAccount_LiveData.setValue(404); } } @@ -109,7 +106,7 @@ public void onFailure(Call call, Throwable t) { System.out.println("NetWorkError"+t); //もしコンソール表記をするならこの下に処理を記載 - response_deleteAccount_LiveData.setValue(404); + error_deleteAccount_LiveData.setValue(404); } }); } @@ -138,8 +135,8 @@ //通信Ver4 //アカウント名変更 - public void changeAccount(String accountId, String accountColor, String token){ - Call call =accountsRest.changeColor(accountId, accountColor, token); + public void changeAccount(String accountId, String new_account_id, String old_password, String token){ + Call call =accountsRest.changeAccount(accountId, new_account_id, old_password, token); call.enqueue(new Callback() { @Override public void onResponse(Call call, Response response) {