Skip to content

LG-6777 capture native camera after failed twice#6727

Merged
peggles2 merged 14 commits intomainfrom
LG-6777-capture-native-camera-after-failed
Aug 16, 2022
Merged

LG-6777 capture native camera after failed twice#6727
peggles2 merged 14 commits intomainfrom
LG-6777-capture-native-camera-after-failed

Conversation

@peggles2
Copy link
Contributor

This pull request will force native camera to do the document capture after the sdk camera has failed twice.

Eric Gade and others added 9 commits August 4, 2022 16:58
-- What
We are saving progress, but still trying to figure out where to inject
the faile attempts check in order to trigger manual camera/upload flow.
-- What
For clarity in the FailedCaptureContext interface, we've added a
property called `forceNativeCamera` which is a boolean value that will
update in the FailedCaptureContextProvider whenever the
maxAttemptsBeforeNativeCamera is equal to or exceeds the current
failedCaptures value.

Additionally, we finally have some working tests for this. For the
moment, we only get results by forcing maxAttemptsBeforeNativeCamera
to be 0, then clicking the file input. This seems to do the trick.

But we need to figure out how to test a couple of other scenarios, and
how to force failures from that point in a test case.
changelog: Improvements, Acuant, updating max attempts before login
-- What
This commit updates various JSDoc type annotations so that they
accurately describe the new structure of the FailedCaptureAttempts
context. Specifically, we added maxAttemptsBeforeNativeCamera and
forceNativeCamera to this context in previous commits. Now the types
and provider components accurately reflect those changes.
-- What
Adding a test to ensure that logging is *not* called in the case
where failed attempts is not equal or greater to the max attempts
before native camera is forced.

changelog: Improvements, Acuant Camera settings, updating max failures
before native camera is triggered
@peggles2 peggles2 changed the title Lg 6777 capture native camera after failed twice Lg-6777 capture native camera after failed twice Aug 11, 2022
@peggles2 peggles2 changed the title Lg-6777 capture native camera after failed twice LG-6777 capture native camera after failed twice Aug 11, 2022
@peggles2 peggles2 requested a review from a team August 11, 2022 22:08
Copy link
Contributor

@solipet solipet left a comment

Choose a reason for hiding this comment

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

Looks good - I'm going to try and test it locally, but that will wait until Monday...

Comment on lines +400 to +402
addPageAction(`IdV: Force native camera. Failed attempts: ${failedCaptureAttempts}`, {
field: name,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Since addPageAction logs to the event.log, the name passed should be constant and the failed attempts should go in the data hash that will be logged with it.

Suggested change
addPageAction(`IdV: Force native camera. Failed attempts: ${failedCaptureAttempts}`, {
field: name,
});
addPageAction('IdV: Force native camera.', {
field: name,
failed_attempts: $(failedCaptureAttempts),
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also allowlist this event? see EVENT_MAP for methods on AnalyticsEvents

  1. so it doesn't need to get prefixed with "frontend"
  2. so we can get documentation for it?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should probably leave out the period as well in the suggested change, for consistency with other events?

Copy link
Contributor

Choose a reason for hiding this comment

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

Going to work on this now. What are the arguments passed to these ruby-side logging methods in AnalyticsEvents -- are they just the same as the dict/object we pass as the second arg to addPageAction on the frontend?

Copy link
Contributor

Choose a reason for hiding this comment

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

Going to work on this now. What are the arguments passed to these ruby-side logging methods in AnalyticsEvents -- are they just the same as the dict/object we pass as the second arg to addPageAction on the frontend?

Yeah, the properties we add in the JavaScript object here will be passed through as keyword arguments to the corresponding Ruby method.

analytics_method.bind_call(analytics, **payload)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok I believe I've dealt with this in 1b78fed and subsequent commits

eric-gade added 5 commits August 15, 2022 08:59
changelog: Improvements, Acuant native camera, linting fixes
-- What
We were not correctly calling `addPageAction` when trying to log the
force native camera event from the frontend.

Additionally, we are adding a method to the frontend log controller
for this action so that it can have appropriate documentation.

changelog: Improvement, Logging, loggin force native camera event
changelog: Improvements, Testing, removing unused features from tests
-- What
After updating the IdV logging string for forcing native camera, we
neede to also change the assumption of the tests that check for that
string

changelog: Improvements, Frontend Testing, fixing logging tests for
failed capture
changelog: Improvements, Lintinf fixes, fixing linting in ruby analytics
Comment on lines 50 to +51
* @prop {number} maxFailedAttemptsBeforeTips
* @prop {number} maxAttemptsBeforeNativeCamera
Copy link
Contributor

Choose a reason for hiding this comment

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

Will a user ever see these tips anymore? If not, is this a feature we'd want to remove?

Copy link
Contributor

Choose a reason for hiding this comment

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

@aduth good catch -- we are currently all discussing this and will get back to you / push changes if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok. We have decided to open a separate ticket for dealing with the tips issue. It's going to take us a bit more time to sort that all out. As it stands with this branch, the tips should never be triggered (the default is 3 failed attempts vs our 2).

@eric-gade
Copy link
Contributor

Question: since we have added a configurable yaml setting (doc_auth_max_attempts_before_native_camera: 2) in application.default.yml, do we need to also add this in the stored S3 prod settings somehow?

@aduth
Copy link
Contributor

aduth commented Aug 16, 2022

Question: since we have added a configurable yaml setting (doc_auth_max_attempts_before_native_camera: 2) in application.default.yml, do we need to also add this in the stored S3 prod settings somehow?

No, as long as it's either in the top-level or production: section of application.yml.default, it'll be used assuming there is no value in the S3 configuration that overrides it, since the latter is merged with the defaults.

@peggles2 peggles2 merged commit 602df44 into main Aug 16, 2022
@peggles2 peggles2 deleted the LG-6777-capture-native-camera-after-failed branch August 16, 2022 21:00
@jmhooper jmhooper mentioned this pull request Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants