Refactor command handling in ChatRepository for Android and iOS
- Reset commandLines and commandKind to default values when a command table event is received, ensuring a clean state for subsequent commands. - This change improves the handling of command events and maintains consistency across platforms.
This commit is contained in:
@@ -362,6 +362,8 @@ class ChatRepository(
|
|||||||
errorMessage = if (event.kind == "info" || event.kind.startsWith("login")) event.lines.joinToString(" | ") else current.errorMessage
|
errorMessage = if (event.kind == "info" || event.kind.startsWith("login")) event.lines.joinToString(" | ") else current.errorMessage
|
||||||
)
|
)
|
||||||
is SocketEvent.CommandTable -> current.copy(
|
is SocketEvent.CommandTable -> current.copy(
|
||||||
|
commandLines = emptyList(),
|
||||||
|
commandKind = null,
|
||||||
commandTable = CommandTableState(event.title, event.columns, event.rows)
|
commandTable = CommandTableState(event.title, event.columns, event.rows)
|
||||||
)
|
)
|
||||||
is SocketEvent.Error -> current.copy(errorMessage = event.message)
|
is SocketEvent.Error -> current.copy(errorMessage = event.message)
|
||||||
|
|||||||
@@ -483,6 +483,8 @@ final class ChatRepository: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case .commandTable(let title, let columns, let rows):
|
case .commandTable(let title, let columns, let rows):
|
||||||
|
current.commandLines = []
|
||||||
|
current.commandKind = nil
|
||||||
current.commandTable = CommandTableState(title: title, columns: columns, rows: rows)
|
current.commandTable = CommandTableState(title: title, columns: columns, rows: rows)
|
||||||
|
|
||||||
case .error(let message):
|
case .error(let message):
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ export function setupBroadcast(io, __dirname) {
|
|||||||
['/stat ages', 'Jüngster und ältester Nutzer'],
|
['/stat ages', 'Jüngster und ältester Nutzer'],
|
||||||
['/stat names', 'Häufigkeit der verwendeten Namen'],
|
['/stat names', 'Häufigkeit der verwendeten Namen'],
|
||||||
['/stat countries', 'Häufigkeit der Länder'],
|
['/stat countries', 'Häufigkeit der Länder'],
|
||||||
['/all-stats', 'Zusammenfassung wichtiger Kennzahlen']
|
['/all-stats', 'Kurzübersicht nur aus Logindatei (logins.log), keine Live-Chat-Metriken']
|
||||||
]);
|
]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -665,7 +665,7 @@ export function setupBroadcast(io, __dirname) {
|
|||||||
['/logout-admin', 'Admin-/Command-Login beenden'],
|
['/logout-admin', 'Admin-/Command-Login beenden'],
|
||||||
['/whoami-rights', 'Aktuelle Admin-Rechte anzeigen'],
|
['/whoami-rights', 'Aktuelle Admin-Rechte anzeigen'],
|
||||||
['/stat help', 'Hilfe zu Statistikbefehlen anzeigen'],
|
['/stat help', 'Hilfe zu Statistikbefehlen anzeigen'],
|
||||||
['/all-stats', 'Zusammenfassung wichtiger Statistiken'],
|
['/all-stats', 'Kurzübersicht nur aus Logindatei (logins.log), keine Live-Chat-Metriken'],
|
||||||
['/kick <username>', 'Benutzer aus dem Chat werfen'],
|
['/kick <username>', 'Benutzer aus dem Chat werfen'],
|
||||||
['/help oder /?', 'Diese Hilfe anzeigen']
|
['/help oder /?', 'Diese Hilfe anzeigen']
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user