[mob][photos] Make code better readable

This commit is contained in:
ashilkn
2024-07-24 16:00:18 +05:30
parent b1907ff091
commit 40f0829f6b
2 changed files with 8 additions and 11 deletions

View File

@@ -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,
);
}

View File

@@ -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() {