Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix theme update

AmanRajSinghMourya1c46401ad97d
diff --git a/mobile/apps/locker/lib/app.dart b/mobile/apps/locker/lib/app.dart
index 1b7d5e4f75..d0cd4dbdf6 100644
--- a/mobile/apps/locker/lib/app.dart
+++ b/mobile/apps/locker/lib/app.dart
@@ -23,7 +23,13 @@ import 'package:window_manager/window_manager.dart';
class App extends StatefulWidget {
final Locale? locale;
- const App({super.key, this.locale = const Locale("en")});
+ final AdaptiveThemeMode? savedThemeMode;
+
+ const App({
+ super.key,
+ this.locale = const Locale("en"),
+ this.savedThemeMode,
+ });
static void setLocale(BuildContext context, Locale newLocale) {
final _AppState state = context.findAncestorStateOfType<_AppState>()!;
@@ -104,7 +110,7 @@ class _AppState extends State<App>
return AdaptiveTheme(
light: lightThemeData,
dark: darkThemeData,
- initial: AdaptiveThemeMode.system,
+ initial: widget.savedThemeMode ?? AdaptiveThemeMode.system,
builder: (lightTheme, dartTheme) => MaterialApp(
title: "ente",
themeMode: ThemeMode.system,
diff --git a/mobile/apps/locker/lib/main.dart b/mobile/apps/locker/lib/main.dart
index 066e8ead2b..7ab3ef98ae 100644
--- a/mobile/apps/locker/lib/main.dart
+++ b/mobile/apps/locker/lib/main.dart
@@ -100,7 +100,8 @@ Future<void> _initSystemTray() async {
Future<void> _runInForeground() async {
AppThemeConfig.initialize(EnteApp.locker);
- final savedThemeMode = _themeMode(await AdaptiveTheme.getThemeMode());
+ final adaptiveThemeMode = await AdaptiveTheme.getThemeMode();
+ final savedThemeMode = _themeMode(adaptiveThemeMode);
return await _runWithLogs(() async {
_logger.info("Starting app in foreground");
try {
@@ -112,7 +113,8 @@ Future<void> _runInForeground() async {
final Locale? locale = await getLocale(noFallback: true);
runApp(
AppLock(
- builder: (args) => App(locale: locale),
+ builder: (args) =>
+ App(locale: locale, savedThemeMode: adaptiveThemeMode),
lockScreen: LockScreen(Configuration.instance),
enabled: await LockScreenSettings.instance.shouldShowLockScreen(),
locale: locale,