feat: add dialog to hide presence list with long-press

This commit is contained in:
Marcus Hoffmann 2024-02-11 22:16:46 +01:00
parent ccfa3fa8f6
commit f8f73b7661
3 changed files with 19 additions and 2 deletions

View file

@ -2300,6 +2300,7 @@
}
},
"hideUnimportantStateEvents": "Hide unimportant state events",
"hidePresences": "Hide Status List?",
"doNotShowAgain": "Do not show again",
"wasDirectChatDisplayName": "Empty chat (was {oldDisplayName})",
"@wasDirectChatDisplayName": {

View file

@ -21,6 +21,7 @@ import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import '../../../utils/account_bundles.dart';
import '../../config/setting_keys.dart';
import '../../utils/matrix_sdk_extensions/matrix_file_extension.dart';
import '../../utils/url_launcher.dart';
import '../../utils/voip/callkeep_manager.dart';
@ -511,6 +512,18 @@ class ChatListController extends State<ChatList>
setState(() {});
}
void dismissStatusList() async {
final result = await showOkCancelAlertDialog(
title: L10n.of(context)!.hidePresences,
context: context,
);
if (result == OkCancelResult.ok) {
await Matrix.of(context).store.setBool(SettingKeys.showPresences, false);
AppConfig.showPresences = false;
setState(() {});
}
}
void setStatus() async {
final client = Matrix.of(context).client;
final currentPresence = await client.fetchCurrentPresence(client.userID!);

View file

@ -134,8 +134,11 @@ class ChatListViewBody extends StatelessWidget {
if (!controller.isSearchMode &&
controller.activeFilter != ActiveFilter.groups &&
AppConfig.showPresences)
StatusMessageList(
onStatusEdit: controller.setStatus,
GestureDetector(
onLongPress: () => controller.dismissStatusList(),
child: StatusMessageList(
onStatusEdit: controller.setStatus,
),
),
const ConnectionStatusHeader(),
AnimatedContainer(