feat: cartões de publicação em canais e corrreções de salas arquivadas
- Canais: publicações viram cartões de largura total mantendo todas as funções do balão (reações, resposta, editar, excluir, comentários em thread). Composer de publicação fica restrito a admins no feed; membros comentam via tela de thread. Canais novos usam events_default 0 para permitir comentários e reações. - Ao sair/excluir uma sala, a cópia local é removida do banco imediatamente; salas já deixadas no servidor não apresentam mais erro ao excluir de novo. - Classificação mural/canal carregada direto do sync (room_type em importantStateEvents + postLoad) sem precisar abrir a sala. - Diálogos com raio e padding reduzidos (dialogTheme, text input e ok/cancel). - Ícones do app regenerados (logo_background) e dependência linkify.
This commit is contained in:
33
lib/utils/matrix_sdk_extensions/room_extension.dart
Normal file
33
lib/utils/matrix_sdk_extensions/room_extension.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
|
||||
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:tatchat/config/app_config.dart';
|
||||
|
||||
/// State event type that marks the room category (canal/mural) on a room
|
||||
/// level. Unlike the personal tags (per-account data), this marker is shared
|
||||
/// by all room members which makes the categorization consistent across
|
||||
/// different accounts.
|
||||
const String roomTypeStateEvent = 'tatuchat.room_type';
|
||||
|
||||
extension RoomTypeExtension on Room {
|
||||
String? get roomType =>
|
||||
getState(roomTypeStateEvent)?.content.tryGet<String>('type');
|
||||
|
||||
bool get isCanal =>
|
||||
tags.keys.contains(AppConfig.canalTag) || roomType == 'canal';
|
||||
|
||||
bool get isMural =>
|
||||
tags.keys.contains(AppConfig.muralTag) || roomType == 'mural';
|
||||
|
||||
/// Whether the account left (or was banned from) this room. Such rooms must
|
||||
/// not be shown in the chat list, even if a stale local copy with an old
|
||||
/// "join" membership reappears after a restart.
|
||||
bool get isLeftOrBanned =>
|
||||
{Membership.leave, Membership.ban}.contains(membership);
|
||||
|
||||
Future<String> setRoomType(String type) =>
|
||||
client.setRoomStateWithKey(id, roomTypeStateEvent, '', {'type': type});
|
||||
}
|
||||
Reference in New Issue
Block a user