Add UserRemoteFlag service

This commit is contained in:
Neeraj Gupta 2022-09-20 11:35:34 +05:30
parent 6b24997d93
commit ca940e9c64
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
2 changed files with 7 additions and 2 deletions

View file

@ -31,6 +31,7 @@ import 'package:photos/services/search_service.dart';
import 'package:photos/services/sync_service.dart';
import 'package:photos/services/trash_sync_service.dart';
import 'package:photos/services/update_service.dart';
import 'package:photos/services/user_remote_flag_service.dart';
import 'package:photos/services/user_service.dart';
import 'package:photos/ui/tools/app_lock.dart';
import 'package:photos/ui/tools/lock_screen.dart';
@ -133,6 +134,7 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
await Network.instance.init();
await Configuration.instance.init();
await UserService.instance.init();
await UserRemoteFlagService.instance.init();
await UpdateService.instance.init();
await BillingService.instance.init();
await CollectionsService.instance.init();

View file

@ -36,6 +36,9 @@ class UserRemoteFlagService {
return _prefs.getBool(needRecoveryKeyVerification)!;
}
// markRecoveryVerificationAsDone is used to track if user has verified their
// recovery key in the past or not. This helps in avoid showing the same
// prompt to the user on re-install or signing into a different device
Future<void> markRecoveryVerificationAsDone() async {
await _setBooleanFlag(recoveryVerificationFlag, true);
await _prefs.setBool(needRecoveryKeyVerification, false);
@ -107,10 +110,10 @@ class UserRemoteFlagService {
return true;
} on DioError catch (e) {
_logger.info(e);
return false;
rethrow;
} catch (e) {
_logger.warning("marking recovery key status failed", e);
return false;
rethrow;
}
}
}