-
-
Notifications
You must be signed in to change notification settings - Fork 433
Delay bio auth #642
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
Delay bio auth #642
Conversation
perhaps could place this constant in |
Co-Authored-By: dsvf <philipp@dsvf.net>
0828890
to
15071fa
Compare
@sourcery-ai review |
Reviewer's GuideThis PR adds a configurable delay before triggering biometric authentication by introducing a new setting toggle for a 10-second grace period and updating the app lifecycle handlers in HomePage to respect this delay. Entity relationship diagram for new delayBioAuthLock setting propertyUnable to render rich display Could not find a suitable point for the given distance erDiagram
SETTING_STORE {
bool useBioAuth
bool delayBioAuthLock
bool editorHighlight
}
SETTING_STORE ||--o| HOME_PAGE_STATE : uses
Class diagram for updated SettingStore and HomePageStateclassDiagram
class SettingStore {
+useBioAuth: bool
+delayBioAuthLock: bool
+editorHighlight: bool
}
class _HomePageState {
-_switchingPage: bool
-_shouldAuth: bool
-_pausedTime: DateTime?
+dispose()
+AppLifecycleState handler (updated)
}
SettingStore <.. _HomePageState : uses delayBioAuthLock
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `lib/view/page/home.dart:67` </location>
<code_context>
case AppLifecycleState.resumed:
- if (_shouldAuth) _goAuth();
+ if (_shouldAuth) {
+ if (Stores.setting.delayBioAuthLock.fetch() == true && _pausedTime != null) {
+ if (DateTime.now().difference(_pausedTime ?? DateTime.now()).inSeconds > 10) {
+ _goAuth();
+ } else {
</code_context>
<issue_to_address>
Consider extracting the delay duration into a configurable constant or setting.
Making the 10-second delay configurable will make future adjustments easier and enhance code maintainability.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
if (DateTime.now().difference(_pausedTime ?? DateTime.now()).inSeconds > 10) {
_goAuth();
} else {
=======
const int bioAuthLockDelaySeconds = 10; // Make this configurable as needed
if (DateTime.now().difference(_pausedTime ?? DateTime.now()).inSeconds > bioAuthLockDelaySeconds) {
_goAuth();
} else {
>>>>>>> REPLACE
</suggested_fix>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
I find it difficult when switching between Server Box and other apps that the fingerprint auth activates immediately.
I implemented a delay, if switching away from Server Box and back to it within 10 seconds, then there is no auth request. I also added a setting under App/Android Setting and App/iOS Settings to enable and disable this behavior.
The Strings in the settings widget are hardcoded english since I did not want to add a second pull request to lppcg/fl_lib
Also, the 10 seconds are hardcoded and the "10" value in the settings subtitle is not synchronized with the delay in home.dart, since I'm not sure where and how you like to store a global constant in your project.
You are welcome to consider including this PR into the app.
Summary by Sourcery
Add an optional delay for biometric authentication when returning to the app shortly after backgrounding it.
New Features:
Enhancements: