Chat View Model#72
Merged
Merged
Conversation
the-only-queen-anna
requested changes
Jun 8, 2026
the-only-queen-anna
left a comment
Collaborator
There was a problem hiding this comment.
Grundsätzlich bin ich einverstanden, allerdings würde ich mir noch folgende Änderungen bzw. Erweiterungen wünschen:
- Auslagern der "destinations" in das Repository oder den Controller dazu
- Einführen eines ChatWebSocketController (oder so), damit der Chat und das Game entkoppelt werden (einfach die Methoden aus dem Game Controller rauskopieren in einen neuen Controller und den verwenden)
- Das Repository richtig nutzen, und zwar soll das ViewModel nur die Nachricht weiterleiten, das Repository mappt dann auf das dto und leitet sie an den korrekten Pfad weiter, das ViewModel sollte nichts von der WebSocket Logik wissen.
Das mit dem Repository würde ich noch in dieser PR ändern, der Controller kann sonst eine eigene werden auch.
Siehe Kommentare im Code :)
| ), | ||
| ) | ||
| val uiState: StateFlow<ChatUiState> = _uiState.asStateFlow() | ||
| @HiltViewModel |
Collaborator
There was a problem hiding this comment.
Supi, hilt macht das viel angenehmer
| content: String, | ||
| ) { | ||
| viewModelScope.launch { | ||
| chatRepository.sendMessage("/app/chat/$lobbyCode/$team", username, content) |
Collaborator
There was a problem hiding this comment.
Das ViewModel sollte nichts von den Destinations wissen, das ist schon Socket-Logik
…es/Frontend into chat_view_model solved merge conflicts in ChatViewModel
Collaborator
Author
|
die changes sollten jetzt (hoffentlich) richtig sein |
|
the-only-queen-anna
approved these changes
Jun 10, 2026
the-only-queen-anna
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, danke für die Änderungen :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Context
refactored Chat logic into ChatViewModel
Description
Moved chat functions from GameViewModel into ChatViewModel and updated tests
Changes in the codebase:
Files changed:
GameViewModel.kt, ChatViewModel.kt. GameViewModelTest.kt, ChatViewModelTest,kt, LobbyScreen.kt, NavGraph.kt, GameScreenWrapper.kt