revealIfNeeded static method
Implementation
static Future revealIfNeeded(BuildContext context) async {
final IAppDataStore appDataStore = getObject();
final shouldNudgeAppLock = await appDataStore.shouldNudgeAppLock();
if (!shouldNudgeAppLock) {
return;
}
final isAlreadyEnabled = await appDataStore.isLocalAuthEnabled();
if (isAlreadyEnabled) {
await appDataStore.setShouldNudgeAppLock(false);
return;
}
// ignore: use_build_context_synchronously
final shouldEnable = await _askUserToEnableAppLock(context);
if (shouldEnable == null) {
return;
}
if (shouldEnable) {
await appDataStore.setLocalAuthEnabled(true);
}
await appDataStore.setShouldNudgeAppLock(false);
}