Bug fixes - chat sender and receiver id to be principal ids
This commit is contained in:
8
.idea/deploymentTargetDropDown.xml
generated
8
.idea/deploymentTargetDropDown.xml
generated
@@ -1,9 +1,9 @@
|
||||
<?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" />
|
||||
@@ -11,8 +11,8 @@
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2024-01-16T07:20:16.259959Z" />
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2024-01-17T10:14:36.242892Z" />
|
||||
<targetsSelectedWithDialog>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
|
||||
@@ -478,7 +478,7 @@ public abstract class AppUtil {
|
||||
|
||||
// geofence details clear
|
||||
updatePatientGeofence(context, null, null, null, null, null);
|
||||
updatePatientGeofenceChatsCred(context, -1, -1, -1);
|
||||
updatePatientGeofenceChatsCred(context, -1, -1, -1, -1);
|
||||
|
||||
// removing geofence of same tag
|
||||
removeGeofence(context);
|
||||
@@ -708,6 +708,7 @@ public abstract class AppUtil {
|
||||
private static final String PATIENT_GEOFENCE_CG_ID = "pg_cg_uid";
|
||||
private static final String PATIENT_GEOFENCE_CHANNEL_ID = "pg_channel_uid";
|
||||
private static final String PATIENT_GEOFENCE_PATIENT_PRINCIPLE_ID = "pg_patient_geofence_uid";
|
||||
private static final String PATIENT_GEOFENCE_CAREGIVER_PRINCIPLE_ID = "pg_caregiver_geofence_uid";
|
||||
|
||||
public static final String IS_SENIOR_OUT_OF_GEOFENCE = "is_senior_out_of_geofence";
|
||||
|
||||
@@ -727,13 +728,16 @@ public abstract class AppUtil {
|
||||
|
||||
public static void updatePatientGeofenceChatsCred(Context context,
|
||||
int cg_id,
|
||||
int channel_id, int patient_principal_id){
|
||||
int channel_id,
|
||||
int patient_principal_id,
|
||||
int cg_principal_id){
|
||||
SharedPreferences sp = context.getSharedPreferences(PATIENT_DETAILS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
|
||||
editor.putInt(PATIENT_GEOFENCE_CG_ID, cg_id);
|
||||
editor.putInt(PATIENT_GEOFENCE_CHANNEL_ID, channel_id);
|
||||
editor.putInt(PATIENT_GEOFENCE_PATIENT_PRINCIPLE_ID, patient_principal_id);
|
||||
editor.putInt(PATIENT_GEOFENCE_CAREGIVER_PRINCIPLE_ID, cg_principal_id);
|
||||
|
||||
editor.apply();
|
||||
}
|
||||
@@ -744,13 +748,15 @@ public abstract class AppUtil {
|
||||
// 1 -> caregiver_id
|
||||
// 2 -> channel_id
|
||||
// 3 -> patient_principal_id
|
||||
// 4 -> cg_principal_id
|
||||
@NonNull
|
||||
public static int[] getPatientGeofenceChatCred(Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(PATIENT_DETAILS, Context.MODE_PRIVATE);
|
||||
return new int[]{sp.getInt(PATIENT_UID, -1),
|
||||
sp.getInt(PATIENT_GEOFENCE_CG_ID, -1),
|
||||
sp.getInt(PATIENT_GEOFENCE_CHANNEL_ID, -1),
|
||||
sp.getInt(PATIENT_GEOFENCE_PATIENT_PRINCIPLE_ID, -1)};
|
||||
sp.getInt(PATIENT_GEOFENCE_PATIENT_PRINCIPLE_ID, -1),
|
||||
sp.getInt(PATIENT_GEOFENCE_CAREGIVER_PRINCIPLE_ID, -1)};
|
||||
}
|
||||
|
||||
public static void updatePatientGeofence(Context context,
|
||||
|
||||
@@ -61,10 +61,10 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
CaregiverDataCache.getCaregiverData(this, (careGiverData) -> {
|
||||
this.careGiverData = careGiverData;
|
||||
|
||||
if (careGiverData != null){
|
||||
if (careGiverData != null && careGiverData.patientDetails != null){
|
||||
SocketHelper.getInstance().establishConnection(null);
|
||||
|
||||
String uniqueKey = careGiverData.patientId + "medActivity" + careGiverData.caregiver_xid;
|
||||
String uniqueKey = careGiverData.patientDetails.id + "medActivity" + careGiverData.id;
|
||||
SocketHelper.getInstance().initializeSocket(this, uniqueKey);
|
||||
}
|
||||
|
||||
@@ -327,8 +327,8 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
}
|
||||
|
||||
replaceFragment(new ChatFragment(
|
||||
careGiverData1.caregiver_xid + "",
|
||||
careGiverData1.patientId + "",
|
||||
careGiverData1.id + "",
|
||||
careGiverData1.patientDetails.id + "",
|
||||
careGiverData1.link_id,
|
||||
careGiverData1.patientDetails.id + "",
|
||||
careGiverData1.first_name,
|
||||
|
||||
@@ -42,8 +42,8 @@ public class ChatsActivity extends AppCompatActivity implements INotificationLif
|
||||
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add(R.id.chats_fcv, new ChatFragment(
|
||||
careGiverData1.caregiver_xid + "",
|
||||
careGiverData1.patientId + "",
|
||||
careGiverData1.id + "",
|
||||
careGiverData1.patientDetails.id + "",
|
||||
careGiverData1.link_id,
|
||||
careGiverData1.patientDetails.id + "",
|
||||
careGiverData1.first_name,
|
||||
|
||||
@@ -305,14 +305,14 @@ public class LocationService extends Service implements LocationClient.DefaultLo
|
||||
}
|
||||
|
||||
int[] chatsCred = AppUtil.getPatientGeofenceChatCred(context);
|
||||
if (chatsCred[0] == -1 || chatsCred[1] == -1 || chatsCred[2] == -1) {
|
||||
if (chatsCred[3] == -1 || chatsCred[4] == -1 || chatsCred[2] == -1) {
|
||||
Log.d(GEOFENCE_TAG, "notifyPatient: CANNOT SEND MESSAGE AS EITHER PAT_ID, CG_ID OR CHANNEL_ID IS NOT AVAILABLE");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d(GEOFENCE_TAG, "notifyPatient: " + chatsCred[2]);
|
||||
// sending message
|
||||
sendMessage(message, chatsCred[0], chatsCred[1], chatsCred[2], chatsCred[3]);
|
||||
sendMessage(message, chatsCred[3], chatsCred[4], chatsCred[2], chatsCred[3]);
|
||||
}
|
||||
|
||||
private void sendMessage(@NonNull String message, int patientId, int cg_id, int channel_id, int patient_principal_id) {
|
||||
|
||||
@@ -97,7 +97,7 @@ public class DashBoardActivity extends AppCompatActivity implements CgHomeContra
|
||||
PatientDataCache.getPatientData(this, patientData -> {
|
||||
if (patientData == null) return;
|
||||
|
||||
String uniqueKey = patientData.caregiverId + "medActivity" + patientData.patientId;
|
||||
String uniqueKey = patientData.caregiver_iamprincipal_id + "medActivity" + patientData.id;
|
||||
initSocket(uniqueKey);
|
||||
}, false);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,8 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
|
||||
requireContext(),
|
||||
cg_id,
|
||||
channel_id,
|
||||
patientData.id
|
||||
patientData.id,
|
||||
patientData.caregiver_iamprincipal_id == null?-1:Integer.parseInt(patientData.caregiver_iamprincipal_id)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -319,8 +320,8 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
|
||||
|
||||
getParentFragmentManager().beginTransaction()
|
||||
.replace(R.id.fragmentContainerView, new ChatFragment(
|
||||
patientData1.patientId + "",
|
||||
patientData1.caregiverId,
|
||||
patientData1.id + "",
|
||||
patientData1.caregiver_iamprincipal_id,
|
||||
patientData1.link_id,
|
||||
patientData1.caregiver_iamprincipal_id,
|
||||
patientData1.first_name,
|
||||
|
||||
@@ -131,14 +131,14 @@ public class GeoFenceBroadcastReceiver extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
int[] chatsCred = AppUtil.getPatientGeofenceChatCred(context);
|
||||
if (chatsCred[0] == -1 || chatsCred[1] == -1 || chatsCred[2] == -1) {
|
||||
if (chatsCred[3] == -1 || chatsCred[4] == -1 || chatsCred[2] == -1) {
|
||||
Log.d(GEOFENCE_TAG, "notifyPatient: CANNOT SEND MESSAGE AS EITHER PAT_ID, CG_ID OR CHANNEL_ID IS NOT AVAILABLE");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d(GEOFENCE_TAG, "notifyPatient: " + chatsCred[2]);
|
||||
// sending message
|
||||
sendMessage(message, chatsCred[0], chatsCred[1], chatsCred[2], chatsCred[3]);
|
||||
sendMessage(message, chatsCred[3], chatsCred[4], chatsCred[2], chatsCred[3]);
|
||||
}
|
||||
|
||||
private void sendMessage(@NonNull String message, int patientId, int cg_id, int channel_id, int patient_principal_id) {
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ReminderViewModel extends ViewModel {
|
||||
return;
|
||||
}
|
||||
|
||||
String uniqueId = patientData.patientId + "medActivity" + patientData.caregiverId;
|
||||
String uniqueId = patientData.id + "medActivity" + patientData.caregiver_iamprincipal_id;
|
||||
SocketHelper.getInstance().establishConnection(new SocketHelper.SockCallBack() {
|
||||
@Override
|
||||
public void onSocketConnected() {
|
||||
@@ -133,11 +133,11 @@ public class ReminderViewModel extends ViewModel {
|
||||
}else{
|
||||
// caregiver logged in
|
||||
CaregiverDataCache.getCaregiverData(context, careGiverData -> {
|
||||
if (careGiverData == null){
|
||||
if (careGiverData == null || careGiverData.patientDetails == null){
|
||||
return;
|
||||
}
|
||||
|
||||
String uniqueId = careGiverData.caregiver_xid + "medActivity" + careGiverData.patientId;
|
||||
String uniqueId = careGiverData.id + "medActivity" + careGiverData.patientDetails.id;
|
||||
SocketHelper.getInstance().establishConnection(new SocketHelper.SockCallBack() {
|
||||
@Override
|
||||
public void onSocketConnected() {
|
||||
|
||||
@@ -109,7 +109,7 @@ public class RoutineViewModel extends ViewModel {
|
||||
return;
|
||||
}
|
||||
|
||||
String uniqueId = patientData.patientId + "medActivity" + patientData.caregiverId;
|
||||
String uniqueId = patientData.id + "medActivity" + patientData.caregiver_iamprincipal_id;
|
||||
SocketHelper.getInstance().establishConnection(new SocketHelper.SockCallBack() {
|
||||
@Override
|
||||
public void onSocketConnected() {
|
||||
@@ -131,11 +131,11 @@ public class RoutineViewModel extends ViewModel {
|
||||
}else{
|
||||
// caregiver logged in
|
||||
CaregiverDataCache.getCaregiverData(context, careGiverData -> {
|
||||
if (careGiverData == null){
|
||||
if (careGiverData == null || careGiverData.patientDetails == null){
|
||||
return;
|
||||
}
|
||||
|
||||
String uniqueId = careGiverData.caregiver_xid + "medActivity" + careGiverData.patientId;
|
||||
String uniqueId = careGiverData.id + "medActivity" + careGiverData.patientDetails.id;
|
||||
SocketHelper.getInstance().establishConnection(new SocketHelper.SockCallBack() {
|
||||
@Override
|
||||
public void onSocketConnected() {
|
||||
|
||||
Reference in New Issue
Block a user