.
This commit is contained in:
@@ -2,7 +2,6 @@ package com.ssb.simplitend.apputils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
@@ -10,7 +9,6 @@ import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -28,10 +26,17 @@ public abstract class AppUtil {
|
||||
|
||||
// fields
|
||||
public static final String USER_DETAILS = "user_details";
|
||||
public static final String CAREGIVER_DETAILS = "user_details";
|
||||
public static final String CAREGIVER_DETAILS = "caregiver_details";
|
||||
|
||||
public static final String USER_TOKEN = "user_token";
|
||||
public static final String CAREGIVER_TOKEN = "user_token";
|
||||
public static final String CAREGIVER_TOKEN = "caregiver_token";
|
||||
|
||||
public static final String CG_APP_SECURITY = "cg_app_security";
|
||||
|
||||
public static final int NOT_ASKED_CG_SECURITY = 2;
|
||||
public static final int CG_NO_SECURITY_NEEDED = 3;
|
||||
public static final int CG_SECURITY_NEEDED = 4;
|
||||
|
||||
public static final String PATIENT_UID = "patient_uid";
|
||||
|
||||
// util functions
|
||||
@@ -167,4 +172,23 @@ public abstract class AppUtil {
|
||||
return sp.getString(CAREGIVER_TOKEN, null);
|
||||
}
|
||||
|
||||
public static void setWantSecurityFlag(Context context, int watSecurity){
|
||||
SharedPreferences sp = context.getSharedPreferences(CAREGIVER_DETAILS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
|
||||
editor.putInt(CG_APP_SECURITY, watSecurity);
|
||||
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static int getWantSecurityFlag(Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(CAREGIVER_DETAILS, Context.MODE_PRIVATE);
|
||||
return sp.getInt(CG_APP_SECURITY, NOT_ASKED_CG_SECURITY);
|
||||
}
|
||||
|
||||
public static void cgSignOut(Context context){
|
||||
saveCgData(null, context);
|
||||
setWantSecurityFlag(context, NOT_ASKED_CG_SECURITY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
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,5 +1,6 @@
|
||||
package com.ssb.simplitend.caregiverdashboard;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
@@ -13,10 +14,12 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.UserDataCache;
|
||||
import com.ssb.simplitend.caregiverdashboard.fragments.CaregiverChatsFragment;
|
||||
import com.ssb.simplitend.caregiverdashboard.fragments.DashBoardFragment;
|
||||
import com.ssb.simplitend.caregiverdashboard.fragments.MyPatientFragment;
|
||||
import com.ssb.simplitend.caregiverdashboard.mvvm.CaregiverMainViewModel;
|
||||
import com.ssb.simplitend.cg_subscription.CgSubscriptionActivity;
|
||||
import com.ssb.simplitend.customsviews.HomeBottomNav;
|
||||
import com.ssb.simplitend.customsviews.MenuItem;
|
||||
import com.ssb.simplitend.databinding.CaregiverDashboardActivityBinding;
|
||||
@@ -40,6 +43,17 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ssb.simplitend.cg_subscription;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
@@ -12,10 +13,13 @@ 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.caregiverdashboard.CaregiverDashActivity;
|
||||
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;
|
||||
@@ -50,6 +54,14 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
|
||||
presenter = SubscriptionPresenter.getPresenter();
|
||||
|
||||
// static
|
||||
AppUtil.showAlert(this,
|
||||
"Testing!",
|
||||
"Payment is in testing phase. So each time u open app it ill bring to subsription screen. This ill be updated in next build.",
|
||||
"Ok, got it.",
|
||||
((dialogInterface, i) -> {}),
|
||||
null, null);
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
@@ -63,6 +75,11 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
private void payForSubscription() {
|
||||
if (UserDataCache.careGiverData == null) {
|
||||
Toast.makeText(this, "Couldn't make payment", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
int position = binding.viewPager.getCurrentItem();
|
||||
if (subscriptionPlans == null || position < 0 || position >= subscriptionPlans.size()){
|
||||
Toast.makeText(this, "Couldn't load plan.", Toast.LENGTH_SHORT).show();
|
||||
@@ -78,10 +95,10 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
|
||||
Map<String, RequestBody> body = new HashMap<>();
|
||||
|
||||
RequestBody name_body = RequestBody.create("Aditya Gaikwad", MediaType.parse("text/plain"));
|
||||
RequestBody name_body = RequestBody.create(UserDataCache.careGiverData.first_name, MediaType.parse("text/plain"));
|
||||
body.put("name", name_body);
|
||||
|
||||
RequestBody email_body = RequestBody.create("test@gmail.com", MediaType.parse("text/plain"));
|
||||
RequestBody email_body = RequestBody.create(UserDataCache.careGiverData.email, MediaType.parse("text/plain"));
|
||||
body.put("email", email_body);
|
||||
|
||||
RequestBody price_body = RequestBody.create("595", MediaType.parse("text/plain"));
|
||||
@@ -90,7 +107,7 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
RequestBody subscription_xid_body = RequestBody.create("4", MediaType.parse("text/plain"));
|
||||
body.put("subscription_xid", subscription_xid_body);
|
||||
|
||||
RequestBody caregiver_xid_body = RequestBody.create("4", MediaType.parse("text/plain"));
|
||||
RequestBody caregiver_xid_body = RequestBody.create("" + UserDataCache.careGiverData.caregiver_xid, MediaType.parse("text/plain"));
|
||||
body.put("caregiver_xid", caregiver_xid_body);
|
||||
|
||||
String token = "Bearer " + AppUtil.getCgToken(this);
|
||||
@@ -137,8 +154,18 @@ public class CgSubscriptionActivity extends AppCompatActivity
|
||||
Toast.makeText(this, "Payment failed.", Toast.LENGTH_SHORT).show();
|
||||
} else if (paymentSheetResult instanceof PaymentSheetResult.Completed) {
|
||||
// Display for example, an order confirmation screen
|
||||
Log.d(TAG, "Completed");
|
||||
Log.d(TAG, "Payment successful");
|
||||
Toast.makeText(this, "Payment successful.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
// TODO: 11-08-2023 do the api call
|
||||
if (UserDataCache.careGiverData != null){
|
||||
UserDataCache.careGiverData.isCaregiverTakeSubscription = 1;
|
||||
|
||||
Intent intent = new Intent(this, CaregiverDashActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,8 +16,4 @@ public class SubscriptionPlan{
|
||||
|
||||
public SubscriptionPlan(){}
|
||||
|
||||
public SubscriptionPlan(String plan_name, String plan_value) {
|
||||
this.plan_name = plan_name;
|
||||
this.plan_value = plan_value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
|
||||
if (profile_progress == 4){
|
||||
btn_text = "Proceed";
|
||||
}else{
|
||||
btn_text = "Skip";
|
||||
btn_text = "Skip to dashboard";
|
||||
}
|
||||
|
||||
binding.proceed.setText(btn_text);
|
||||
|
||||
@@ -11,6 +11,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.daimajia.androidanimations.library.Techniques;
|
||||
import com.daimajia.androidanimations.library.YoYo;
|
||||
import com.ssb.simplitend.R;
|
||||
@@ -27,7 +33,7 @@ public class RegisterCompleteFragment extends Fragment {
|
||||
|
||||
int profile_progress, is_connect_to_caregiver;
|
||||
|
||||
public RegisterCompleteFragment(){
|
||||
public RegisterCompleteFragment() {
|
||||
// required
|
||||
}
|
||||
|
||||
@@ -36,47 +42,33 @@ public class RegisterCompleteFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = RegisterationDoneFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
if (getArguments() != null){
|
||||
if (getArguments() != null) {
|
||||
profile_progress = getArguments().getInt(PROFILE_PROGRESS, 20);
|
||||
is_connect_to_caregiver = getArguments().getInt(IS_CONNECTED_TO_CG, 0);
|
||||
}
|
||||
|
||||
binding.animIv.setAnimation(R.raw.done_anim_2);
|
||||
binding.animIv.playAnimation();
|
||||
Glide.with(requireContext())
|
||||
.asGif()
|
||||
.load(R.raw.filling_anim)
|
||||
.listener(new RequestListener<GifDrawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) {
|
||||
return false;
|
||||
}
|
||||
|
||||
binding.animIv.addAnimatorListener(new Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(@NonNull Animator animator) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(@NonNull Animator animator) {
|
||||
|
||||
String title = "Your profile is " + (profile_progress * 20) + "% complete!";
|
||||
|
||||
binding.title.setText(title);
|
||||
YoYo.with(Techniques.FadeIn)
|
||||
.duration(100)
|
||||
.playOn(binding.title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(@NonNull Animator animator) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(@NonNull Animator animator) {
|
||||
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) {
|
||||
resource.setLoopCount(1);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(binding.animIv);
|
||||
|
||||
binding.proceed.setOnClickListener(v -> {
|
||||
|
||||
if (is_connect_to_caregiver == 1){
|
||||
if (is_connect_to_caregiver == 1) {
|
||||
gotoPatientDashBoard();
|
||||
}else {
|
||||
} else {
|
||||
AppUtil.showAlert(requireContext(),
|
||||
"Ask Caregiver to register",
|
||||
"Kindly ask CareGiver to complete registeration.",
|
||||
@@ -97,3 +89,34 @@ public class RegisterCompleteFragment extends Fragment {
|
||||
requireActivity().finish();
|
||||
}
|
||||
}
|
||||
|
||||
//binding.animIv.setAnimation(R.raw.done_anim_2);
|
||||
// binding.animIv.playAnimation();
|
||||
//
|
||||
// binding.animIv.addAnimatorListener(new Animator.AnimatorListener() {
|
||||
//@Override
|
||||
//public void onAnimationStart(@NonNull Animator animator) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
//@Override
|
||||
//public void onAnimationEnd(@NonNull Animator animator) {
|
||||
//
|
||||
// String title = "Your profile is " + (profile_progress * 20) + "% complete!";
|
||||
//
|
||||
// binding.title.setText(title);
|
||||
// YoYo.with(Techniques.FadeIn)
|
||||
// .duration(100)
|
||||
// .playOn(binding.title);
|
||||
// }
|
||||
//
|
||||
//@Override
|
||||
//public void onAnimationCancel(@NonNull Animator animator) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
//@Override
|
||||
//public void onAnimationRepeat(@NonNull Animator animator) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
@@ -42,4 +42,7 @@ public interface WelcomeApiService {
|
||||
@POST("api/auth/patient-caregiver-connect")
|
||||
Call<CallResponse<ConnectCgResult>> connectCg(@Body Map<String, String> body);
|
||||
|
||||
@GET("api/caregiver-user-data")
|
||||
Call<CallResponse<CareGiverData>> getCgUserData(@Header("Authorization") String token);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public interface WelcomeContracts {
|
||||
|
||||
interface RegisterCareGiverCallback{
|
||||
|
||||
void onCareGiverRegistered(CareGiverData careGiverData);
|
||||
void onCareGiverRegistered(CareGiverData careGiverData, String token);
|
||||
|
||||
void onRegisterFailed(Throwable t, String message);
|
||||
|
||||
@@ -52,4 +52,12 @@ public interface WelcomeContracts {
|
||||
|
||||
}
|
||||
|
||||
interface CgGetUserDataCallback{
|
||||
|
||||
void onCgDataFetched(CareGiverData careGiverData);
|
||||
|
||||
void onCgDataFetchFailed(Throwable t, String message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.ssb.simplitend.welcome.welcomecg.fragments;
|
||||
|
||||
import static android.hardware.biometrics.BiometricManager.Authenticators.BIOMETRIC_WEAK;
|
||||
import static android.hardware.biometrics.BiometricManager.Authenticators.DEVICE_CREDENTIAL;
|
||||
import static androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_STRONG;
|
||||
|
||||
import android.content.Intent;
|
||||
@@ -10,7 +8,6 @@ import android.provider.Settings;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -38,6 +35,19 @@ public class CgAuthActivity extends AppCompatActivity {
|
||||
binding = CgAuthFragmentBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
int cg_security = AppUtil.getWantSecurityFlag(this);
|
||||
|
||||
if (cg_security == AppUtil.NOT_ASKED_CG_SECURITY){
|
||||
// user has never been asked to setup security
|
||||
// thus, showing that ui
|
||||
binding.notAsked.setVisibility(View.VISIBLE);
|
||||
binding.askedView.setVisibility(View.GONE);
|
||||
}else{
|
||||
// user was asked already
|
||||
binding.notAsked.setVisibility(View.GONE);
|
||||
binding.askedView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
@@ -46,10 +56,18 @@ public class CgAuthActivity extends AppCompatActivity {
|
||||
|
||||
private void clickEvents() {
|
||||
binding.fingerprintView.setOnClickListener(v -> {
|
||||
|
||||
authenticateBiometrics();
|
||||
|
||||
});
|
||||
|
||||
binding.setUpFingerprint.setOnClickListener(v -> {
|
||||
authenticateBiometrics();
|
||||
});
|
||||
|
||||
binding.skip.setOnClickListener(v -> {
|
||||
AppUtil.setWantSecurityFlag(this, AppUtil.CG_NO_SECURITY_NEEDED);
|
||||
gotoCgDash();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
@@ -66,6 +84,7 @@ public class CgAuthActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) {
|
||||
super.onAuthenticationSucceeded(result);
|
||||
AppUtil.setWantSecurityFlag(CgAuthActivity.this, AppUtil.CG_SECURITY_NEEDED);
|
||||
gotoCgDash();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,10 @@ public class CgChangePwdFragment extends Fragment implements WelcomeContracts.Ch
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
binding.backBtn.setOnClickListener(view -> {
|
||||
requireActivity().onBackPressed();
|
||||
});
|
||||
|
||||
binding.resetPin.setOnClickListener(v -> {
|
||||
if (allOkay()) {
|
||||
changePassword();
|
||||
|
||||
@@ -81,6 +81,11 @@ public class CgCheckEmailFragment extends Fragment implements WelcomeContracts.F
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(view -> {
|
||||
requireActivity().onBackPressed();
|
||||
});
|
||||
|
||||
binding.submit.setOnClickListener(view -> {
|
||||
if (checkOTPInputs()){
|
||||
verifyOTP();
|
||||
|
||||
@@ -33,7 +33,6 @@ public class CgConnectFragment extends Fragment implements WelcomeContracts.Conn
|
||||
protected ConnectCaregiverFragmentBinding binding;
|
||||
|
||||
public static final String CAREGIVER_EMAIL = "cg_email";
|
||||
public static final String CAREGIVER_PASSWORD = "caregiver_pwd";
|
||||
|
||||
private String cg_email;
|
||||
|
||||
@@ -147,7 +146,7 @@ public class CgConnectFragment extends Fragment implements WelcomeContracts.Conn
|
||||
Toast.makeText(requireContext(), "Caregiver connected.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
// go to cg dash board
|
||||
Intent intent = new Intent(requireActivity(), CaregiverDashActivity.class);
|
||||
Intent intent = new Intent(requireActivity(), CgAuthActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
|
||||
@@ -58,6 +58,10 @@ public class CgForgotPasswordFragment extends Fragment implements WelcomeContrac
|
||||
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(view -> {
|
||||
requireActivity().onBackPressed();
|
||||
});
|
||||
|
||||
binding.submit.setOnClickListener(v -> {
|
||||
|
||||
if (!Patterns.EMAIL_ADDRESS.matcher(binding.emailAddress.getText().toString().trim()).matches()){
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.ssb.simplitend.welcome.welcomecg.fragments;
|
||||
|
||||
import static com.ssb.simplitend.welcome.welcomecg.fragments.CgConnectFragment.CAREGIVER_EMAIL;
|
||||
import static com.ssb.simplitend.welcome.welcomecg.fragments.CgConnectFragment.CAREGIVER_PASSWORD;
|
||||
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.ProgressDialog;
|
||||
@@ -423,9 +422,11 @@ public class CgRegisterFragment extends Fragment implements WelcomeContracts.Reg
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCareGiverRegistered(CareGiverData careGiverData) {
|
||||
public void onCareGiverRegistered(CareGiverData careGiverData, String token) {
|
||||
Toast.makeText(requireContext(), "Caregiver registered successfully.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
AppUtil.saveCgData(token, requireContext());
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(CAREGIVER_EMAIL, careGiverData.email);
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.ssb.simplitend.welcome.welcomecg.fragments;
|
||||
|
||||
import static com.ssb.simplitend.welcome.welcomecg.fragments.CgConnectFragment.CAREGIVER_EMAIL;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
@@ -17,6 +19,8 @@ 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.caregiverdashboard.CaregiverDashActivity;
|
||||
import com.ssb.simplitend.databinding.CgSignInFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.welcomecg.WelcomeContracts;
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
@@ -112,35 +116,51 @@ public class CgSignInFragment extends Fragment implements WelcomeContracts.CgLog
|
||||
return allOkay;
|
||||
}
|
||||
|
||||
private void gotoCgAuthActivity() {
|
||||
Intent intent = new Intent(requireActivity(), CgAuthActivity.class);
|
||||
private void gotoDashboard() {
|
||||
int cg_app_security = AppUtil.getWantSecurityFlag(requireContext());
|
||||
|
||||
Intent intent;
|
||||
if (cg_app_security == AppUtil.CG_NO_SECURITY_NEEDED){
|
||||
// caregiver user has chosen to not use security
|
||||
intent = new Intent(requireActivity(), CaregiverDashActivity.class);
|
||||
|
||||
}else{
|
||||
// caregiver user has asked to for security
|
||||
intent = new Intent(requireActivity(), CgAuthActivity.class);
|
||||
}
|
||||
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
|
||||
requireActivity().finish();
|
||||
}
|
||||
|
||||
private void gotoCgConnect() {
|
||||
private void gotoCgConnect(String email) {
|
||||
NavOptions navOptions = new NavOptions.Builder()
|
||||
.setPopUpTo(R.id.welcomeFragment, true)
|
||||
.build();
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(CAREGIVER_EMAIL, email);
|
||||
|
||||
// goto cg connect screen
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_cgSignInFragment_to_cgConnectFragment, null, navOptions);
|
||||
.navigate(R.id.action_cgSignInFragment_to_cgConnectFragment, bundle, navOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginSuccess(CareGiverData careGiverData, String token) {
|
||||
// caching user data
|
||||
UserDataCache.careGiverData = careGiverData;
|
||||
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(requireContext(), "Log in success.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
AppUtil.saveCgData(token, requireContext());
|
||||
|
||||
if (careGiverData.isPatientLinkedAndConnected == 1){
|
||||
gotoCgAuthActivity();
|
||||
if (careGiverData.isPatientAndCareGiverConnected == 1){
|
||||
gotoDashboard();
|
||||
}else{
|
||||
gotoCgConnect();
|
||||
gotoCgConnect(careGiverData.email);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public class CareGiverData{
|
||||
public int is_patient;
|
||||
public int is_caregiver;
|
||||
public int is_caregiver_account_updated;
|
||||
public int isPatientLinkedAndConnected;
|
||||
public int isPatientAndCareGiverConnected, isCaregiverTakeSubscription;
|
||||
public int caregiver_xid;
|
||||
public String is_admin;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class CgWelcomeRepository {
|
||||
return;
|
||||
}
|
||||
|
||||
registerCareGiverCallback.onCareGiverRegistered(response.body().result);
|
||||
registerCareGiverCallback.onCareGiverRegistered(response.body().result, response.body().token);
|
||||
}else{
|
||||
registerCareGiverCallback.onRegisterFailed(new Exception(), "Please try again later.");
|
||||
}
|
||||
|
||||
@@ -21,11 +21,12 @@ 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.patient_dashboard.DashBoardActivity;
|
||||
import com.ssb.simplitend.databinding.SignInFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.WelcomeContracts;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.WelcomeViewModel;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientResult;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -149,7 +150,10 @@ public class SignInFragment extends Fragment implements WelcomeContracts.Registe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(PatientResult patientResult, String token) {
|
||||
public void onResponse(PatientData patientResult, String token) {
|
||||
// caching user data
|
||||
UserDataCache.patientData = patientResult;
|
||||
|
||||
progressDialog.dismiss();
|
||||
|
||||
progressDialog.setMessage("Almost there...");
|
||||
@@ -160,20 +164,15 @@ public class SignInFragment extends Fragment implements WelcomeContracts.Registe
|
||||
|
||||
Toast.makeText(requireContext(), "Log in successful.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
if (patientResult.patientData != null){
|
||||
if (patientResult.patientData.isCareGiverConnectedWithPatient == 1){
|
||||
// connected to caregiver
|
||||
// thus, sending it to dashboard
|
||||
Intent intent = new Intent(requireActivity(), DashBoardActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
} else if (patientResult.patientData.isCareGiverLink == 1){
|
||||
gotoProfileProgress();
|
||||
}else{
|
||||
// no patient data or no caregiver contact yet added thus sending to contact list
|
||||
gotoContactList();
|
||||
}
|
||||
if (patientResult.isCareGiverConnectedWithPatient == 1){
|
||||
// connected to caregiver
|
||||
// thus, sending it to dashboard
|
||||
Intent intent = new Intent(requireActivity(), DashBoardActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
} else if (patientResult.isCareGiverLink == 1){
|
||||
gotoProfileProgress();
|
||||
}else{
|
||||
// no patient data or no caregiver contact yet added thus sending to contact list
|
||||
gotoContactList();
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.ssb.simplitend.databinding.CreatePinFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.WelcomeContracts;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.WelcomeViewModel;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientResult;
|
||||
|
||||
public class CreatePinFragment extends Fragment implements WelcomeContracts.RegisterPatientContract {
|
||||
|
||||
@@ -150,7 +149,7 @@ public class CreatePinFragment extends Fragment implements WelcomeContracts.Regi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(PatientResult patientResult, String token) {
|
||||
public void onResponse(PatientData patientResult, String token) {
|
||||
Log.d(TAG, "onResponse: " + patientResult);
|
||||
Log.d(TAG, "onResponse: Token " + token);
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ 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.EditTextErrorRemover;
|
||||
import com.ssb.simplitend.databinding.RegisterFragmentBinding;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.WelcomeContracts;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.WelcomeViewModel;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.ssb.simplitend.welcome.welcomepatient.fragments.register;
|
||||
|
||||
import static com.ssb.simplitend.welcome.welcomecg.fragments.CgConnectFragment.CAREGIVER_EMAIL;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -16,10 +18,16 @@ 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.caregiverdashboard.CaregiverDashActivity;
|
||||
import com.ssb.simplitend.databinding.SplashFragmentBinding;
|
||||
import com.ssb.simplitend.patient_dashboard.DashBoardActivity;
|
||||
import com.ssb.simplitend.patientprofile.PatientProfileAPIService;
|
||||
import com.ssb.simplitend.patientprofile.ProfileContracts;
|
||||
import com.ssb.simplitend.welcome.welcomecg.WelcomeApiService;
|
||||
import com.ssb.simplitend.welcome.welcomecg.WelcomeContracts;
|
||||
import com.ssb.simplitend.welcome.welcomecg.fragments.CgAuthActivity;
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
|
||||
@@ -27,7 +35,9 @@ import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class SplashFragment extends Fragment implements ProfileContracts.ProfileProgressCallback{
|
||||
public class SplashFragment extends Fragment
|
||||
implements ProfileContracts.ProfileProgressCallback,
|
||||
WelcomeContracts.CgGetUserDataCallback {
|
||||
|
||||
// view binding
|
||||
protected SplashFragmentBinding binding;
|
||||
@@ -54,14 +64,16 @@ public class SplashFragment extends Fragment implements ProfileContracts.Profile
|
||||
binding.retry.setVisibility(View.GONE);
|
||||
binding.loadAnim.setVisibility(View.VISIBLE);
|
||||
|
||||
String token = AppUtil.getUserToken(requireContext());
|
||||
if (token != null && !token.isEmpty()){
|
||||
String patient_token = AppUtil.getUserToken(requireContext());
|
||||
String cg_token = AppUtil.getCgToken(requireContext());
|
||||
|
||||
if (patient_token != null && !patient_token.isEmpty()){
|
||||
// user is already logged in as PATIENT
|
||||
// thus, checking if the logged in PATIENT has already added CAREGIVER
|
||||
|
||||
PatientProfileAPIService apiService = RetrofitHelper.getRetrofit().create(PatientProfileAPIService.class);
|
||||
|
||||
apiService.getUsrProfileProgress("Bearer " + token)
|
||||
apiService.getUsrProfileProgress("Bearer " + patient_token)
|
||||
.enqueue(new Callback<CallResponse<PatientData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<PatientData>> call, Response<CallResponse<PatientData>> response) {
|
||||
@@ -83,13 +95,39 @@ public class SplashFragment extends Fragment implements ProfileContracts.Profile
|
||||
}
|
||||
});
|
||||
|
||||
}else if (cg_token != null){
|
||||
|
||||
WelcomeApiService welcomeApiService = RetrofitHelper.getRetrofit().create(WelcomeApiService.class);
|
||||
|
||||
welcomeApiService.getCgUserData("Bearer " + cg_token)
|
||||
.enqueue(new Callback<CallResponse<CareGiverData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<CareGiverData>> call, Response<CallResponse<CareGiverData>> response) {
|
||||
if (response.body() != null) {
|
||||
if (response.body().status != 200 || response.body().result == null) {
|
||||
onCgDataFetchFailed(new Exception(), response.body().message);
|
||||
return;
|
||||
}
|
||||
|
||||
onCgDataFetched(response.body().result);
|
||||
} else {
|
||||
onCgDataFetchFailed(new Exception(), "Please try again later.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CallResponse<CareGiverData>> call, Throwable t) {
|
||||
onCgDataFetchFailed(new Exception(), "Please try again later.");
|
||||
}
|
||||
});
|
||||
|
||||
}else{
|
||||
// no user has logged in
|
||||
gotoWelcomeFragment();
|
||||
}
|
||||
}
|
||||
|
||||
private void gotoProfileProgress(){
|
||||
private void gotoPatientProfileProgress(){
|
||||
NavOptions navOptions = new NavOptions.Builder()
|
||||
.setPopUpTo(R.id.splashFragment, true)
|
||||
.build();
|
||||
@@ -107,18 +145,88 @@ public class SplashFragment extends Fragment implements ProfileContracts.Profile
|
||||
.navigate(R.id.action_splashFragment_to_welcomeFragment, null, navOptions);
|
||||
}
|
||||
|
||||
private void gotoPatientDashBoard() {
|
||||
Intent intent = new Intent(requireActivity(), DashBoardActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
}
|
||||
|
||||
private void gotoCgAuthScreen(){
|
||||
Intent intent = new Intent(requireActivity(), CgAuthActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
}
|
||||
|
||||
private void gotoCgDashBoard(){
|
||||
Intent intent = new Intent(requireActivity(), CaregiverDashActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
}
|
||||
|
||||
// get cg user data callback
|
||||
@Override
|
||||
public void onCgDataFetched(CareGiverData careGiverData) {
|
||||
// caching data
|
||||
UserDataCache.careGiverData = careGiverData;
|
||||
|
||||
binding.retry.setVisibility(View.GONE);
|
||||
binding.loadAnim.setVisibility(View.GONE);
|
||||
|
||||
if (careGiverData.isPatientAndCareGiverConnected == 1){
|
||||
// patient is linked with the caregiver
|
||||
int cg_security = AppUtil.getWantSecurityFlag(requireContext());
|
||||
|
||||
if (cg_security == AppUtil.NOT_ASKED_CG_SECURITY){
|
||||
// user want their app to be secure
|
||||
gotoCgAuthScreen();
|
||||
}else{
|
||||
// user does not want the security
|
||||
gotoCgDashBoard();
|
||||
}
|
||||
|
||||
}else{
|
||||
// patient is not linked with the caregiver
|
||||
// thus, sending it to the cg connect screen
|
||||
NavOptions navOptions = new NavOptions.Builder()
|
||||
.setPopUpTo(R.id.splashFragment, true)
|
||||
.build();
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(CAREGIVER_EMAIL, careGiverData.email);
|
||||
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_splashFragment_to_cgConnectFragment, bundle, navOptions);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCgDataFetchFailed(Throwable t, String message) {
|
||||
Toast.makeText(requireContext(), "Couldn't connect.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
binding.retry.setVisibility(View.VISIBLE);
|
||||
binding.loadAnim.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// get patient user data callback
|
||||
@Override
|
||||
public void onProfileProgressFetched(PatientData patientData) {
|
||||
// caching data
|
||||
UserDataCache.patientData = patientData;
|
||||
|
||||
binding.retry.setVisibility(View.GONE);
|
||||
binding.loadAnim.setVisibility(View.GONE);
|
||||
|
||||
if (patientData.isCareGiverConnectedWithPatient == 1){
|
||||
// go to dashboard
|
||||
gotoDashBoard();
|
||||
gotoPatientDashBoard();
|
||||
}else if (patientData.isCareGiverLink == 1){
|
||||
// user has already added caregiver as a contact
|
||||
// thus, sending it to dashboard
|
||||
gotoProfileProgress();
|
||||
gotoPatientProfileProgress();
|
||||
}else{
|
||||
// user has not added caregiver contact.
|
||||
// thus, sending it to contact list to add caregiver contact.
|
||||
@@ -131,13 +239,6 @@ public class SplashFragment extends Fragment implements ProfileContracts.Profile
|
||||
}
|
||||
}
|
||||
|
||||
private void gotoDashBoard() {
|
||||
Intent intent = new Intent(requireActivity(), DashBoardActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileProgressFetchFailed(Throwable t, String message) {
|
||||
|
||||
|
||||
@@ -11,9 +11,13 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.ImageViewTarget;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.ThankYouFragmentBinding;
|
||||
|
||||
@@ -43,6 +47,18 @@ public class ThankYouFragment extends Fragment {
|
||||
Glide.with(requireContext())
|
||||
.asGif()
|
||||
.load(R.raw.done_anim)
|
||||
.listener(new RequestListener<GifDrawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) {
|
||||
resource.setLoopCount(1);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(binding.animIv);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.ssb.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.models.
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.OTPSentResponse;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -27,14 +26,14 @@ public interface WelcomeApiService {
|
||||
|
||||
@Multipart
|
||||
@POST("api/auth/patient-register")
|
||||
Call<CallResponse<PatientResult>> registerPatient(@PartMap Map<String, RequestBody> body);
|
||||
Call<CallResponse<PatientData>> registerPatient(@PartMap Map<String, RequestBody> body);
|
||||
|
||||
@Multipart
|
||||
@POST("api/auth/patient-login")
|
||||
Call<CallResponse<PatientResult>> loginPatient(@PartMap Map<String, RequestBody> credentials);
|
||||
Call<CallResponse<PatientData>> loginPatient(@PartMap Map<String, RequestBody> credentials);
|
||||
|
||||
@POST("api/auth/verify-patient-exists")
|
||||
Call<CallResponse<PatientResult>> verifyEmail(@Body Map<String, String> body);
|
||||
Call<CallResponse<PatientData>> verifyEmail(@Body Map<String, String> body);
|
||||
|
||||
@Multipart
|
||||
@POST
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.ssb.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.Contact
|
||||
import com.ssb.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.models.ContactListResponse;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.OTPSentResponse;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -12,7 +11,7 @@ public interface WelcomeContracts {
|
||||
|
||||
interface RegisterPatientContract{
|
||||
|
||||
void onResponse(PatientResult patientResult, String token);
|
||||
void onResponse(PatientData patientResult, String token);
|
||||
|
||||
void onFailure(Throwable t, String message, int error_code);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import androidx.annotation.NonNull;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.OTPSentResponse;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -42,9 +41,9 @@ public class WelcomeRepository {
|
||||
public void loginPatient(@NonNull Map<String, RequestBody> credentials,
|
||||
@NonNull WelcomeContracts.RegisterPatientContract loginCallback){
|
||||
|
||||
welcomeApiService.loginPatient(credentials).enqueue(new Callback<CallResponse<PatientResult>>() {
|
||||
welcomeApiService.loginPatient(credentials).enqueue(new Callback<CallResponse<PatientData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<PatientResult>> call, Response<CallResponse<PatientResult>> response) {
|
||||
public void onResponse(Call<CallResponse<PatientData>> call, Response<CallResponse<PatientData>> response) {
|
||||
if (response.body() != null){
|
||||
if (response.body().status != 200 || response.body().result == null){
|
||||
loginCallback.onFailure(new Exception(), response.body().message, response.body().status);
|
||||
@@ -58,7 +57,7 @@ public class WelcomeRepository {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CallResponse<PatientResult>> call, Throwable t) {
|
||||
public void onFailure(Call<CallResponse<PatientData>> call, Throwable t) {
|
||||
Log.e(TAG, "onFailure: login patient", t);
|
||||
loginCallback.onFailure(t, t.getMessage(), 1);
|
||||
}
|
||||
@@ -71,9 +70,9 @@ public class WelcomeRepository {
|
||||
|
||||
|
||||
|
||||
welcomeApiService.registerPatient(body).enqueue(new Callback<CallResponse<PatientResult>>() {
|
||||
welcomeApiService.registerPatient(body).enqueue(new Callback<CallResponse<PatientData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<PatientResult>> call, Response<CallResponse<PatientResult>> response) {
|
||||
public void onResponse(Call<CallResponse<PatientData>> call, Response<CallResponse<PatientData>> response) {
|
||||
if (response.isSuccessful() && response.body() != null && response.body().result != null)
|
||||
{
|
||||
registerPatient.onResponse(response.body().result, response.body().token);
|
||||
@@ -87,7 +86,7 @@ public class WelcomeRepository {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CallResponse<PatientResult>> call, Throwable t) {
|
||||
public void onFailure(Call<CallResponse<PatientData>> call, Throwable t) {
|
||||
Log.e(TAG, "onFailure: ", t);
|
||||
registerPatient.onFailure(t, t.getMessage(), 1);
|
||||
}
|
||||
@@ -97,9 +96,9 @@ public class WelcomeRepository {
|
||||
|
||||
public void verifyEmail(Map<String, String> email_address, WelcomeContracts.VerifyEmailCallBack emailCallBack){
|
||||
|
||||
welcomeApiService.verifyEmail(email_address).enqueue(new Callback<CallResponse<PatientResult>>() {
|
||||
welcomeApiService.verifyEmail(email_address).enqueue(new Callback<CallResponse<PatientData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<PatientResult>> call, Response<CallResponse<PatientResult>> response) {
|
||||
public void onResponse(Call<CallResponse<PatientData>> call, Response<CallResponse<PatientData>> response) {
|
||||
Log.d(TAG, "onResponse: ");
|
||||
if (response.isSuccessful() && response.body() != null){
|
||||
// error_cede
|
||||
@@ -112,7 +111,7 @@ public class WelcomeRepository {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CallResponse<PatientResult>> call, Throwable t) {
|
||||
public void onFailure(Call<CallResponse<PatientData>> call, Throwable t) {
|
||||
Log.e(TAG, "onFailure: verify email ", t);
|
||||
emailCallBack.onVerificationFailed();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ public class PatientData {
|
||||
public String updated_at;
|
||||
public String created_at;
|
||||
public int id;
|
||||
public int patientId;
|
||||
|
||||
// for payload purpose
|
||||
public String pin_code, c_pin_code;
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.ssb.simplitend.welcome.welcomepatient.mvvm.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PatientResult {
|
||||
@SerializedName("PatientData")
|
||||
public PatientData patientData;
|
||||
public int patientId;
|
||||
|
||||
public PatientResult(){}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PatientResult{" +
|
||||
"patientData=" + patientData +
|
||||
", patientId=" + patientId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
BIN
app/src/main/res/drawable/ic_fingerprint.png
Normal file
BIN
app/src/main/res/drawable/ic_fingerprint.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
@@ -1,120 +1,238 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"
|
||||
android:background="@color/white_bg">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@color/white">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/not_asked"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/_150sdp"
|
||||
android:layout_height="@dimen/_150sdp"
|
||||
android:src="@drawable/welcome_img"
|
||||
android:contentDescription="@string/welcome_illustration"
|
||||
android:layout_marginTop="30dp"/>
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/skip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/welcome_to_simplitend"
|
||||
android:fontFamily="@font/nunito_semibold"
|
||||
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
|
||||
android:layout_marginBottom="15dp"
|
||||
|
||||
|
||||
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:text="@string/skip"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_24ssp"
|
||||
android:textAlignment="center"
|
||||
/>
|
||||
android:textSize="@dimen/_16ssp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/security_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sign_in_to_continue"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
|
||||
android:text="@string/security"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
android:textAlignment="center"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/pin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:background="@drawable/edit_text_bg_3"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="@dimen/_35sdp"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:paddingVertical="10dp"
|
||||
|
||||
android:hint="@string/enter_login_pin"
|
||||
android:textColor="@color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
android:layout_gravity="start"
|
||||
|
||||
android:maxLength="4"
|
||||
|
||||
android:drawableStart="@drawable/ic_lock"
|
||||
android:drawablePadding="15dp"
|
||||
|
||||
android:autofillHints="password"
|
||||
android:inputType="numberPassword"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fingerprint_or"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/or"
|
||||
android:fontFamily="@font/nunito_semibold"
|
||||
android:text="@string/to_enhance_the_security_of_your_account_please_add_biometric_authentication_using_either_face_id_or_fingerprint"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
android:textSize="@dimen/_16ssp"
|
||||
|
||||
android:layout_marginVertical="@dimen/_15sdp"
|
||||
android:layout_below="@id/security_title"
|
||||
|
||||
android:layout_margin="15dp"
|
||||
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fingerprint_view"
|
||||
android:visibility="visible"
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/set_up_fingerprint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
|
||||
android:background="@drawable/edit_text_bg_3"
|
||||
app:cardElevation="5dp"
|
||||
app:strokeWidth="1dp"
|
||||
app:strokeColor="@color/color_accent"
|
||||
|
||||
android:gravity="center_vertical"
|
||||
app:cardCornerRadius="15dp"
|
||||
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="15dp"
|
||||
android:gravity="center_vertical"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/_60sdp"
|
||||
android:layout_height="@dimen/_60sdp"
|
||||
|
||||
app:srcCompat="@drawable/ic_fingerprint"
|
||||
android:contentDescription="@string/unlock_with_fingerprint"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/setup_with_fingerprint_or_faceid"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_16ssp"
|
||||
|
||||
android:layout_marginHorizontal="20dp"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/asked_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never"
|
||||
android:visibility="gone"
|
||||
android:background="@color/white_bg">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/_25sdp"
|
||||
android:layout_height="@dimen/_25sdp"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginVertical="15dp"
|
||||
|
||||
android:src="@drawable/ic_info"
|
||||
android:layout_width="@dimen/_150sdp"
|
||||
android:layout_height="@dimen/_150sdp"
|
||||
android:src="@drawable/welcome_img"
|
||||
android:contentDescription="@string/welcome_illustration"
|
||||
android:layout_marginTop="30dp"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/welcome_to_simplitend"
|
||||
android:fontFamily="@font/nunito_semibold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_24ssp"
|
||||
android:textAlignment="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sign_in_to_continue"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
android:textAlignment="center"
|
||||
/>
|
||||
|
||||
android:text="@string/unlock_with_fingerprint"
|
||||
<EditText
|
||||
android:id="@+id/pin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:background="@drawable/edit_text_bg_3"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="@dimen/_35sdp"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:paddingVertical="10dp"
|
||||
|
||||
android:hint="@string/enter_login_pin"
|
||||
android:textColor="@color/black"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
|
||||
android:maxLength="4"
|
||||
|
||||
android:drawableStart="@drawable/ic_lock"
|
||||
android:drawablePadding="15dp"
|
||||
|
||||
android:autofillHints="password"
|
||||
android:inputType="numberPassword"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fingerprint_or"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/or"
|
||||
android:fontFamily="@font/nunito_semibold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_14ssp"/>
|
||||
android:textSize="@dimen/_18ssp"
|
||||
|
||||
android:layout_marginVertical="@dimen/_15sdp"
|
||||
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fingerprint_view"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
|
||||
android:background="@drawable/edit_text_bg_3"
|
||||
|
||||
android:gravity="center_vertical"
|
||||
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/_25sdp"
|
||||
android:layout_height="@dimen/_25sdp"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginVertical="15dp"
|
||||
|
||||
android:src="@drawable/ic_info"
|
||||
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/unlock_with_fingerprint"
|
||||
android:fontFamily="@font/nunito_semibold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_14ssp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
||||
@@ -45,7 +45,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
tools:text="A temporary pin will be sent to the registered email address (s***@ Si***.com) and phone number (+1732***88)"
|
||||
android:text="@string/a_temporary_pin_will_be_sent_to_the_registered_email_address"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
android:fontFamily="@font/nunito_regular"
|
||||
android:layout_marginVertical="5dp"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
<ImageView
|
||||
android:id="@+id/anim_iv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/_215sdp"
|
||||
|
||||
@@ -207,6 +207,9 @@
|
||||
<action
|
||||
android:id="@+id/action_splashFragment_to_profileProgressFragment"
|
||||
app:destination="@id/profileProgressFragment" />
|
||||
<action
|
||||
android:id="@+id/action_splashFragment_to_cgConnectFragment"
|
||||
app:destination="@id/cgConnectFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/medicalInfoFragment"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 741 KiB After Width: | Height: | Size: 389 KiB |
BIN
app/src/main/res/raw/filling_anim.gif
Normal file
BIN
app/src/main/res/raw/filling_anim.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
@@ -303,5 +303,9 @@
|
||||
<string name="real_time_alerts_and_notifications">Real-time alerts and notifications</string>
|
||||
<string name="setup_geo_fence_zone">Setup geo-fence zone</string>
|
||||
<string name="retry"><u>Retry</u></string>
|
||||
<string name="a_temporary_pin_will_be_sent_to_the_registered_email_address">A temporary pin will be sent to the registered email address.</string>
|
||||
<string name="security">Security</string>
|
||||
<string name="to_enhance_the_security_of_your_account_please_add_biometric_authentication_using_either_face_id_or_fingerprint">To enhance the security of your account, please add biometric authentication using either Face ID or Fingerprint.</string>
|
||||
<string name="setup_with_fingerprint_or_faceid">Setup security</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user