.
This commit is contained in:
@@ -17,6 +17,19 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.SimpliTend"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".caregiverdashboard.PatientProfileShowerActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".caregiverdashboard.CgProfileProgressActivity"
|
||||
android:exported="true">
|
||||
|
||||
|
||||
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".cg_geofencing.CgGeoFencingActivity"
|
||||
android:exported="true"></activity>
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
@@ -28,25 +41,20 @@
|
||||
<activity
|
||||
android:name=".caregiverdashboard.CaregiverDashActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait">
|
||||
|
||||
|
||||
</activity>
|
||||
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".patient_dashboard.DashBoardActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait">
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".welcome.activities.WelcomeActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -57,20 +65,18 @@
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
</activity>
|
||||
|
||||
<activity android:name=".welcome.welcomecg.fragments.CgAuthActivity"
|
||||
<activity
|
||||
android:name=".welcome.welcomecg.fragments.CgAuthActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait">
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
</activity>
|
||||
|
||||
<activity android:name=".cg_subscription.CgSubscriptionActivity"
|
||||
<activity
|
||||
android:name=".cg_subscription.CgSubscriptionActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait">
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="" />
|
||||
|
||||
@@ -25,10 +25,10 @@ public abstract class AppUtil {
|
||||
private static final String TAG = "AppUtil";
|
||||
|
||||
// fields
|
||||
public static final String USER_DETAILS = "user_details";
|
||||
public static final String PATIENT_DETAILS = "user_details";
|
||||
public static final String CAREGIVER_DETAILS = "caregiver_details";
|
||||
|
||||
public static final String USER_TOKEN = "user_token";
|
||||
public static final String PATIENT_TOKEN = "user_token";
|
||||
public static final String CAREGIVER_TOKEN = "caregiver_token";
|
||||
|
||||
public static final String CG_APP_SECURITY = "cg_app_security";
|
||||
@@ -38,6 +38,7 @@ public abstract class AppUtil {
|
||||
public static final int CG_SECURITY_NEEDED = 4;
|
||||
|
||||
public static final String PATIENT_UID = "patient_uid";
|
||||
public static final String IS_PATIENT_LOGGED_IN = "patient_logged_in";
|
||||
|
||||
// util functions
|
||||
|
||||
@@ -132,12 +133,13 @@ public abstract class AppUtil {
|
||||
alertBuilder.create().show(); // Showing alert dialog
|
||||
}
|
||||
|
||||
public static void saveUserCache(String token, int patient_uid, Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(USER_DETAILS, Context.MODE_PRIVATE);
|
||||
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();
|
||||
|
||||
editor.putString(USER_TOKEN, token);
|
||||
editor.putString(PATIENT_TOKEN, token);
|
||||
editor.putInt(PATIENT_UID, patient_uid);
|
||||
editor.putBoolean(IS_PATIENT_LOGGED_IN, isLoggedIn);
|
||||
|
||||
editor.apply();
|
||||
|
||||
@@ -145,17 +147,22 @@ public abstract class AppUtil {
|
||||
|
||||
}
|
||||
|
||||
public static String getUserToken(Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(USER_DETAILS, Context.MODE_PRIVATE);
|
||||
return sp.getString(USER_TOKEN, "");
|
||||
public static String getPatientToken(Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(PATIENT_DETAILS, Context.MODE_PRIVATE);
|
||||
return sp.getString(PATIENT_TOKEN, "");
|
||||
}
|
||||
|
||||
public static int getPatientUid(Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(USER_DETAILS, Context.MODE_PRIVATE);
|
||||
SharedPreferences sp = context.getSharedPreferences(PATIENT_DETAILS, Context.MODE_PRIVATE);
|
||||
return sp.getInt(PATIENT_UID, -1);
|
||||
}
|
||||
|
||||
public static void saveCgData(String token, Context context){
|
||||
public static boolean isPatientLoggedIn(Context context) {
|
||||
SharedPreferences sp = context.getSharedPreferences(PATIENT_DETAILS, Context.MODE_PRIVATE);
|
||||
return sp.getBoolean(IS_PATIENT_LOGGED_IN, false);
|
||||
}
|
||||
|
||||
public static void saveCgData(String token, int patient_id, Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(CAREGIVER_DETAILS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
|
||||
@@ -163,6 +170,10 @@ public abstract class AppUtil {
|
||||
|
||||
editor.apply();
|
||||
|
||||
// now saving patient data
|
||||
// This is important as there are instances where patient data such as patient id and patient_token is required
|
||||
savePatientData(token, patient_id, context, false);
|
||||
|
||||
Log.d(TAG, "saveToken: caregiver token saved successful");
|
||||
|
||||
}
|
||||
@@ -187,8 +198,7 @@ public abstract class AppUtil {
|
||||
}
|
||||
|
||||
public static void cgSignOut(Context context){
|
||||
saveCgData(null, context);
|
||||
saveCgData(null, -1, context);
|
||||
setWantSecurityFlag(context, NOT_ASKED_CG_SECURITY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.ssb.simplitend.apputils;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.ssb.simplitend.welcome.welcomecg.WelcomeApiService;
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public abstract class CaregiverDataCache {
|
||||
|
||||
private static CareGiverData careGiverData;
|
||||
|
||||
public static void setCareGiverData(CareGiverData data){
|
||||
careGiverData = data;
|
||||
}
|
||||
|
||||
public static void getCaregiverData(Context context,
|
||||
@NonNull GetCaregiverDataCallBack callBack){
|
||||
if (careGiverData != null && careGiverData.patientDetails != null){
|
||||
callBack.careGiverData(careGiverData);
|
||||
return;
|
||||
}
|
||||
|
||||
updateCaregiverData(context, callBack);
|
||||
}
|
||||
|
||||
private static void updateCaregiverData(Context context,
|
||||
@Nullable GetCaregiverDataCallBack callBack) {
|
||||
WelcomeApiService apiService = RetrofitHelper.getRetrofit().create(WelcomeApiService.class);
|
||||
|
||||
ProgressDialog progressDialog = new ProgressDialog(context);
|
||||
progressDialog.setTitle("Please wait...");
|
||||
progressDialog.setMessage("while we fetch details for you...");
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
apiService.getCgUserData("Bearer " + AppUtil.getCgToken(context))
|
||||
.enqueue(new Callback<CallResponse<CareGiverData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<CareGiverData>> call, Response<CallResponse<CareGiverData>> response) {
|
||||
progressDialog.dismiss();
|
||||
if (response.body() != null) {
|
||||
if (response.body().status != 200 || response.body().result == null) {
|
||||
if (callBack != null) callBack.careGiverData(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (callBack != null){
|
||||
setCareGiverData(response.body().result);
|
||||
callBack.careGiverData(response.body().result);
|
||||
}
|
||||
} else {
|
||||
if (callBack != null) callBack.careGiverData(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CallResponse<CareGiverData>> call, Throwable t) {
|
||||
progressDialog.dismiss();
|
||||
if (callBack != null) callBack.careGiverData(null);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
// interfaces
|
||||
@FunctionalInterface
|
||||
public interface GetCaregiverDataCallBack{
|
||||
void careGiverData(CareGiverData careGiverData);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.ssb.simplitend.apputils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
|
||||
public abstract class UserDataCache {
|
||||
|
||||
@Nullable
|
||||
public static PatientData patientData;
|
||||
@Nullable
|
||||
public static CareGiverData careGiverData;
|
||||
|
||||
}
|
||||
@@ -1,20 +1,17 @@
|
||||
package com.ssb.simplitend.caregiverdashboard;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.UserDataCache;
|
||||
import com.ssb.simplitend.apputils.CaregiverDataCache;
|
||||
import com.ssb.simplitend.caregiverdashboard.fragments.CaregiverChatsFragment;
|
||||
import com.ssb.simplitend.caregiverdashboard.fragments.DashBoardFragment;
|
||||
import com.ssb.simplitend.caregiverdashboard.fragments.MyPatientFragment;
|
||||
@@ -24,6 +21,7 @@ import com.ssb.simplitend.customsviews.HomeBottomNav;
|
||||
import com.ssb.simplitend.customsviews.MenuItem;
|
||||
import com.ssb.simplitend.databinding.CaregiverDashboardActivityBinding;
|
||||
import com.ssb.simplitend.databinding.CaregiverDashboardMenuBinding;
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
import com.yarolegovich.slidingrootnav.SlidingRootNavBuilder;
|
||||
import com.yarolegovich.slidingrootnav.callback.DragStateListener;
|
||||
|
||||
@@ -37,24 +35,19 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
|
||||
protected CaregiverMainViewModel viewModel;
|
||||
|
||||
private CareGiverData careGiverData;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = CaregiverDashboardActivityBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
if (UserDataCache.careGiverData != null){
|
||||
if (UserDataCache.careGiverData.isCaregiverTakeSubscription != 1){
|
||||
// user has not subscribed yet
|
||||
Intent intent = new Intent(this, CgSubscriptionActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
return;
|
||||
}else{
|
||||
Toast.makeText(this, "Subscription on.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
CaregiverDataCache.getCaregiverData(this, (careGiverData) -> {
|
||||
this.careGiverData = careGiverData;
|
||||
|
||||
watchSubscription();
|
||||
});
|
||||
|
||||
initViews();
|
||||
|
||||
@@ -105,6 +98,20 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
});
|
||||
}
|
||||
|
||||
private void watchSubscription(){
|
||||
if (careGiverData != null){
|
||||
if (careGiverData.isCaregiverTakeSubscription != 1){
|
||||
// user has not subscribed yet
|
||||
Intent intent = new Intent(this, CgSubscriptionActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(this, "Subscription on.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceFragment(Fragment fragment){
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.fcv_cg_home, fragment)
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.ssb.simplitend.caregiverdashboard;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.ssb.simplitend.apputils.CaregiverDataCache;
|
||||
import com.ssb.simplitend.databinding.ActivityCgProfileProgressBinding;
|
||||
import com.ssb.simplitend.welcome.welcomecg.fragments.CgAuthActivity;
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
|
||||
import static com.ssb.simplitend.caregiverdashboard.PatientProfileShowerActivity.*;
|
||||
|
||||
public class CgProfileProgressActivity extends AppCompatActivity {
|
||||
|
||||
// view binding
|
||||
protected ActivityCgProfileProgressBinding binding;
|
||||
|
||||
private CareGiverData careGiverData;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityCgProfileProgressBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
CaregiverDataCache.getCaregiverData(this, (careGiverData1 -> {
|
||||
this.careGiverData = careGiverData1;
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
}));
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
binding.skipToDash.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(this, CaregiverDashActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
});
|
||||
|
||||
binding.medicReminder.setOnClickListener(v -> {
|
||||
gotoProfileShower(MED_REMINDER_F);
|
||||
});
|
||||
|
||||
binding.addContact.setOnClickListener(v -> {
|
||||
gotoProfileShower(CONTACTS_F);
|
||||
});
|
||||
|
||||
binding.medicInfo.setOnClickListener(v -> {
|
||||
gotoProfileShower(MED_INFO_F);
|
||||
});
|
||||
|
||||
binding.setUpRoutine.setOnClickListener(v -> {
|
||||
gotoProfileShower(ACTIVITY_F);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
if (careGiverData == null || careGiverData.patientDetails == null){
|
||||
Toast.makeText(this, "Something went wrong.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
binding.title.setText(careGiverData.patientDetails.first_name);
|
||||
}
|
||||
|
||||
private void gotoProfileShower(String which_f) {
|
||||
Intent intent = new Intent(this, PatientProfileShowerActivity.class);
|
||||
intent.putExtra(WHICH_FRAGMENT, which_f);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.ssb.simplitend.caregiverdashboard;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.ActivityPatientProfileShowerBinding;
|
||||
import com.ssb.simplitend.patientprofile.medicalinfo.MedicalInfoFragment;
|
||||
import com.ssb.simplitend.patientprofile.medreminder.ReminderFragment;
|
||||
import com.ssb.simplitend.patientprofile.setuproutine.RoutineFragment;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.fragments.contacts.AddContactFragment;
|
||||
|
||||
public class PatientProfileShowerActivity extends AppCompatActivity {
|
||||
|
||||
// view binding
|
||||
protected ActivityPatientProfileShowerBinding binding;
|
||||
|
||||
public static final String PERSONAL_INFO = "personal_info_f";
|
||||
public static final String CONTACTS_F = "contacts_f";
|
||||
public static final String MED_REMINDER_F = "med_reminder_f";
|
||||
public static final String MED_INFO_F = "med_info_f";
|
||||
public static final String ACTIVITY_F = "activity_f";
|
||||
|
||||
public static final String WHICH_FRAGMENT = "which_f";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityPatientProfileShowerBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
String which_f = getIntent().getStringExtra(WHICH_FRAGMENT);
|
||||
if (which_f == null){
|
||||
// which_f is necessary
|
||||
Toast.makeText(this, "Couldn't load.", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
Fragment fragment = getFragment(which_f);
|
||||
|
||||
if (fragment == null){
|
||||
Toast.makeText(this, "Couldn't load.", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
addFragment(fragment);
|
||||
|
||||
}
|
||||
|
||||
private Fragment getFragment(String which_f) {
|
||||
Fragment fragment = null;
|
||||
|
||||
switch (which_f){
|
||||
case CONTACTS_F:
|
||||
fragment = new AddContactFragment();
|
||||
break;
|
||||
case MED_REMINDER_F:
|
||||
fragment = new ReminderFragment();
|
||||
break;
|
||||
case MED_INFO_F:
|
||||
fragment = new MedicalInfoFragment();
|
||||
break;
|
||||
case ACTIVITY_F:
|
||||
fragment = new RoutineFragment();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
||||
private void addFragment(Fragment fragment) {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add(R.id.fcv_profile_shower, fragment)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.ssb.simplitend.cg_geofencing;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.ActivityCgGeofencingBinding;
|
||||
|
||||
public class CgGeoFencingActivity extends AppCompatActivity {
|
||||
|
||||
// view binding
|
||||
protected ActivityCgGeofencingBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityCgGeofencingBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,15 @@ import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.UserDataCache;
|
||||
import com.ssb.simplitend.apputils.CaregiverDataCache;
|
||||
import com.ssb.simplitend.caregiverdashboard.CaregiverDashActivity;
|
||||
import com.ssb.simplitend.caregiverdashboard.CgProfileProgressActivity;
|
||||
import com.ssb.simplitend.caregiverdashboard.PatientProfileShowerActivity;
|
||||
import com.ssb.simplitend.cg_subscription.mvp.SubscriptionContracts;
|
||||
import com.ssb.simplitend.cg_subscription.mvp.SubscriptionCredentials;
|
||||
import com.ssb.simplitend.cg_subscription.mvp.SubscriptionPresenter;
|
||||
import com.ssb.simplitend.databinding.CgSubscriptionLayoutBinding;
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
import com.stripe.android.PaymentConfiguration;
|
||||
import com.stripe.android.paymentsheet.PaymentSheet;
|
||||
import com.stripe.android.paymentsheet.PaymentSheetResult;
|
||||
@@ -46,6 +49,8 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
|
||||
private PaymentSheet paymentSheet;
|
||||
|
||||
private CareGiverData careGiverData;
|
||||
|
||||
private String payment_intent_id, stripe_price_id;
|
||||
|
||||
@Override
|
||||
@@ -56,6 +61,10 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
|
||||
presenter = SubscriptionPresenter.getPresenter();
|
||||
|
||||
CaregiverDataCache.getCaregiverData(this, (careGiverData -> {
|
||||
this.careGiverData = careGiverData;
|
||||
}));
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
@@ -69,8 +78,8 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
private void payForSubscription() {
|
||||
if (UserDataCache.careGiverData == null) {
|
||||
Toast.makeText(this, "Couldn't make payment", Toast.LENGTH_SHORT).show();
|
||||
if (careGiverData == null){
|
||||
Toast.makeText(this, "Something went wrong", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -89,10 +98,10 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
|
||||
Map<String, RequestBody> body = new HashMap<>();
|
||||
|
||||
RequestBody name_body = RequestBody.create(UserDataCache.careGiverData.first_name, MediaType.parse("text/plain"));
|
||||
RequestBody name_body = RequestBody.create(careGiverData.first_name, MediaType.parse("text/plain"));
|
||||
body.put("name", name_body);
|
||||
|
||||
RequestBody email_body = RequestBody.create(UserDataCache.careGiverData.email, MediaType.parse("text/plain"));
|
||||
RequestBody email_body = RequestBody.create(careGiverData.email, MediaType.parse("text/plain"));
|
||||
body.put("email", email_body);
|
||||
|
||||
// important part
|
||||
@@ -112,7 +121,7 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
RequestBody subscription_xid_body = RequestBody.create(plan.id + "", MediaType.parse("text/plain"));
|
||||
body.put("subscription_xid", subscription_xid_body);
|
||||
|
||||
RequestBody caregiver_xid_body = RequestBody.create("" + UserDataCache.careGiverData.caregiver_xid, MediaType.parse("text/plain"));
|
||||
RequestBody caregiver_xid_body = RequestBody.create("" + careGiverData.caregiver_xid, MediaType.parse("text/plain"));
|
||||
body.put("caregiver_xid", caregiver_xid_body);
|
||||
|
||||
String token = "Bearer " + AppUtil.getCgToken(this);
|
||||
@@ -255,11 +264,11 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
@Override
|
||||
public void onSubscriptionCreated() {
|
||||
// statically changing the flag of subscription to 1
|
||||
if (UserDataCache.careGiverData != null){
|
||||
UserDataCache.careGiverData.isCaregiverTakeSubscription = 1;
|
||||
if (careGiverData != null){
|
||||
careGiverData.isCaregiverTakeSubscription = 1;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, CaregiverDashActivity.class);
|
||||
Intent intent = new Intent(this, CgProfileProgressActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
|
||||
progressDialog.dismiss();
|
||||
|
||||
@@ -14,7 +14,6 @@ import androidx.navigation.Navigation;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.databinding.PatientDashboardFragmentBinding;
|
||||
import com.ssb.simplitend.patient_dashboard.DashBoardActivity;
|
||||
import com.ssb.simplitend.welcome.activities.WelcomeActivity;
|
||||
|
||||
public class PatientDashboardFragment extends Fragment {
|
||||
@@ -45,7 +44,7 @@ public class PatientDashboardFragment extends Fragment {
|
||||
// fake sign out
|
||||
// TODO: 08-08-2023 remove this
|
||||
|
||||
AppUtil.saveUserCache(null, -1, requireContext());
|
||||
AppUtil.savePatientData(null, -1, requireContext(), false);
|
||||
|
||||
Intent intent = new Intent(requireActivity(), WelcomeActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
|
||||
|
||||
PatientProfileAPIService apiService = RetrofitHelper.getRetrofit().create(PatientProfileAPIService.class);
|
||||
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
|
||||
apiService.getUsrProfileProgress(token)
|
||||
.enqueue(new Callback<CallResponse<PatientData>>() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ssb.simplitend.patientprofile.medicalinfo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputFilter;
|
||||
@@ -12,14 +13,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.google.i18n.phonenumbers.NumberParseException;
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.ProfileProgress;
|
||||
import com.ssb.simplitend.databinding.AddMedicalInfoBinding;
|
||||
import com.ssb.simplitend.patientprofile.ProfileContracts;
|
||||
import com.ssb.simplitend.patientprofile.medicalinfo.mvvm.MedicalInfoViewModel;
|
||||
@@ -249,7 +248,7 @@ public class AddMedicalInfoFragment extends Fragment implements
|
||||
|
||||
body.put("is_update", is_update_body);
|
||||
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
|
||||
medicalInfoViewModel.addNUpdateMedicalInfo(body,
|
||||
AppUtil.getPatientUid(requireContext()),
|
||||
@@ -334,7 +333,10 @@ public class AddMedicalInfoFragment extends Fragment implements
|
||||
title,
|
||||
R.raw.done_anim_primary, 3600,
|
||||
yes -> {
|
||||
Navigation.findNavController(binding.getRoot()).popBackStack(R.id.medicalInfoFragment, false);
|
||||
Activity activity = getActivity();
|
||||
if (activity != null){
|
||||
activity.onBackPressed();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.ProfileProgress;
|
||||
import com.ssb.simplitend.databinding.MedicalIntoFragmentBinding;
|
||||
import com.ssb.simplitend.patientprofile.ProfileContracts;
|
||||
import com.ssb.simplitend.patientprofile.medicalinfo.mvvm.MedicalInfoViewModel;
|
||||
@@ -34,7 +33,7 @@ public class MedicalInfoFragment extends Fragment implements ProfileContracts.Ge
|
||||
|
||||
private MedicationInfo medicationInfo;
|
||||
|
||||
public MedicalInfoFragment(){
|
||||
public MedicalInfoFragment() {
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@@ -61,7 +60,7 @@ public class MedicalInfoFragment extends Fragment implements ProfileContracts.Ge
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
|
||||
medicalInfoViewModel.getMedicalInfo(AppUtil.getPatientUid(requireContext()),
|
||||
token, this);
|
||||
@@ -70,30 +69,51 @@ public class MedicalInfoFragment extends Fragment implements ProfileContracts.Ge
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> {
|
||||
if (getActivity() != null){
|
||||
if (getActivity() != null) {
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
});
|
||||
|
||||
binding.addMedInfo.setOnClickListener(v -> {
|
||||
Navigation.findNavController(v).navigate(R.id.action_medicalInfoFragment_to_addMedicalInfoFragment);
|
||||
}
|
||||
|
||||
try {
|
||||
Navigation.findNavController(v).navigate(R.id.action_medicalInfoFragment_to_addMedicalInfoFragment);
|
||||
} catch (Exception e) {
|
||||
// there may be a IllegalStateException as this same fragment is used from another fragment
|
||||
// and not through the nav graph
|
||||
|
||||
getParentFragmentManager().beginTransaction()
|
||||
.replace(R.id.fcv_profile_shower, AddMedicalInfoFragment.class, null)
|
||||
.addToBackStack("add_reminder")
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
binding.editBtn.setOnClickListener(v -> {
|
||||
|
||||
if (medicationInfo != null){
|
||||
if (medicationInfo != null) {
|
||||
Bundle bundle = new Bundle();
|
||||
|
||||
bundle.putSerializable(MEDICAL_INFO_KEY, medicationInfo);
|
||||
|
||||
Navigation.findNavController(v).navigate(R.id.action_medicalInfoFragment_to_addMedicalInfoFragment, bundle);
|
||||
try {
|
||||
Navigation.findNavController(v).navigate(R.id.action_medicalInfoFragment_to_addMedicalInfoFragment, bundle);
|
||||
}catch (Exception e){
|
||||
// there may be a IllegalStateException as this same fragment is used from another fragment
|
||||
// and not through the nav graph
|
||||
|
||||
getParentFragmentManager().beginTransaction()
|
||||
.replace(R.id.fcv_profile_shower, AddMedicalInfoFragment.class, bundle)
|
||||
.addToBackStack("add_reminder")
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
binding.done.setOnClickListener(v -> {
|
||||
if (getActivity() != null){
|
||||
if (getActivity() != null) {
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
});
|
||||
@@ -114,14 +134,14 @@ public class MedicalInfoFragment extends Fragment implements ProfileContracts.Ge
|
||||
this.medicationInfo = medicationInfo;
|
||||
progressDialog.dismiss();
|
||||
|
||||
if (medicationInfo != null){
|
||||
if (medicationInfo != null) {
|
||||
binding.medicalInfo.setVisibility(View.VISIBLE);
|
||||
binding.noData.setVisibility(View.GONE);
|
||||
binding.addMedInfo.setVisibility(View.GONE);
|
||||
binding.editBtn.setVisibility(View.VISIBLE);
|
||||
|
||||
loadMedicalInfo(medicationInfo);
|
||||
}else{
|
||||
} else {
|
||||
binding.noData.setVisibility(View.VISIBLE);
|
||||
binding.medicalInfo.setVisibility(View.GONE);
|
||||
binding.addMedInfo.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ssb.simplitend.patientprofile.medreminder;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.app.TimePickerDialog;
|
||||
@@ -19,7 +20,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.skydoves.powerspinner.OnSpinnerItemSelectedListener;
|
||||
import com.ssb.simplitend.R;
|
||||
@@ -200,7 +200,7 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
|
||||
reminderResult.is_update = "0";
|
||||
}
|
||||
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
|
||||
viewModel.addReminder(AppUtil.getPatientUid(requireContext()),
|
||||
reminderResult,
|
||||
@@ -640,7 +640,7 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
viewModel.fetchFreqNMedTypes(token, this);
|
||||
}
|
||||
|
||||
@@ -700,8 +700,10 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
|
||||
if (reminder == null) {
|
||||
Toast.makeText(requireContext(), "Reminder added successfully.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.popBackStack(R.id.reminderFragment, false, true);
|
||||
Activity activity = getActivity();
|
||||
if (activity != null){
|
||||
activity.onBackPressed();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -709,7 +711,10 @@ public class AddReminderFragment extends Fragment implements CompoundButton.OnCh
|
||||
getString(R.string.changes_successful), R.raw.done_anim_primary,
|
||||
3600, v3 -> {
|
||||
// here v3 is null
|
||||
Navigation.findNavController(binding.getRoot()).popBackStack(R.id.reminderFragment, false, true);
|
||||
Activity activity = getActivity();
|
||||
if (activity != null){
|
||||
activity.onBackPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.ProfileProgress;
|
||||
import com.ssb.simplitend.databinding.RemindersFragmentBinding;
|
||||
import com.ssb.simplitend.patientprofile.ProfileContracts;
|
||||
import com.ssb.simplitend.patientprofile.medreminder.mvvm.ReminderAdapter;
|
||||
@@ -105,7 +104,20 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
|
||||
|
||||
// add button
|
||||
binding.addReminder.setOnClickListener(v ->
|
||||
Navigation.findNavController(v).navigate(R.id.action_reminderFragment_to_addReminderFragment)
|
||||
{
|
||||
|
||||
try {
|
||||
Navigation.findNavController(v).navigate(R.id.action_reminderFragment_to_addReminderFragment);
|
||||
}catch (Exception e){
|
||||
// there may be a IllegalStateException as this same fragment is used from another fragment
|
||||
// and not through the nav graph
|
||||
|
||||
getParentFragmentManager().beginTransaction()
|
||||
.replace(R.id.fcv_profile_shower, AddReminderFragment.class, null)
|
||||
.addToBackStack("add_reminder")
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
binding.done.setOnClickListener(v -> {
|
||||
@@ -130,7 +142,7 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
|
||||
|
||||
day_of_week--; // because, at server side day_of_week starts from 0
|
||||
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
int patient_uid = AppUtil.getPatientUid(requireContext());
|
||||
reminderViewModel.getRemindersList(patient_uid, day_of_week, token, this);
|
||||
}
|
||||
@@ -378,7 +390,7 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
|
||||
v -> {
|
||||
// yes button clicked
|
||||
int patientReminderId = reminderAdapter.getReminderResultList().get(position).id;
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
|
||||
progressDialog.setTitle("Please wait...");
|
||||
progressDialog.setMessage("while we delete the reminder for you.");
|
||||
@@ -407,8 +419,18 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
|
||||
|
||||
bundle.putSerializable(AddReminderFragment.REMINDER_KEY, reminderAdapter.getReminderResultList().get(position));
|
||||
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_reminderFragment_to_addReminderFragment, bundle);
|
||||
try {
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_reminderFragment_to_addReminderFragment, bundle);
|
||||
}catch (Exception e){
|
||||
// there may be a IllegalStateException as this same fragment is used from another fragment
|
||||
// and not through the nav graph
|
||||
|
||||
getParentFragmentManager().beginTransaction()
|
||||
.add(R.id.fcv_profile_shower, AddReminderFragment.class, bundle)
|
||||
.addToBackStack("add_reminder")
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -499,7 +521,7 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
|
||||
reminderViewModel.addReminder(
|
||||
AppUtil.getPatientUid(requireContext()),
|
||||
reminderResult,
|
||||
"Bearer " + AppUtil.getUserToken(requireContext()),
|
||||
"Bearer " + AppUtil.getPatientToken(requireContext()),
|
||||
this
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ssb.simplitend.patientprofile.setuproutine;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.os.Bundle;
|
||||
@@ -17,7 +18,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
@@ -241,7 +241,7 @@ public class AddRoutineFragment extends Fragment implements CompoundButton.OnChe
|
||||
routineDetails.is_update = 0;
|
||||
}
|
||||
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
|
||||
routineViewModel.addNUpdateRoutine(AppUtil.getPatientUid(requireContext()),
|
||||
routineDetails,
|
||||
@@ -473,8 +473,10 @@ public class AddRoutineFragment extends Fragment implements CompoundButton.OnChe
|
||||
if (this.routine == null) {
|
||||
Toast.makeText(requireContext(), "Routine added successfully.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.popBackStack(R.id.routineFragment, false, true);
|
||||
Activity activity = getActivity();
|
||||
if (activity != null){
|
||||
activity.onBackPressed();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -482,7 +484,10 @@ public class AddRoutineFragment extends Fragment implements CompoundButton.OnChe
|
||||
getString(R.string.changes_successful), R.raw.done_anim_primary,
|
||||
3600, v3 -> {
|
||||
// here v3 is null
|
||||
Navigation.findNavController(binding.getRoot()).popBackStack(R.id.routineFragment, false, true);
|
||||
Activity activity = getActivity();
|
||||
if (activity != null){
|
||||
activity.onBackPressed();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.Navigation;
|
||||
@@ -21,6 +20,7 @@ import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.databinding.RoutineFragmentBinding;
|
||||
import com.ssb.simplitend.patientprofile.ProfileContracts;
|
||||
import com.ssb.simplitend.patientprofile.medreminder.AddReminderFragment;
|
||||
import com.ssb.simplitend.patientprofile.medreminder.WeekDayViewHolder;
|
||||
import com.ssb.simplitend.patientprofile.setuproutine.mvvm.RoutineAdapter;
|
||||
import com.ssb.simplitend.patientprofile.setuproutine.mvvm.RoutineDetails;
|
||||
@@ -29,13 +29,8 @@ import com.ssb.simplitend.patientprofile.setuproutine.mvvm.RoutineViewModel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
public class RoutineFragment extends Fragment implements RoutineAdapter.ClickListener,
|
||||
RoutineAdapter.DeleteClickListener,
|
||||
@@ -114,7 +109,18 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
});
|
||||
|
||||
binding.addRoutine.setOnClickListener(v -> {
|
||||
Navigation.findNavController(v).navigate(R.id.action_routineFragment_to_addRoutineFragment);
|
||||
try {
|
||||
|
||||
Navigation.findNavController(v).navigate(R.id.action_routineFragment_to_addRoutineFragment);
|
||||
}catch (Exception e){
|
||||
// there may be a IllegalStateException as this same fragment is used from another fragment
|
||||
// and not through the nav graph
|
||||
|
||||
getParentFragmentManager().beginTransaction()
|
||||
.replace(R.id.fcv_profile_shower, AddRoutineFragment.class, null)
|
||||
.addToBackStack("add_reminder")
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
});
|
||||
|
||||
binding.done.setOnClickListener(v -> {
|
||||
@@ -133,7 +139,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
|
||||
day_of_week--; // because, at server side day_of_week starts from 0
|
||||
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
int patient_uid = AppUtil.getPatientUid(requireContext());
|
||||
routineViewModel.getRoutines(patient_uid, token, day_of_week, this);
|
||||
|
||||
@@ -369,7 +375,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
|
||||
routineViewModel.deleteRoutine(AppUtil.getPatientUid(requireContext()),
|
||||
routine.id,
|
||||
@@ -387,7 +393,18 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(ROUTINE_KEY, routine);
|
||||
|
||||
Navigation.findNavController(binding.getRoot()).navigate(R.id.action_routineFragment_to_addRoutineFragment, bundle);
|
||||
|
||||
try {
|
||||
Navigation.findNavController(binding.getRoot()).navigate(R.id.action_routineFragment_to_addRoutineFragment, bundle);
|
||||
}catch (Exception e){
|
||||
// there may be a IllegalStateException as this same fragment is used from another fragment
|
||||
// and not through the nav graph
|
||||
|
||||
getParentFragmentManager().beginTransaction()
|
||||
.add(R.id.fcv_profile_shower, AddRoutineFragment.class, bundle)
|
||||
.addToBackStack("add_reminder")
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -444,7 +461,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
routineViewModel.addNUpdateRoutine(
|
||||
AppUtil.getPatientUid(requireContext()),
|
||||
routine,
|
||||
"Bearer " + AppUtil.getUserToken(requireContext()),
|
||||
"Bearer " + AppUtil.getPatientToken(requireContext()),
|
||||
this
|
||||
);
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import androidx.navigation.Navigation;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.caregiverdashboard.CaregiverDashActivity;
|
||||
import com.ssb.simplitend.databinding.ConnectCaregiverFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.welcomecg.WelcomeContracts;
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CgWelcomeViewModel;
|
||||
|
||||
@@ -30,8 +30,8 @@ import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
import com.google.i18n.phonenumbers.Phonenumber;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.CaregiverDataCache;
|
||||
import com.ssb.simplitend.apputils.EditTextErrorRemover;
|
||||
import com.ssb.simplitend.apputils.UserDataCache;
|
||||
import com.ssb.simplitend.databinding.CgRegisterFragmentBinding;
|
||||
import com.ssb.simplitend.databinding.PasswordPopUpBinding;
|
||||
import com.ssb.simplitend.welcome.welcomecg.WelcomeContracts;
|
||||
@@ -409,9 +409,9 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
|
||||
public void onCareGiverRegistered(CareGiverData careGiverData, String token) {
|
||||
Toast.makeText(requireContext(), "Caregiver registered successfully.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
UserDataCache.careGiverData = careGiverData;
|
||||
CaregiverDataCache.setCareGiverData(careGiverData);
|
||||
|
||||
AppUtil.saveCgData(token, requireContext());
|
||||
AppUtil.saveCgData(token, careGiverData.patientId, requireContext());
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(CAREGIVER_EMAIL, careGiverData.email);
|
||||
|
||||
@@ -19,7 +19,7 @@ import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.UserDataCache;
|
||||
import com.ssb.simplitend.apputils.CaregiverDataCache;
|
||||
import com.ssb.simplitend.caregiverdashboard.CaregiverDashActivity;
|
||||
import com.ssb.simplitend.databinding.CgSignInFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.welcomecg.WelcomeContracts;
|
||||
@@ -150,12 +150,12 @@ public class CgSignInFragment extends Fragment implements WelcomeContracts.CgLog
|
||||
@Override
|
||||
public void onLoginSuccess(CareGiverData careGiverData, String token) {
|
||||
// caching user data
|
||||
UserDataCache.careGiverData = careGiverData;
|
||||
CaregiverDataCache.setCareGiverData(careGiverData);
|
||||
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(requireContext(), "Log in success.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
AppUtil.saveCgData(token, requireContext());
|
||||
AppUtil.saveCgData(token, careGiverData.patientId, requireContext());
|
||||
|
||||
if (careGiverData.isPatientAndCareGiverConnected == 1){
|
||||
gotoDashboard();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.ssb.simplitend.welcome.welcomecg.mvvm;
|
||||
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
|
||||
public class CareGiverData{
|
||||
public int id;
|
||||
public String principal_type_xid;
|
||||
@@ -35,4 +37,7 @@ public class CareGiverData{
|
||||
public int isPatientAndCareGiverConnected, isCaregiverTakeSubscription;
|
||||
public int caregiver_xid;
|
||||
public String is_admin;
|
||||
public int patientId;
|
||||
|
||||
public PatientData patientDetails;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import androidx.navigation.Navigation;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.EditTextErrorRemover;
|
||||
import com.ssb.simplitend.apputils.UserDataCache;
|
||||
import com.ssb.simplitend.apputils.CaregiverDataCache;
|
||||
import com.ssb.simplitend.patient_dashboard.DashBoardActivity;
|
||||
import com.ssb.simplitend.databinding.SignInFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.WelcomeContracts;
|
||||
@@ -152,13 +152,12 @@ public class SignInFragment extends Fragment implements WelcomeContracts.Registe
|
||||
@Override
|
||||
public void onResponse(PatientData patientResult, String token) {
|
||||
// caching user data
|
||||
UserDataCache.patientData = patientResult;
|
||||
|
||||
progressDialog.dismiss();
|
||||
|
||||
progressDialog.setMessage("Almost there...");
|
||||
|
||||
AppUtil.saveUserCache(token, patientResult.patientId, requireContext());
|
||||
AppUtil.savePatientData(token, patientResult.patientId, requireContext(), true);
|
||||
|
||||
progressDialog.dismiss();
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public class AddContactFragment extends Fragment implements WelcomeContracts.Con
|
||||
|
||||
binding.progressBar.setVisibility(View.VISIBLE);
|
||||
contactViewModel.getRemoteContactList(this,
|
||||
"Bearer " + AppUtil.getUserToken(requireContext()));
|
||||
"Bearer " + AppUtil.getPatientToken(requireContext()));
|
||||
|
||||
contactAdapter.setContactClickListener(this);
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ContactInfoFragment extends Fragment implements WelcomeContracts.De
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
contactViewModel.deleteContact(AppUtil.getUserToken(requireContext()),
|
||||
contactViewModel.deleteContact(AppUtil.getPatientToken(requireContext()),
|
||||
contactData.contact_id, this);
|
||||
}, no -> {
|
||||
// nothing to do
|
||||
|
||||
@@ -320,7 +320,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
filePart,
|
||||
edit_contact ? null : this, // create contact call back
|
||||
edit_contact ? this : null, // update contact call back
|
||||
"Bearer " + AppUtil.getUserToken(requireContext()));
|
||||
"Bearer " + AppUtil.getPatientToken(requireContext()));
|
||||
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
String token = "Bearer " + AppUtil.getUserToken(requireContext());
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
contactViewModel.getRemoteContactList(this, token);
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public class CreatePinFragment extends Fragment implements WelcomeContracts.Regi
|
||||
|
||||
progressDialog.setMessage("Almost there...");
|
||||
|
||||
AppUtil.saveUserCache(token, patientResult.patientId, requireContext());
|
||||
AppUtil.savePatientData(token, patientResult.patientId, requireContext(), true);
|
||||
|
||||
progressDialog.dismiss();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import androidx.navigation.Navigation;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.RetrofitHelper;
|
||||
import com.ssb.simplitend.apputils.UserDataCache;
|
||||
import com.ssb.simplitend.apputils.CaregiverDataCache;
|
||||
import com.ssb.simplitend.caregiverdashboard.CaregiverDashActivity;
|
||||
import com.ssb.simplitend.databinding.SplashFragmentBinding;
|
||||
import com.ssb.simplitend.patient_dashboard.DashBoardActivity;
|
||||
@@ -64,10 +64,11 @@ public class SplashFragment extends Fragment
|
||||
binding.retry.setVisibility(View.GONE);
|
||||
binding.loadAnim.setVisibility(View.VISIBLE);
|
||||
|
||||
String patient_token = AppUtil.getUserToken(requireContext());
|
||||
String patient_token = AppUtil.getPatientToken(requireContext());
|
||||
String cg_token = AppUtil.getCgToken(requireContext());
|
||||
boolean is_patient_logged_in = AppUtil.isPatientLoggedIn(requireContext());
|
||||
|
||||
if (patient_token != null && !patient_token.isEmpty()){
|
||||
if (patient_token != null && !patient_token.isEmpty() && is_patient_logged_in){
|
||||
// user is already logged in as PATIENT
|
||||
// thus, checking if the logged in PATIENT has already added CAREGIVER
|
||||
|
||||
@@ -170,7 +171,7 @@ public class SplashFragment extends Fragment
|
||||
@Override
|
||||
public void onCgDataFetched(CareGiverData careGiverData) {
|
||||
// caching data
|
||||
UserDataCache.careGiverData = careGiverData;
|
||||
CaregiverDataCache.setCareGiverData(careGiverData);
|
||||
|
||||
binding.retry.setVisibility(View.GONE);
|
||||
binding.loadAnim.setVisibility(View.GONE);
|
||||
@@ -215,7 +216,6 @@ public class SplashFragment extends Fragment
|
||||
@Override
|
||||
public void onProfileProgressFetched(PatientData patientData) {
|
||||
// caching data
|
||||
UserDataCache.patientData = patientData;
|
||||
|
||||
binding.retry.setVisibility(View.GONE);
|
||||
binding.loadAnim.setVisibility(View.GONE);
|
||||
|
||||
5
app/src/main/res/drawable/ic_setting.xml
Normal file
5
app/src/main/res/drawable/ic_setting.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
|
||||
</vector>
|
||||
165
app/src/main/res/layout/activity_cg_geofencing.xml
Normal file
165
app/src/main/res/layout/activity_cg_geofencing.xml
Normal file
@@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_btn"
|
||||
android:layout_width="35sp"
|
||||
android:layout_height="35sp"
|
||||
android:layout_margin="15dp"
|
||||
android:contentDescription="@string/back_button"
|
||||
android:padding="5dp"
|
||||
android:paddingStart="-15dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:src="@drawable/arrow_back" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/geofencing"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/set_specific_geographic_areas_and_receive_instant_alerts_when_your_loved_one_leaves_the_geofenced_zone"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:textSize="@dimen/_14ssp"
|
||||
|
||||
android:layout_marginVertical="15dp"
|
||||
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/geofence_map"
|
||||
android:name="com.google.android.gms.maps.SupportMapFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginHorizontal="@dimen/_10sdp"
|
||||
android:layout_marginTop="@dimen/_10sdp"
|
||||
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardElevation="5dp"
|
||||
|
||||
app:strokeWidth="0.5dp"
|
||||
app:strokeColor="@color/color_accent"
|
||||
|
||||
app:cardCornerRadius="20dp"
|
||||
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/search_places"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:textColor="@android:color/darker_gray"
|
||||
android:textSize="@dimen/_14ssp"
|
||||
|
||||
android:layout_marginVertical="10dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
|
||||
app:drawableStartCompat="@drawable/ic_search_outline"
|
||||
android:drawablePadding="15dp"
|
||||
|
||||
/>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_below="@id/search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginHorizontal="@dimen/_10sdp"
|
||||
android:layout_marginTop="@dimen/_10sdp"
|
||||
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardElevation="5dp"
|
||||
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="@color/color_accent"
|
||||
|
||||
app:cardCornerRadius="15dp"
|
||||
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/away"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/destination_0_5m_away"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_14ssp"
|
||||
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_below="@id/away"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/_165_hasley_st_newark_nj_07102"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:textColor="@android:color/darker_gray"
|
||||
android:textSize="@dimen/_14ssp"
|
||||
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
|
||||
android:layout_alignParentEnd="true"
|
||||
|
||||
android:layout_margin="8dp"
|
||||
android:padding="3dp"
|
||||
|
||||
app:srcCompat="@drawable/ic_setting"
|
||||
|
||||
app:tint="@color/black" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -435,12 +435,12 @@
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/proceed"
|
||||
android:id="@+id/skip_to_dash"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:text="@string/proceed"
|
||||
android:text="@string/skip_to_dashboard"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:textAllCaps="false"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
14
app/src/main/res/layout/activity_patient_profile_shower.xml
Normal file
14
app/src/main/res/layout/activity_patient_profile_shower.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
tools:context=".caregiverdashboard.PatientProfileShowerActivity">
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/fcv_profile_shower"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -2,7 +2,7 @@
|
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/welcome_nav_graph"
|
||||
app:startDestination="@id/splashFragment">
|
||||
app:startDestination="@id/profileProgressFragment">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/welcomeFragment"
|
||||
|
||||
@@ -314,5 +314,9 @@
|
||||
<string name="continue_"><u>Continue</u></string>
|
||||
<string name="no_contacts_found">No contacts found.</string>
|
||||
<string name="there_are_no_contacts_added_in_your_contact_directory_please_click_on_the_create_new_contact_button_above">There are no contacts added in your contact directory. Please click on the "Create New Contact" button above.</string>
|
||||
<string name="geofencing">Geofencing</string>
|
||||
<string name="set_specific_geographic_areas_and_receive_instant_alerts_when_your_loved_one_leaves_the_geofenced_zone">Set specific geographic areas and receive instant alerts when your loved one leaves the geofenced zone.</string>
|
||||
<string name="destination_0_5m_away">Destination 0.5m away</string>
|
||||
<string name="_165_hasley_st_newark_nj_07102">165 Hasley St. Newark, NJ 07102</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user