diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/mypage/InvitedConnectionModel.java b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/mypage/InvitedConnectionModel.java index a3832fb..521075b 100644 --- a/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/mypage/InvitedConnectionModel.java +++ b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/mypage/InvitedConnectionModel.java @@ -1,5 +1,9 @@ package org.ntlab.acanthus_client.views.main_menu_ui.mypage; +import android.util.Log; + +import androidx.lifecycle.MutableLiveData; + import org.ntlab.acanthus_client.Acanthus; import org.ntlab.acanthus_client.R; import org.ntlab.acanthus_client.resources.accounts.InvitedRest; @@ -15,8 +19,7 @@ // public class InvitedConnectionModel { - private String successMessage; - + private final String TAG = "InvitedConnectionModel"; private Retrofit retrofit; private Acanthus acanthus; @@ -28,37 +31,18 @@ } //----------------------------------------------------------------- - // getter - public String getSuccessMessage() { - return successMessage; - } - - //----------------------------------------------------------------- - //----------------------------------------------------------------- - // - public void init(Acanthus acanthus) { - this.acanthus = acanthus; - this.retrofit = new Retrofit.Builder() - .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/acanthus/") - .addConverterFactory(ScalarsConverterFactory.create()) - .addConverterFactory(JacksonConverterFactory.create()) - .build(); - } - - //----------------------------------------------------------------- // 招待確認 - public void checkInvited() { + public void checkInvited(MutableLiveData mText) { final InvitedRest invitedRest = retrofit.create(InvitedRest.class); - Integer uid = acanthus.getPreferenceUid(); - Integer aid = acanthus.getAid(); - - Call call = invitedRest.checkAccountInvited(uid, aid); - + Call call = invitedRest.checkAccountInvited(acanthus.getPreferenceUid(), acanthus.getAid()); call.enqueue(new Callback() { @Override public void onResponse(Call call, Response response) { - if (response.isSuccessful()) successMessage = "招待されています"; + if (response.isSuccessful()){ + Log.d(TAG, response.body().toString()); + mText.setValue(response.body().toString()); + } } @Override @@ -68,6 +52,18 @@ }); } + + //----------------------------------------------------------------- + //----------------------------------------------------------------- + // init + private void init(Acanthus acanthus) { + this.acanthus = acanthus; + this.retrofit = new Retrofit.Builder() + .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/acanthus/") + .addConverterFactory(ScalarsConverterFactory.create()) + .addConverterFactory(JacksonConverterFactory.create()) + .build(); + } //----------------------------------------------------------------- }