This commit is contained in:
14Sandee
2024-01-22 20:33:28 +05:30
parent 977fffa621
commit 863e106e46
12 changed files with 77 additions and 6 deletions

View File

@@ -12,7 +12,7 @@
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-01-18T07:41:56.824804Z" />
<timeTargetWasSelectedWithDropDown value="2024-01-22T11:26:05.362358Z" />
<targetsSelectedWithDialog>
<Target>
<type value="QUICK_BOOT_TARGET" />

View File

@@ -396,6 +396,8 @@ public abstract class AppUtil {
public static final String SKIPPED_UPDATE_VERSION = "skipped_update_version";
public static final String IS_USER_SUBSCRIBED = "is_user_subscribed";
public static void savePatientData(String token, int patient_uid, Context context, boolean isLoggedIn) {
SharedPreferences sp = context.getSharedPreferences(PATIENT_DETAILS, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
@@ -453,6 +455,20 @@ public abstract class AppUtil {
return sp.getBoolean(IS_BATTERY_LOW_NOTIFICATION_SHOWN, false);
}
public static void setUserSubscribed(Context context, boolean subscribed){
SharedPreferences sp = context.getSharedPreferences(PATIENT_DETAILS, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean(IS_USER_SUBSCRIBED, subscribed);
editor.apply();
}
public static boolean isUserSubscribed(Context context){
SharedPreferences sp = context.getSharedPreferences(PATIENT_DETAILS, Context.MODE_PRIVATE);
return sp.getBoolean(IS_USER_SUBSCRIBED, false);
}
public static void patientSignOut(Context context) {
clearAllNotifications(context);
clearAllChatNotificationsCount(context);
@@ -466,6 +482,8 @@ public abstract class AppUtil {
PatientMainViewModel.remindersList = null;
PatientMainViewModel.activityList = null;
setUserSubscribed(context, false);
// turning off app_blocking accessibility permission
Intent stop_accessibility_intent = new Intent(context, TopAppDetectionService.class);
stop_accessibility_intent.setAction(TopAppDetectionService.STOP_ACCESSIBILITY_SERVICE);

View File

@@ -501,6 +501,9 @@ public class BottomNotificationActivity extends AppCompatActivity {
body = routine.routine_title;
routine_description = start_time + " - " + end_time;
}else{
finish();
break;
}
} catch (Exception e) {
// do nothing
@@ -546,6 +549,9 @@ public class BottomNotificationActivity extends AppCompatActivity {
if (reminder.medication_instruction == null)
reminder.medication_instruction = "None";
description = "Instructions: " + reminder.medication_instruction;
}else {
finish();
break;
}
} catch (Exception e) {
// do nothing

View File

@@ -4,6 +4,7 @@ import static android.content.Context.NOTIFICATION_SERVICE;
import static com.app.simplitend.apputils.AppUtil.NOTIFICATION_ACTION;
import static com.app.simplitend.apputils.Constants.ACTIVITY_TIME;
import static com.app.simplitend.apputils.Constants.BATTERY_LOW;
import static com.app.simplitend.apputils.Constants.MEDICATION_REFILL;
import static com.app.simplitend.apputils.Constants.MEDICINE_TIME;
import static com.app.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_TAG;
@@ -114,6 +115,7 @@ public class NotificationService implements INotificationServiceExtension {
// when patient is logged in
if ( (PatientMainViewModel.remindersList != null && MEDICINE_TIME.equals(content_type)) ||
(PatientMainViewModel.remindersList != null && MEDICATION_REFILL.equals(content_type)) ||
(PatientMainViewModel.activityList != null && ACTIVITY_TIME.equals(content_type)) ||
BATTERY_LOW.equals(content_type)){
iNotificationReceivedEvent.getContext().startActivity(intent);

View File

@@ -125,6 +125,11 @@ public class PatientDataCache {
}
if (callBack != null){
try {
AppUtil.setUserSubscribed(context, response.body().result.isCaregiverTakeSubscription == 1);
} catch (Exception e) {
// do nothing
}
setPatientData(response.body().result);
callBack.patientData(response.body().result);
}

View File

@@ -71,7 +71,7 @@ public class CallService extends CallScreeningService {
Set<String> white_contacts = AppUtil.getWhiteListedContacts(this);
Log.d(CONTACT_WHITE_LISTING_TAG, "WHITE LISTED CONTACTS -> " + white_contacts);
if (white_contacts != null && !white_contacts.contains(phoneNumber)){
if (AppUtil.isUserSubscribed(this) && white_contacts != null && !white_contacts.contains(phoneNumber)){
endCall(builder);
Log.d(CONTACT_WHITE_LISTING_TAG, "CALL ENDED");
}

View File

@@ -302,7 +302,7 @@ public class CgGeoFencingActivity extends AppCompatActivity implements OnMapRead
float distance = homeLocation.distanceTo(cureLocation);
if (distance > 160){
if (distance > 50){
distance = distance/1609; // meters to miles
binding.bsDistanceFromHome.setVisibility(View.VISIBLE);
binding.bsDistanceFromHome.setText(String.format(Locale.getDefault(), "%.2f miles away from home", distance));
@@ -312,8 +312,14 @@ public class CgGeoFencingActivity extends AppCompatActivity implements OnMapRead
try {
List<Address> addresses = geocoder.getFromLocation(cureLocation.getLatitude(), cureLocation.getLongitude(), 1);
if (addresses == null || addresses.isEmpty()) throw new Exception();
String location = addresses.get(0).getThoroughfare();
if (location == null || location.isEmpty()){
location = "Unknown";
}else{
location = "At " + location;
}
binding.bsSeniorCurrentLocationTxt.setText(addresses.get(0).getThoroughfare());
binding.bsSeniorCurrentLocationTxt.setText(location);
} catch (Exception e) {
binding.bsSeniorCurrentLocationTxt.setText("No location data");
}

View File

@@ -176,6 +176,12 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
// updating patient data
PatientDataCache.setPatientData(response.body().result);
try {
AppUtil.setUserSubscribed(requireContext(), response.body().result.isCaregiverTakeSubscription == 1);
} catch (Exception e) {
// do nothing
}
if (response.body().result.isCareGiverConnectedWithPatient == 1) {
if (response.body().result.isCaregiverTakeSubscription == 1){
try {
@@ -292,6 +298,12 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
binding.proceed.setText(btn_text);
try {
AppUtil.setUserSubscribed(requireContext(), patientData.isCaregiverTakeSubscription == 1);
} catch (Exception e) {
// do nothing
}
progressDialog.dismiss();
}

View File

@@ -192,6 +192,12 @@ public class RegisterCompleteFragment extends Fragment implements ProfileContrac
public void onProfileProgressFetched(PatientData patientData) {
progressDialog.dismiss();
try {
AppUtil.setUserSubscribed(requireContext(), patientData.isCaregiverTakeSubscription == 1);
} catch (Exception e) {
// do nothing
}
if (patientData.isCareGiverConnectedWithPatient == 1) {
if (patientData.isCaregiverTakeSubscription == 1){
gotoPatientDashBoard();

View File

@@ -205,6 +205,12 @@ public class SignInFragment extends Fragment implements WelcomeContracts.Registe
Toast.makeText(requireContext(), "Log in successful.", Toast.LENGTH_SHORT).show();
try {
AppUtil.setUserSubscribed(requireContext(), patientResult.isCaregiverTakeSubscription == 1);
} catch (Exception e) {
// do nothing
}
if (patientResult.isCareGiverConnectedWithPatient == 1 && patientResult.isCaregiverTakeSubscription == 1){
// connected to caregiver
// thus, sending it to dashboard

View File

@@ -382,9 +382,19 @@ public class SplashFragment extends Fragment
binding.retry.setVisibility(View.GONE);
binding.loadAnim.setVisibility(View.GONE);
try {
AppUtil.setUserSubscribed(requireContext(), patientData.isCaregiverTakeSubscription == 1);
} catch (Exception e) {
// do nothing
}
if (patientData.isCareGiverConnectedWithPatient == 1 && patientData.isCaregiverTakeSubscription == 1){
// go to dashboard
gotoPatientDashBoard();
try {
gotoPatientDashBoard();
} catch (Exception e) {
// do nothing
}
}else if (patientData.isCareGiverLink == 1){
// user has already added caregiver as a contact
// thus, sending it to dashboard

View File

@@ -260,7 +260,7 @@
<string name="enter_your_basic_details_like_name_number_email_address_pin"><![CDATA[Enter your basic details like Name, Number, Email, Address & Pin]]></string>
<string name="accept_invitation">Accept invitation</string>
<string name="accept_your_loved_one_s_invitation_to_connect">Accept your loved one\'s invitation to connect</string>
<string name="subscribe">Subscribe</string>
<string name="subscribe">Subscribe (+6.625% tax)</string>
<string name="complete_application_subscription">Complete application subscription</string>
<string name="you_are_ready">You are ready!</string>
<string name="your_phone_is_linked_to_your_loved_one">Your phone is linked to your loved one.</string>