fix: guard RefenaScope.defaultRef access in tray helper (#2927) (#2949)

Co-authored-by: ramyaramyarao11278-cmd <ramyaramyarao11278-cmd@users.noreply.github.com>
This commit is contained in:
ramyaramyarao11278-cmd
2026-02-22 23:19:37 +08:00
committed by GitHub
parent fba694b968
commit 22d41c88ff
+10 -2
View File
@@ -72,7 +72,11 @@ Future<void> hideToTray() async {
}
// Disable animations
RefenaScope.defaultRef.notifier(sleepProvider).setState((_) => true);
try {
RefenaScope.defaultRef.notifier(sleepProvider).setState((_) => true);
} catch (e) {
_logger.warning('Failed to update sleep state (Refena not yet initialized)', e);
}
}
Future<void> showFromTray() async {
@@ -86,7 +90,11 @@ Future<void> showFromTray() async {
}
// Enable animations
RefenaScope.defaultRef.notifier(sleepProvider).setState((_) => false);
try {
RefenaScope.defaultRef.notifier(sleepProvider).setState((_) => false);
} catch (e) {
_logger.warning('Failed to update sleep state (Refena not yet initialized)', e);
}
}
Future<void> destroyTray() async {