,
This commit is contained in:
17
.idea/deploymentTargetDropDown.xml
generated
17
.idea/deploymentTargetDropDown.xml
generated
@@ -6,13 +6,24 @@
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="RZCW41EJRPN" />
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_7_Pro_API_33.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-12-12T13:12:40.814090Z" />
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_7_Pro_API_33.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-12-13T14:28:39.050950Z" />
|
||||
<targetsSelectedWithDialog>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.app.simplitend.chats.ChatsActivity;
|
||||
import com.app.simplitend.databinding.BottomSheetAlertBinding;
|
||||
import com.app.simplitend.patientprofile.medreminder.mvvm.models.ReminderResult;
|
||||
import com.app.simplitend.patientprofile.setuproutine.mvvm.RoutineDetails;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -372,7 +373,10 @@ public class BottomNotificationActivity extends AppCompatActivity {
|
||||
String title, String description_title,
|
||||
String description, String btn_text,
|
||||
View.OnClickListener btn_clickListener) {
|
||||
binding.image.setImageResource(img_res);
|
||||
// binding.image.setImageResource(img_res);
|
||||
Glide.with(binding.image)
|
||||
.load(img_res)
|
||||
.into(binding.image);
|
||||
binding.title.setText(title);
|
||||
binding.descriptionTitle.setText(description_title);
|
||||
binding.description.setText(description);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class SimpliTendApp extends Application {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
|
||||
NotificationChannel channel = new NotificationChannel(LOCATION_NOTIFICATION_CHANNEL_ID,
|
||||
"Location updates",
|
||||
NotificationManager.IMPORTANCE_LOW);
|
||||
NotificationManager.IMPORTANCE_DEFAULT);
|
||||
|
||||
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
|
||||
@@ -153,7 +153,11 @@ public class CgDashBoardFragment extends Fragment implements
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
requireContext().unregisterReceiver(notification_receiver);
|
||||
try {
|
||||
requireContext().unregisterReceiver(notification_receiver);
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
private void loadActivities() {
|
||||
|
||||
@@ -178,7 +178,11 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
|
||||
this.contactList = contactList1;
|
||||
|
||||
if (contactList != null) {
|
||||
AppUtil.setWhiteListedContacts(requireContext(), contactList);
|
||||
try {
|
||||
AppUtil.setWhiteListedContacts(requireContext(), contactList);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}), false);
|
||||
|
||||
|
||||
@@ -2,18 +2,27 @@ package com.app.simplitend.patientgeofencing;
|
||||
|
||||
import static com.app.simplitend.chats.SocketHelper.kHost;
|
||||
import static com.app.simplitend.locationupdates.LocationService.LOCATION_INTERVAL_BASE_TIME;
|
||||
import static com.app.simplitend.locationupdates.LocationService.LOCATION_NOTIFICATION_CHANNEL_ID;
|
||||
import static com.app.simplitend.locationupdates.LocationService.LOCATION_UPDATE_MIN_INTERVAL;
|
||||
import static com.app.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_TAG;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Notification;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Location;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.app.simplitend.R;
|
||||
import com.app.simplitend.apputils.AppUtil;
|
||||
import com.app.simplitend.apputils.RetrofitHelper;
|
||||
import com.app.simplitend.caregiverdashboard.mvvm.NotificationApiService;
|
||||
@@ -29,6 +38,7 @@ import java.util.Map;
|
||||
|
||||
import io.socket.client.IO;
|
||||
import io.socket.client.Socket;
|
||||
import io.socket.emitter.Emitter;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@@ -78,6 +88,18 @@ public class GeoFenceBroadcastReceiver extends BroadcastReceiver {
|
||||
break;
|
||||
case Geofence.GEOFENCE_TRANSITION_ENTER:
|
||||
Log.d(GEOFENCE_TAG, "onReceive: ENTER");
|
||||
Notification notification = new NotificationCompat.Builder(context, LOCATION_NOTIFICATION_CHANNEL_ID)
|
||||
.setSmallIcon(R.mipmap.ic_launcher_round)
|
||||
.setContentTitle("Geofence entered")
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH).build();
|
||||
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
|
||||
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
|
||||
return;
|
||||
}
|
||||
notificationManager.notify(1023, notification);
|
||||
|
||||
Intent locationServiceIntent = new Intent(context, LocationService.class);
|
||||
locationServiceIntent.setAction(LocationService.ACTION_START_LOCATION_UPDATES);
|
||||
locationServiceIntent.putExtra(LOCATION_UPDATE_MIN_INTERVAL, LOCATION_INTERVAL_BASE_TIME);
|
||||
@@ -89,6 +111,19 @@ public class GeoFenceBroadcastReceiver extends BroadcastReceiver {
|
||||
break;
|
||||
case Geofence.GEOFENCE_TRANSITION_EXIT:
|
||||
Log.d(GEOFENCE_TAG, "onReceive: EXIT");
|
||||
|
||||
Notification notification1 = new NotificationCompat.Builder(context, LOCATION_NOTIFICATION_CHANNEL_ID)
|
||||
.setSmallIcon(R.mipmap.ic_launcher_round)
|
||||
.setContentTitle("Geofence exited")
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH).build();
|
||||
|
||||
NotificationManagerCompat notificationManager1 = NotificationManagerCompat.from(context);
|
||||
|
||||
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
|
||||
return;
|
||||
}
|
||||
notificationManager1.notify(1032, notification1);
|
||||
|
||||
notifyOutOfGeofence(context, String.format(Locale.getDefault(), "%.2f", distance));
|
||||
|
||||
notifyPatient(context);
|
||||
@@ -126,14 +161,34 @@ public class GeoFenceBroadcastReceiver extends BroadcastReceiver {
|
||||
options.reconnection = true;
|
||||
Socket mSocket = IO.socket(kHost, options);
|
||||
|
||||
mSocket.on(channel_id + "", new Emitter.Listener() {
|
||||
@Override
|
||||
public void call(Object... args) {
|
||||
try {
|
||||
if (args.length >= 4) {
|
||||
String received_sender_id = (String) args[1];
|
||||
if (received_sender_id.equals(cg_id+"")){
|
||||
// message was sent successfully
|
||||
Log.d(GEOFENCE_TAG, "GEOFENCE MESSAGE WAS SENT SUCCESSFULLY");
|
||||
|
||||
mSocket.disconnect();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
mSocket.disconnect();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mSocket.on(Socket.EVENT_CONNECT, args -> {
|
||||
Log.d(GEOFENCE_TAG, "Socket connected ");
|
||||
socketHelper.sendMessage(message, cg_id + "", patientId + "", channel_id + "",
|
||||
patient_principal_id < 0 ? null : patient_principal_id + "");
|
||||
mSocket.disconnect();
|
||||
});
|
||||
|
||||
mSocket.on(Socket.EVENT_DISCONNECT, args -> Log.d(GEOFENCE_TAG, "Socket disconnected "));
|
||||
mSocket.on(Socket.EVENT_DISCONNECT, args -> {
|
||||
Log.d(GEOFENCE_TAG, "Socket disconnected ");
|
||||
});
|
||||
|
||||
mSocket.on(Socket.EVENT_CONNECT_ERROR, args -> {
|
||||
Exception e = (Exception) args[0];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="220dp"
|
||||
android:height="180dp"
|
||||
android:width="314dp"
|
||||
android:height="226dp"
|
||||
android:viewportWidth="314"
|
||||
android:viewportHeight="226">
|
||||
<path
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="@dimen/_160sdp"
|
||||
android:layout_height="@dimen/_150sdp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/_180sdp"
|
||||
android:contentDescription="@string/illustration"
|
||||
android:layout_marginVertical="25dp"
|
||||
android:scaleType="fitXY"
|
||||
android:scaleType="fitCenter"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@@ -35,12 +35,13 @@
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
tools:text="Raj Shinde has gone out of the geofence"
|
||||
android:fontFamily="@font/nunito_semibold"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_16ssp"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
|
||||
android:textAlignment="center"
|
||||
|
||||
android:maxLines="3"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
|
||||
/>
|
||||
|
||||
@@ -99,38 +100,40 @@
|
||||
android:weightSum="2"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
<Button
|
||||
android:id="@+id/btn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
tools:text="Call senior"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:textColor="@color/white"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="@dimen/_16ssp"
|
||||
|
||||
android:paddingVertical="10dp"
|
||||
app:cornerRadius="5dp"
|
||||
android:paddingVertical="10dp"
|
||||
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
|
||||
/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
<Button
|
||||
android:id="@+id/close"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
|
||||
android:text="@string/close_"
|
||||
android:fontFamily="@font/nunito_bold"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:textColor="@color/black"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="@dimen/_16ssp"
|
||||
|
||||
android:paddingVertical="10dp"
|
||||
app:cornerRadius="5dp"
|
||||
android:paddingVertical="10dp"
|
||||
|
||||
app:backgroundTint="@color/white"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user