fix: jump cannot work properly when there are multi users
This commit is contained in:
parent
ccb2a23075
commit
940d3e62db
4 changed files with 17 additions and 2 deletions
|
|
@ -415,6 +415,7 @@ class ChatListController extends State<ChatList>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Matrix.of(context).setController(this);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -815,6 +816,14 @@ class ChatListController extends State<ChatList>
|
||||||
_clientStream.add(client);
|
_clientStream.add(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setActiveClientWithUserId(String name) {
|
||||||
|
setState(() {
|
||||||
|
activeFilter = ActiveFilter.allChats;
|
||||||
|
_activeSpaceId = null;
|
||||||
|
Matrix.of(context).setActiveClientWithUserId(name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void setActiveBundle(String bundle) {
|
void setActiveBundle(String bundle) {
|
||||||
context.go('/rooms');
|
context.go('/rooms');
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
|
||||||
|
|
@ -147,8 +147,8 @@ extension LocalNotificationsExtension on MatrixState {
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case DesktopNotificationActions.openChat:
|
case DesktopNotificationActions.openChat:
|
||||||
if (userId != null) {
|
if (userId != null && controller != null) {
|
||||||
Matrix.of(context).setActiveClientWithUserId(userId);
|
controller!.setActiveClientWithUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluffyChatApp.router.go('/rooms/${event.room.id}');
|
FluffyChatApp.router.go('/rooms/${event.room.id}');
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|
@ -70,6 +71,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
bool? loginRegistrationSupported;
|
bool? loginRegistrationSupported;
|
||||||
|
|
||||||
BackgroundPush? backgroundPush;
|
BackgroundPush? backgroundPush;
|
||||||
|
ChatListController? controller;
|
||||||
|
|
||||||
Client get client {
|
Client get client {
|
||||||
if (_activeClient < 0 || _activeClient >= widget.clients.length) {
|
if (_activeClient < 0 || _activeClient >= widget.clients.length) {
|
||||||
|
|
@ -100,6 +102,9 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
Logs().w('Tried to set an unknown user $userId as active');
|
Logs().w('Tried to set an unknown user $userId as active');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void setController(ChatListController controller) {
|
||||||
|
this.controller = controller;
|
||||||
|
}
|
||||||
|
|
||||||
void setActiveClient(Client? cl) {
|
void setActiveClient(Client? cl) {
|
||||||
final i = widget.clients.indexWhere((c) => c == cl);
|
final i = widget.clients.indexWhere((c) => c == cl);
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ endif()
|
||||||
# default. In most cases, you should add new options to specific targets instead
|
# default. In most cases, you should add new options to specific targets instead
|
||||||
# of modifying this function.
|
# of modifying this function.
|
||||||
function(APPLY_STANDARD_SETTINGS TARGET)
|
function(APPLY_STANDARD_SETTINGS TARGET)
|
||||||
|
target_compile_options(${TARGET} PRIVATE -Wno-deprecated)
|
||||||
target_compile_features(${TARGET} PUBLIC cxx_std_14)
|
target_compile_features(${TARGET} PUBLIC cxx_std_14)
|
||||||
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
|
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
|
||||||
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
|
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue