Skip to content

Commit

Permalink
Properly reset audio instructions service
Browse files Browse the repository at this point in the history
  • Loading branch information
adeveloper-wq committed Jun 28, 2024
1 parent 3c1f9f7 commit 1a8b8ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/ride/services/audio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Audio {
positioning!.addListener(_processPositioningUpdates);
}

/// Clean up the audio service.
/// Clean up the audio instructions feature.
Future<void> cleanUp() async {
ride = null;
positioning?.removeListener(_processPositioningUpdates);
Expand All @@ -62,6 +62,13 @@ class Audio {
lastRecommendation.clear();
}

/// Reset the complete audio service.
Future<void> reset() async {
settings?.removeListener(_processSettingsUpdates);
settings = null;
await cleanUp();
}

/// Check for rerouting.
Future<void> _processRideUpdates() async {
if (ride?.navigationIsActive != true) return;
Expand Down
2 changes: 1 addition & 1 deletion lib/ride/views/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class RideViewState extends State<RideView> {
@override
void dispose() {
settings.removeListener(update);
audio?.cleanUp();
audio?.reset();
audio = null;

/// Reenable the bottom navigation bar on Android after hiding it.
Expand Down

0 comments on commit 1a8b8ef

Please sign in to comment.