mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-22 05:22:34 +01:00
refactor: active room ID now only in defined in the path
This commit is contained in:
parent
2be0188671
commit
2b83e69c1f
@ -204,7 +204,6 @@ class ChatController extends State<Chat> {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
timeline?.cancelSubscriptions();
|
timeline?.cancelSubscriptions();
|
||||||
timeline = null;
|
timeline = null;
|
||||||
matrix.client.activeRoomId = '';
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ class ChatView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
controller.matrix.client.activeRoomId = controller.roomId;
|
|
||||||
|
|
||||||
if (controller.room.membership == Membership.invite) {
|
if (controller.room.membership == Membership.invite) {
|
||||||
showFutureLoadingDialog(
|
showFutureLoadingDialog(
|
||||||
|
@ -586,8 +586,10 @@ class BackgroundPush {
|
|||||||
await room.postLoad();
|
await room.postLoad();
|
||||||
final event = await client.database.getEventById(client.id, eventId, room);
|
final event = await client.database.getEventById(client.id, eventId, room);
|
||||||
|
|
||||||
if (((client.activeRoomId?.isNotEmpty ?? false) &&
|
final activeRoomId = router.currentState.pathParameters['roomid'];
|
||||||
client.activeRoomId == room.id &&
|
|
||||||
|
if (((activeRoomId?.isNotEmpty ?? false) &&
|
||||||
|
activeRoomId == room.id &&
|
||||||
client.syncPresence == null) ||
|
client.syncPresence == null) ||
|
||||||
(event != null && room.notificationCount == 0)) {
|
(event != null && room.notificationCount == 0)) {
|
||||||
return;
|
return;
|
||||||
|
@ -7,9 +7,6 @@ import '../famedlysdk_store.dart';
|
|||||||
class FluffyClient extends Client {
|
class FluffyClient extends Client {
|
||||||
static FluffyClient _instance;
|
static FluffyClient _instance;
|
||||||
|
|
||||||
/// The ID of the currently active room, if there is one. May be null or emtpy
|
|
||||||
String activeRoomId;
|
|
||||||
|
|
||||||
factory FluffyClient({testMode = false}) {
|
factory FluffyClient({testMode = false}) {
|
||||||
_instance ??= FluffyClient._internal(testMode: testMode);
|
_instance ??= FluffyClient._internal(testMode: testMode);
|
||||||
return _instance;
|
return _instance;
|
||||||
|
@ -204,9 +204,12 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||||||
|
|
||||||
bool webHasFocus = true;
|
bool webHasFocus = true;
|
||||||
|
|
||||||
|
String get activeRoomId =>
|
||||||
|
VRouter.of(navigatorContext).pathParameters['roomid'];
|
||||||
|
|
||||||
void _showLocalNotification(EventUpdate eventUpdate) async {
|
void _showLocalNotification(EventUpdate eventUpdate) async {
|
||||||
final roomId = eventUpdate.roomID;
|
final roomId = eventUpdate.roomID;
|
||||||
if (webHasFocus && client.activeRoomId == roomId) return;
|
if (webHasFocus && activeRoomId == roomId) return;
|
||||||
final room = client.getRoomById(roomId);
|
final room = client.getRoomById(roomId);
|
||||||
if (room.notificationCount == 0) return;
|
if (room.notificationCount == 0) return;
|
||||||
final event = Event.fromJson(eventUpdate.content, room);
|
final event = Event.fromJson(eventUpdate.content, room);
|
||||||
|
Loading…
Reference in New Issue
Block a user