,
This commit is contained in:
@@ -32,7 +32,9 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.app.simplitend.R;
|
||||
import com.app.simplitend.apputils.AppUtil;
|
||||
import com.app.simplitend.apputils.PatientDataCache;
|
||||
import com.app.simplitend.databinding.FuaEduDialogBinding;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -79,6 +81,17 @@ public class FUAActivity extends AppCompatActivity {
|
||||
Dialog fuaDialog = new Dialog(this, R.style.BottomSheetDialog);
|
||||
fuaDialog.setContentView(dialogBinding.getRoot());
|
||||
|
||||
PatientDataCache.getPatientData(this, (patientData -> {
|
||||
if (patientData != null && patientData.profile_photo != null){
|
||||
Glide.with(this)
|
||||
.load(AppUtil.IMAGE_BASE_URL + patientData.profile_photo)
|
||||
.placeholder(R.drawable.senior_img)
|
||||
.error(R.drawable.senior_img)
|
||||
.fitCenter()
|
||||
.into(dialogBinding.seniorImg);
|
||||
}
|
||||
}), false);
|
||||
|
||||
dialogBinding.checkBox.setOnCheckedChangeListener((compoundButton, b) -> {
|
||||
AppUtil.setShouldShowFuaDialog(this, !b);
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.annotation.Nullable;
|
||||
import com.app.simplitend.welcome.welcomecg.WelcomeApiService;
|
||||
import com.app.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
import com.onesignal.OneSignal;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@@ -44,7 +45,9 @@ public abstract class CaregiverDataCache {
|
||||
progressDialog.setCancelable(false);
|
||||
if (show_progress) progressDialog.show();
|
||||
|
||||
apiService.getCgUserData("Bearer " + AppUtil.getCgToken(context))
|
||||
String sub_id = OneSignal.getUser().getPushSubscription().getId() + "";
|
||||
|
||||
apiService.getCgUserData("Bearer " + AppUtil.getCgToken(context), sub_id)
|
||||
.enqueue(new Callback<CallResponse<CareGiverData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<CareGiverData>> call, Response<CallResponse<CareGiverData>> response) {
|
||||
|
||||
@@ -11,10 +11,13 @@ import com.app.simplitend.welcome.welcomepatient.fragments.contacts.mvvm.models.
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.WelcomeApiService;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
import com.onesignal.OneSignal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@@ -107,7 +110,10 @@ public class PatientDataCache {
|
||||
progressDialog.show();
|
||||
}
|
||||
|
||||
apiService.getUsrProfileProgress("Bearer " + AppUtil.getPatientToken(context))
|
||||
String sub_id = OneSignal.getUser().getPushSubscription().getId() + "";
|
||||
|
||||
apiService.getUsrProfileProgress("Bearer " + AppUtil.getPatientToken(context),
|
||||
sub_id, AppUtil.getTimeZone())
|
||||
.enqueue(new Callback<CallResponse<PatientData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<PatientData>> call, Response<CallResponse<PatientData>> response) {
|
||||
|
||||
@@ -288,6 +288,7 @@ public class CgGeoFencingActivity extends AppCompatActivity implements OnMapRead
|
||||
List<Place.Field> fields = Arrays.asList(Place.Field.ID, Place.Field.NAME, Place.Field.LAT_LNG);
|
||||
|
||||
Intent intent = new Autocomplete.IntentBuilder(AutocompleteActivityMode.OVERLAY, fields)
|
||||
.setHint(getString(R.string.enter_new_address_here))
|
||||
.build(this);
|
||||
|
||||
startAutocompleteMapSearch.launch(intent);
|
||||
|
||||
@@ -23,8 +23,12 @@ import com.app.simplitend.databinding.ActivityNotificationsBinding;
|
||||
import com.app.simplitend.databinding.NotificationViewholderBinding;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@@ -269,12 +273,19 @@ public class NotificationsActivity extends AppCompatActivity implements Callback
|
||||
}
|
||||
|
||||
// created at format 2023-11-03T11:13:22.000000Z
|
||||
if (notification.created_at != null){
|
||||
String time = AppUtil.formatDate(
|
||||
"yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'",
|
||||
"dd MMM yyyy 'at' hh:mm a",
|
||||
notification.created_at
|
||||
);
|
||||
if (notification.date_added != null){
|
||||
String time;
|
||||
try {
|
||||
SimpleDateFormat fromSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
|
||||
fromSdf.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
SimpleDateFormat toSdf = new SimpleDateFormat("dd MMM yyyy 'at' hh:mm a", Locale.getDefault());
|
||||
toSdf.setTimeZone(TimeZone.getDefault());
|
||||
|
||||
Date date = fromSdf.parse(notification.date_added);
|
||||
time = toSdf.format(date);
|
||||
}catch (Exception e){
|
||||
time = null;
|
||||
}
|
||||
|
||||
if (time == null){
|
||||
binding.timeView.setVisibility(View.GONE);
|
||||
|
||||
@@ -17,6 +17,9 @@ import com.app.simplitend.databinding.ChatFragmentBinding;
|
||||
import com.app.simplitend.patient_dashboard.chats.mvvm.Message;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.stfalcon.chatkit.messages.MessagesListAdapter;
|
||||
import com.stfalcon.chatkit.utils.DateFormatter;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class ChatFragment extends Fragment implements SocketHelper.Callback<Message> {
|
||||
|
||||
@@ -66,15 +69,32 @@ public class ChatFragment extends Fragment implements SocketHelper.Callback<Mess
|
||||
|
||||
clickEvents();
|
||||
|
||||
enableDenButton(false);
|
||||
|
||||
if (patient_id != null){
|
||||
SocketHelper socketHelper = SocketHelper.getInstance();
|
||||
socketHelper.establishConnection(null);
|
||||
socketHelper.establishConnection(new SocketHelper.SockCallBack() {
|
||||
@Override
|
||||
public void onSocketConnected() {
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
enableDenButton(true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionError(Exception e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
socketHelper.getMessage(this, patient_id, nick_name,
|
||||
receiver_image,
|
||||
author_image);
|
||||
|
||||
enableDenButton(true);
|
||||
}
|
||||
|
||||
return binding.getRoot();
|
||||
@@ -153,6 +173,16 @@ public class ChatFragment extends Fragment implements SocketHelper.Callback<Mess
|
||||
}
|
||||
});
|
||||
|
||||
messageAdapter.setDateHeadersFormatter(date -> {
|
||||
if (DateFormatter.isToday(date)) {
|
||||
return "Today";
|
||||
} else if (DateFormatter.isYesterday(date)) {
|
||||
return "Yesterday";
|
||||
} else {
|
||||
return DateFormatter.format(date, DateFormatter.Template.STRING_DAY_MONTH_YEAR);
|
||||
}
|
||||
});
|
||||
|
||||
binding.messageList.setAdapter(messageAdapter);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class SocketHelper {
|
||||
|
||||
private static final String TAG = "SOCKET_CHAT_TAG";
|
||||
|
||||
public static final String kHost = "http://77.68.102.23:3002/";
|
||||
public static final String kHost = "http://simplitendapp.betadelivery.com:3002/";
|
||||
|
||||
private static SocketHelper instance;
|
||||
private Socket mSocket;
|
||||
|
||||
@@ -23,11 +23,9 @@ import retrofit2.http.Query;
|
||||
|
||||
public interface PatientProfileAPIService {
|
||||
|
||||
@GET("api/auth-user-data")
|
||||
Call<CallResponse<PatientData>> getUsrProfileProgress(@Header("Authorization") String token);
|
||||
|
||||
@GET("api/auth-user-data")
|
||||
Call<CallResponse<PatientData>> getUsrProfileProgress(@Header("Authorization") String token,
|
||||
@Query("player_id") String player_id,
|
||||
@Header("timezone") String timezone);
|
||||
|
||||
@GET("api/patient-reminder-list/{id}")
|
||||
|
||||
@@ -27,7 +27,10 @@ import com.app.simplitend.apputils.RetrofitHelper;
|
||||
import com.app.simplitend.databinding.ProfileProgressFragmentBinding;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
import com.onesignal.OneSignal;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@@ -87,7 +90,9 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
|
||||
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
|
||||
apiService.getUsrProfileProgress(token)
|
||||
String sub_id = OneSignal.getUser().getPushSubscription().getId() + "";
|
||||
|
||||
apiService.getUsrProfileProgress(token, sub_id, AppUtil.getTimeZone())
|
||||
.enqueue(new Callback<CallResponse<PatientData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<PatientData>> call, Response<CallResponse<PatientData>> response) {
|
||||
@@ -154,7 +159,9 @@ public class ProfileProgressFragment extends Fragment implements ProfileContract
|
||||
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
|
||||
apiService.getUsrProfileProgress(token)
|
||||
String sub_id = OneSignal.getUser().getPushSubscription().getId() + "";
|
||||
|
||||
apiService.getUsrProfileProgress(token, sub_id, AppUtil.getTimeZone())
|
||||
.enqueue(new Callback<CallResponse<PatientData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<PatientData>> call, Response<CallResponse<PatientData>> response) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.app.simplitend.databinding.RegisterationDoneFragmentBinding;
|
||||
import com.app.simplitend.patient_dashboard.DashBoardActivity;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
import com.onesignal.OneSignal;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@@ -138,7 +139,9 @@ public class RegisterCompleteFragment extends Fragment implements ProfileContrac
|
||||
|
||||
String token = "Bearer " + AppUtil.getPatientToken(requireContext());
|
||||
|
||||
apiService.getUsrProfileProgress(token)
|
||||
String sub_id = OneSignal.getUser().getPushSubscription().getId() + "";
|
||||
|
||||
apiService.getUsrProfileProgress(token, sub_id, AppUtil.getTimeZone())
|
||||
.enqueue(new Callback<CallResponse<PatientData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<PatientData>> call, Response<CallResponse<PatientData>> response) {
|
||||
|
||||
@@ -133,15 +133,15 @@ public class ReminderAdapter extends RecyclerView.Adapter<ReminderAdapter.Remind
|
||||
break;
|
||||
case "Spoon":
|
||||
binding.medImg.setImageResource(R.drawable.ic_med_spoon);
|
||||
quantity = reminder.medication_quantity + " units";
|
||||
quantity = reminder.medication_quantity + " spoon";
|
||||
break;
|
||||
case "Cup":
|
||||
binding.medImg.setImageResource(R.drawable.ic_cup);
|
||||
quantity = reminder.medication_quantity + " units";
|
||||
quantity = reminder.medication_quantity + " cup";
|
||||
break;
|
||||
case "Syringe":
|
||||
binding.medImg.setImageResource(R.drawable.ic_syringe);
|
||||
quantity = reminder.medication_quantity + " units";
|
||||
quantity = reminder.medication_quantity + " syringe";
|
||||
break;
|
||||
default:
|
||||
binding.medImg.setImageResource(R.drawable.ic_other_med);
|
||||
|
||||
@@ -15,6 +15,7 @@ import retrofit2.http.Header;
|
||||
import retrofit2.http.Multipart;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.PartMap;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface WelcomeApiService {
|
||||
|
||||
@@ -46,6 +47,7 @@ public interface WelcomeApiService {
|
||||
@Header("Authorization") String token);
|
||||
|
||||
@GET("api/caregiver-user-data")
|
||||
Call<CallResponse<CareGiverData>> getCgUserData(@Header("Authorization") String token);
|
||||
Call<CallResponse<CareGiverData>> getCgUserData(@Header("Authorization") String token,
|
||||
@Query("player_id") String player_id);
|
||||
|
||||
}
|
||||
|
||||
@@ -200,6 +200,12 @@ public class CreateContactFragment extends Fragment implements WelcomeContracts.
|
||||
}
|
||||
});
|
||||
|
||||
binding.cancelBtn.setOnClickListener(view -> {
|
||||
if (getActivity() != null) {
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
});
|
||||
|
||||
binding.nextBtn.setOnClickListener(v -> {
|
||||
|
||||
String[] phone_numbers = getAllPhoneNumbers();
|
||||
|
||||
@@ -37,7 +37,10 @@ import com.app.simplitend.welcome.welcomecg.fragments.CgAuthActivity;
|
||||
import com.app.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.CallResponse;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
import com.onesignal.OneSignal;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@@ -81,7 +84,9 @@ public class SplashFragment extends Fragment
|
||||
|
||||
PatientProfileAPIService apiService = RetrofitHelper.getRetrofit().create(PatientProfileAPIService.class);
|
||||
|
||||
apiService.getUsrProfileProgress("Bearer " + patient_token, AppUtil.getTimeZone())
|
||||
String sub_id = OneSignal.getUser().getPushSubscription().getId() + "";
|
||||
|
||||
apiService.getUsrProfileProgress("Bearer " + patient_token, sub_id, AppUtil.getTimeZone())
|
||||
.enqueue(new Callback<CallResponse<PatientData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<PatientData>> call, Response<CallResponse<PatientData>> response) {
|
||||
@@ -107,7 +112,9 @@ public class SplashFragment extends Fragment
|
||||
|
||||
WelcomeApiService welcomeApiService = RetrofitHelper.getRetrofit().create(WelcomeApiService.class);
|
||||
|
||||
welcomeApiService.getCgUserData("Bearer " + cg_token)
|
||||
String sub_id = OneSignal.getUser().getPushSubscription().getId() + "";
|
||||
|
||||
welcomeApiService.getCgUserData("Bearer " + cg_token, sub_id)
|
||||
.enqueue(new Callback<CallResponse<CareGiverData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<CallResponse<CareGiverData>> call, Response<CallResponse<CareGiverData>> response) {
|
||||
|
||||
Reference in New Issue
Block a user