-
Notifications
You must be signed in to change notification settings - Fork 19
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
Feature: allow changing backgroundLockLatency #27
base: main
Are you sure you want to change the base?
Feature: allow changing backgroundLockLatency #27
Conversation
Thanks for this! Will review (at some point) with the aim of merging it in 👍 |
Hello, Is this feature planned to be in prod? |
Thanks @Bptmn! Out of curiosity, this call to change the background lock latency, you'd also need to pass it through when instantiating AppLock anyway, as changing the background lock latency in this manner at runtime won't persist across app launches 🤔 Which also makes me think that the So with that I also wonder if being able to control background latency is something that should be done by a descendant of AppLock 🤔 I'm thinking while it might have been convenient I don't think it's the right approach... |
Thanks for your answer @tomalabaster. I am not an expert in Flutter so my following thoughts should be treated cautiously. To enable or disable AppLock, the method "AppLock.of(context)!.enable()" works while being in runtime, so it does have an effect to the AppLock constructor, right? For example, the value of the backgroundLockLatency would be a persisted app state with a default value. Given the app state is initialized first, the backgroundLockLatency will have a value at launch, and if the value of the appstate is changed at runtime, it will persist across app launches. What I already tried:
Do you think it would be possible? |
Could you elaborate? If enabling and disabling is possible, so - and in the same way - should be editing the latency, I think. I.e. for both settings we need both a constructor parameter of Prefixing the constructor parameter with an "initial" is possible, but probably not necessary. And the issue of persistence shouldn't be part of this discussion. You (as an app developer) would use a storage solution (isar, shared_preferences, whatever you like) for that and pass the value to |
Small feature suggestion: Allow to change the backgroundLockLatency during runtime.
Possible usecase for that: You're using a zero-latency app lock, but want to use a file picker, which puts the app in background. On return from the file picker the user should not have to enter a pin, unless maybe after a certain timeout, which would require changing backgroundLockLatency before and after using the file picker.
A relatively minor change to app_lock.dart, and I've added a possibility to test it in the example app.