.
This commit is contained in:
@@ -2,15 +2,19 @@ package com.ssb.simplitend.apputils;
|
||||
|
||||
import static com.ssb.simplitend.apputils.Constants.ACTIVITY_EXTRA_KEY;
|
||||
import static com.ssb.simplitend.apputils.Constants.REMINDER_EXTRA_KEY;
|
||||
import static com.ssb.simplitend.articles.ArticleShowerActivity.ARTICLE_TITLE;
|
||||
import static com.ssb.simplitend.articles.ArticleShowerActivity.ARTICLE_URL_KEY;
|
||||
import static com.ssb.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_ID;
|
||||
import static com.ssb.simplitend.patientgeofencing.GeoFenceHelper.GEOFENCE_TAG;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
@@ -28,6 +32,7 @@ import com.google.android.gms.location.LocationServices;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.appblocking.MySharedPref;
|
||||
import com.ssb.simplitend.articles.ArticleShowerActivity;
|
||||
import com.ssb.simplitend.databinding.BottomSheetAlertBinding;
|
||||
import com.ssb.simplitend.databinding.DecisionBottomsheetBinding;
|
||||
import com.ssb.simplitend.databinding.DoneBottomsheetBinding;
|
||||
@@ -223,6 +228,15 @@ public abstract class AppUtil {
|
||||
return returnString.toString();
|
||||
}
|
||||
|
||||
public static void callPhone(Activity activity, String phone_number){
|
||||
if (activity.checkSelfPermission(Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_GRANTED){
|
||||
Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel",
|
||||
phone_number, null));
|
||||
activity.startActivity(intent);
|
||||
}else{
|
||||
dialPhone(activity, phone_number);
|
||||
}
|
||||
}
|
||||
|
||||
public static void dialPhone(Context activity, String phone_number) {
|
||||
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel",
|
||||
@@ -408,6 +422,18 @@ public abstract class AppUtil {
|
||||
binding.btn.setOnClickListener(btn_clickListener);
|
||||
}
|
||||
|
||||
public static void openLink(Activity activity,
|
||||
@NonNull String link, @NonNull String title){
|
||||
try {
|
||||
Intent intent = new Intent(activity, ArticleShowerActivity.class);
|
||||
intent.putExtra(ARTICLE_URL_KEY, link);
|
||||
intent.putExtra(ARTICLE_TITLE, title);
|
||||
activity.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ********************* USER DATA UTILS ******************************************
|
||||
|
||||
|
||||
@@ -64,6 +64,17 @@ public class CaregiverSettingsActivity extends AppCompatActivity implements CgHo
|
||||
Intent intent = new Intent(this, DeActivateAccountActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
binding.tNC.setOnClickListener(v -> {
|
||||
AppUtil.openLink(this, getString(R.string.terms_n_conditions_link),
|
||||
getString(R.string.terms_conditions_));
|
||||
});
|
||||
|
||||
binding.privacy.setOnClickListener(v -> {
|
||||
AppUtil.openLink(this, getString(R.string.privacy_policy_link),
|
||||
getString(R.string.privacy_policy));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,4 +25,7 @@ public interface AccountApiService {
|
||||
Call<CallResponse<Object>> contactAdmin(@PartMap Map<String, RequestBody> body,
|
||||
@Header("Authorization") String token);
|
||||
|
||||
@POST("api/logout")
|
||||
Call<CallResponse<Object>> signOut(@Header("Authorization") String token);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.ssb.simplitend.caregiverdashboard.activities.deactivateacc;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.ssb.simplitend.apputils.RetrofitHelper;
|
||||
import com.ssb.simplitend.caregiverdashboard.mvvm.CgHomeContracts;
|
||||
import com.ssb.simplitend.patient_dashboard.PatSettingsActivity;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -96,6 +98,29 @@ public class AccountPresenter {
|
||||
|
||||
}
|
||||
|
||||
public void signOut(String token, @NonNull CgHomeContracts.SignOutCallback signOutCallback) {
|
||||
apiService.signOut(token).enqueue(new Callback<CallResponse<Object>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<Object>> call, Response<CallResponse<Object>> response) {
|
||||
if (response.body() != null) {
|
||||
if (response.body().status != 200) {
|
||||
signOutCallback.onSignOutFailed(new Exception(), response.body().message);
|
||||
return;
|
||||
}
|
||||
|
||||
signOutCallback.onSignOutSuccess();
|
||||
} else {
|
||||
signOutCallback.onSignOutFailed(new Exception(), "Please try again later.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CallResponse<Object>> call, Throwable t) {
|
||||
signOutCallback.onSignOutFailed(new Exception(), "Please try again later.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface AccountReDeActivateCallback{
|
||||
void onAccountDeReActivate();
|
||||
|
||||
|
||||
@@ -12,9 +12,11 @@ import android.widget.Toast;
|
||||
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.CaregiverDataCache;
|
||||
import com.ssb.simplitend.apputils.PatientDataCache;
|
||||
import com.ssb.simplitend.databinding.ActivityDeactivateAccBinding;
|
||||
import com.ssb.simplitend.welcome.activities.WelcomeActivity;
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
|
||||
public class DeActivateAccountActivity extends AppCompatActivity implements AccountPresenter.AccountReDeActivateCallback {
|
||||
|
||||
@@ -25,15 +27,28 @@ public class DeActivateAccountActivity extends AppCompatActivity implements Acco
|
||||
|
||||
private CareGiverData careGiverData;
|
||||
|
||||
private PatientData patientData;
|
||||
|
||||
private boolean isPatient;
|
||||
public static final String IS_PATIENT_KEY = "is_patient_key";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityDeactivateAccBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
CaregiverDataCache.getCaregiverData(this, (careGiverData1 -> {
|
||||
this.careGiverData = careGiverData1;
|
||||
}), true);
|
||||
isPatient = getIntent().getBooleanExtra(IS_PATIENT_KEY, false);
|
||||
|
||||
if (isPatient){
|
||||
PatientDataCache.getPatientData(this, (patientData1 -> {
|
||||
this.patientData = patientData1;
|
||||
}), true);
|
||||
}else {
|
||||
CaregiverDataCache.getCaregiverData(this, (careGiverData1 -> {
|
||||
this.careGiverData = careGiverData1;
|
||||
}), true);
|
||||
}
|
||||
|
||||
accountPresenter = AccountPresenter.getAccountPresenter();
|
||||
progressDialog = new ProgressDialog(this);
|
||||
@@ -63,19 +78,41 @@ public class DeActivateAccountActivity extends AppCompatActivity implements Acco
|
||||
});
|
||||
|
||||
binding.confirmDeactivate.setOnClickListener(v -> {
|
||||
if (careGiverData == null){
|
||||
Toast.makeText(this, "Couldn't load data", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
|
||||
int id;
|
||||
String token;
|
||||
|
||||
if (isPatient){
|
||||
if (patientData == null){
|
||||
Toast.makeText(this, "Couldn't load data", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
progressDialog.setTitle("Please wait....");
|
||||
progressDialog.setMessage("while we de-activate your account");
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
id = patientData.patientId;
|
||||
token = AppUtil.getPatientToken(this);
|
||||
}else{
|
||||
if (careGiverData == null){
|
||||
Toast.makeText(this, "Couldn't load data", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
progressDialog.setTitle("Please wait....");
|
||||
progressDialog.setMessage("while we de-activate your account");
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
id = careGiverData.caregiver_xid;
|
||||
token = AppUtil.getCgToken(this);
|
||||
}
|
||||
|
||||
progressDialog.setTitle("Please wait....");
|
||||
progressDialog.setMessage("while we de-activate your account");
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
accountPresenter.accountReDeActivate(AccountPresenter.ACC_DEACTIVATE_BY_USER,
|
||||
careGiverData.caregiver_xid,
|
||||
"Bearer " + AppUtil.getCgToken(this),
|
||||
id,
|
||||
"Bearer " + token,
|
||||
this);
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
@@ -16,9 +17,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
||||
import com.google.firebase.crashlytics.internal.common.CrashlyticsCore;
|
||||
import com.google.firebase.crashlytics.internal.model.CrashlyticsReport;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.CaregiverDataCache;
|
||||
@@ -32,6 +30,8 @@ import com.stripe.android.PaymentConfiguration;
|
||||
import com.stripe.android.paymentsheet.PaymentSheet;
|
||||
import com.stripe.android.paymentsheet.PaymentSheetResult;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -104,10 +104,12 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
contactMail();
|
||||
});
|
||||
|
||||
binding.retry.setOnClickListener(v -> loadPlans());
|
||||
|
||||
}
|
||||
|
||||
private void payForSubscription() {
|
||||
if (careGiverData == null) {
|
||||
if (careGiverData == null || subscriptionPlans == null) {
|
||||
Toast.makeText(this, "Something went wrong", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
@@ -146,48 +148,36 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
// important part
|
||||
String plan_price;
|
||||
try {
|
||||
float plan_price_float = Float.parseFloat(plan.plan_value);
|
||||
plan_price_float *= 100; // converting from dollars to cents
|
||||
BigDecimal plan_price_d = new BigDecimal(plan.plan_value);
|
||||
plan_price = plan_price_d.multiply(new BigDecimal(100)).toBigInteger().toString(); // converting to cents
|
||||
|
||||
if (position == 1){
|
||||
// yearly plan
|
||||
// adding 25% off
|
||||
plan_price_float = plan_price_float * 0.75f;
|
||||
}
|
||||
RequestBody price_body = RequestBody.create(plan_price, MediaType.parse("text/plain"));
|
||||
body.put("price", price_body);
|
||||
|
||||
plan_price = "" + (int) plan_price_float; // converting to int to remove leading ".0"
|
||||
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("" + careGiverData.caregiver_xid, MediaType.parse("text/plain"));
|
||||
body.put("caregiver_xid", caregiver_xid_body);
|
||||
|
||||
String token = "Bearer " + AppUtil.getCgToken(this);
|
||||
|
||||
this.stripe_price_id = plan.stripe_price_id;
|
||||
|
||||
presenter.getPaymentCred(token, body, this);
|
||||
} catch (Exception e) {
|
||||
plan_price = getString(R.string.default_price);
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(this, "Invalid price", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
RequestBody price_body = RequestBody.create(plan_price, MediaType.parse("text/plain"));
|
||||
body.put("price", price_body);
|
||||
|
||||
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("" + careGiverData.caregiver_xid, MediaType.parse("text/plain"));
|
||||
body.put("caregiver_xid", caregiver_xid_body);
|
||||
|
||||
String token = "Bearer " + AppUtil.getCgToken(this);
|
||||
|
||||
this.stripe_price_id = plan.stripe_price_id;
|
||||
|
||||
presenter.getPaymentCred(token, body, this);
|
||||
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
// loading subscription plans
|
||||
progressDialog = new ProgressDialog(this);
|
||||
|
||||
progressDialog.setTitle("Please wait....");
|
||||
progressDialog.setMessage("while we fetch subscription plans for you.");
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
String token = "Bearer " + AppUtil.getCgToken(this);
|
||||
presenter.getSubscriptionPlans(token, this);
|
||||
loadPlans();
|
||||
|
||||
paymentSheet = new PaymentSheet(this, this::onPaymentSheetResult);
|
||||
|
||||
@@ -214,6 +204,20 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
}
|
||||
}
|
||||
|
||||
private void loadPlans() {
|
||||
CaregiverDataCache.getCaregiverData(this, (careGiverData1 -> {
|
||||
this.careGiverData = careGiverData1;
|
||||
|
||||
progressDialog.setTitle("Please wait....");
|
||||
progressDialog.setMessage("while we fetch subscription plans for you.");
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
String token = "Bearer " + AppUtil.getCgToken(this);
|
||||
presenter.getSubscriptionPlans(token, this);
|
||||
}), true);
|
||||
}
|
||||
|
||||
private void contactMail() {
|
||||
String contact_email = getString(R.string.contact_email);
|
||||
|
||||
@@ -270,6 +274,56 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
|
||||
}
|
||||
|
||||
private void inflatePlans() {
|
||||
try {
|
||||
String monthly_price = null;
|
||||
String yearly_price = null;
|
||||
|
||||
for (SubscriptionPlan plan: subscriptionPlans){
|
||||
if (getString(R.string.monthly).equals(plan.plan_name)){
|
||||
// monthly
|
||||
binding.monthlyName.setText(plan.plan_name);
|
||||
monthly_price = plan.plan_value;
|
||||
}else if (getString(R.string.year).equals(plan.plan_name)){
|
||||
// yearly
|
||||
binding.yearlyName.setText(plan.plan_name);
|
||||
yearly_price = plan.plan_value;
|
||||
}
|
||||
}
|
||||
|
||||
if (monthly_price == null || yearly_price == null) throw new Exception();
|
||||
|
||||
binding.yearDiscountedPrice.setText(yearly_price);
|
||||
binding.monthlyPrice.setText(monthly_price);
|
||||
|
||||
BigDecimal TWELVE = new BigDecimal(12);
|
||||
|
||||
BigDecimal year_price_d = new BigDecimal(yearly_price);
|
||||
BigDecimal month_price_d = new BigDecimal(monthly_price);
|
||||
|
||||
BigDecimal actual_year_price = month_price_d.multiply(TWELVE);
|
||||
|
||||
String strike_actual_year_price = "<strike>$" + actual_year_price + "</strike>";
|
||||
binding.yearActualPrice.setText(Html.fromHtml(strike_actual_year_price));
|
||||
|
||||
String yearly_month_price = year_price_d.divide(TWELVE, RoundingMode.DOWN).toString();
|
||||
yearly_month_price = "$" + yearly_month_price;
|
||||
binding.yearlyMonthPrice.setText(yearly_month_price);
|
||||
|
||||
try {
|
||||
String discount = (actual_year_price.subtract(year_price_d)).divide(actual_year_price, RoundingMode.DOWN).multiply(new BigDecimal(100)).toBigInteger().toString() + "% OFF";
|
||||
binding.yearDiscount.setText(discount);
|
||||
} catch (Exception e) {
|
||||
binding.yearDiscount.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
binding.plansView.setVisibility(View.VISIBLE);
|
||||
|
||||
}catch (Exception e){
|
||||
binding.plansView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
// get payment credentials callback
|
||||
@Override
|
||||
public void onPaymentCredFetched(SubscriptionCredentials credentials) {
|
||||
@@ -311,13 +365,14 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
@Override
|
||||
public void onSubscriptionFetched(ArrayList<SubscriptionPlan> subscriptionPlans) {
|
||||
this.subscriptionPlans = subscriptionPlans;
|
||||
inflatePlans();
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubsFetchFailed(Throwable t, String message) {
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(this, "" + message, Toast.LENGTH_SHORT).show();
|
||||
binding.plansView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// subscription create callback
|
||||
|
||||
@@ -103,7 +103,8 @@ public class DirectionToHomeActivity extends AppCompatActivity
|
||||
String cur_location = pat_cur_lat + "," + pat_cur_lng;
|
||||
String pat_location = pat_lat + "," + pat_lng;
|
||||
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
|
||||
Uri.parse("http://maps.google.com/maps?saddr=" + cur_location + "&daddr=" + pat_location));
|
||||
Uri.parse("https://www.google.com/maps/dir/?api=1&destination=" + pat_location + "&travelmode=walking"));
|
||||
|
||||
startActivity(intent);
|
||||
|
||||
viewModel.notifyRequestedDirections(AppUtil.getPatientUid(this)+"",
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.ssb.simplitend.patient_dashboard;
|
||||
|
||||
import static com.ssb.simplitend.caregiverdashboard.activities.deactivateacc.DeActivateAccountActivity.IS_PATIENT_KEY;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.onesignal.OneSignal;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.caregiverdashboard.activities.deactivateacc.AccountPresenter;
|
||||
import com.ssb.simplitend.caregiverdashboard.activities.deactivateacc.DeActivateAccountActivity;
|
||||
import com.ssb.simplitend.caregiverdashboard.mvvm.CgHomeContracts;
|
||||
import com.ssb.simplitend.databinding.ActivityPatSettingsBinding;
|
||||
import com.ssb.simplitend.welcome.activities.WelcomeActivity;
|
||||
|
||||
public class PatSettingsActivity extends AppCompatActivity implements CgHomeContracts.SignOutCallback {
|
||||
|
||||
private ActivityPatSettingsBinding binding;
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
private AccountPresenter accountPresenter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityPatSettingsBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
progressDialog = new ProgressDialog(this);
|
||||
accountPresenter = AccountPresenter.getAccountPresenter();
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
binding.notificationCheck.setChecked(OneSignal.getUser().getPushSubscription().getOptedIn());
|
||||
binding.notificationCheck.setOnCheckedChangeListener((compoundButton, check) -> {
|
||||
if (check){
|
||||
OneSignal.getUser().getPushSubscription().optIn();
|
||||
}else{
|
||||
OneSignal.getUser().getPushSubscription().optOut();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.deActivate.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(this, DeActivateAccountActivity.class);
|
||||
intent.putExtra(IS_PATIENT_KEY, true);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
binding.tNC.setOnClickListener(v -> {
|
||||
AppUtil.openLink(this, getString(R.string.terms_n_conditions_link),
|
||||
getString(R.string.terms_conditions_));
|
||||
});
|
||||
|
||||
binding.privacy.setOnClickListener(v -> {
|
||||
AppUtil.openLink(this, getString(R.string.privacy_policy_link),
|
||||
getString(R.string.privacy_policy));
|
||||
});
|
||||
|
||||
binding.logout.setOnClickListener(v -> {
|
||||
AppUtil.showAlert(this,
|
||||
"Are you sure?", "Do you want to sign out?",
|
||||
getString(R.string.no),
|
||||
((dialogInterface, i) -> {}),
|
||||
getString(R.string.yes),
|
||||
((dialogInterface, i) -> {
|
||||
progressDialog.setTitle("Please wait...");
|
||||
progressDialog.setMessage("while we sign you out");
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
accountPresenter.signOut("Bearer " + AppUtil.getCgToken(this),
|
||||
this);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSignOutSuccess() {
|
||||
progressDialog.dismiss();
|
||||
|
||||
AppUtil.patientSignOut(this);
|
||||
|
||||
Intent intent = new Intent(this, WelcomeActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSignOutFailed(Throwable t, String message) {
|
||||
progressDialog.dismiss();
|
||||
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -145,13 +146,15 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
|
||||
private void setDetails() {
|
||||
if (patientData == null) return;
|
||||
|
||||
Glide.with(requireContext())
|
||||
.load(AppUtil.IMAGE_BASE_URL + patientData.profile_photo)
|
||||
.diskCacheStrategy(DiskCacheStrategy.DATA)
|
||||
.fitCenter()
|
||||
.placeholder(android.R.color.darker_gray)
|
||||
.error(R.drawable.senior_img)
|
||||
.into(binding.profile);
|
||||
if (patientData.profile_photo != null){
|
||||
Glide.with(requireContext())
|
||||
.load(AppUtil.IMAGE_BASE_URL + patientData.profile_photo)
|
||||
.diskCacheStrategy(DiskCacheStrategy.DATA)
|
||||
.fitCenter()
|
||||
.placeholder(android.R.color.darker_gray)
|
||||
.error(R.drawable.senior_img)
|
||||
.into(binding.profile);
|
||||
}
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
@@ -187,22 +190,24 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
|
||||
);
|
||||
|
||||
binding.sosBtn.setOnClickListener(v -> {
|
||||
// fake sign out
|
||||
PatientDataCache.getContactList(requireContext(),
|
||||
"Bearer " + AppUtil.getPatientToken(requireContext()), (contactList1 -> {
|
||||
this.contactList = contactList1;
|
||||
|
||||
// TODO: 08-08-2023 remove this
|
||||
viewModel.notifyRequestedSOS(AppUtil.getPatientUid(requireContext())+"",
|
||||
AppUtil.getPatientToken(requireContext()));
|
||||
viewModel.notifyRequestedSOS(AppUtil.getPatientUid(requireContext())+"",
|
||||
AppUtil.getPatientToken(requireContext()));
|
||||
|
||||
AppUtil.showAlert(requireContext(),
|
||||
"Test mode", "Do you want to log out?",
|
||||
"LOG OUT", ((dialogInterface, i) -> {
|
||||
AppUtil.patientSignOut(requireContext());
|
||||
String phone_number = "911";
|
||||
|
||||
Intent intent = new Intent(requireActivity(), WelcomeActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
}), "Cancel", ((dialogInterface, i) -> {}));
|
||||
for (ContactData contactData: contactList1){
|
||||
if (contactData.is_sos.equals("1")){
|
||||
phone_number = contactData.phone_number;
|
||||
}
|
||||
}
|
||||
|
||||
AppUtil.callPhone(requireActivity(), phone_number);
|
||||
|
||||
}), true);
|
||||
});
|
||||
|
||||
binding.closeReminder.setOnClickListener(v -> removeReminder());
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.ssb.simplitend.apputils.PatientDataCache;
|
||||
import com.ssb.simplitend.caregiverdashboard.activities.EditProfileInfoActivity;
|
||||
import com.ssb.simplitend.caregiverdashboard.activities.PatientProfileShowerActivity;
|
||||
import com.ssb.simplitend.databinding.ActivityPatProfileInfoBinding;
|
||||
import com.ssb.simplitend.patient_dashboard.PatSettingsActivity;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
|
||||
public class PatientProfileInfoFragment extends Fragment {
|
||||
@@ -115,6 +116,11 @@ public class PatientProfileInfoFragment extends Fragment {
|
||||
intent.putExtra(IS_FROM_PATIENT, true);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
binding.settings.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(requireActivity(), PatSettingsActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
|
||||
@@ -218,7 +218,7 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
|
||||
|
||||
binding.tncBtn.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("https://www.google.com"));
|
||||
intent.setData(Uri.parse(getString(R.string.terms_n_conditions_link)));
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
|
||||
|
||||
binding.tncBtn.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("https://www.google.com"));
|
||||
intent.setData(Uri.parse(getString(R.string.terms_n_conditions_link)));
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user