Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Jul 17, 2025

Closes #6810

Why is this the best possible solution? Were any other approaches considered?

To summarize all the discussions we've had across different channels:

The issue was that when MDM applied settings to Collect, those settings were re-applied every time the Main Menu was opened. After saving the settings, the form update process was triggered, which meant it ran every time a user returned to the Main Menu to start a new blank form. If the form that needed to be updated (or even just checked for updates) included a large number of media attachments, the process became time-consuming. Additionally, if such a form contained entities, opening it was blocked until the update process completed.

I didn't change the approach of continuously saving settings. Instead, I updated the code responsible for triggering form updates so that the update is now triggered only when relevant settings have actually changed. The relevant settings are:

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

This should prevent redundant form update scheduling when new settings are applied - whether they come from MDM and are re-applied every time the Main Menu is opened, or when a user reconfigures the app using a QR code that doesn't change anything related to form updates (i.e., the two settings mentioned above).

Do we need any specific form for testing your changes? If so, please attach one.

Any form with entities + thousands of media files.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@grzesiek2010 grzesiek2010 marked this pull request as ready for review July 17, 2025 10:28
@grzesiek2010 grzesiek2010 assigned seadowg and unassigned seadowg Jul 17, 2025
@grzesiek2010 grzesiek2010 requested a review from seadowg July 17, 2025 10:28
@grzesiek2010 grzesiek2010 added the high priority Should be looked at before other PRs/issues label Jul 17, 2025
Copy link
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

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

Ace! I think for master, would you consider a follow-up where we just pass through all the changes keys to onSettingsChanged instead of just a flag for form update settings? I think that would then allow us to just have one piece of logic around reacting to key changes.

@grzesiek2010
Copy link
Member Author

Ace! I think for master, would you consider a follow-up where we just pass through all the changes keys to onSettingsChanged instead of just a flag for form update settings? I think that would then allow us to just have one piece of logic around reacting to key changes.

Yeah, I considered that solution, but I felt it would take a bit more time. I will do that after reviewing your pr: #6811

@tobiasmcnulty
Copy link

tobiasmcnulty commented Jul 17, 2025

Confirming I no longer see the loading indicator (with this APK) after tapping 'Start new form' with the 'Settings JSON' parameter enabled. Thanks for the quick fix!

@dbemke
Copy link

dbemke commented Jul 18, 2025

Tested with Success!

Verified on a device with Android 10

Verified cases:

  • Collect and MDM form dowload
  • changing form management settings in JSON file
  • changing different settings in JSON file
  • checking if match exactly and previously downloaded forms works as expected
  • updating form version and adding new entities
  • blocking entities forms while they're being updated

@WKobus
Copy link

WKobus commented Jul 18, 2025

Tested with success

Verified on device with Android 15

@grzesiek2010 grzesiek2010 merged commit 8e4b789 into getodk:v2025.2.x Jul 18, 2025
6 checks passed
grzesiek2010 added a commit to seadowg/collect that referenced this pull request Jul 21, 2025
Schedule form updates only if relevant settings have changed after import
seadowg pushed a commit to seadowg/collect that referenced this pull request Aug 4, 2025
Schedule form updates only if relevant settings have changed after import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

behavior verified high priority Should be looked at before other PRs/issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants