Merge pull request #892 from Bubu/hide_presences_list
feat: make showing user presence info optional
This commit is contained in:
commit
f8fbbf4c3e
7 changed files with 56 additions and 3 deletions
|
|
@ -1734,6 +1734,16 @@
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"presenceStyle": "Presence:",
|
||||||
|
"@presenceStyle": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"presencesToggle": "Show status messages from other users",
|
||||||
|
"@presencesToggle": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
"singlesignon": "Single Sign on",
|
"singlesignon": "Single Sign on",
|
||||||
"@singlesignon": {
|
"@singlesignon": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
|
@ -2290,6 +2300,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"hideUnimportantStateEvents": "Hide unimportant state events",
|
"hideUnimportantStateEvents": "Hide unimportant state events",
|
||||||
|
"hidePresences": "Hide Status List?",
|
||||||
"doNotShowAgain": "Do not show again",
|
"doNotShowAgain": "Do not show again",
|
||||||
"wasDirectChatDisplayName": "Empty chat (was {oldDisplayName})",
|
"wasDirectChatDisplayName": "Empty chat (was {oldDisplayName})",
|
||||||
"@wasDirectChatDisplayName": {
|
"@wasDirectChatDisplayName": {
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ abstract class AppConfig {
|
||||||
static bool sendTypingNotifications = true;
|
static bool sendTypingNotifications = true;
|
||||||
static bool sendPublicReadReceipts = true;
|
static bool sendPublicReadReceipts = true;
|
||||||
static bool? sendOnEnter;
|
static bool? sendOnEnter;
|
||||||
|
static bool showPresences = true;
|
||||||
static bool experimentalVoip = false;
|
static bool experimentalVoip = false;
|
||||||
static const bool hideTypingUsernames = false;
|
static const bool hideTypingUsernames = false;
|
||||||
static const bool hideAllStateEvents = false;
|
static const bool hideAllStateEvents = false;
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,5 @@ abstract class SettingKeys {
|
||||||
'chat.fluffy.send_public_read_receipts';
|
'chat.fluffy.send_public_read_receipts';
|
||||||
static const String sendOnEnter = 'chat.fluffy.send_on_enter';
|
static const String sendOnEnter = 'chat.fluffy.send_on_enter';
|
||||||
static const String experimentalVoip = 'chat.fluffy.experimental_voip';
|
static const String experimentalVoip = 'chat.fluffy.experimental_voip';
|
||||||
|
static const String showPresences = 'chat.fluffy.show_presences';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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/matrix_sdk_extensions/matrix_locals.dart';
|
||||||
import 'package:fluffychat/utils/platform_infos.dart';
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
import '../../../utils/account_bundles.dart';
|
import '../../../utils/account_bundles.dart';
|
||||||
|
import '../../config/setting_keys.dart';
|
||||||
import '../../utils/matrix_sdk_extensions/matrix_file_extension.dart';
|
import '../../utils/matrix_sdk_extensions/matrix_file_extension.dart';
|
||||||
import '../../utils/url_launcher.dart';
|
import '../../utils/url_launcher.dart';
|
||||||
import '../../utils/voip/callkeep_manager.dart';
|
import '../../utils/voip/callkeep_manager.dart';
|
||||||
|
|
@ -511,6 +512,18 @@ class ChatListController extends State<ChatList>
|
||||||
setState(() {});
|
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 {
|
void setStatus() async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final currentPresence = await client.fetchCurrentPresence(client.userID!);
|
final currentPresence = await client.fetchCurrentPresence(client.userID!);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import 'package:animations/animations.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list_item.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
||||||
|
|
@ -131,9 +132,13 @@ class ChatListViewBody extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
if (!controller.isSearchMode &&
|
if (!controller.isSearchMode &&
|
||||||
controller.activeFilter != ActiveFilter.groups)
|
controller.activeFilter != ActiveFilter.groups &&
|
||||||
StatusMessageList(
|
AppConfig.showPresences)
|
||||||
onStatusEdit: controller.setStatus,
|
GestureDetector(
|
||||||
|
onLongPress: () => controller.dismissStatusList(),
|
||||||
|
child: StatusMessageList(
|
||||||
|
onStatusEdit: controller.setStatus,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const ConnectionStatusHeader(),
|
const ConnectionStatusHeader(),
|
||||||
AnimatedContainer(
|
AnimatedContainer(
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/config/setting_keys.dart';
|
||||||
import 'package:fluffychat/config/themes.dart';
|
import 'package:fluffychat/config/themes.dart';
|
||||||
import 'package:fluffychat/utils/account_config.dart';
|
import 'package:fluffychat/utils/account_config.dart';
|
||||||
import 'package:fluffychat/widgets/avatar.dart';
|
import 'package:fluffychat/widgets/avatar.dart';
|
||||||
|
|
@ -9,6 +10,7 @@ import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
import 'package:fluffychat/widgets/mxc_image.dart';
|
import 'package:fluffychat/widgets/mxc_image.dart';
|
||||||
import '../../config/app_config.dart';
|
import '../../config/app_config.dart';
|
||||||
|
import '../../widgets/settings_switch_list_tile.dart';
|
||||||
import 'settings_style.dart';
|
import 'settings_style.dart';
|
||||||
|
|
||||||
class SettingsStyleView extends StatelessWidget {
|
class SettingsStyleView extends StatelessWidget {
|
||||||
|
|
@ -162,6 +164,22 @@ class SettingsStyleView extends StatelessWidget {
|
||||||
onChanged: controller.switchTheme,
|
onChanged: controller.switchTheme,
|
||||||
),
|
),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
|
ListTile(
|
||||||
|
title: Text(
|
||||||
|
L10n.of(context)!.presenceStyle,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SettingsSwitchListTile.adaptive(
|
||||||
|
title: L10n.of(context)!.presencesToggle,
|
||||||
|
onChanged: (b) => AppConfig.showPresences = b,
|
||||||
|
storeKey: SettingKeys.showPresences,
|
||||||
|
defaultValue: AppConfig.showPresences,
|
||||||
|
),
|
||||||
|
const Divider(height: 1),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context)!.messagesStyle,
|
L10n.of(context)!.messagesStyle,
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ class Matrix extends StatefulWidget {
|
||||||
class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
int _activeClient = -1;
|
int _activeClient = -1;
|
||||||
String? activeBundle;
|
String? activeBundle;
|
||||||
|
|
||||||
SharedPreferences get store => widget.store;
|
SharedPreferences get store => widget.store;
|
||||||
|
|
||||||
HomeserverSummary? loginHomeserverSummary;
|
HomeserverSummary? loginHomeserverSummary;
|
||||||
|
|
@ -443,6 +444,9 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
|
|
||||||
AppConfig.experimentalVoip = store.getBool(SettingKeys.experimentalVoip) ??
|
AppConfig.experimentalVoip = store.getBool(SettingKeys.experimentalVoip) ??
|
||||||
AppConfig.experimentalVoip;
|
AppConfig.experimentalVoip;
|
||||||
|
|
||||||
|
AppConfig.showPresences =
|
||||||
|
store.getBool(SettingKeys.showPresences) ?? AppConfig.showPresences;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue