mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 08:15:09 +00:00
feat: add dialog to hide presence list with long-press
This commit is contained in:
parent
ccfa3fa8f6
commit
f8f73b7661
3 changed files with 19 additions and 2 deletions
|
@ -2300,6 +2300,7 @@
|
|||
}
|
||||
},
|
||||
"hideUnimportantStateEvents": "Hide unimportant state events",
|
||||
"hidePresences": "Hide Status List?",
|
||||
"doNotShowAgain": "Do not show again",
|
||||
"wasDirectChatDisplayName": "Empty chat (was {oldDisplayName})",
|
||||
"@wasDirectChatDisplayName": {
|
||||
|
|
|
@ -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!);
|
||||
|
|
|
@ -134,9 +134,12 @@ class ChatListViewBody extends StatelessWidget {
|
|||
if (!controller.isSearchMode &&
|
||||
controller.activeFilter != ActiveFilter.groups &&
|
||||
AppConfig.showPresences)
|
||||
StatusMessageList(
|
||||
GestureDetector(
|
||||
onLongPress: () => controller.dismissStatusList(),
|
||||
child: StatusMessageList(
|
||||
onStatusEdit: controller.setStatus,
|
||||
),
|
||||
),
|
||||
const ConnectionStatusHeader(),
|
||||
AnimatedContainer(
|
||||
height: controller.isTorBrowser ? 64 : 0,
|
||||
|
|
Loading…
Reference in a new issue