mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 11:45:10 +00:00
feat: Add "Show related DMs in spaces" settings
This commit is contained in:
parent
cef13412fb
commit
4398c305d2
6 changed files with 20 additions and 1 deletions
|
@ -2145,6 +2145,11 @@
|
|||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"showDirectChatsInSpaces": "Show related Direct Chats in Spaces",
|
||||
"@showDirectChatsInSpaces": {
|
||||
"type": "text",
|
||||
"placeholders": {}
|
||||
},
|
||||
"showPassword": "Show password",
|
||||
"@showPassword": {
|
||||
"type": "text",
|
||||
|
|
|
@ -36,6 +36,7 @@ abstract class AppConfig {
|
|||
static bool renderHtml = true;
|
||||
static bool hideRedactedEvents = false;
|
||||
static bool hideUnknownEvents = true;
|
||||
static bool showDirectChatsInSpaces = true;
|
||||
static bool separateChatTypes = false;
|
||||
static bool autoplayImages = true;
|
||||
static bool sendOnEnter = false;
|
||||
|
|
|
@ -3,6 +3,8 @@ abstract class SettingKeys {
|
|||
static const String renderHtml = 'chat.fluffy.renderHtml';
|
||||
static const String hideRedactedEvents = 'chat.fluffy.hideRedactedEvents';
|
||||
static const String hideUnknownEvents = 'chat.fluffy.hideUnknownEvents';
|
||||
static const String showDirectChatsInSpaces =
|
||||
'chat.fluffy.showDirectChatsInSpaces';
|
||||
static const String separateChatTypes = 'chat.fluffy.separateChatTypes';
|
||||
static const String chatColor = 'chat.fluffy.chat_color';
|
||||
static const String sentry = 'sentry';
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/client_stories_extension.dart';
|
||||
import '../../widgets/matrix.dart';
|
||||
|
||||
|
@ -162,7 +163,7 @@ class SpaceSpacesEntry extends SpacesEntry {
|
|||
if (_roomInsideSpace(room, space)) {
|
||||
return true;
|
||||
}
|
||||
if (true) {
|
||||
if (AppConfig.showDirectChatsInSpaces) {
|
||||
if (room.isDirectChat &&
|
||||
room.summary.mHeroes != null &&
|
||||
room.summary.mHeroes!.any((userId) {
|
||||
|
|
|
@ -77,6 +77,12 @@ class SettingsChatView extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
SettingsSwitchListTile.adaptive(
|
||||
title: L10n.of(context)!.showDirectChatsInSpaces,
|
||||
onChanged: (b) => AppConfig.showDirectChatsInSpaces = b,
|
||||
storeKey: SettingKeys.showDirectChatsInSpaces,
|
||||
defaultValue: AppConfig.showDirectChatsInSpaces,
|
||||
),
|
||||
SettingsSwitchListTile.adaptive(
|
||||
title: L10n.of(context)!.separateChatTypes,
|
||||
onChanged: (b) => AppConfig.separateChatTypes = b,
|
||||
|
|
|
@ -480,6 +480,10 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
store
|
||||
.getItemBool(SettingKeys.hideUnknownEvents, AppConfig.hideUnknownEvents)
|
||||
.then((value) => AppConfig.hideUnknownEvents = value);
|
||||
store
|
||||
.getItemBool(SettingKeys.showDirectChatsInSpaces,
|
||||
AppConfig.showDirectChatsInSpaces)
|
||||
.then((value) => AppConfig.showDirectChatsInSpaces = value);
|
||||
store
|
||||
.getItemBool(SettingKeys.separateChatTypes, AppConfig.separateChatTypes)
|
||||
.then((value) => AppConfig.separateChatTypes = value);
|
||||
|
|
Loading…
Reference in a new issue