.
This commit is contained in:
@@ -162,4 +162,9 @@ public abstract class AppUtil {
|
||||
|
||||
}
|
||||
|
||||
public static String getCgToken(Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(CAREGIVER_DETAILS, Context.MODE_PRIVATE);
|
||||
return sp.getString(CAREGIVER_TOKEN, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
package com.ssb.simplitend.cg_subscription;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
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.stripe.android.PaymentConfiguration;
|
||||
import com.stripe.android.paymentsheet.PaymentSheet;
|
||||
import com.stripe.android.paymentsheet.PaymentSheetResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
public class CgSubscriptionActivity extends AppCompatActivity
|
||||
implements SubscriptionContracts.GetSubPlansCallback, SubscriptionContracts.PaySubscriptionCallback {
|
||||
|
||||
private static final String TAG = "CgSubscriptionActivity";
|
||||
|
||||
private CgSubscriptionLayoutBinding binding;
|
||||
|
||||
private ArrayList<SubscriptionPlan> subscriptionPlans;
|
||||
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
private SubscriptionPresenter presenter;
|
||||
|
||||
private PaymentSheet paymentSheet;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = CgSubscriptionLayoutBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
presenter = SubscriptionPresenter.getPresenter();
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
binding.makePayment.setOnClickListener(view -> {
|
||||
payForSubscription();
|
||||
});
|
||||
}
|
||||
|
||||
private void payForSubscription() {
|
||||
int position = binding.viewPager.getCurrentItem();
|
||||
if (subscriptionPlans == null || position < 0 || position >= subscriptionPlans.size()){
|
||||
Toast.makeText(this, "Couldn't load plan.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
progressDialog.setTitle("Please wait...");
|
||||
progressDialog.setMessage("while we take you to the payment gateway.");
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
SubscriptionPlan plan = subscriptionPlans.get(position);
|
||||
|
||||
Map<String, RequestBody> body = new HashMap<>();
|
||||
|
||||
RequestBody name_body = RequestBody.create("Aditya Gaikwad", MediaType.parse("text/plain"));
|
||||
body.put("name", name_body);
|
||||
|
||||
RequestBody email_body = RequestBody.create("test@gmail.com", MediaType.parse("text/plain"));
|
||||
body.put("email", email_body);
|
||||
|
||||
RequestBody price_body = RequestBody.create("595", MediaType.parse("text/plain"));
|
||||
body.put("price", price_body);
|
||||
|
||||
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"));
|
||||
body.put("caregiver_xid", caregiver_xid_body);
|
||||
|
||||
String token = "Bearer " + AppUtil.getCgToken(this);
|
||||
|
||||
presenter.getPaymentCred(token, body, this);
|
||||
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
binding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
if (subscriptionPlans == null
|
||||
|| position < 0 || position >= subscriptionPlans.size()) return;
|
||||
|
||||
String btn_text = "Make payment $" + subscriptionPlans.get(position).plan_value;
|
||||
binding.makePayment.setText(btn_text);
|
||||
}
|
||||
});
|
||||
|
||||
// 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);
|
||||
|
||||
paymentSheet = new PaymentSheet(this, this::onPaymentSheetResult);
|
||||
}
|
||||
|
||||
// payment callback
|
||||
public void onPaymentSheetResult(final PaymentSheetResult paymentSheetResult) {
|
||||
// implemented in the next steps
|
||||
if (paymentSheetResult instanceof PaymentSheetResult.Canceled) {
|
||||
Toast.makeText(this, "Payment canceled.", Toast.LENGTH_SHORT).show();
|
||||
} else if (paymentSheetResult instanceof PaymentSheetResult.Failed) {
|
||||
Log.e(TAG, "Got error: ", ((PaymentSheetResult.Failed) paymentSheetResult).getError());
|
||||
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");
|
||||
Toast.makeText(this, "Payment successful.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// get payment credentials callback
|
||||
@Override
|
||||
public void onPaymentCredFetched(SubscriptionCredentials credentials) {
|
||||
if (credentials == null){
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(this, "Something went wrong.", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
final PaymentSheet.CustomerConfiguration customerConfig = new PaymentSheet.CustomerConfiguration(
|
||||
credentials.customerId,
|
||||
credentials.ephemeralKey
|
||||
);
|
||||
String paymentIntentClientSecret = credentials.paymentIntent;
|
||||
PaymentConfiguration.init(getApplicationContext(), credentials.stripe_publish_key);
|
||||
|
||||
// dismissing dialog now
|
||||
progressDialog.dismiss();
|
||||
|
||||
final PaymentSheet.Configuration configuration = new PaymentSheet.Configuration.Builder("SimpliTend")
|
||||
.customer(customerConfig)
|
||||
.allowsDelayedPaymentMethods(true)
|
||||
.build();
|
||||
paymentSheet.presentWithPaymentIntent(
|
||||
paymentIntentClientSecret,
|
||||
configuration
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPaymentCredFetchFailed(Throwable throwable, String message) {
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(this, "" + message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscriptionFetched(ArrayList<SubscriptionPlan> subscriptionPlans) {
|
||||
this.subscriptionPlans = subscriptionPlans;
|
||||
progressDialog.dismiss();
|
||||
|
||||
// loading plans
|
||||
PlanAdapter planAdapter = new PlanAdapter(subscriptionPlans);
|
||||
binding.viewPager.setAdapter(planAdapter);
|
||||
binding.circleIndicator.setViewPager(binding.viewPager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubsFetchFailed(Throwable t, String message) {
|
||||
progressDialog.dismiss();
|
||||
Toast.makeText(this, "" + message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.ssb.simplitend.cg_subscription;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.databinding.SubscriptionViewholderBinding;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class PlanAdapter extends RecyclerView.Adapter<PlanAdapter.PlanViewHolder>{
|
||||
|
||||
private final ArrayList<SubscriptionPlan> subscriptionPlans;
|
||||
|
||||
public PlanAdapter(@NonNull ArrayList<SubscriptionPlan> subscriptionPlans) {
|
||||
this.subscriptionPlans = subscriptionPlans;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public PlanViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
SubscriptionViewholderBinding binding = SubscriptionViewholderBinding.inflate(
|
||||
LayoutInflater.from(parent.getContext()),
|
||||
parent,
|
||||
false
|
||||
);
|
||||
return new PlanViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull PlanViewHolder holder, int position) {
|
||||
holder.setData(subscriptionPlans.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return subscriptionPlans.size();
|
||||
}
|
||||
|
||||
public static class PlanViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
public SubscriptionViewholderBinding binding;
|
||||
|
||||
public PlanViewHolder(@NonNull SubscriptionViewholderBinding binding) {
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
|
||||
public void setData(SubscriptionPlan subscriptionPlan, int position){
|
||||
if (subscriptionPlan == null) return;
|
||||
|
||||
binding.planName.setText(subscriptionPlan.plan_name);
|
||||
|
||||
String price = "$" + subscriptionPlan.plan_value;
|
||||
binding.planValue.setText(price);
|
||||
|
||||
switch (position){
|
||||
case 0:
|
||||
binding.image.setImageResource(R.drawable.ic_sub_1);
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
binding.image.setImageResource(R.drawable.ic_sub_2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ssb.simplitend.cg_subscription;
|
||||
|
||||
public class SubscriptionPlan{
|
||||
public int id;
|
||||
public String plan_name;
|
||||
public String plan_value;
|
||||
public String plan_details;
|
||||
public String stripe_product_id;
|
||||
public String stripe_price_id;
|
||||
public String active;
|
||||
public String deleted_at;
|
||||
public String created_by;
|
||||
public String updated_by;
|
||||
public String created_at;
|
||||
public String updated_at;
|
||||
|
||||
public SubscriptionPlan(){}
|
||||
|
||||
public SubscriptionPlan(String plan_name, String plan_value) {
|
||||
this.plan_name = plan_name;
|
||||
this.plan_value = plan_value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ssb.simplitend.cg_subscription.mvp;
|
||||
|
||||
import com.ssb.simplitend.cg_subscription.SubscriptionPlan;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.Multipart;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.PartMap;
|
||||
|
||||
public interface SubscriptionApiService {
|
||||
|
||||
@GET("api/list-of-plans")
|
||||
Call<CallResponse<ArrayList<SubscriptionPlan>>> getSubscriptionPlans(@Header("Authorization") String token);
|
||||
|
||||
@Multipart
|
||||
@POST("api/pay-subscription")
|
||||
Call<CallResponse<SubscriptionCredentials>> paySubscription(
|
||||
@Header("Authorization") String token,
|
||||
@PartMap Map<String, RequestBody> body);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ssb.simplitend.cg_subscription.mvp;
|
||||
|
||||
import com.ssb.simplitend.cg_subscription.SubscriptionPlan;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface SubscriptionContracts {
|
||||
|
||||
interface GetSubPlansCallback{
|
||||
|
||||
void onSubscriptionFetched(ArrayList<SubscriptionPlan> subscriptionPlans);
|
||||
|
||||
void onSubsFetchFailed(Throwable t, String message);
|
||||
|
||||
}
|
||||
|
||||
interface PaySubscriptionCallback{
|
||||
|
||||
void onPaymentCredFetched(SubscriptionCredentials credentials);
|
||||
|
||||
void onPaymentCredFetchFailed(Throwable throwable, String message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.ssb.simplitend.cg_subscription.mvp;
|
||||
|
||||
public class SubscriptionCredentials{
|
||||
public String customerId;
|
||||
public String paymentIntent;
|
||||
public String ephemeralKey;
|
||||
public String stripe_publish_key;
|
||||
|
||||
public SubscriptionCredentials(){}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.ssb.simplitend.cg_subscription.mvp;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.RetrofitHelper;
|
||||
import com.ssb.simplitend.cg_subscription.CgSubscriptionActivity;
|
||||
import com.ssb.simplitend.cg_subscription.SubscriptionPlan;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class SubscriptionPresenter {
|
||||
|
||||
private static SubscriptionPresenter presenter;
|
||||
|
||||
private final SubscriptionApiService apiService;
|
||||
|
||||
private SubscriptionPresenter(){
|
||||
apiService = RetrofitHelper.getRetrofit().create(SubscriptionApiService.class);
|
||||
}
|
||||
|
||||
public static synchronized SubscriptionPresenter getPresenter(){
|
||||
if (presenter == null){
|
||||
presenter = new SubscriptionPresenter();
|
||||
}
|
||||
|
||||
return presenter;
|
||||
}
|
||||
|
||||
public void getSubscriptionPlans(@NonNull String token, @NonNull SubscriptionContracts.GetSubPlansCallback subPlansCallback){
|
||||
apiService.getSubscriptionPlans(token)
|
||||
.enqueue(new Callback<CallResponse<ArrayList<SubscriptionPlan>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<ArrayList<SubscriptionPlan>>> call, Response<CallResponse<ArrayList<SubscriptionPlan>>> response) {
|
||||
if (response.body() != null){
|
||||
if (response.body().status != 200 || response.body().result == null){
|
||||
subPlansCallback.onSubsFetchFailed(new Exception(), response.body().message);
|
||||
return;
|
||||
}
|
||||
|
||||
subPlansCallback.onSubscriptionFetched(response.body().result);
|
||||
}else{
|
||||
subPlansCallback.onSubsFetchFailed(new Exception(), "Please try again later.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CallResponse<ArrayList<SubscriptionPlan>>> call, Throwable t) {
|
||||
subPlansCallback.onSubsFetchFailed(new Exception(), "Please try again later.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getPaymentCred(@NonNull String token,
|
||||
Map<String, RequestBody> body,
|
||||
@NonNull SubscriptionContracts.PaySubscriptionCallback paySubscriptionCallback){
|
||||
|
||||
apiService.paySubscription(token, body)
|
||||
.enqueue(new Callback<CallResponse<SubscriptionCredentials>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<SubscriptionCredentials>> call, Response<CallResponse<SubscriptionCredentials>> response) {
|
||||
if (response.body() != null){
|
||||
if (response.body().status != 200 || response.body().result == null){
|
||||
paySubscriptionCallback.onPaymentCredFetchFailed(new Exception(), response.body().message);
|
||||
return;
|
||||
}
|
||||
|
||||
paySubscriptionCallback.onPaymentCredFetched(response.body().result);
|
||||
}else{
|
||||
paySubscriptionCallback.onPaymentCredFetchFailed(new Exception(), "Please try again later.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<CallResponse<SubscriptionCredentials>> call, Throwable t) {
|
||||
paySubscriptionCallback.onPaymentCredFetchFailed(new Exception(), "Please try again later.");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.NavOptions;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
@@ -159,10 +160,17 @@ public class SignInFragment extends Fragment implements WelcomeContracts.Registe
|
||||
|
||||
Toast.makeText(requireContext(), "Log in successful.", Toast.LENGTH_SHORT).show();
|
||||
|
||||
Intent intent = new Intent(requireActivity(), DashBoardActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
if (patientResult.patientData != null){
|
||||
if (patientResult.patientData.isCareGiverLink == 1){
|
||||
gotoProfileProgress();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// no patient data or no caregiver contact yet added thus sending to contactlist
|
||||
gotoContactList();
|
||||
|
||||
// TODO: 09-08-2023 don't do anything further more.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -177,4 +185,23 @@ public class SignInFragment extends Fragment implements WelcomeContracts.Registe
|
||||
dialog.dismiss();
|
||||
}), null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void gotoProfileProgress(){
|
||||
NavOptions navOptions = new NavOptions.Builder()
|
||||
.setPopUpTo(R.id.signInFragment, true)
|
||||
.build();
|
||||
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_signInFragment_to_profileProgressFragment, null, navOptions);
|
||||
}
|
||||
|
||||
private void gotoContactList(){
|
||||
NavOptions navOptions = new NavOptions.Builder()
|
||||
.setPopUpTo(R.id.welcomeFragment, true)
|
||||
.build();
|
||||
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_signInFragment_to_contactListFragment, null, navOptions);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -69,10 +69,7 @@ public class ContactListFragment extends Fragment {
|
||||
private void clickEvents() {
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> {
|
||||
if (Navigation.findNavController(v).getPreviousBackStackEntry() != null){
|
||||
Navigation.findNavController(v).popBackStack();
|
||||
Toast.makeText(requireContext(), "Back done", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
requireActivity().onBackPressed();
|
||||
});
|
||||
|
||||
binding.createContact.setOnClickListener(v ->
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ssb.simplitend.welcome.welcomepatient.fragments.register;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -37,13 +38,12 @@ public class SplashFragment extends Fragment implements ProfileContracts.Profile
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = SplashFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
checkIfAhyUser();
|
||||
}
|
||||
|
||||
@@ -83,24 +83,22 @@ public class SplashFragment extends Fragment implements ProfileContracts.Profile
|
||||
}
|
||||
}
|
||||
|
||||
private void gotoDashBoard(){
|
||||
Intent intent = new Intent(requireActivity(), DashBoardActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
private void gotoProfileProgress(){
|
||||
NavOptions navOptions = new NavOptions.Builder()
|
||||
.setPopUpTo(R.id.splashFragment, true)
|
||||
.build();
|
||||
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_splashFragment_to_profileProgressFragment, null, navOptions);
|
||||
}
|
||||
|
||||
public void gotoWelcomeFragment(){
|
||||
new Handler().postDelayed(() -> {
|
||||
NavOptions navOptions = new NavOptions.Builder()
|
||||
.setPopUpTo(R.id.splashFragment, true)
|
||||
.build();
|
||||
|
||||
NavOptions navOptions = new NavOptions.Builder()
|
||||
.setPopUpTo(R.id.splashFragment, true)
|
||||
.build();
|
||||
|
||||
Navigation.findNavController(binding.mainIcon)
|
||||
.navigate(R.id.action_splashFragment_to_welcomeFragment, null, navOptions);
|
||||
|
||||
}, 1000);
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_splashFragment_to_welcomeFragment, null, navOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,7 +106,7 @@ public class SplashFragment extends Fragment implements ProfileContracts.Profile
|
||||
if (patientData.isCareGiverLink == 1){
|
||||
// user has already added caregiver as a contact
|
||||
// thus, sending it to dashboard
|
||||
gotoDashBoard();
|
||||
gotoProfileProgress();
|
||||
}else{
|
||||
// user has not added caregiver contact.
|
||||
// thus, sending it to contact list to add caregiver contact.
|
||||
@@ -116,7 +114,7 @@ public class SplashFragment extends Fragment implements ProfileContracts.Profile
|
||||
.setPopUpTo(R.id.splashFragment, true)
|
||||
.build();
|
||||
|
||||
Navigation.findNavController(binding.mainIcon)
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_splashFragment_to_contactListFragment, null, navOptions);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user