This commit is contained in:
2023-10-16 20:56:35 +05:30
parent 98cc3bde18
commit fcb6c7890d
22 changed files with 131 additions and 18 deletions

View File

@@ -233,6 +233,7 @@ public class CaregiverDashActivity extends AppCompatActivity implements
}
menuBinding.name.setText(careGiverData.first_name);
if (careGiverData.profile_photo != null) {
Glide.with(this)
.load(AppUtil.IMAGE_BASE_URL + careGiverData.profile_photo)
@@ -258,6 +259,15 @@ public class CaregiverDashActivity extends AppCompatActivity implements
}
}
String patient_name;
try {
patient_name = careGiverData.patientDetails.first_name.split(" ")[0];
} catch (Exception e) {
patient_name = careGiverData.patientDetails.first_name;
}
binding.bottomNav.setChatWithTxt("Chat with " + patient_name);
binding.bottomNav.setMyPatient(patient_name);
}
private void replaceFragment(Fragment fragment, String tag) {

View File

@@ -112,7 +112,7 @@ public class CgProfileProgressActivity extends AppCompatActivity implements CgHo
binding.fua.setOnClickListener(v -> {
AppUtil.showAlert(this,
"App Whitelist",
"You can whitelist app from the patients device.",
"You can whitelist app from the patient's device.",
getString(R.string.ok),
((dialogInterface, i) -> {}),
null, null);

View File

@@ -28,6 +28,9 @@ import com.app.simplitend.cg_subscription.mvp.SubscriptionPresenter;
import com.app.simplitend.databinding.CgSubscriptionLayoutBinding;
import com.app.simplitend.welcome.welcomecg.mvvm.CareGiverData;
import com.stripe.android.PaymentConfiguration;
import com.stripe.android.model.PaymentMethod;
import com.stripe.android.paymentsheet.CreateIntentCallback;
import com.stripe.android.paymentsheet.CreateIntentResult;
import com.stripe.android.paymentsheet.PaymentSheet;
import com.stripe.android.paymentsheet.PaymentSheetResult;
@@ -37,6 +40,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import kotlin.coroutines.Continuation;
import okhttp3.MediaType;
import okhttp3.RequestBody;
@@ -77,10 +81,11 @@ public class CgSubscriptionActivity extends AppCompatActivity
this.careGiverData = careGiverData;
if (careGiverData != null){
if (careGiverData.isCaregiverTakeSubscription != 1){
// not subscribed thus, load plans
loadPlans();
paymentSheet = new PaymentSheet(this, this::onPaymentSheetResult);
paymentSheet = new PaymentSheet(this, this::onPaymentSheetResult);
}else{
// Already subscribed thus, loading current plans
loadCurrentPlans();
@@ -320,6 +325,7 @@ public class CgSubscriptionActivity extends AppCompatActivity
RequestBody price_id_body = RequestBody.create(this.stripe_price_id, MediaType.parse("text/plain"));
bodyMap.put("price_id", price_id_body);
presenter.createSubscription(bodyMap,
"Bearer " + AppUtil.getCgToken(this),
this);
@@ -460,6 +466,7 @@ public class CgSubscriptionActivity extends AppCompatActivity
credentials.customerId,
credentials.ephemeralKey
);
String paymentIntentClientSecret = credentials.paymentIntent;
PaymentConfiguration.init(getApplicationContext(), credentials.stripe_publish_key);
@@ -470,6 +477,7 @@ public class CgSubscriptionActivity extends AppCompatActivity
.customer(customerConfig)
.allowsDelayedPaymentMethods(true)
.build();
paymentSheet.presentWithPaymentIntent(
paymentIntentClientSecret,
configuration

View File

@@ -5,6 +5,7 @@ import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -20,6 +21,8 @@ public class HomeBottomNav extends FrameLayout {
private FloatingActionButton dashBtnBig, patientBig, chatsBig;
private LinearLayout dashSmall, patientSmall, chatsSmall;
private TextView chatWithTxt, myPatientTxt;
// fields
private MenuItem selected_item = MenuItem.DASHBOARD;
@@ -53,6 +56,9 @@ public class HomeBottomNav extends FrameLayout {
chatsBig = view.findViewById(R.id.chat_big);
chatsSmall = view.findViewById(R.id.chats_small);
chatWithTxt = view.findViewById(R.id.chat_with);
myPatientTxt = view.findViewById(R.id.my_patient);
clickEvents();
}
@@ -83,6 +89,18 @@ public class HomeBottomNav extends FrameLayout {
this.itemSelectListener = itemSelectListener;
}
public void setMyPatient(String myPatient){
if (myPatient != null && myPatientTxt != null){
myPatientTxt.setText(myPatient);
}
}
public void setChatWithTxt(String chatWith){
if (chatWith != null && chatWithTxt != null){
chatWithTxt.setText(chatWith);
}
}
public void selectMenuItem(MenuItem menuitem){
clearItemSelection(this.selected_item);

View File

@@ -135,7 +135,6 @@ public class DashBoardActivity extends AppCompatActivity implements CgHomeContra
public void onGeofenceDetailsFetched(@NonNull GeoFenceDetails geoFenceDetails) {
validateAndAddGeofence(geoFenceDetails);
}
@Override
public void onGeofenceDetailsFetchFailed(Throwable throwable, String message) {
Log.d(GEOFENCE_TAG, "onGeofenceDetailsFetchFailed: " + message);

View File

@@ -66,6 +66,20 @@ public class NotificationsActivity extends AppCompatActivity implements Callback
token = getIntent().getStringExtra(USER_TOKEN);
isCaregiver = getIntent().getBooleanExtra(IS_CAREGIVER, false);
initViews();
clickEvents();
page_no = 1; // loading first page
loadNotifications(false);
}
private void clickEvents() {
binding.backBtn.setOnClickListener(v -> onBackPressed());
}
private void initViews() {
binding.notificationRv.setLayoutManager(new LinearLayoutManager(this));
notificationsAdapter = new NotificationsAdapter();
binding.notificationRv.setAdapter(notificationsAdapter);
@@ -89,10 +103,6 @@ public class NotificationsActivity extends AppCompatActivity implements Callback
}
}
});
page_no = 1; // loading first page
loadNotifications(false);
}
private void loadNotifications(boolean show_bottom_progress) {
@@ -216,6 +226,34 @@ public class NotificationsActivity extends AppCompatActivity implements Callback
if (notification == null) return;
binding.description.setText(notification.description);
// 0-> medcine , 1-> activity , 2-> outofgeofence, 3-> reuqestedDirection , 4-> SOS , 5-> location , 6- radius add or update
int imageRes = -1;
switch (notification.type){
case "0":
imageRes = R.drawable.ic_med_noti;
break;
case "1":
imageRes = R.drawable.ic_activity_not;
break;
case "2":
case "5":
imageRes = R.drawable.ic_geofence_noti;
break;
case "3":
case "6":
imageRes = R.drawable.ic_home_noti;
break;
case "4":
imageRes = R.drawable.ic_sos_noti;
break;
}
if (imageRes != -1) {
binding.image.setImageResource(imageRes);
binding.imageCard.setCardBackgroundColor(itemView.getContext().getColor(R.color.color_accent));
}
}
}
}

View File

@@ -104,7 +104,7 @@ public class PatientMainViewModel extends ViewModel {
LocationRequest locationRequest = new LocationRequest();
locationRequest.setInterval(10_000);
locationRequest.setSmallestDisplacement(100);
locationRequest.setSmallestDisplacement(15);
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
Intent intent = new Intent(activity, PatientLocationUpdatesReceiver.class);

View File

@@ -163,6 +163,10 @@ public class PatientDashboardFragment extends Fragment implements ProfileContrac
.error(R.drawable.senior_img)
.into(binding.profile);
}
if (patientData.caregiver_name != null){
binding.chatWith.setText("Chat with " + patientData.caregiver_name);
}
}
private void initViews() {

View File

@@ -9,6 +9,7 @@ import static com.app.simplitend.welcome.welcomepatient.fragments.register.ReAct
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Patterns;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -114,6 +115,9 @@ public class CgSignInFragment extends Fragment implements WelcomeContracts.CgLog
if (binding.email.getText().toString().trim().isEmpty()){
allOkay = false;
binding.email.setError("Please enter email.");
}else if (!Patterns.EMAIL_ADDRESS.matcher(binding.email.getText().toString()).matches()){
allOkay = false;
binding.email.setError("Invalid email");
}
if (binding.password.getText() != null && binding.password.getText().toString().trim().isEmpty()){

View File

@@ -217,7 +217,6 @@ public class RegisterFragment extends Fragment implements WelcomeContracts.Verif
progressDialog.show();
viewModel.verifyEmail(binding.email.getText().toString().trim(), this);
}
});