- Salas (chat, canais, murais e salas de espacos) abrem bottom sheet com grid de acoes - Botao + da barra de digitacao abre painel de anexos em grid de 3 colunas que empurra a caixa de texto - Modal do perfil permite editar nome/status e ler QR code (mobile) - Alterar status atualiza localmente via extensao do SDK matrix - Mural pre-carrega historico para exibir todas as midias em dispositivos sem cache
34 lines
1.2 KiB
Dart
34 lines
1.2 KiB
Dart
// 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';
|
|
|
|
extension ClientPresenceExtension on Client {
|
|
/// Sets the own presence status message.
|
|
///
|
|
/// The SDK's [Client.setPresence] only performs the HTTP request and does not
|
|
/// update the local presence cache, the database or the
|
|
/// [Client.onPresenceChanged] stream. As a result
|
|
/// [Client.fetchCurrentPresence] keeps returning the previous status until the
|
|
/// homeserver echoes it back over `/sync`. This helper updates all local
|
|
/// caches after a successful request so the new status is shown immediately.
|
|
Future<void> setStatusMessage(String statusMsg) async {
|
|
final userId = userID;
|
|
if (userId == null) return;
|
|
await setPresence(userId, PresenceType.online, statusMsg: statusMsg);
|
|
final presence = CachedPresence(
|
|
PresenceType.online,
|
|
null,
|
|
statusMsg,
|
|
null,
|
|
userId,
|
|
);
|
|
// ignore: deprecated_member_use
|
|
presences[userId] = presence;
|
|
await database.storePresence(userId, presence);
|
|
onPresenceChanged.add(presence);
|
|
}
|
|
}
|