ground-android icon indicating copy to clipboard operation
ground-android copied to clipboard

Only trigger permission dialog for capture location when user arrives on the task.

Open sufyanAbbasi opened this issue 1 year ago • 0 comments
trafficstars

Fixes #2388

Prevents the location permission dialog from being shown too early (see issue for explanation), by only triggering early when the user has already given permission, and otherwise waiting to trigger the dialog until the user has arrived at the capture location task.

  • [x] Adds a new flow property, enableLocationLockFlow, that keeps track of three states:
  1. whether the location lock has already been enabled
  2. whether the location lock needs to be enabled
  3. whether to actually enable the location lock
  • [x] If permission was already given, the existing behavior of starting the location lock early is preserved.
  • [x] If permission was not given, then the request to turn on location lock is deferred to when the task is resumed or the user hits "Capture" if they declined the permission.
  • [x] Created survey with a text task before a capture location task. Verified that turning off permission does not trigger the permission early, and triggers when the user arrives on the task.
  • [x] Verified that already having the permission replicates the existing behavior.
  • [x] Verified in offline mode as well.

No permission dialog: Screenshot 2024-03-20 at 9 58 08 PM Shown when clicking Next: Screenshot 2024-03-20 at 9 58 17 PM If declined, and also clicking "Capture" after declining the first time: Screenshot 2024-03-20 at 9 58 46 PM

PTAL @gino-m @shobhitagarwal1612 !

sufyanAbbasi avatar Mar 21 '24 04:03 sufyanAbbasi