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 521075b..20d1ad8 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 @@ -6,7 +6,9 @@ import org.ntlab.acanthus_client.Acanthus; import org.ntlab.acanthus_client.R; +import org.ntlab.acanthus_client.entities.Work; import org.ntlab.acanthus_client.resources.accounts.InvitedRest; +import org.ntlab.acanthus_client.resources.accounts.WorkRest; import retrofit2.Call; import retrofit2.Callback; @@ -16,10 +18,9 @@ import retrofit2.converter.scalars.ScalarsConverterFactory; //----------------------------------------------------------------- -// +// 招待されているかの問い合わせAPI public class InvitedConnectionModel { - private final String TAG = "InvitedConnectionModel"; private Retrofit retrofit; private Acanthus acanthus; @@ -32,17 +33,15 @@ //----------------------------------------------------------------- // 招待確認 - public void checkInvited(MutableLiveData mText) { + public void checkInvited(MutableLiveData mIsInvitedText) { final InvitedRest invitedRest = retrofit.create(InvitedRest.class); Call call = invitedRest.checkAccountInvited(acanthus.getPreferenceUid(), acanthus.getAid()); call.enqueue(new Callback() { @Override public void onResponse(Call call, Response response) { - if (response.isSuccessful()){ - Log.d(TAG, response.body().toString()); - mText.setValue(response.body().toString()); - } + if (response.isSuccessful()) + mIsInvitedText.setValue(response.body().toString()); } @Override @@ -54,6 +53,26 @@ } //----------------------------------------------------------------- + // 招待承認 + public void acceptInvite() { + final WorkRest workRest = retrofit.create(WorkRest.class); + + // 作品への参加 + Call call = workRest.updateWork(acanthus.getPreferenceUid(), acanthus.getPreferenceToken(), acanthus.getAid()); + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccessful()) ; + } + + @Override + public void onFailure(Call call, Throwable t) { + + } + }); + } + + //----------------------------------------------------------------- //----------------------------------------------------------------- // init private void init(Acanthus acanthus) {