Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call becomeFirstResponder with dispatch to main queue after delay #915

Merged
merged 1 commit into from Mar 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion ResearchKit/Common/ORKPasscodeStepViewController.m
Expand Up @@ -369,7 +369,17 @@ - (void)promptTouchId {
}]];
[strongSelf presentViewController:alert animated:YES completion:nil];
} else if (error.code == LAErrorUserCancel) {
[strongSelf makePasscodeViewBecomeFirstResponder];

// call becomeFirstResponder here to show the keyboard. dispatch to main queue with
// delay because without it, the transition from the touch ID context back to the app
// inexplicably causes the keyboard to be invisble. It's not hidden, as user can still
// tap keys, but cannot see them

double delayInSeconds = 0.3;
Copy link
Contributor

Choose a reason for hiding this comment

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

@joshbruhin
Thanks for figuring this out. How did you choose this delay? I seem to recall (fuzzy on this one) that standard animation time for iOS presentation/dismissal is 0.2 seconds?

Copy link
Member

Choose a reason for hiding this comment

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

@joshbruhin It would be nice to know how you decided on 0.3 for the delay. Thanks!

dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[strongSelf makePasscodeViewBecomeFirstResponder];
});
}

[strongSelf finishTouchId];
Expand Down