diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Service/SessionStatusAPI.java b/android/app/src/main/java/com/example/doctor_app_flutter/Service/SessionStatusAPI.java deleted file mode 100644 index fbc8d1d3..00000000 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Service/SessionStatusAPI.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.doctor_app_flutter.Service; - -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; - - -import retrofit2.Call; -import retrofit2.http.Body; -import retrofit2.http.POST; - -public interface SessionStatusAPI { - - @POST("LiveCareApi/DoctorApp/GetSessionStatus") - Call getSessionStatusModelData(@Body GetSessionStatusModel getSessionStatusModel); -} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallContract.java b/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallContract.java deleted file mode 100644 index 21122239..00000000 --- a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallContract.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.example.doctor_app_flutter.ui; - -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; - -public interface VideoCallContract { - - interface VideoCallView{ - - void onCallSuccessful(SessionStatusModel sessionStatusModel); - void onFailure(); - } - - interface VideoCallPresenter { - - void callClintConnected(GetSessionStatusModel statusModel); - } -} diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt b/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt index aed21dd3..612118c9 100644 --- a/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt @@ -3,9 +3,9 @@ package com.hmg.hmgDr import android.app.Activity import android.content.Intent import androidx.annotation.NonNull -import com.example.doctor_app_flutter.Model.GetSessionStatusModel -import com.example.doctor_app_flutter.Model.SessionStatusModel -import com.example.doctor_app_flutter.ui.VideoCallActivity +import com.hmg.hmgDr.Model.GetSessionStatusModel +import com.hmg.hmgDr.Model.SessionStatusModel +import com.hmg.hmgDr.ui.VideoCallActivity import com.google.gson.GsonBuilder import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.engine.FlutterEngine diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/Model/ChangeCallStatusRequestModel.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/ChangeCallStatusRequestModel.java new file mode 100644 index 00000000..5fcdb611 --- /dev/null +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/ChangeCallStatusRequestModel.java @@ -0,0 +1,137 @@ +package com.hmg.hmgDr.Model; + + +import android.os.Parcel; +import android.os.Parcelable; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + + +public class ChangeCallStatusRequestModel implements Parcelable { + + @SerializedName("CallStatus") + @Expose + private Integer callStatus; + @SerializedName("DoctorId") + @Expose + private Integer doctorId; + @SerializedName("generalid") + @Expose + private String generalid; + @SerializedName("TokenID") + @Expose + private String tokenID; + @SerializedName("VC_ID") + @Expose + private Integer vcId; + + public ChangeCallStatusRequestModel(Integer callStatus, Integer doctorId, String generalid, String tokenID, Integer vcId) { + this.callStatus = callStatus; + this.doctorId = doctorId; + this.generalid = generalid; + this.tokenID = tokenID; + this.vcId = vcId; + } + + protected ChangeCallStatusRequestModel(Parcel in) { + if (in.readByte() == 0) { + callStatus = null; + } else { + callStatus = in.readInt(); + } + if (in.readByte() == 0) { + doctorId = null; + } else { + doctorId = in.readInt(); + } + generalid = in.readString(); + tokenID = in.readString(); + if (in.readByte() == 0) { + vcId = null; + } else { + vcId = in.readInt(); + } + } + + public static final Creator CREATOR = new Creator() { + @Override + public ChangeCallStatusRequestModel createFromParcel(Parcel in) { + return new ChangeCallStatusRequestModel(in); + } + + @Override + public ChangeCallStatusRequestModel[] newArray(int size) { + return new ChangeCallStatusRequestModel[size]; + } + }; + + public Integer getCallStatus() { + return callStatus; + } + + public void setCallStatus(Integer callStatus) { + this.callStatus = callStatus; + } + + public Integer getDoctorId() { + return doctorId; + } + + public void setDoctorId(Integer doctorId) { + this.doctorId = doctorId; + } + + public String getGeneralid() { + return generalid; + } + + public void setGeneralid(String generalid) { + this.generalid = generalid; + } + + public String getTokenID() { + return tokenID; + } + + public void setTokenID(String tokenID) { + this.tokenID = tokenID; + } + + public Integer getVcId() { + return vcId; + } + + public void setVcId(Integer vcId) { + this.vcId = vcId; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + if (callStatus == null) { + dest.writeByte((byte) 0); + } else { + dest.writeByte((byte) 1); + dest.writeInt(callStatus); + } + if (doctorId == null) { + dest.writeByte((byte) 0); + } else { + dest.writeByte((byte) 1); + dest.writeInt(doctorId); + } + dest.writeString(generalid); + dest.writeString(tokenID); + if (vcId == null) { + dest.writeByte((byte) 0); + } else { + dest.writeByte((byte) 1); + dest.writeInt(vcId); + } + } +} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Model/GetSessionStatusModel.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java similarity index 98% rename from android/app/src/main/java/com/example/doctor_app_flutter/Model/GetSessionStatusModel.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java index 8f83b7b9..d41aa146 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Model/GetSessionStatusModel.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.Model; +package com.hmg.hmgDr.Model; import android.os.Parcel; import android.os.Parcelable; diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Model/SessionStatusModel.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/SessionStatusModel.java similarity index 98% rename from android/app/src/main/java/com/example/doctor_app_flutter/Model/SessionStatusModel.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/Model/SessionStatusModel.java index da6bba1d..51b0b1ee 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Model/SessionStatusModel.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/SessionStatusModel.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.Model; +package com.hmg.hmgDr.Model; import android.os.Parcel; import android.os.Parcelable; diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/Service/AppRetrofit.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/AppRetrofit.java similarity index 97% rename from android/app/src/main/java/com/example/doctor_app_flutter/Service/AppRetrofit.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/Service/AppRetrofit.java index 6646bd6f..9ca9abc1 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/Service/AppRetrofit.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/AppRetrofit.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.Service; +package com.hmg.hmgDr.Service; import android.app.Activity; import android.app.Application; diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/Service/SessionStatusAPI.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/SessionStatusAPI.java new file mode 100644 index 00000000..e507650e --- /dev/null +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Service/SessionStatusAPI.java @@ -0,0 +1,19 @@ +package com.hmg.hmgDr.Service; + +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; + + +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.POST; + +public interface SessionStatusAPI { + + @POST("LiveCareApi/DoctorApp/GetSessionStatus") + Call getSessionStatusModelData(@Body GetSessionStatusModel getSessionStatusModel); + + @POST("LiveCareApi/DoctorApp/ChangeCallStatus") + Call changeCallStatus(@Body ChangeCallStatusRequestModel changeCallStatusRequestModel); +} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallActivity.java b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallActivity.java similarity index 95% rename from android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallActivity.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallActivity.java index 0b6adadb..e196e7f1 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallActivity.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallActivity.java @@ -1,4 +1,4 @@ -package com.example.doctor_app_flutter.ui; +package com.hmg.hmgDr.ui; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; @@ -20,8 +20,9 @@ import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; import com.hmg.hmgDr.R; import com.opentok.android.Session; import com.opentok.android.Stream; @@ -277,6 +278,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi } isConnected = true; subscribeToStream(stream); + videoCallPresenter.callChangeCallStatus(new ChangeCallStatusRequestModel(3,sessionStatusModel.getDoctorId(), sessionStatusModel.getGeneralid(),token,sessionStatusModel.getVCID())); } @Override @@ -369,6 +371,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi if (countDownTimer != null) { countDownTimer.cancel(); } + videoCallPresenter.callChangeCallStatus(new ChangeCallStatusRequestModel(16,sessionStatusModel.getDoctorId(), sessionStatusModel.getGeneralid(),token,sessionStatusModel.getVCID())); finish(); } @@ -423,6 +426,11 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi } } + @Override + public void onCallChangeCallStatusSuccessful(SessionStatusModel sessionStatusModel) { + + } + @Override public void onFailure() { diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java new file mode 100644 index 00000000..2b099551 --- /dev/null +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java @@ -0,0 +1,24 @@ +package com.hmg.hmgDr.ui; + +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; + +public interface VideoCallContract { + + interface VideoCallView { + + void onCallSuccessful(SessionStatusModel sessionStatusModel); + + void onCallChangeCallStatusSuccessful(SessionStatusModel sessionStatusModel); + + void onFailure(); + } + + interface VideoCallPresenter { + + void callClintConnected(GetSessionStatusModel statusModel); + + void callChangeCallStatus(ChangeCallStatusRequestModel statusModel); + } +} diff --git a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallPresenterImpl.java b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java similarity index 56% rename from android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallPresenterImpl.java rename to android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java index 363d1ca8..ea2128ba 100644 --- a/android/app/src/main/java/com/example/doctor_app_flutter/ui/VideoCallPresenterImpl.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java @@ -1,9 +1,10 @@ -package com.example.doctor_app_flutter.ui; +package com.hmg.hmgDr.ui; -import com.example.doctor_app_flutter.Model.GetSessionStatusModel; -import com.example.doctor_app_flutter.Model.SessionStatusModel; -import com.example.doctor_app_flutter.Service.AppRetrofit; -import com.example.doctor_app_flutter.Service.SessionStatusAPI; +import com.hmg.hmgDr.Model.ChangeCallStatusRequestModel; +import com.hmg.hmgDr.Model.GetSessionStatusModel; +import com.hmg.hmgDr.Model.SessionStatusModel; +import com.hmg.hmgDr.Service.AppRetrofit; +import com.hmg.hmgDr.Service.SessionStatusAPI; import org.jetbrains.annotations.NotNull; @@ -46,4 +47,25 @@ public class VideoCallPresenterImpl implements VideoCallContract.VideoCallPresen }); } + + @Override + public void callChangeCallStatus(ChangeCallStatusRequestModel statusModel) { + sessionStatusAPI = AppRetrofit.getRetrofit(baseUrl).create(SessionStatusAPI.class); + + Call call = sessionStatusAPI.changeCallStatus(statusModel); + + call.enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) { + if (!response.isSuccessful()) + view.onFailure(); + + } + + @Override + public void onFailure(@NotNull Call call, @NotNull Throwable t) { + view.onFailure(); + } + }); + } }