onUnmute method
Future<void>
onUnmute( - dynamic context,
- dynamic ref
)
Implementation
Future<void> onUnmute(BuildContext context, WidgetRef ref) async {
final room = await ref.read(maybeRoomProvider(roomId).future);
if (room == null) {
_log.severe('Room not found: $roomId');
if (!context.mounted) return;
EasyLoading.showError(
L10n.of(context).roomNotFound,
duration: const Duration(seconds: 3),
);
return;
}
await room.unmute();
if (!context.mounted) return;
EasyLoading.showToast(L10n.of(context).notificationsUnmuted);
await Future.delayed(const Duration(seconds: 1), () {
// FIXME: we want to refresh the view but don’t know
// when the event was confirmed form sync :(
// let’s hope that a second delay is reasonable enough
ref.invalidate(maybeRoomProvider(roomId));
});
}