Skip to content

screen to be on if playing game or watching game#1835

Closed
MunibullahShah wants to merge 16 commits intolichess-org:mainfrom
MunibullahShah:main
Closed

screen to be on if playing game or watching game#1835
MunibullahShah wants to merge 16 commits intolichess-org:mainfrom
MunibullahShah:main

Conversation

@MunibullahShah
Copy link
Copy Markdown

@MunibullahShah MunibullahShah commented Jun 4, 2025

@veloce
Copy link
Copy Markdown
Contributor

veloce commented Jun 4, 2025

There is already a WakeLock widget. You should use it, no need to create one.

Also game screen is already keeping screen on (contrary to what the issue says...), so no need to modify game screen.
Happens here:

child: WakelockWidget(

(admitedly it would be better if it was on game screen, it could be changed);

@MunibullahShah
Copy link
Copy Markdown
Author

Removed the services created and used the already-made widget.
Also moved the Wakelock from GameBody to GameScreen with the condition if the loadedGame !=null

Comment thread lib/src/view/game/game_screen.dart Outdated

actions: [if (loadedGame != null) _GameMenu(gameId: loadedGame.gameId)],
return WakelockWidget(
shouldEnableOnFocusGained: () => loadedGame != null,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that it is not the condition we want.

Before it was:

shouldEnableOnFocusGained: () => gameState.game.playable,

So I think you should revert the changes on game_body.dart and game_screen.dart.

Copy link
Copy Markdown
Contributor

@veloce veloce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code formatting is wrong for game_screen.dart; you can fix it by running dart format lib/src

Comment thread lib/src/view/watch/tv_screen.dart Outdated
final _whiteClockKey = GlobalKey(debugLabel: 'whiteClockOnTvScreen');
final _blackClockKey = GlobalKey(debugLabel: 'blackClockOnTvScreen');

@override
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code does nothing, it can be removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if the comment was not placed on the good line.

This is useful:

final _whiteClockKey = GlobalKey(debugLabel: 'whiteClockOnTvScreen');
  final _blackClockKey = GlobalKey(debugLabel: 'blackClockOnTvScreen');

This is useless:

@override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

Comment thread lib/src/view/game/game_screen.dart Outdated
final _blackClockKey = GlobalKey(debugLabel: 'blackClockOnGameScreen');
final _boardKey = GlobalKey(debugLabel: 'boardOnGameScreen');

@override
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove that

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are being used in GameBody where the comments says that these variables are being used to preserve state if orientation changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the empty initState and dispose; they are useless here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, removing it now :)

@MunibullahShah
Copy link
Copy Markdown
Author

@veloce any update on this?

@MunibullahShah
Copy link
Copy Markdown
Author

MunibullahShah commented Jun 15, 2025

@veloce removed the code in both files

userId: widget.user?.id,
);

final _whiteClockKey = GlobalKey(debugLabel: 'whiteClockOnTvScreen');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay.
I still cannot accept the PR because these keys are removed where they should be kept.

@veloce
Copy link
Copy Markdown
Contributor

veloce commented Feb 21, 2026

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants