[mob][photos] Make code better readable
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user