mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-19 10:39:26 +01:00
feat: Add "Show related DMs in spaces" settings
This commit is contained in:
parent
4b17b1651b
commit
7e751fa726
@ -2145,6 +2145,11 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
|
"showDirectChatsInSpaces": "Show related Direct Chats in Spaces",
|
||||||
|
"@showDirectChatsInSpaces": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
"showPassword": "Show password",
|
"showPassword": "Show password",
|
||||||
"@showPassword": {
|
"@showPassword": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
@ -36,6 +36,7 @@ abstract class AppConfig {
|
|||||||
static bool renderHtml = true;
|
static bool renderHtml = true;
|
||||||
static bool hideRedactedEvents = false;
|
static bool hideRedactedEvents = false;
|
||||||
static bool hideUnknownEvents = true;
|
static bool hideUnknownEvents = true;
|
||||||
|
static bool showDirectChatsInSpaces = true;
|
||||||
static bool separateChatTypes = false;
|
static bool separateChatTypes = false;
|
||||||
static bool autoplayImages = true;
|
static bool autoplayImages = true;
|
||||||
static bool sendOnEnter = false;
|
static bool sendOnEnter = false;
|
||||||
|
@ -3,6 +3,8 @@ abstract class SettingKeys {
|
|||||||
static const String renderHtml = 'chat.fluffy.renderHtml';
|
static const String renderHtml = 'chat.fluffy.renderHtml';
|
||||||
static const String hideRedactedEvents = 'chat.fluffy.hideRedactedEvents';
|
static const String hideRedactedEvents = 'chat.fluffy.hideRedactedEvents';
|
||||||
static const String hideUnknownEvents = 'chat.fluffy.hideUnknownEvents';
|
static const String hideUnknownEvents = 'chat.fluffy.hideUnknownEvents';
|
||||||
|
static const String showDirectChatsInSpaces =
|
||||||
|
'chat.fluffy.showDirectChatsInSpaces';
|
||||||
static const String separateChatTypes = 'chat.fluffy.separateChatTypes';
|
static const String separateChatTypes = 'chat.fluffy.separateChatTypes';
|
||||||
static const String chatColor = 'chat.fluffy.chat_color';
|
static const String chatColor = 'chat.fluffy.chat_color';
|
||||||
static const String sentry = 'sentry';
|
static const String sentry = 'sentry';
|
||||||
|
@ -4,6 +4,7 @@ import 'package:flutter/material.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/utils/matrix_sdk_extensions.dart/client_stories_extension.dart';
|
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/client_stories_extension.dart';
|
||||||
import '../../widgets/matrix.dart';
|
import '../../widgets/matrix.dart';
|
||||||
|
|
||||||
@ -162,7 +163,7 @@ class SpaceSpacesEntry extends SpacesEntry {
|
|||||||
if (_roomInsideSpace(room, space)) {
|
if (_roomInsideSpace(room, space)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (true) {
|
if (AppConfig.showDirectChatsInSpaces) {
|
||||||
if (room.isDirectChat &&
|
if (room.isDirectChat &&
|
||||||
room.summary.mHeroes != null &&
|
room.summary.mHeroes != null &&
|
||||||
room.summary.mHeroes!.any((userId) {
|
room.summary.mHeroes!.any((userId) {
|
||||||
|
@ -77,6 +77,12 @@ class SettingsChatView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
|
SettingsSwitchListTile.adaptive(
|
||||||
|
title: L10n.of(context)!.showDirectChatsInSpaces,
|
||||||
|
onChanged: (b) => AppConfig.showDirectChatsInSpaces = b,
|
||||||
|
storeKey: SettingKeys.showDirectChatsInSpaces,
|
||||||
|
defaultValue: AppConfig.showDirectChatsInSpaces,
|
||||||
|
),
|
||||||
SettingsSwitchListTile.adaptive(
|
SettingsSwitchListTile.adaptive(
|
||||||
title: L10n.of(context)!.separateChatTypes,
|
title: L10n.of(context)!.separateChatTypes,
|
||||||
onChanged: (b) => AppConfig.separateChatTypes = b,
|
onChanged: (b) => AppConfig.separateChatTypes = b,
|
||||||
|
@ -480,6 +480,10 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||||||
store
|
store
|
||||||
.getItemBool(SettingKeys.hideUnknownEvents, AppConfig.hideUnknownEvents)
|
.getItemBool(SettingKeys.hideUnknownEvents, AppConfig.hideUnknownEvents)
|
||||||
.then((value) => AppConfig.hideUnknownEvents = value);
|
.then((value) => AppConfig.hideUnknownEvents = value);
|
||||||
|
store
|
||||||
|
.getItemBool(SettingKeys.showDirectChatsInSpaces,
|
||||||
|
AppConfig.showDirectChatsInSpaces)
|
||||||
|
.then((value) => AppConfig.showDirectChatsInSpaces = value);
|
||||||
store
|
store
|
||||||
.getItemBool(SettingKeys.separateChatTypes, AppConfig.separateChatTypes)
|
.getItemBool(SettingKeys.separateChatTypes, AppConfig.separateChatTypes)
|
||||||
.then((value) => AppConfig.separateChatTypes = value);
|
.then((value) => AppConfig.separateChatTypes = value);
|
||||||
|
Loading…
Reference in New Issue
Block a user