Skip to content

Commit

Permalink
[mob][photos] Auto lock time changed
Browse files Browse the repository at this point in the history
  • Loading branch information
AmanRajSinghMourya committed Jul 18, 2024
1 parent ab9c097 commit e5a5d9c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 21 deletions.
2 changes: 0 additions & 2 deletions mobile/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ const kFGHomeWidgetSyncFrequency = Duration(minutes: 15);
const kBGTaskTimeout = Duration(seconds: 25);
const kBGPushTimeout = Duration(seconds: 28);
const kFGTaskDeathTimeoutInMicroseconds = 5000000;
const kBackgroundLockLatency = Duration(seconds: 3);

void main() async {
debugRepaintRainbowEnabled = false;
Expand Down Expand Up @@ -100,7 +99,6 @@ Future<void> _runInForeground(AdaptiveThemeMode? savedThemeMode) async {
locale: locale,
lightTheme: lightThemeData,
darkTheme: darkThemeData,
backgroundLockLatency: kBackgroundLockLatency,
savedThemeMode: _themeMode(savedThemeMode),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class _AutoLockItemsState extends State<AutoLockItems> {
} else if (duration.inSeconds != 0) {
return "${duration.inSeconds}s";
} else {
return "Disabled";
return "Immediately";
}
}
}
14 changes: 2 additions & 12 deletions mobile/lib/ui/settings/lock_screen/lock_screen_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,7 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {
} else if (duration.inSeconds != 0) {
return "in ${duration.inSeconds} second${duration.inSeconds > 1 ? 's' : ''}";
} else {
return "Disabled";
}
}

String _getAppLockType() {
if (isPinEnabled) {
return "Pin";
} else if (isPasswordEnabled) {
return "Password";
} else {
return "Device lock";
return "Immediately";
}
}

Expand Down Expand Up @@ -269,7 +259,7 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {
right: 12,
),
child: Text(
"Require ${_getAppLockType()} if away for some time .",
"Time after which the app will be locked after closing",
style: textTheme.miniFaint,
textAlign: TextAlign.left,
),
Expand Down
4 changes: 1 addition & 3 deletions mobile/lib/ui/tools/app_lock.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import "package:photos/utils/lock_screen_settings.dart";
/// `AppLock.of(context).disable();` or the convenience method `AppLock.of(context).setEnabled(enabled);`
/// using a bool argument.
///
/// [backgroundLockLatency] determines how much time is allowed to pass when
/// [_backgroundLockLatencyTimer] determines how much time is allowed to pass when
/// the app is in the background state before the [lockScreen] widget should be
/// shown upon returning. It defaults to instantly.
///
Expand All @@ -32,7 +32,6 @@ class AppLock extends StatefulWidget {
final Widget Function(Object?) builder;
final Widget lockScreen;
final bool enabled;
final Duration backgroundLockLatency;
final ThemeData? darkTheme;
final ThemeData? lightTheme;
final ThemeMode savedThemeMode;
Expand All @@ -45,7 +44,6 @@ class AppLock extends StatefulWidget {
required this.savedThemeMode,
this.enabled = true,
this.locale = const Locale("en", "US"),
this.backgroundLockLatency = const Duration(seconds: 0),
this.darkTheme,
this.lightTheme,
}) : super(key: key);
Expand Down
5 changes: 2 additions & 3 deletions mobile/lib/utils/lock_screen_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ class LockScreenSettings {
late SharedPreferences _preferences;
static const List<Duration> autoLockDurations = [
Duration(seconds: 0),
Duration(seconds: 30),
Duration(seconds: 5),
Duration(seconds: 15),
Duration(minutes: 1),
Duration(minutes: 5),
Duration(minutes: 15),
Duration(minutes: 30),
Duration(hours: 1),
];
void init(SharedPreferences prefs) async {
_secureStorage = const FlutterSecureStorage();
Expand Down

0 comments on commit e5a5d9c

Please sign in to comment.