fix: repeatedly auth (#294 #320)

This commit is contained in:
lollipopkit
2024-03-27 18:48:01 -06:00
parent f5d5bf9c37
commit dacc042a85
4 changed files with 11 additions and 16 deletions

View File

@@ -82,13 +82,13 @@ class _HomePageState extends State<HomePage>
switch (state) {
case AppLifecycleState.resumed:
BioAuth.auth();
if (!Pros.server.isAutoRefreshOn) {
Pros.server.startAutoRefresh();
}
HomeWidgetMC.update();
break;
case AppLifecycleState.paused:
BioAuth.go();
// Keep running in background on Android device
if (isAndroid && Stores.setting.bgRun.fetch()) {
// Keep this if statement single
@@ -316,7 +316,7 @@ ${GithubIds.participants.map((e) => '[$e](${e.url})').join(' ')}
@override
Future<void> afterFirstLayout(BuildContext context) async {
// Auth required for first launch
BioAuth.auth();
BioAuth.go();
if (Stores.setting.autoCheckAppUpdate.fetch()) {
doUpdate(context);

View File

@@ -36,7 +36,7 @@ abstract final class PlatformPublicSettings {
return;
}
// Only auth when turn off (val == false)
final result = await BioAuth.authWithResult();
final result = await BioAuth.goWithResult();
// If failed, turn on again
if (result != AuthResult.success) {
Stores.setting.useBioAuth.put(true);