Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
995ef60
- added sync menu in visit page
pm-dimagi Jul 17, 2025
7ef1b7d
Adds build_number to analytics
shubham1g5 Jul 17, 2025
2197f68
Merge pull request #3251 from dimagi/addBuildNumberToAnalytics
shubham1g5 Jul 18, 2025
ed15466
- hide credential menu
pm-dimagi Jul 18, 2025
8644c28
- removed extra lint file change
pm-dimagi Jul 18, 2025
4eecf90
- abstract navigation code
pm-dimagi Jul 18, 2025
d9754d3
- call api on sync to refresh the visit
pm-dimagi Jul 18, 2025
e9f4b18
Merge pull request #3254 from dimagi/pm_beta_bugs
pm-dimagi Jul 18, 2025
01bda49
Corrected the app crash after downloading the learning/delivery app
Jul 18, 2025
9b97269
-fix yes confirmation tile
pm-dimagi Jul 18, 2025
5937d3a
Solved progress display error while navigating from payment tab in de…
Jul 18, 2025
0978000
Merge pull request #3255 from dimagi/fix/qa-7932
pm-dimagi Jul 18, 2025
15b53d7
Merge pull request #3256 from dimagi/pm_qa_7928
pm-dimagi Jul 18, 2025
4e34d77
Changes as per comment -1
Jul 18, 2025
f6d8a49
Merge pull request #3257 from dimagi/fix/qa-7923
pm-dimagi Jul 18, 2025
e000082
- play store service check
pm-dimagi Jul 18, 2025
5cf09cd
- string resource
pm-dimagi Jul 18, 2025
a1298ca
- handle the result of the dialog, handle if the issue is resolvable
pm-dimagi Jul 18, 2025
9c256cc
- handle the error code and typo mistake
pm-dimagi Jul 18, 2025
23c1a80
- handled translations
pm-dimagi Jul 18, 2025
7341852
Merge pull request #3258 from dimagi/pm_play_service_update
pm-dimagi Jul 18, 2025
228ab04
-fixed yes click issue
pm-dimagi Jul 21, 2025
6a61507
Merge pull request #3260 from dimagi/pm_qa_7928_fix
pm-dimagi Jul 21, 2025
6c2251e
Merge branch 'commcare_2.58' of https://github.com/dimagi/commcare-an…
pm-dimagi Jul 25, 2025
c96c05e
Merge branch 'commcare_2.58' of https://github.com/dimagi/commcare-an…
pm-dimagi Jul 25, 2025
f5d6808
Merge branch 'commcare_2.58' of https://github.com/dimagi/commcare-an…
pm-dimagi Jul 28, 2025
cc77e6c
fixed for loop .. issue replaced with until
pm-dimagi Jul 28, 2025
e3f3279
Merge branch 'feature/connect' of https://github.com/dimagi/commcare-…
pm-dimagi Jul 30, 2025
bf43285
Merge branch 'feature/connect' of https://github.com/dimagi/commcare-…
pm-dimagi Jul 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/res/menu/menu_connect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
android:id="@+id/action_credential"
android:icon="@drawable/ic_credential"
android:title="@string/credential"
android:visible="false"
app:showAsAction="always" />
<item
android:id="@+id/action_sync"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
Expand All @@ -14,12 +17,16 @@
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.core.view.MenuHost;
import androidx.core.view.MenuProvider;
import androidx.lifecycle.Lifecycle;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import org.commcare.android.database.connect.models.ConnectJobDeliveryFlagRecord;
import org.commcare.android.database.connect.models.ConnectJobDeliveryRecord;
import org.commcare.connect.ConnectDateUtils;
import org.commcare.connect.ConnectJobHelper;
import org.commcare.dalvik.R;
import org.commcare.dalvik.databinding.FragmentConnectDeliveryListBinding;

Expand Down Expand Up @@ -49,9 +56,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
binding = FragmentConnectDeliveryListBinding.inflate(inflater, container, false);
unitName = ConnectDeliveryListFragmentArgs.fromBundle(getArguments()).getUnitId();
requireActivity().setTitle(getString(R.string.connect_visit_type_title, unitName));

setupRecyclerView();
setupFilterControls();
setupMenuProvider();
return binding.getRoot();
}

Expand Down Expand Up @@ -95,6 +102,32 @@ private int getFilterCardId(String filter) {
};
}

private void setupMenuProvider() {
MenuHost host = requireActivity();
host.addMenuProvider(new MenuProvider() {
@Override
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
}

@Override
public boolean onMenuItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.action_sync) {
refreshData();
return true;
}
return false;
}
}, getViewLifecycleOwner(), Lifecycle.State.RESUMED);
}

private void refreshData() {
ConnectJobHelper.INSTANCE.updateDeliveryProgress(getContext(), job, success -> {
if (success) {
adapter.updateDeliveries(getFilteredDeliveries());
}
});
}
Comment on lines +123 to +129
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add error handling for sync failures

The current implementation doesn't provide feedback when the sync fails. Users should be notified of sync failures.

 private void refreshData() {
     ConnectJobHelper.INSTANCE.updateDeliveryProgress(getContext(), job, success -> {
         if (success) {
             adapter.updateDeliveries(getFilteredDeliveries());
+        } else {
+            Toast.makeText(getContext(), R.string.connect_sync_failed, Toast.LENGTH_SHORT).show();
         }
     });
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private void refreshData() {
ConnectJobHelper.INSTANCE.updateDeliveryProgress(getContext(), job, success -> {
if (success) {
adapter.updateDeliveries(getFilteredDeliveries());
}
});
}
private void refreshData() {
ConnectJobHelper.INSTANCE.updateDeliveryProgress(getContext(), job, success -> {
if (success) {
adapter.updateDeliveries(getFilteredDeliveries());
} else {
Toast.makeText(getContext(),
R.string.connect_sync_failed,
Toast.LENGTH_SHORT)
.show();
}
});
}
🤖 Prompt for AI Agents
In app/src/org/commcare/fragments/connect/ConnectDeliveryListFragment.java
around lines 123 to 129, the refreshData method lacks error handling for sync
failures. Modify the callback to handle the case when success is false by adding
user notification, such as showing a toast or dialog, to inform users that the
sync has failed. This will improve user feedback on sync status.


private void setFilterHighlight(CardView card, TextView label, boolean selected) {
int bgColor = getResources().getColor(selected ? R.color.connect_blue_color : R.color.connect_blue_color_10);
int textColor = getResources().getColor(selected ? android.R.color.white : R.color.connect_blue_color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,16 @@ private HashMap<String, HashMap<String, Integer>> getStatusMap(ConnectJobRecord
return statusMap;
}


/**
* This was added to re-calculate the correct height of a fragment in ViewPager2. This is required as ViewPager2
* has bug currently due to which it's not calculating the height of it's different fragment correctly.
* When found some other solution for this ViewPager2 bug, we can remove this but make sure to QA
* by pressing sync button while in different fragments.
*/
@Override
public void onResume() {
super.onResume();
binding.getRoot().requestLayout();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,11 @@ private void setupRefreshAndConfirmationActions() {
});

binding.connectPaymentConfirmYesButton.setOnClickListener(v -> {
updatePaymentConfirmationTile(true);
if (paymentToConfirm != null) {
FirebaseAnalyticsUtil.reportCccPaymentConfirmationInteraction(true);
ConnectJobHelper.INSTANCE.updatePaymentConfirmed(getContext(), paymentToConfirm, true, success -> {});
ConnectJobHelper.INSTANCE.updatePaymentConfirmed(getContext(), paymentToConfirm, true, success -> {
updatePaymentConfirmationTile(true);
});
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ public void onSuccessfulVerification() {
setBackButtonAndActionBarState(true);
View view = getView();
if (view != null) {
Navigation.findNavController(view).popBackStack();

//Launch the learn/deliver app
ConnectAppRecord appToLaunch = getLearnApp ? job.getLearnAppInfo() : job.getDeliveryAppInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ private void updateProgressViews(int percent, boolean hideProgress) {
viewBinding.connectLearningProgressBar.setVisibility(visibility);
viewBinding.connectLearningProgressText.setVisibility(visibility);
viewBinding.connectLearnProgressBarTextContainer.setVisibility(visibility);
viewBinding.learningCard.setVisibility(visibility);

if (!hideProgress) {
viewBinding.connectLearningProgressBar.setProgress(percent);
Expand Down Expand Up @@ -244,9 +245,15 @@ private void populateJobCard(ConnectJobRecord job) {
boolean showHours = hours != null;
jobCard.tvJobTime.setVisibility(showHours ? View.VISIBLE : View.GONE);
jobCard.tvDailyVisitTitle.setVisibility(showHours ? View.VISIBLE : View.GONE);
jobCard.tvViewMore.setOnClickListener(this::navigateToJobDetailBottomSheet);

if (showHours) {
jobCard.tvJobTime.setText(hours);
}
}

private void navigateToJobDetailBottomSheet(View view) {
Navigation.findNavController(view).navigate(
ConnectLearningProgressFragmentDirections.actionConnectJobLearningProgressFragmentToConnectJobDetailBottomSheetDialogFragment());
}
}