,
This commit is contained in:
12
.idea/deploymentTargetDropDown.xml
generated
12
.idea/deploymentTargetDropDown.xml
generated
@@ -1,18 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<targetSelectedWithDropDown>
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_7_Pro_API_33.avd" />
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="RZCW41EJRPN" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-11-10T15:13:15.397276Z" />
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-11-13T14:36:53.968997Z" />
|
||||
<targetsSelectedWithDialog>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
|
||||
@@ -11,7 +11,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
||||
public abstract class RetrofitHelper {
|
||||
|
||||
// urls
|
||||
public static final String BASE_URL = "https://simplitend.betadelivery.com/";
|
||||
private static final String BASE_URL = "https://simplitend.betadelivery.com/";
|
||||
|
||||
public static final String CREATE_CONTACT = "api/contact-create";
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import android.provider.MediaStore;
|
||||
import android.provider.Telephony;
|
||||
import android.util.Log;
|
||||
|
||||
import com.app.simplitend.patient_dashboard.chats.SocketHelper;
|
||||
import com.onesignal.Continue;
|
||||
import com.onesignal.OneSignal;
|
||||
import com.onesignal.debug.LogLevel;
|
||||
|
||||
@@ -16,6 +16,7 @@ import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.app.simplitend.patient_dashboard.chats.SocketHelper;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.app.simplitend.R;
|
||||
import com.app.simplitend.apputils.AppUtil;
|
||||
@@ -158,6 +159,7 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
unregisterReceiver(notification_receiver);
|
||||
SocketHelper.getInstance().closeConnection();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
@@ -359,8 +361,10 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
receiver_image = AppUtil.IMAGE_BASE_URL + careGiverData1.patientDetails.profile_photo;
|
||||
}
|
||||
|
||||
replaceFragment(new ChatFragment(careGiverData1.caregiver_xid + "",
|
||||
replaceFragment(new ChatFragment(
|
||||
careGiverData1.caregiver_xid + "",
|
||||
careGiverData1.patientId + "",
|
||||
careGiverData1.link_id,
|
||||
careGiverData1.first_name,
|
||||
careGiverData1.patientDetails.first_name,
|
||||
sender_image,
|
||||
|
||||
@@ -555,7 +555,7 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
// get payment credentials callback
|
||||
@Override
|
||||
public void onPaymentCredFetched(SubscriptionCredentials credentials) {
|
||||
if (credentials == null) {
|
||||
if (credentials == null || credentials.stripe_publish_key == null) {
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(this, "Something went wrong.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.app.simplitend.apputils.AppUtil;
|
||||
import com.app.simplitend.apputils.PatientDataCache;
|
||||
import com.app.simplitend.caregiverdashboard.mvvm.CgHomeContracts;
|
||||
import com.app.simplitend.caregiverdashboard.mvvm.models.GeoFenceDetails;
|
||||
import com.app.simplitend.patient_dashboard.chats.SocketHelper;
|
||||
|
||||
public class DashBoardActivity extends AppCompatActivity implements CgHomeContracts.GetGeoFenceCallback {
|
||||
|
||||
@@ -113,6 +114,12 @@ public class DashBoardActivity extends AppCompatActivity implements CgHomeContra
|
||||
super.attachBaseContext(newBase);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
SocketHelper.getInstance().closeConnection();
|
||||
}
|
||||
|
||||
private void setGeofenceAndLocationUpdates() {
|
||||
// retrieving geofence
|
||||
viewModel.getGeoFenceDetails(AppUtil.getPatientUid(this) + "",
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.app.simplitend.patient_dashboard.chats;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -11,17 +12,24 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.app.simplitend.R;
|
||||
import com.app.simplitend.apputils.AppUtil;
|
||||
import com.app.simplitend.databinding.ChatFragmentBinding;
|
||||
import com.app.simplitend.patient_dashboard.chats.mvvm.Author;
|
||||
import com.app.simplitend.patient_dashboard.chats.mvvm.ChatViewModel;
|
||||
import com.app.simplitend.patient_dashboard.chats.mvvm.Message;
|
||||
import com.app.simplitend.patient_dashboard.chats.mvvm.Receiver;
|
||||
import com.app.simplitend.patient_dashboard.chats.mvvm.RemoteMessage;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.stfalcon.chatkit.messages.MessagesListAdapter;
|
||||
import com.stfalcon.chatkit.utils.DateFormatter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
public class ChatFragment extends Fragment implements SocketHelper.Callback<Message> {
|
||||
public class ChatFragment extends Fragment implements SocketHelper.Callback<Message>, ChatViewModel.ChatsCallBack {
|
||||
|
||||
private static final String TAG = "SOCKET_CHAT_TAG";
|
||||
|
||||
@@ -36,14 +44,21 @@ public class ChatFragment extends Fragment implements SocketHelper.Callback<Mess
|
||||
|
||||
private final String author_image, receiver_image;
|
||||
|
||||
private final String sender_id, receiver_id;
|
||||
private final String sender_id, receiver_id, channel_id;
|
||||
|
||||
public static final String SEND = "Send";
|
||||
|
||||
private ChatViewModel chatViewModel;
|
||||
|
||||
private boolean isLastPageLoaded;
|
||||
|
||||
private int current_page_no;
|
||||
|
||||
public ChatFragment(){
|
||||
// required
|
||||
this.sender_id = null;
|
||||
this.receiver_id = null;
|
||||
this.channel_id = null;
|
||||
this.nick_name = "NONE";
|
||||
this.receiver_name = "NONE";
|
||||
this.author_image = null;
|
||||
@@ -52,11 +67,14 @@ public class ChatFragment extends Fragment implements SocketHelper.Callback<Mess
|
||||
|
||||
public ChatFragment(String sender_id,
|
||||
String receiver_id,
|
||||
String channel_id,
|
||||
String nick_name,
|
||||
String receiver_name,
|
||||
String sender_image, String receiver_image) {
|
||||
String sender_image,
|
||||
String receiver_image) {
|
||||
this.sender_id = sender_id;
|
||||
this.receiver_id = receiver_id;
|
||||
this.channel_id = channel_id;
|
||||
this.nick_name = nick_name;
|
||||
this.receiver_name = receiver_name;
|
||||
this.author_image = sender_image;
|
||||
@@ -68,13 +86,19 @@ public class ChatFragment extends Fragment implements SocketHelper.Callback<Mess
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = ChatFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
chatViewModel = new ViewModelProvider(requireActivity()).get(ChatViewModel.class);
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
|
||||
current_page_no = 1;
|
||||
isLastPageLoaded = false;
|
||||
getChats();
|
||||
|
||||
enableDenButton(false);
|
||||
|
||||
if (sender_id != null && receiver_id != null){
|
||||
if (sender_id != null && receiver_id != null && channel_id != null){
|
||||
SocketHelper socketHelper = SocketHelper.getInstance();
|
||||
socketHelper.establishConnection(new SocketHelper.SockCallBack() {
|
||||
@Override
|
||||
@@ -97,18 +121,42 @@ public class ChatFragment extends Fragment implements SocketHelper.Callback<Mess
|
||||
|
||||
socketHelper.getMessage(this,
|
||||
sender_id,
|
||||
receiver_id,
|
||||
channel_id,
|
||||
receiver_image,
|
||||
author_image);
|
||||
}else{
|
||||
Toast.makeText(requireContext(), "Something went wrong", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void getChats() {
|
||||
if (channel_id == null){
|
||||
binding.noChats.setVisibility(View.VISIBLE);
|
||||
binding.noChatMsg.setText(R.string.couldn_t_load_chats);
|
||||
return;
|
||||
}
|
||||
|
||||
binding.progressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
String token;
|
||||
if (AppUtil.isPatientLoggedIn(requireContext())){
|
||||
token = AppUtil.getPatientToken(requireContext());
|
||||
}else {
|
||||
token = AppUtil.getCgToken(requireContext());
|
||||
}
|
||||
|
||||
chatViewModel.getRemoteChatList("Bearer " + token,
|
||||
channel_id, current_page_no, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
SocketHelper.getInstance().closeConnection();
|
||||
if (channel_id != null){
|
||||
SocketHelper.getInstance().stopMessages(channel_id);
|
||||
}
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
@@ -123,8 +171,14 @@ public class ChatFragment extends Fragment implements SocketHelper.Callback<Mess
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender_id == null || receiver_id == null || channel_id == null){
|
||||
Toast.makeText(requireContext(), "Something went wrong", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (SocketHelper.getInstance().isConnected()) {
|
||||
SocketHelper.getInstance().sendMessage(binding.messageEt.getText().toString().trim(), nick_name, receiver_id);
|
||||
SocketHelper.getInstance().sendMessage(binding.messageEt.getText().toString().trim(),
|
||||
sender_id, receiver_id, channel_id);
|
||||
binding.messageEt.setText("");
|
||||
enableDenButton(false);
|
||||
} else {
|
||||
@@ -189,6 +243,13 @@ public class ChatFragment extends Fragment implements SocketHelper.Callback<Mess
|
||||
});
|
||||
|
||||
binding.messageList.setAdapter(messageAdapter);
|
||||
|
||||
messageAdapter.setLoadMoreListener((page, totalItemsCount) -> {
|
||||
if (!isLastPageLoaded){
|
||||
current_page_no++;
|
||||
getChats();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void enableDenButton(boolean enable){
|
||||
@@ -231,4 +292,51 @@ public class ChatFragment extends Fragment implements SocketHelper.Callback<Mess
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChatsFetched(ArrayList<RemoteMessage> chatsList, int page_no) {
|
||||
// 2023-11-13 14:43:43 dateTime format
|
||||
Log.d(TAG, "onChatsFetched: ");
|
||||
if (chatsList.size() < ChatViewModel.MESSAGES_PER_PAGE){
|
||||
this.isLastPageLoaded = true;
|
||||
}
|
||||
|
||||
if (sender_id == null){
|
||||
return;
|
||||
}
|
||||
|
||||
if (page_no == 1 && chatsList.isEmpty()){
|
||||
binding.noChats.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
binding.noChats.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
ArrayList<Message> messages = new ArrayList<>();
|
||||
|
||||
for (RemoteMessage remoteMessage: chatsList){
|
||||
Message message;
|
||||
if (sender_id.equals(remoteMessage.senderID)){
|
||||
// Author message
|
||||
message = new Message(new Author(sender_id, author_image), remoteMessage.message, remoteMessage.dateTime);
|
||||
}else{
|
||||
// receiver message
|
||||
message = new Message(new Receiver(sender_id, receiver_image), remoteMessage.message, remoteMessage.dateTime);
|
||||
}
|
||||
|
||||
messages.add(message);
|
||||
}
|
||||
|
||||
binding.progressBar.setVisibility(View.GONE);
|
||||
messageAdapter.addToEnd(messages, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChatsFailed(Throwable t, String message) {
|
||||
current_page_no = Math.min(1, current_page_no-1);
|
||||
binding.progressBar.setVisibility(View.GONE);
|
||||
if (messageAdapter.getMessagesCount() == 0){
|
||||
binding.noChats.setVisibility(View.VISIBLE);
|
||||
binding.noChatMsg.setText(R.string.couldn_t_load_chats);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,8 @@ public class SocketHelper {
|
||||
this.socketCallback = sockCallBack;
|
||||
if (!mSocket.connected()) {
|
||||
mSocket.connect();
|
||||
}else if (sockCallBack != null) {
|
||||
socketCallback.onSocketConnected();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,28 +95,28 @@ public class SocketHelper {
|
||||
|
||||
public void getMessage(final Callback<Message> callback,
|
||||
@NonNull String sender_id,
|
||||
@NonNull String receiver_id,
|
||||
@NonNull String channel_id,
|
||||
String receiver_image,
|
||||
String author_image) {
|
||||
mSocket.on(receiver_id, new Emitter.Listener() {
|
||||
mSocket.on(channel_id, new Emitter.Listener() {
|
||||
@Override
|
||||
public void call(Object... args) {
|
||||
try {
|
||||
if (args.length >= 3) {
|
||||
// commiitttt
|
||||
String received_sender_id = (String) args[0];
|
||||
String message_txt = (String) args[1];
|
||||
String date = (String) args[2];
|
||||
Log.d("aditya_testing", "call: " + args);
|
||||
if (args.length >= 4) {
|
||||
String received_sender_id = (String) args[1];
|
||||
String message_txt = (String) args[2];
|
||||
String date = (String) args[3]; // mm/dd/yyyy',' HH:mm:ss a
|
||||
|
||||
Message message;
|
||||
|
||||
if (sender_id.equals(received_sender_id)){
|
||||
// Author message
|
||||
message = new Message(new Author(received_sender_id, author_image), message_txt);
|
||||
message = new Message(new Author(received_sender_id, author_image), message_txt, date);
|
||||
callback.onMessageSentSuccessfully();
|
||||
}else{
|
||||
// receiver message
|
||||
message = new Message(new Receiver(received_sender_id, receiver_image), message_txt);
|
||||
message = new Message(new Receiver(received_sender_id, receiver_image), message_txt, date);
|
||||
}
|
||||
|
||||
callback.onMessageReceived(message);
|
||||
@@ -125,11 +127,15 @@ public class SocketHelper {
|
||||
}
|
||||
});
|
||||
|
||||
Log.d(TAG, "LISTENER FOR ID : " + receiver_id);
|
||||
Log.d(TAG, "LISTENER FOR CHANNEL ID : " + channel_id);
|
||||
}
|
||||
|
||||
public void sendMessage(@NonNull String message, @NonNull String sender_id, @NonNull String receiver_id) {
|
||||
mSocket.emit("chatMessage", sender_id, message, receiver_id);
|
||||
public void stopMessages(@NonNull String channel_id){
|
||||
mSocket.off(channel_id);
|
||||
}
|
||||
|
||||
public void sendMessage(@NonNull String message, @NonNull String sender_id, @NonNull String receiver_id, @NonNull String channel_id) {
|
||||
mSocket.emit("chatMessage", sender_id, message, receiver_id, channel_id);
|
||||
}
|
||||
|
||||
private static final String LOCATION_EVENT_PREFIX = "patientCurrentLocation";
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.app.simplitend.patient_dashboard.chats.mvvm;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class ChatViewModel extends ViewModel {
|
||||
|
||||
public static final int MESSAGES_PER_PAGE = 50;
|
||||
|
||||
private final ChatsApiService apiService;
|
||||
|
||||
public ChatViewModel() {
|
||||
this.apiService = new Retrofit.Builder()
|
||||
.baseUrl("https://simplitendapp.betadelivery.com/")
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.build().create(ChatsApiService.class);
|
||||
}
|
||||
|
||||
public void getRemoteChatList(@NonNull String token,
|
||||
@NonNull String channel_id, int page_no,
|
||||
ChatsCallBack chatsCallBack) {
|
||||
// loading this page from server
|
||||
apiService.getRemoteChatsList(token, channel_id,
|
||||
MESSAGES_PER_PAGE, page_no)
|
||||
.enqueue(new Callback<CallResponse<ArrayList<RemoteMessage>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<ArrayList<RemoteMessage>>> call, Response<CallResponse<ArrayList<RemoteMessage>>> response) {
|
||||
if (response.body() != null){
|
||||
if (response.body().status != 200 || response.body().result == null){
|
||||
chatsCallBack.onChatsFailed(new Exception("Response body is null"), "Something went wrong");
|
||||
return;
|
||||
}
|
||||
|
||||
chatsCallBack.onChatsFetched(response.body().result, page_no);
|
||||
}else{
|
||||
chatsCallBack.onChatsFailed(new Exception("Response body is null"), "Something went wrong");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CallResponse<ArrayList<RemoteMessage>>> call, Throwable t) {
|
||||
chatsCallBack.onChatsFailed(t, t.getLocalizedMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// interfaces
|
||||
public interface ChatsCallBack {
|
||||
void onChatsFetched(ArrayList<RemoteMessage> chatsList, int page_no);
|
||||
|
||||
void onChatsFailed(Throwable t, String message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.app.simplitend.patient_dashboard.chats.mvvm;
|
||||
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface ChatsApiService {
|
||||
@GET("api/get-chats")
|
||||
Call<CallResponse<ArrayList<RemoteMessage>>> getRemoteChatsList(
|
||||
@Header("Authorization") String token,
|
||||
@Query("c_id") String channel_id,
|
||||
@Query("per_page") int per_page,
|
||||
@Query("page") int page_no
|
||||
);
|
||||
}
|
||||
@@ -10,9 +10,12 @@ public class Message implements IMessage {
|
||||
private final IUser author;
|
||||
private final String text;
|
||||
|
||||
public Message(IUser user, String text){
|
||||
private final String date;
|
||||
|
||||
public Message(IUser user, String text, String date){
|
||||
this.author = user;
|
||||
this.text = text;
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.app.simplitend.patient_dashboard.chats.mvvm;
|
||||
|
||||
public class RemoteMessage {
|
||||
public String id;
|
||||
public String chat_room_id;
|
||||
public String senderID;
|
||||
public String receiverID;
|
||||
public String message;
|
||||
public String dateTime;
|
||||
public String created_at;
|
||||
public String updated_at;
|
||||
}
|
||||
@@ -228,8 +228,6 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
|
||||
sender_image = AppUtil.IMAGE_BASE_URL + patientData.profile_photo;
|
||||
}
|
||||
|
||||
patientData.caregiver_profile_photo = null;
|
||||
|
||||
String receiver_image;
|
||||
if (patientData.caregiver_profile_photo == null){
|
||||
receiver_image = String.valueOf(R.drawable.caregiver_img);
|
||||
@@ -241,6 +239,7 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
|
||||
.replace(R.id.fragmentContainerView, new ChatFragment(
|
||||
patientData1.patientId + "",
|
||||
patientData1.caregiverId,
|
||||
patientData1.link_id,
|
||||
patientData1.first_name,
|
||||
patientData.caregiver_name,
|
||||
sender_image,
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.app.simplitend.R;
|
||||
import com.app.simplitend.appblocking.FUAActivity;
|
||||
import com.app.simplitend.appblocking.TopAppDetectionService;
|
||||
import com.app.simplitend.apputils.AppUtil;
|
||||
import com.app.simplitend.apputils.PatientDataCache;
|
||||
import com.app.simplitend.apputils.RetrofitHelper;
|
||||
import com.app.simplitend.databinding.ProfileProgressFragmentBinding;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
@@ -172,6 +173,9 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
|
||||
return;
|
||||
}
|
||||
|
||||
// updating patient data
|
||||
PatientDataCache.setPatientData(response.body().result);
|
||||
|
||||
if (response.body().result.isCareGiverConnectedWithPatient == 1) {
|
||||
if (response.body().result.isCaregiverTakeSubscription == 1){
|
||||
try {
|
||||
|
||||
@@ -20,6 +20,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.vectordrawable.graphics.drawable.Animatable2Compat;
|
||||
|
||||
import com.app.simplitend.apputils.Constants;
|
||||
import com.app.simplitend.apputils.PatientDataCache;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
@@ -101,7 +102,6 @@ public class RegisterCompleteFragment extends Fragment implements ProfileContrac
|
||||
.into(binding.animIv);
|
||||
|
||||
binding.proceed.setOnClickListener(v -> {
|
||||
|
||||
checkConnectionStatus();
|
||||
});
|
||||
|
||||
@@ -112,19 +112,33 @@ public class RegisterCompleteFragment extends Fragment implements ProfileContrac
|
||||
|
||||
if (Constants.NEW_SUBSCRIPTION.equals(content_type)){
|
||||
// new subscription was bought by caregiver
|
||||
gotoPatientDashBoard();
|
||||
// updating patient data cache
|
||||
PatientDataCache.setPatientData(null); // to load new instance of data
|
||||
PatientDataCache.getPatientData(requireContext(), patientData -> {
|
||||
if (patientData == null){
|
||||
Toast.makeText(requireContext(), "Couldn't connect", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
gotoPatientDashBoard();
|
||||
}, true);
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
requireContext().registerReceiver(notification_receiver, new IntentFilter(AppUtil.NOTIFICATION_ACTION));
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
requireContext().registerReceiver(notification_receiver, new IntentFilter(AppUtil.NOTIFICATION_ACTION));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
requireContext().unregisterReceiver(notification_receiver);
|
||||
}
|
||||
|
||||
@@ -151,6 +165,9 @@ public class RegisterCompleteFragment extends Fragment implements ProfileContrac
|
||||
return;
|
||||
}
|
||||
|
||||
// updating patient data cache
|
||||
PatientDataCache.setPatientData(response.body().result);
|
||||
|
||||
onProfileProgressFetched(response.body().result);
|
||||
} else {
|
||||
onProfileProgressFetchFailed(new Exception(), "Please try again later.");
|
||||
|
||||
@@ -39,7 +39,7 @@ public class CareGiverData{
|
||||
public String is_admin;
|
||||
public int patientId;
|
||||
|
||||
public String caregiver_status, one_signal_player_id;
|
||||
public String caregiver_status, one_signal_player_id, link_id;
|
||||
|
||||
public PatientData patientDetails;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class PatientData {
|
||||
|
||||
public String one_signal_player_id;
|
||||
|
||||
public String caregiver_name, caregiver_profile_photo, caregiverId;
|
||||
public String caregiver_name, caregiver_profile_photo, caregiverId, link_id;
|
||||
|
||||
// progress flags
|
||||
public int isCareGiverLink
|
||||
|
||||
@@ -325,7 +325,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/color_primary_dark"
|
||||
android:background="@color/color_primary_dark_2"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:paddingVertical="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
@@ -7,60 +7,80 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white_bg">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_btn"
|
||||
android:layout_width="35sp"
|
||||
android:layout_height="35sp"
|
||||
android:contentDescription="@string/back_button"
|
||||
android:padding="5dp"
|
||||
android:src="@drawable/arrow_back"
|
||||
android:layout_margin="15dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
app:cardElevation="5dp">
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/receiver_image"
|
||||
android:layout_width="@dimen/_30sdp"
|
||||
android:layout_height="@dimen/_30sdp"
|
||||
tools:src="@drawable/static_3"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/chat_title"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
tools:text="Akanksha surve"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
android:textColor="@color/black"
|
||||
<ImageView
|
||||
android:id="@+id/back_btn"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:contentDescription="@string/back_button"
|
||||
android:padding="5dp"
|
||||
android:src="@drawable/arrow_back"/>
|
||||
|
||||
android:layout_marginStart="15dp"
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/receiver_image"
|
||||
android:layout_width="@dimen/_30sdp"
|
||||
android:layout_height="@dimen/_30sdp"
|
||||
tools:src="@drawable/static_3"
|
||||
android:layout_marginStart="5dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
<TextView
|
||||
android:id="@+id/chat_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:maxEms="8"
|
||||
tools:text="Akanksha surve"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
android:textColor="@color/black"
|
||||
|
||||
/>
|
||||
android:layout_marginStart="10dp"
|
||||
|
||||
</LinearLayout>
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
|
||||
android:maxEms="8"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:visibility="gone"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/no_chats"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/message_et"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
@@ -71,6 +91,7 @@
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_chat_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
@@ -87,6 +108,7 @@
|
||||
|
||||
<com.stfalcon.chatkit.messages.MessagesList
|
||||
android:id="@+id/messageList"
|
||||
android:layout_below="@id/progress_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/message_et"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<color name="color_accent">#C9E0FB</color>
|
||||
|
||||
<color name="color_primary_dark">#005F9A</color>
|
||||
<color name="color_primary_dark_2">#043E61</color>
|
||||
|
||||
<color name="cg_dash_bg">#005F9A</color>
|
||||
<color name="pwd_bg">#545454</color>
|
||||
|
||||
@@ -486,5 +486,6 @@
|
||||
<string name="double_next_arrow"><![CDATA[>>]]></string>
|
||||
<string name="enter_new_address_here">Enter new address here</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="couldn_t_load_chats">Couldn\'t load chats</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user