diff --git a/lib/src/model/game/game_controller.dart b/lib/src/model/game/game_controller.dart index d2a4ac3791..fa878aef4b 100644 --- a/lib/src/model/game/game_controller.dart +++ b/lib/src/model/game/game_controller.dart @@ -12,6 +12,7 @@ import 'package:lichess_mobile/src/model/account/account_preferences.dart'; import 'package:lichess_mobile/src/model/account/account_repository.dart'; import 'package:lichess_mobile/src/model/analysis/analysis_controller.dart'; import 'package:lichess_mobile/src/model/analysis/server_analysis_service.dart'; +import 'package:lichess_mobile/src/model/auth/auth_session.dart'; import 'package:lichess_mobile/src/model/common/chess.dart'; import 'package:lichess_mobile/src/model/common/id.dart'; import 'package:lichess_mobile/src/model/common/service/move_feedback.dart'; @@ -113,6 +114,16 @@ class GameController extends _$GameController { _socketEventVersion = fullEvent.socketEventVersion; + // Play "dong" sound when this is a new game and we're playing it (not spectating) + final myUserId = ref.watch(authSessionProvider)?.user.id; + final isMyGame = + myUserId != null && game.playerSideOf(myUserId) != null; + if (isMyGame && + game.status == GameStatus.started && + game.steps.length == 1) { + ref.read(soundServiceProvider).play(Sound.dong); + } + if (game.playable) { _appLifecycleListener = AppLifecycleListener( onResume: () {