Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Make code better readable

ashilkn40f0829f6b06
diff --git a/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart b/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart
index 8faa85a209..9537270646 100644
--- a/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart
+++ b/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart
@@ -36,7 +36,6 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {
@override
void initState() {
super.initState();
- hideAppContent = _lockscreenSetting.getShouldShowAppContent();
autoLockTimeInMilliseconds = _lockscreenSetting.getAutoLockTime();
_initializeSettings();
appLock = isPinEnabled ||
@@ -47,12 +46,10 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {
Future<void> _initializeSettings() async {
final bool passwordEnabled = await _lockscreenSetting.isPasswordSet();
final bool pinEnabled = await _lockscreenSetting.isPinSet();
- final bool shouldShowAppContent =
- _lockscreenSetting.getShouldShowAppContent();
setState(() {
isPasswordEnabled = passwordEnabled;
isPinEnabled = pinEnabled;
- hideAppContent = shouldShowAppContent;
+ hideAppContent = _lockscreenSetting.getShouldShowAppContent();
});
}
@@ -113,7 +110,7 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {
await _configuration.setSystemLockScreen(!appLock);
await _lockscreenSetting.removePinAndPassword();
if (appLock == true) {
- await _lockscreenSetting.shouldShowAppContent(isContentVisible: false);
+ await _lockscreenSetting.setShowAppContent(false);
}
setState(() {
_initializeSettings();
@@ -125,8 +122,8 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {
setState(() {
hideAppContent = !hideAppContent;
});
- await _lockscreenSetting.shouldShowAppContent(
- isContentVisible: hideAppContent,
+ await _lockscreenSetting.setShowAppContent(
+ hideAppContent,
);
}
diff --git a/mobile/lib/utils/lock_screen_settings.dart b/mobile/lib/utils/lock_screen_settings.dart
index 3df6546f0a..c93338cd52 100644
--- a/mobile/lib/utils/lock_screen_settings.dart
+++ b/mobile/lib/utils/lock_screen_settings.dart
@@ -32,11 +32,11 @@ class LockScreenSettings {
void init(SharedPreferences prefs) async {
_secureStorage = const FlutterSecureStorage();
_preferences = prefs;
- await shouldShowAppContent(isContentVisible: getShouldShowAppContent());
+ await setShowAppContent(getShouldShowAppContent());
}
- Future<void> shouldShowAppContent({bool isContentVisible = true}) async {
- !isContentVisible
+ Future<void> setShowAppContent(bool showContent) async {
+ !showContent
? await PrivacyScreen.instance.disable()
: await PrivacyScreen.instance.enable(
iosOptions: const PrivacyIosOptions(
@@ -48,7 +48,7 @@ class LockScreenSettings {
),
blurEffect: PrivacyBlurEffect.extraLight,
);
- await _preferences.setBool(keyShowAppContent, isContentVisible);
+ await _preferences.setBool(keyShowAppContent, showContent);
}
bool getShouldShowAppContent() {