From 9570ae00b7aa9bd62843a8c68ae08f575fbf24e2 Mon Sep 17 00:00:00 2001 From: SputNikPlop <100245448+SputNikPlop@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:56:55 -0700 Subject: [PATCH] fix: merge --- lib/screens/home.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 6d4c76d0..e54b8f86 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -188,9 +188,10 @@ class _HomeScreenState extends State with TickerProviderStateMixin { if (model.sources.isEmpty || (await AudioChannel.hasPermission())) { return; } - if (mounted) { + debugPrint("Conditions passed"); model.showAudioPermissionDialog(context); + checkAndHandleBatteryLevel(ttsModel); } }); } @@ -201,7 +202,10 @@ class _HomeScreenState extends State with TickerProviderStateMixin { if (batteryLevel < 5 && !isCharging) { if (model.enabled) { - model.enabled = false; + if (mounted) { + model.setEnabled(AppLocalizations.of(context)!, false); + } + updateChannelSubscription(""); await TextToSpeechPlugin.speak("Text to speech disabled"); await TextToSpeechPlugin.disableTTS(); @@ -214,10 +218,6 @@ class _HomeScreenState extends State with TickerProviderStateMixin { void dispose() { WakelockPlus.disable(); super.dispose(); - - if (_batteryStateSubscription != null) { - _batteryStateSubscription!.cancel(); - } } @override