mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 08:25:12 +00:00
chore: Follow up set read marker
This commit is contained in:
parent
a349a0804a
commit
fe00db3281
1 changed files with 10 additions and 1 deletions
|
@ -103,7 +103,8 @@ class ChatPageWithRoom extends StatefulWidget {
|
|||
ChatController createState() => ChatController();
|
||||
}
|
||||
|
||||
class ChatController extends State<ChatPageWithRoom> {
|
||||
class ChatController extends State<ChatPageWithRoom>
|
||||
with WidgetsBindingObserver {
|
||||
Room get room => sendingClient.getRoomById(roomId) ?? widget.room;
|
||||
|
||||
late Client sendingClient;
|
||||
|
@ -358,6 +359,13 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
|
||||
String? scrollToEventIdMarker;
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (state != AppLifecycleState.resumed) return;
|
||||
if (!_scrolledUp) return;
|
||||
setReadMarker();
|
||||
}
|
||||
|
||||
Future<void>? _setReadMarkerFuture;
|
||||
|
||||
void setReadMarker({String? eventId}) {
|
||||
|
@ -1169,6 +1177,7 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
|
||||
void onInputBarChanged(String text) {
|
||||
if (_inputTextIsEmpty != text.isEmpty) {
|
||||
setReadMarker();
|
||||
setState(() {
|
||||
_inputTextIsEmpty = text.isEmpty;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue